diff --git a/docs/assets/css/codemirror.css b/docs/assets/css/codemirror.css
deleted file mode 100644
index c7a8ae704..000000000
--- a/docs/assets/css/codemirror.css
+++ /dev/null
@@ -1,346 +0,0 @@
-/* BASICS */
-
-.CodeMirror {
- /* Set height, width, borders, and global font properties here */
- font-family: monospace;
- height: 300px;
- color: black;
- direction: ltr;
-}
-
-/* PADDING */
-
-.CodeMirror-lines {
- padding: 4px 0; /* Vertical padding around content */
-}
-.CodeMirror pre {
- padding: 0 4px; /* Horizontal padding of content */
-}
-
-.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
- background-color: white; /* The little square between H and V scrollbars */
-}
-
-/* GUTTER */
-
-.CodeMirror-gutters {
- border-right: 1px solid #ddd;
- background-color: #f7f7f7;
- white-space: nowrap;
-}
-.CodeMirror-linenumbers {}
-.CodeMirror-linenumber {
- padding: 0 3px 0 5px;
- min-width: 20px;
- text-align: right;
- color: #999;
- white-space: nowrap;
-}
-
-.CodeMirror-guttermarker { color: black; }
-.CodeMirror-guttermarker-subtle { color: #999; }
-
-/* CURSOR */
-
-.CodeMirror-cursor {
- border-left: 1px solid black;
- border-right: none;
- width: 0;
-}
-/* Shown when moving in bi-directional text */
-.CodeMirror div.CodeMirror-secondarycursor {
- border-left: 1px solid silver;
-}
-.cm-fat-cursor .CodeMirror-cursor {
- width: auto;
- border: 0 !important;
- background: #7e7;
-}
-.cm-fat-cursor div.CodeMirror-cursors {
- z-index: 1;
-}
-.cm-fat-cursor-mark {
- background-color: rgba(20, 255, 20, 0.5);
- -webkit-animation: blink 1.06s steps(1) infinite;
- -moz-animation: blink 1.06s steps(1) infinite;
- animation: blink 1.06s steps(1) infinite;
-}
-.cm-animate-fat-cursor {
- width: auto;
- border: 0;
- -webkit-animation: blink 1.06s steps(1) infinite;
- -moz-animation: blink 1.06s steps(1) infinite;
- animation: blink 1.06s steps(1) infinite;
- background-color: #7e7;
-}
-@-moz-keyframes blink {
- 0% {}
- 50% { background-color: transparent; }
- 100% {}
-}
-@-webkit-keyframes blink {
- 0% {}
- 50% { background-color: transparent; }
- 100% {}
-}
-@keyframes blink {
- 0% {}
- 50% { background-color: transparent; }
- 100% {}
-}
-
-/* Can style cursor different in overwrite (non-insert) mode */
-.CodeMirror-overwrite .CodeMirror-cursor {}
-
-.cm-tab { display: inline-block; text-decoration: inherit; }
-
-.CodeMirror-rulers {
- position: absolute;
- left: 0; right: 0; top: -50px; bottom: -20px;
- overflow: hidden;
-}
-.CodeMirror-ruler {
- border-left: 1px solid #ccc;
- top: 0; bottom: 0;
- position: absolute;
-}
-
-/* DEFAULT THEME */
-
-.cm-s-default .cm-header {color: blue;}
-.cm-s-default .cm-quote {color: #090;}
-.cm-negative {color: #d44;}
-.cm-positive {color: #292;}
-.cm-header, .cm-strong {font-weight: bold;}
-.cm-em {font-style: italic;}
-.cm-link {text-decoration: underline;}
-.cm-strikethrough {text-decoration: line-through;}
-
-.cm-s-default .cm-keyword {color: #708;}
-.cm-s-default .cm-atom {color: #219;}
-.cm-s-default .cm-number {color: #164;}
-.cm-s-default .cm-def {color: #00f;}
-.cm-s-default .cm-variable,
-.cm-s-default .cm-punctuation,
-.cm-s-default .cm-property,
-.cm-s-default .cm-operator {}
-.cm-s-default .cm-variable-2 {color: #05a;}
-.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
-.cm-s-default .cm-comment {color: #a50;}
-.cm-s-default .cm-string {color: #a11;}
-.cm-s-default .cm-string-2 {color: #f50;}
-.cm-s-default .cm-meta {color: #555;}
-.cm-s-default .cm-qualifier {color: #555;}
-.cm-s-default .cm-builtin {color: #30a;}
-.cm-s-default .cm-bracket {color: #997;}
-.cm-s-default .cm-tag {color: #170;}
-.cm-s-default .cm-attribute {color: #00c;}
-.cm-s-default .cm-hr {color: #999;}
-.cm-s-default .cm-link {color: #00c;}
-
-.cm-s-default .cm-error {color: #f00;}
-.cm-invalidchar {color: #f00;}
-
-.CodeMirror-composing { border-bottom: 2px solid; }
-
-/* Default styles for common addons */
-
-div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
-div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
-.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
-.CodeMirror-activeline-background {background: #e8f2ff;}
-
-/* STOP */
-
-/* The rest of this file contains styles related to the mechanics of
- the editor. You probably shouldn't touch them. */
-
-.CodeMirror {
- position: relative;
- overflow: hidden;
- background: white;
-}
-
-.CodeMirror-scroll {
- overflow: scroll !important; /* Things will break if this is overridden */
- /* 30px is the magic margin used to hide the element's real scrollbars */
- /* See overflow: hidden in .CodeMirror */
- margin-bottom: -30px; margin-right: -30px;
- padding-bottom: 30px;
- height: 100%;
- outline: none; /* Prevent dragging from highlighting the element */
- position: relative;
-}
-.CodeMirror-sizer {
- position: relative;
- border-right: 30px solid transparent;
-}
-
-/* The fake, visible scrollbars. Used to force redraw during scrolling
- before actual scrolling happens, thus preventing shaking and
- flickering artifacts. */
-.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
- position: absolute;
- z-index: 6;
- display: none;
-}
-.CodeMirror-vscrollbar {
- right: 0; top: 0;
- overflow-x: hidden;
- overflow-y: scroll;
-}
-.CodeMirror-hscrollbar {
- bottom: 0; left: 0;
- overflow-y: hidden;
- overflow-x: scroll;
-}
-.CodeMirror-scrollbar-filler {
- right: 0; bottom: 0;
-}
-.CodeMirror-gutter-filler {
- left: 0; bottom: 0;
-}
-
-.CodeMirror-gutters {
- position: absolute; left: 0; top: 0;
- min-height: 100%;
- z-index: 3;
-}
-.CodeMirror-gutter {
- white-space: normal;
- height: 100%;
- display: inline-block;
- vertical-align: top;
- margin-bottom: -30px;
-}
-.CodeMirror-gutter-wrapper {
- position: absolute;
- z-index: 4;
- background: none !important;
- border: none !important;
-}
-.CodeMirror-gutter-background {
- position: absolute;
- top: 0; bottom: 0;
- z-index: 4;
-}
-.CodeMirror-gutter-elt {
- position: absolute;
- cursor: default;
- z-index: 4;
-}
-.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
-.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
-
-.CodeMirror-lines {
- cursor: text;
- min-height: 1px; /* prevents collapsing before first draw */
-}
-.CodeMirror pre {
- /* Reset some styles that the rest of the page might have set */
- -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
- border-width: 0;
- background: transparent;
- font-family: inherit;
- font-size: inherit;
- margin: 0;
- white-space: pre;
- word-wrap: normal;
- line-height: inherit;
- color: inherit;
- z-index: 2;
- position: relative;
- overflow: visible;
- -webkit-tap-highlight-color: transparent;
- -webkit-font-variant-ligatures: contextual;
- font-variant-ligatures: contextual;
-}
-.CodeMirror-wrap pre {
- word-wrap: break-word;
- white-space: pre-wrap;
- word-break: normal;
-}
-
-.CodeMirror-linebackground {
- position: absolute;
- left: 0; right: 0; top: 0; bottom: 0;
- z-index: 0;
-}
-
-.CodeMirror-linewidget {
- position: relative;
- z-index: 2;
- padding: 0.1px; /* Force widget margins to stay inside of the container */
-}
-
-.CodeMirror-widget {}
-
-.CodeMirror-rtl pre { direction: rtl; }
-
-.CodeMirror-code {
- outline: none;
-}
-
-/* Force content-box sizing for the elements where we expect it */
-.CodeMirror-scroll,
-.CodeMirror-sizer,
-.CodeMirror-gutter,
-.CodeMirror-gutters,
-.CodeMirror-linenumber {
- -moz-box-sizing: content-box;
- box-sizing: content-box;
-}
-
-.CodeMirror-measure {
- position: absolute;
- width: 100%;
- height: 0;
- overflow: hidden;
- visibility: hidden;
-}
-
-.CodeMirror-cursor {
- position: absolute;
- pointer-events: none;
-}
-.CodeMirror-measure pre { position: static; }
-
-div.CodeMirror-cursors {
- visibility: hidden;
- position: relative;
- z-index: 3;
-}
-div.CodeMirror-dragcursors {
- visibility: visible;
-}
-
-.CodeMirror-focused div.CodeMirror-cursors {
- visibility: visible;
-}
-
-.CodeMirror-selected { background: #d9d9d9; }
-.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
-.CodeMirror-crosshair { cursor: crosshair; }
-.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
-.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
-
-.cm-searching {
- background-color: #ffa;
- background-color: rgba(255, 255, 0, .4);
-}
-
-/* Used to force a border model for a node */
-.cm-force-border { padding-right: .1px; }
-
-@media print {
- /* Hide the cursor when printing */
- .CodeMirror div.CodeMirror-cursors {
- visibility: hidden;
- }
-}
-
-/* See issue #2901 */
-.cm-tab-wrap-hack:after { content: ''; }
-
-/* Help users use markselection to safely style text background */
-span.CodeMirror-selectedtext { background: none; }
diff --git a/docs/assets/css/dracula.css b/docs/assets/css/dracula.css
deleted file mode 100644
index c1ed556e2..000000000
--- a/docs/assets/css/dracula.css
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
- Name: dracula
- Author: Michael Kaminsky (http://github.com/mkaminsky11)
-
- Original dracula color scheme by Zeno Rocha (https://github.com/zenorocha/dracula-theme)
-
-*/
-
-
-.cm-s-dracula.CodeMirror, .cm-s-dracula .CodeMirror-gutters {
- background-color: #282a36 !important;
- color: #f8f8f2 !important;
- border: none;
- }
- .cm-s-dracula .CodeMirror-gutters { color: #282a36; }
- .cm-s-dracula .CodeMirror-cursor { border-left: solid thin #f8f8f0; }
- .cm-s-dracula .CodeMirror-linenumber { color: #6D8A88; }
- .cm-s-dracula .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
- .cm-s-dracula .CodeMirror-line::selection, .cm-s-dracula .CodeMirror-line > span::selection, .cm-s-dracula .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
- .cm-s-dracula .CodeMirror-line::-moz-selection, .cm-s-dracula .CodeMirror-line > span::-moz-selection, .cm-s-dracula .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
- .cm-s-dracula span.cm-comment { color: #6272a4; }
- .cm-s-dracula span.cm-string, .cm-s-dracula span.cm-string-2 { color: #f1fa8c; }
- .cm-s-dracula span.cm-number { color: #bd93f9; }
- .cm-s-dracula span.cm-variable { color: #50fa7b; }
- .cm-s-dracula span.cm-variable-2 { color: white; }
- .cm-s-dracula span.cm-def { color: #50fa7b; }
- .cm-s-dracula span.cm-operator { color: #ff79c6; }
- .cm-s-dracula span.cm-keyword { color: #ff79c6; }
- .cm-s-dracula span.cm-atom { color: #bd93f9; }
- .cm-s-dracula span.cm-meta { color: #f8f8f2; }
- .cm-s-dracula span.cm-tag { color: #ff79c6; }
- .cm-s-dracula span.cm-attribute { color: #50fa7b; }
- .cm-s-dracula span.cm-qualifier { color: #50fa7b; }
- .cm-s-dracula span.cm-property { color: #66d9ef; }
- .cm-s-dracula span.cm-builtin { color: #50fa7b; }
- .cm-s-dracula span.cm-variable-3, .cm-s-dracula span.cm-type { color: #ffb86c; }
-
- .cm-s-dracula .CodeMirror-activeline-background { background: rgba(255,255,255,0.1); }
- .cm-s-dracula .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
-
\ No newline at end of file
diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css
index f2ed1c6ad..9a78e8a31 100644
--- a/docs/assets/css/style.css
+++ b/docs/assets/css/style.css
@@ -173,7 +173,7 @@ img {
.main .part-left .code .codeMirrorWrap {
height: 100%;
- overflow-x: hidden;
+ overflow: hidden;
}
.CodeMirror {
diff --git a/docs/assets/js/codemirror.js b/docs/assets/js/codemirror.js
deleted file mode 100644
index 93c0ead2a..000000000
--- a/docs/assets/js/codemirror.js
+++ /dev/null
@@ -1,9698 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: https://codemirror.net/LICENSE
-
-// This is CodeMirror (https://codemirror.net), a code editor
-// implemented in JavaScript on top of the browser's DOM.
-//
-// You can find some technical background for some of the code below
-// at http://marijnhaverbeke.nl/blog/#cm-internals .
-
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.CodeMirror = factory());
-}(this, (function () { 'use strict';
-
- // Kludges for bugs and behavior differences that can't be feature
- // detected are enabled based on userAgent etc sniffing.
- var userAgent = navigator.userAgent;
- var platform = navigator.platform;
-
- var gecko = /gecko\/\d/i.test(userAgent);
- var ie_upto10 = /MSIE \d/.test(userAgent);
- var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
- var edge = /Edge\/(\d+)/.exec(userAgent);
- var ie = ie_upto10 || ie_11up || edge;
- var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
- var webkit = !edge && /WebKit\//.test(userAgent);
- var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
- var chrome = !edge && /Chrome\//.test(userAgent);
- var presto = /Opera\//.test(userAgent);
- var safari = /Apple Computer/.test(navigator.vendor);
- var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
- var phantom = /PhantomJS/.test(userAgent);
-
- var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
- var android = /Android/.test(userAgent);
- // This is woefully incomplete. Suggestions for alternative methods welcome.
- var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
- var mac = ios || /Mac/.test(platform);
- var chromeOS = /\bCrOS\b/.test(userAgent);
- var windows = /win/i.test(platform);
-
- var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
- if (presto_version) { presto_version = Number(presto_version[1]); }
- if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
- // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
- var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
- var captureRightClick = gecko || (ie && ie_version >= 9);
-
- function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
-
- var rmClass = function(node, cls) {
- var current = node.className;
- var match = classTest(cls).exec(current);
- if (match) {
- var after = current.slice(match.index + match[0].length);
- node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
- }
- };
-
- function removeChildren(e) {
- for (var count = e.childNodes.length; count > 0; --count)
- { e.removeChild(e.firstChild); }
- return e
- }
-
- function removeChildrenAndAdd(parent, e) {
- return removeChildren(parent).appendChild(e)
- }
-
- function elt(tag, content, className, style) {
- var e = document.createElement(tag);
- if (className) { e.className = className; }
- if (style) { e.style.cssText = style; }
- if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
- else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
- return e
- }
- // wrapper for elt, which removes the elt from the accessibility tree
- function eltP(tag, content, className, style) {
- var e = elt(tag, content, className, style);
- e.setAttribute("role", "presentation");
- return e
- }
-
- var range;
- if (document.createRange) { range = function(node, start, end, endNode) {
- var r = document.createRange();
- r.setEnd(endNode || node, end);
- r.setStart(node, start);
- return r
- }; }
- else { range = function(node, start, end) {
- var r = document.body.createTextRange();
- try { r.moveToElementText(node.parentNode); }
- catch(e) { return r }
- r.collapse(true);
- r.moveEnd("character", end);
- r.moveStart("character", start);
- return r
- }; }
-
- function contains(parent, child) {
- if (child.nodeType == 3) // Android browser always returns false when child is a textnode
- { child = child.parentNode; }
- if (parent.contains)
- { return parent.contains(child) }
- do {
- if (child.nodeType == 11) { child = child.host; }
- if (child == parent) { return true }
- } while (child = child.parentNode)
- }
-
- function activeElt() {
- // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
- // IE < 10 will throw when accessed while the page is loading or in an iframe.
- // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
- var activeElement;
- try {
- activeElement = document.activeElement;
- } catch(e) {
- activeElement = document.body || null;
- }
- while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
- { activeElement = activeElement.shadowRoot.activeElement; }
- return activeElement
- }
-
- function addClass(node, cls) {
- var current = node.className;
- if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
- }
- function joinClasses(a, b) {
- var as = a.split(" ");
- for (var i = 0; i < as.length; i++)
- { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
- return b
- }
-
- var selectInput = function(node) { node.select(); };
- if (ios) // Mobile Safari apparently has a bug where select() is broken.
- { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
- else if (ie) // Suppress mysterious IE10 errors
- { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
-
- function bind(f) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function(){return f.apply(null, args)}
- }
-
- function copyObj(obj, target, overwrite) {
- if (!target) { target = {}; }
- for (var prop in obj)
- { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
- { target[prop] = obj[prop]; } }
- return target
- }
-
- // Counts the column offset in a string, taking tabs into account.
- // Used mostly to find indentation.
- function countColumn(string, end, tabSize, startIndex, startValue) {
- if (end == null) {
- end = string.search(/[^\s\u00a0]/);
- if (end == -1) { end = string.length; }
- }
- for (var i = startIndex || 0, n = startValue || 0;;) {
- var nextTab = string.indexOf("\t", i);
- if (nextTab < 0 || nextTab >= end)
- { return n + (end - i) }
- n += nextTab - i;
- n += tabSize - (n % tabSize);
- i = nextTab + 1;
- }
- }
-
- var Delayed = function() {this.id = null;};
- Delayed.prototype.set = function (ms, f) {
- clearTimeout(this.id);
- this.id = setTimeout(f, ms);
- };
-
- function indexOf(array, elt) {
- for (var i = 0; i < array.length; ++i)
- { if (array[i] == elt) { return i } }
- return -1
- }
-
- // Number of pixels added to scroller and sizer to hide scrollbar
- var scrollerGap = 30;
-
- // Returned or thrown by various protocols to signal 'I'm not
- // handling this'.
- var Pass = {toString: function(){return "CodeMirror.Pass"}};
-
- // Reused option objects for setSelection & friends
- var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
-
- // The inverse of countColumn -- find the offset that corresponds to
- // a particular column.
- function findColumn(string, goal, tabSize) {
- for (var pos = 0, col = 0;;) {
- var nextTab = string.indexOf("\t", pos);
- if (nextTab == -1) { nextTab = string.length; }
- var skipped = nextTab - pos;
- if (nextTab == string.length || col + skipped >= goal)
- { return pos + Math.min(skipped, goal - col) }
- col += nextTab - pos;
- col += tabSize - (col % tabSize);
- pos = nextTab + 1;
- if (col >= goal) { return pos }
- }
- }
-
- var spaceStrs = [""];
- function spaceStr(n) {
- while (spaceStrs.length <= n)
- { spaceStrs.push(lst(spaceStrs) + " "); }
- return spaceStrs[n]
- }
-
- function lst(arr) { return arr[arr.length-1] }
-
- function map(array, f) {
- var out = [];
- for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
- return out
- }
-
- function insertSorted(array, value, score) {
- var pos = 0, priority = score(value);
- while (pos < array.length && score(array[pos]) <= priority) { pos++; }
- array.splice(pos, 0, value);
- }
-
- function nothing() {}
-
- function createObj(base, props) {
- var inst;
- if (Object.create) {
- inst = Object.create(base);
- } else {
- nothing.prototype = base;
- inst = new nothing();
- }
- if (props) { copyObj(props, inst); }
- return inst
- }
-
- var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
- function isWordCharBasic(ch) {
- return /\w/.test(ch) || ch > "\x80" &&
- (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
- }
- function isWordChar(ch, helper) {
- if (!helper) { return isWordCharBasic(ch) }
- if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
- return helper.test(ch)
- }
-
- function isEmpty(obj) {
- for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
- return true
- }
-
- // Extending unicode characters. A series of a non-extending char +
- // any number of extending chars is treated as a single unit as far
- // as editing and measuring is concerned. This is not fully correct,
- // since some scripts/fonts/browsers also treat other configurations
- // of code points as a group.
- var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
- function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
-
- // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
- function skipExtendingChars(str, pos, dir) {
- while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
- return pos
- }
-
- // Returns the value from the range [`from`; `to`] that satisfies
- // `pred` and is closest to `from`. Assumes that at least `to`
- // satisfies `pred`. Supports `from` being greater than `to`.
- function findFirst(pred, from, to) {
- // At any point we are certain `to` satisfies `pred`, don't know
- // whether `from` does.
- var dir = from > to ? -1 : 1;
- for (;;) {
- if (from == to) { return from }
- var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
- if (mid == from) { return pred(mid) ? from : to }
- if (pred(mid)) { to = mid; }
- else { from = mid + dir; }
- }
- }
-
- // The display handles the DOM integration, both for input reading
- // and content drawing. It holds references to DOM nodes and
- // display-related state.
-
- function Display(place, doc, input) {
- var d = this;
- this.input = input;
-
- // Covers bottom-right square when both scrollbars are present.
- d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
- d.scrollbarFiller.setAttribute("cm-not-content", "true");
- // Covers bottom of gutter when coverGutterNextToScrollbar is on
- // and h scrollbar is present.
- d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
- d.gutterFiller.setAttribute("cm-not-content", "true");
- // Will contain the actual code, positioned to cover the viewport.
- d.lineDiv = eltP("div", null, "CodeMirror-code");
- // Elements are added to these to represent selection and cursors.
- d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
- d.cursorDiv = elt("div", null, "CodeMirror-cursors");
- // A visibility: hidden element used to find the size of things.
- d.measure = elt("div", null, "CodeMirror-measure");
- // When lines outside of the viewport are measured, they are drawn in this.
- d.lineMeasure = elt("div", null, "CodeMirror-measure");
- // Wraps everything that needs to exist inside the vertically-padded coordinate system
- d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
- null, "position: relative; outline: none");
- var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
- // Moved around its parent to cover visible view.
- d.mover = elt("div", [lines], null, "position: relative");
- // Set to the height of the document, allowing scrolling.
- d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
- d.sizerWidth = null;
- // Behavior of elts with overflow: auto and padding is
- // inconsistent across browsers. This is used to ensure the
- // scrollable area is big enough.
- d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
- // Will contain the gutters, if any.
- d.gutters = elt("div", null, "CodeMirror-gutters");
- d.lineGutter = null;
- // Actual scrollable element.
- d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
- d.scroller.setAttribute("tabIndex", "-1");
- // The element in which the editor lives.
- d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
-
- // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
- if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
- if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
-
- if (place) {
- if (place.appendChild) { place.appendChild(d.wrapper); }
- else { place(d.wrapper); }
- }
-
- // Current rendered range (may be bigger than the view window).
- d.viewFrom = d.viewTo = doc.first;
- d.reportedViewFrom = d.reportedViewTo = doc.first;
- // Information about the rendered lines.
- d.view = [];
- d.renderedView = null;
- // Holds info about a single rendered line when it was rendered
- // for measurement, while not in view.
- d.externalMeasured = null;
- // Empty space (in pixels) above the view
- d.viewOffset = 0;
- d.lastWrapHeight = d.lastWrapWidth = 0;
- d.updateLineNumbers = null;
-
- d.nativeBarWidth = d.barHeight = d.barWidth = 0;
- d.scrollbarsClipped = false;
-
- // Used to only resize the line number gutter when necessary (when
- // the amount of lines crosses a boundary that makes its width change)
- d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
- // Set to true when a non-horizontal-scrolling line widget is
- // added. As an optimization, line widget aligning is skipped when
- // this is false.
- d.alignWidgets = false;
-
- d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
-
- // Tracks the maximum line length so that the horizontal scrollbar
- // can be kept static when scrolling.
- d.maxLine = null;
- d.maxLineLength = 0;
- d.maxLineChanged = false;
-
- // Used for measuring wheel scrolling granularity
- d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
-
- // True when shift is held down.
- d.shift = false;
-
- // Used to track whether anything happened since the context menu
- // was opened.
- d.selForContextMenu = null;
-
- d.activeTouch = null;
-
- input.init(d);
- }
-
- // Find the line object corresponding to the given line number.
- function getLine(doc, n) {
- n -= doc.first;
- if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
- var chunk = doc;
- while (!chunk.lines) {
- for (var i = 0;; ++i) {
- var child = chunk.children[i], sz = child.chunkSize();
- if (n < sz) { chunk = child; break }
- n -= sz;
- }
- }
- return chunk.lines[n]
- }
-
- // Get the part of a document between two positions, as an array of
- // strings.
- function getBetween(doc, start, end) {
- var out = [], n = start.line;
- doc.iter(start.line, end.line + 1, function (line) {
- var text = line.text;
- if (n == end.line) { text = text.slice(0, end.ch); }
- if (n == start.line) { text = text.slice(start.ch); }
- out.push(text);
- ++n;
- });
- return out
- }
- // Get the lines between from and to, as array of strings.
- function getLines(doc, from, to) {
- var out = [];
- doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
- return out
- }
-
- // Update the height of a line, propagating the height change
- // upwards to parent nodes.
- function updateLineHeight(line, height) {
- var diff = height - line.height;
- if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
- }
-
- // Given a line object, find its line number by walking up through
- // its parent links.
- function lineNo(line) {
- if (line.parent == null) { return null }
- var cur = line.parent, no = indexOf(cur.lines, line);
- for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
- for (var i = 0;; ++i) {
- if (chunk.children[i] == cur) { break }
- no += chunk.children[i].chunkSize();
- }
- }
- return no + cur.first
- }
-
- // Find the line at the given vertical position, using the height
- // information in the document tree.
- function lineAtHeight(chunk, h) {
- var n = chunk.first;
- outer: do {
- for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
- var child = chunk.children[i$1], ch = child.height;
- if (h < ch) { chunk = child; continue outer }
- h -= ch;
- n += child.chunkSize();
- }
- return n
- } while (!chunk.lines)
- var i = 0;
- for (; i < chunk.lines.length; ++i) {
- var line = chunk.lines[i], lh = line.height;
- if (h < lh) { break }
- h -= lh;
- }
- return n + i
- }
-
- function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
-
- function lineNumberFor(options, i) {
- return String(options.lineNumberFormatter(i + options.firstLineNumber))
- }
-
- // A Pos instance represents a position within the text.
- function Pos(line, ch, sticky) {
- if ( sticky === void 0 ) sticky = null;
-
- if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
- this.line = line;
- this.ch = ch;
- this.sticky = sticky;
- }
-
- // Compare two positions, return 0 if they are the same, a negative
- // number when a is less, and a positive number otherwise.
- function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
-
- function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
-
- function copyPos(x) {return Pos(x.line, x.ch)}
- function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
- function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
-
- // Most of the external API clips given positions to make sure they
- // actually exist within the document.
- function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
- function clipPos(doc, pos) {
- if (pos.line < doc.first) { return Pos(doc.first, 0) }
- var last = doc.first + doc.size - 1;
- if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
- return clipToLen(pos, getLine(doc, pos.line).text.length)
- }
- function clipToLen(pos, linelen) {
- var ch = pos.ch;
- if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
- else if (ch < 0) { return Pos(pos.line, 0) }
- else { return pos }
- }
- function clipPosArray(doc, array) {
- var out = [];
- for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
- return out
- }
-
- // Optimize some code when these features are not used.
- var sawReadOnlySpans = false, sawCollapsedSpans = false;
-
- function seeReadOnlySpans() {
- sawReadOnlySpans = true;
- }
-
- function seeCollapsedSpans() {
- sawCollapsedSpans = true;
- }
-
- // TEXTMARKER SPANS
-
- function MarkedSpan(marker, from, to) {
- this.marker = marker;
- this.from = from; this.to = to;
- }
-
- // Search an array of spans for a span matching the given marker.
- function getMarkedSpanFor(spans, marker) {
- if (spans) { for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if (span.marker == marker) { return span }
- } }
- }
- // Remove a span from an array, returning undefined if no spans are
- // left (we don't store arrays for lines without spans).
- function removeMarkedSpan(spans, span) {
- var r;
- for (var i = 0; i < spans.length; ++i)
- { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
- return r
- }
- // Add a span to a line.
- function addMarkedSpan(line, span) {
- line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
- span.marker.attachLine(line);
- }
-
- // Used for the algorithm that adjusts markers for a change in the
- // document. These functions cut an array of spans at a given
- // character position, returning an array of remaining chunks (or
- // undefined if nothing remains).
- function markedSpansBefore(old, startCh, isInsert) {
- var nw;
- if (old) { for (var i = 0; i < old.length; ++i) {
- var span = old[i], marker = span.marker;
- var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
- if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
- var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
- ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
- }
- } }
- return nw
- }
- function markedSpansAfter(old, endCh, isInsert) {
- var nw;
- if (old) { for (var i = 0; i < old.length; ++i) {
- var span = old[i], marker = span.marker;
- var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
- if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
- var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
- ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
- span.to == null ? null : span.to - endCh));
- }
- } }
- return nw
- }
-
- // Given a change object, compute the new set of marker spans that
- // cover the line in which the change took place. Removes spans
- // entirely within the change, reconnects spans belonging to the
- // same marker that appear on both sides of the change, and cuts off
- // spans partially within the change. Returns an array of span
- // arrays with one element for each line in (after) the change.
- function stretchSpansOverChange(doc, change) {
- if (change.full) { return null }
- var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
- var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
- if (!oldFirst && !oldLast) { return null }
-
- var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
- // Get the spans that 'stick out' on both sides
- var first = markedSpansBefore(oldFirst, startCh, isInsert);
- var last = markedSpansAfter(oldLast, endCh, isInsert);
-
- // Next, merge those two ends
- var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
- if (first) {
- // Fix up .to properties of first
- for (var i = 0; i < first.length; ++i) {
- var span = first[i];
- if (span.to == null) {
- var found = getMarkedSpanFor(last, span.marker);
- if (!found) { span.to = startCh; }
- else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
- }
- }
- }
- if (last) {
- // Fix up .from in last (or move them into first in case of sameLine)
- for (var i$1 = 0; i$1 < last.length; ++i$1) {
- var span$1 = last[i$1];
- if (span$1.to != null) { span$1.to += offset; }
- if (span$1.from == null) {
- var found$1 = getMarkedSpanFor(first, span$1.marker);
- if (!found$1) {
- span$1.from = offset;
- if (sameLine) { (first || (first = [])).push(span$1); }
- }
- } else {
- span$1.from += offset;
- if (sameLine) { (first || (first = [])).push(span$1); }
- }
- }
- }
- // Make sure we didn't create any zero-length spans
- if (first) { first = clearEmptySpans(first); }
- if (last && last != first) { last = clearEmptySpans(last); }
-
- var newMarkers = [first];
- if (!sameLine) {
- // Fill gap with whole-line-spans
- var gap = change.text.length - 2, gapMarkers;
- if (gap > 0 && first)
- { for (var i$2 = 0; i$2 < first.length; ++i$2)
- { if (first[i$2].to == null)
- { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
- for (var i$3 = 0; i$3 < gap; ++i$3)
- { newMarkers.push(gapMarkers); }
- newMarkers.push(last);
- }
- return newMarkers
- }
-
- // Remove spans that are empty and don't have a clearWhenEmpty
- // option of false.
- function clearEmptySpans(spans) {
- for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
- { spans.splice(i--, 1); }
- }
- if (!spans.length) { return null }
- return spans
- }
-
- // Used to 'clip' out readOnly ranges when making a change.
- function removeReadOnlyRanges(doc, from, to) {
- var markers = null;
- doc.iter(from.line, to.line + 1, function (line) {
- if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
- var mark = line.markedSpans[i].marker;
- if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
- { (markers || (markers = [])).push(mark); }
- } }
- });
- if (!markers) { return null }
- var parts = [{from: from, to: to}];
- for (var i = 0; i < markers.length; ++i) {
- var mk = markers[i], m = mk.find(0);
- for (var j = 0; j < parts.length; ++j) {
- var p = parts[j];
- if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
- var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
- if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
- { newParts.push({from: p.from, to: m.from}); }
- if (dto > 0 || !mk.inclusiveRight && !dto)
- { newParts.push({from: m.to, to: p.to}); }
- parts.splice.apply(parts, newParts);
- j += newParts.length - 3;
- }
- }
- return parts
- }
-
- // Connect or disconnect spans from a line.
- function detachMarkedSpans(line) {
- var spans = line.markedSpans;
- if (!spans) { return }
- for (var i = 0; i < spans.length; ++i)
- { spans[i].marker.detachLine(line); }
- line.markedSpans = null;
- }
- function attachMarkedSpans(line, spans) {
- if (!spans) { return }
- for (var i = 0; i < spans.length; ++i)
- { spans[i].marker.attachLine(line); }
- line.markedSpans = spans;
- }
-
- // Helpers used when computing which overlapping collapsed span
- // counts as the larger one.
- function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
- function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
-
- // Returns a number indicating which of two overlapping collapsed
- // spans is larger (and thus includes the other). Falls back to
- // comparing ids when the spans cover exactly the same range.
- function compareCollapsedMarkers(a, b) {
- var lenDiff = a.lines.length - b.lines.length;
- if (lenDiff != 0) { return lenDiff }
- var aPos = a.find(), bPos = b.find();
- var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
- if (fromCmp) { return -fromCmp }
- var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
- if (toCmp) { return toCmp }
- return b.id - a.id
- }
-
- // Find out whether a line ends or starts in a collapsed span. If
- // so, return the marker for that span.
- function collapsedSpanAtSide(line, start) {
- var sps = sawCollapsedSpans && line.markedSpans, found;
- if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
- sp = sps[i];
- if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
- (!found || compareCollapsedMarkers(found, sp.marker) < 0))
- { found = sp.marker; }
- } }
- return found
- }
- function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
- function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
-
- function collapsedSpanAround(line, ch) {
- var sps = sawCollapsedSpans && line.markedSpans, found;
- if (sps) { for (var i = 0; i < sps.length; ++i) {
- var sp = sps[i];
- if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
- (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
- } }
- return found
- }
-
- // Test whether there exists a collapsed span that partially
- // overlaps (covers the start or end, but not both) of a new span.
- // Such overlap is not allowed.
- function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
- var line = getLine(doc, lineNo$$1);
- var sps = sawCollapsedSpans && line.markedSpans;
- if (sps) { for (var i = 0; i < sps.length; ++i) {
- var sp = sps[i];
- if (!sp.marker.collapsed) { continue }
- var found = sp.marker.find(0);
- var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
- var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
- if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
- if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
- fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
- { return true }
- } }
- }
-
- // A visual line is a line as drawn on the screen. Folding, for
- // example, can cause multiple logical lines to appear on the same
- // visual line. This finds the start of the visual line that the
- // given line is part of (usually that is the line itself).
- function visualLine(line) {
- var merged;
- while (merged = collapsedSpanAtStart(line))
- { line = merged.find(-1, true).line; }
- return line
- }
-
- function visualLineEnd(line) {
- var merged;
- while (merged = collapsedSpanAtEnd(line))
- { line = merged.find(1, true).line; }
- return line
- }
-
- // Returns an array of logical lines that continue the visual line
- // started by the argument, or undefined if there are no such lines.
- function visualLineContinued(line) {
- var merged, lines;
- while (merged = collapsedSpanAtEnd(line)) {
- line = merged.find(1, true).line
- ;(lines || (lines = [])).push(line);
- }
- return lines
- }
-
- // Get the line number of the start of the visual line that the
- // given line number is part of.
- function visualLineNo(doc, lineN) {
- var line = getLine(doc, lineN), vis = visualLine(line);
- if (line == vis) { return lineN }
- return lineNo(vis)
- }
-
- // Get the line number of the start of the next visual line after
- // the given line.
- function visualLineEndNo(doc, lineN) {
- if (lineN > doc.lastLine()) { return lineN }
- var line = getLine(doc, lineN), merged;
- if (!lineIsHidden(doc, line)) { return lineN }
- while (merged = collapsedSpanAtEnd(line))
- { line = merged.find(1, true).line; }
- return lineNo(line) + 1
- }
-
- // Compute whether a line is hidden. Lines count as hidden when they
- // are part of a visual line that starts with another line, or when
- // they are entirely covered by collapsed, non-widget span.
- function lineIsHidden(doc, line) {
- var sps = sawCollapsedSpans && line.markedSpans;
- if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
- sp = sps[i];
- if (!sp.marker.collapsed) { continue }
- if (sp.from == null) { return true }
- if (sp.marker.widgetNode) { continue }
- if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
- { return true }
- } }
- }
- function lineIsHiddenInner(doc, line, span) {
- if (span.to == null) {
- var end = span.marker.find(1, true);
- return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
- }
- if (span.marker.inclusiveRight && span.to == line.text.length)
- { return true }
- for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
- sp = line.markedSpans[i];
- if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
- (sp.to == null || sp.to != span.from) &&
- (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
- lineIsHiddenInner(doc, line, sp)) { return true }
- }
- }
-
- // Find the height above the given line.
- function heightAtLine(lineObj) {
- lineObj = visualLine(lineObj);
-
- var h = 0, chunk = lineObj.parent;
- for (var i = 0; i < chunk.lines.length; ++i) {
- var line = chunk.lines[i];
- if (line == lineObj) { break }
- else { h += line.height; }
- }
- for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
- for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
- var cur = p.children[i$1];
- if (cur == chunk) { break }
- else { h += cur.height; }
- }
- }
- return h
- }
-
- // Compute the character length of a line, taking into account
- // collapsed ranges (see markText) that might hide parts, and join
- // other lines onto it.
- function lineLength(line) {
- if (line.height == 0) { return 0 }
- var len = line.text.length, merged, cur = line;
- while (merged = collapsedSpanAtStart(cur)) {
- var found = merged.find(0, true);
- cur = found.from.line;
- len += found.from.ch - found.to.ch;
- }
- cur = line;
- while (merged = collapsedSpanAtEnd(cur)) {
- var found$1 = merged.find(0, true);
- len -= cur.text.length - found$1.from.ch;
- cur = found$1.to.line;
- len += cur.text.length - found$1.to.ch;
- }
- return len
- }
-
- // Find the longest line in the document.
- function findMaxLine(cm) {
- var d = cm.display, doc = cm.doc;
- d.maxLine = getLine(doc, doc.first);
- d.maxLineLength = lineLength(d.maxLine);
- d.maxLineChanged = true;
- doc.iter(function (line) {
- var len = lineLength(line);
- if (len > d.maxLineLength) {
- d.maxLineLength = len;
- d.maxLine = line;
- }
- });
- }
-
- // BIDI HELPERS
-
- function iterateBidiSections(order, from, to, f) {
- if (!order) { return f(from, to, "ltr", 0) }
- var found = false;
- for (var i = 0; i < order.length; ++i) {
- var part = order[i];
- if (part.from < to && part.to > from || from == to && part.to == from) {
- f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
- found = true;
- }
- }
- if (!found) { f(from, to, "ltr"); }
- }
-
- var bidiOther = null;
- function getBidiPartAt(order, ch, sticky) {
- var found;
- bidiOther = null;
- for (var i = 0; i < order.length; ++i) {
- var cur = order[i];
- if (cur.from < ch && cur.to > ch) { return i }
- if (cur.to == ch) {
- if (cur.from != cur.to && sticky == "before") { found = i; }
- else { bidiOther = i; }
- }
- if (cur.from == ch) {
- if (cur.from != cur.to && sticky != "before") { found = i; }
- else { bidiOther = i; }
- }
- }
- return found != null ? found : bidiOther
- }
-
- // Bidirectional ordering algorithm
- // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
- // that this (partially) implements.
-
- // One-char codes used for character types:
- // L (L): Left-to-Right
- // R (R): Right-to-Left
- // r (AL): Right-to-Left Arabic
- // 1 (EN): European Number
- // + (ES): European Number Separator
- // % (ET): European Number Terminator
- // n (AN): Arabic Number
- // , (CS): Common Number Separator
- // m (NSM): Non-Spacing Mark
- // b (BN): Boundary Neutral
- // s (B): Paragraph Separator
- // t (S): Segment Separator
- // w (WS): Whitespace
- // N (ON): Other Neutrals
-
- // Returns null if characters are ordered as they appear
- // (left-to-right), or an array of sections ({from, to, level}
- // objects) in the order in which they occur visually.
- var bidiOrdering = (function() {
- // Character types for codepoints 0 to 0xff
- var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
- // Character types for codepoints 0x600 to 0x6f9
- var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
- function charType(code) {
- if (code <= 0xf7) { return lowTypes.charAt(code) }
- else if (0x590 <= code && code <= 0x5f4) { return "R" }
- else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
- else if (0x6ee <= code && code <= 0x8ac) { return "r" }
- else if (0x2000 <= code && code <= 0x200b) { return "w" }
- else if (code == 0x200c) { return "b" }
- else { return "L" }
- }
-
- var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
- var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
-
- function BidiSpan(level, from, to) {
- this.level = level;
- this.from = from; this.to = to;
- }
-
- return function(str, direction) {
- var outerType = direction == "ltr" ? "L" : "R";
-
- if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
- var len = str.length, types = [];
- for (var i = 0; i < len; ++i)
- { types.push(charType(str.charCodeAt(i))); }
-
- // W1. Examine each non-spacing mark (NSM) in the level run, and
- // change the type of the NSM to the type of the previous
- // character. If the NSM is at the start of the level run, it will
- // get the type of sor.
- for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
- var type = types[i$1];
- if (type == "m") { types[i$1] = prev; }
- else { prev = type; }
- }
-
- // W2. Search backwards from each instance of a European number
- // until the first strong type (R, L, AL, or sor) is found. If an
- // AL is found, change the type of the European number to Arabic
- // number.
- // W3. Change all ALs to R.
- for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
- var type$1 = types[i$2];
- if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
- else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
- }
-
- // W4. A single European separator between two European numbers
- // changes to a European number. A single common separator between
- // two numbers of the same type changes to that type.
- for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
- var type$2 = types[i$3];
- if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
- else if (type$2 == "," && prev$1 == types[i$3+1] &&
- (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
- prev$1 = type$2;
- }
-
- // W5. A sequence of European terminators adjacent to European
- // numbers changes to all European numbers.
- // W6. Otherwise, separators and terminators change to Other
- // Neutral.
- for (var i$4 = 0; i$4 < len; ++i$4) {
- var type$3 = types[i$4];
- if (type$3 == ",") { types[i$4] = "N"; }
- else if (type$3 == "%") {
- var end = (void 0);
- for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
- var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
- for (var j = i$4; j < end; ++j) { types[j] = replace; }
- i$4 = end - 1;
- }
- }
-
- // W7. Search backwards from each instance of a European number
- // until the first strong type (R, L, or sor) is found. If an L is
- // found, then change the type of the European number to L.
- for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
- var type$4 = types[i$5];
- if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
- else if (isStrong.test(type$4)) { cur$1 = type$4; }
- }
-
- // N1. A sequence of neutrals takes the direction of the
- // surrounding strong text if the text on both sides has the same
- // direction. European and Arabic numbers act as if they were R in
- // terms of their influence on neutrals. Start-of-level-run (sor)
- // and end-of-level-run (eor) are used at level run boundaries.
- // N2. Any remaining neutrals take the embedding direction.
- for (var i$6 = 0; i$6 < len; ++i$6) {
- if (isNeutral.test(types[i$6])) {
- var end$1 = (void 0);
- for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
- var before = (i$6 ? types[i$6-1] : outerType) == "L";
- var after = (end$1 < len ? types[end$1] : outerType) == "L";
- var replace$1 = before == after ? (before ? "L" : "R") : outerType;
- for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
- i$6 = end$1 - 1;
- }
- }
-
- // Here we depart from the documented algorithm, in order to avoid
- // building up an actual levels array. Since there are only three
- // levels (0, 1, 2) in an implementation that doesn't take
- // explicit embedding into account, we can build up the order on
- // the fly, without following the level-based algorithm.
- var order = [], m;
- for (var i$7 = 0; i$7 < len;) {
- if (countsAsLeft.test(types[i$7])) {
- var start = i$7;
- for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
- order.push(new BidiSpan(0, start, i$7));
- } else {
- var pos = i$7, at = order.length;
- for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
- for (var j$2 = pos; j$2 < i$7;) {
- if (countsAsNum.test(types[j$2])) {
- if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
- var nstart = j$2;
- for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
- order.splice(at, 0, new BidiSpan(2, nstart, j$2));
- pos = j$2;
- } else { ++j$2; }
- }
- if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
- }
- }
- if (direction == "ltr") {
- if (order[0].level == 1 && (m = str.match(/^\s+/))) {
- order[0].from = m[0].length;
- order.unshift(new BidiSpan(0, 0, m[0].length));
- }
- if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
- lst(order).to -= m[0].length;
- order.push(new BidiSpan(0, len - m[0].length, len));
- }
- }
-
- return direction == "rtl" ? order.reverse() : order
- }
- })();
-
- // Get the bidi ordering for the given line (and cache it). Returns
- // false for lines that are fully left-to-right, and an array of
- // BidiSpan objects otherwise.
- function getOrder(line, direction) {
- var order = line.order;
- if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
- return order
- }
-
- // EVENT HANDLING
-
- // Lightweight event framework. on/off also work on DOM nodes,
- // registering native DOM handlers.
-
- var noHandlers = [];
-
- var on = function(emitter, type, f) {
- if (emitter.addEventListener) {
- emitter.addEventListener(type, f, false);
- } else if (emitter.attachEvent) {
- emitter.attachEvent("on" + type, f);
- } else {
- var map$$1 = emitter._handlers || (emitter._handlers = {});
- map$$1[type] = (map$$1[type] || noHandlers).concat(f);
- }
- };
-
- function getHandlers(emitter, type) {
- return emitter._handlers && emitter._handlers[type] || noHandlers
- }
-
- function off(emitter, type, f) {
- if (emitter.removeEventListener) {
- emitter.removeEventListener(type, f, false);
- } else if (emitter.detachEvent) {
- emitter.detachEvent("on" + type, f);
- } else {
- var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
- if (arr) {
- var index = indexOf(arr, f);
- if (index > -1)
- { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
- }
- }
- }
-
- function signal(emitter, type /*, values...*/) {
- var handlers = getHandlers(emitter, type);
- if (!handlers.length) { return }
- var args = Array.prototype.slice.call(arguments, 2);
- for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
- }
-
- // The DOM events that CodeMirror handles can be overridden by
- // registering a (non-DOM) handler on the editor for the event name,
- // and preventDefault-ing the event in that handler.
- function signalDOMEvent(cm, e, override) {
- if (typeof e == "string")
- { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
- signal(cm, override || e.type, cm, e);
- return e_defaultPrevented(e) || e.codemirrorIgnore
- }
-
- function signalCursorActivity(cm) {
- var arr = cm._handlers && cm._handlers.cursorActivity;
- if (!arr) { return }
- var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
- for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
- { set.push(arr[i]); } }
- }
-
- function hasHandler(emitter, type) {
- return getHandlers(emitter, type).length > 0
- }
-
- // Add on and off methods to a constructor's prototype, to make
- // registering events on such objects more convenient.
- function eventMixin(ctor) {
- ctor.prototype.on = function(type, f) {on(this, type, f);};
- ctor.prototype.off = function(type, f) {off(this, type, f);};
- }
-
- // Due to the fact that we still support jurassic IE versions, some
- // compatibility wrappers are needed.
-
- function e_preventDefault(e) {
- if (e.preventDefault) { e.preventDefault(); }
- else { e.returnValue = false; }
- }
- function e_stopPropagation(e) {
- if (e.stopPropagation) { e.stopPropagation(); }
- else { e.cancelBubble = true; }
- }
- function e_defaultPrevented(e) {
- return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
- }
- function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
-
- function e_target(e) {return e.target || e.srcElement}
- function e_button(e) {
- var b = e.which;
- if (b == null) {
- if (e.button & 1) { b = 1; }
- else if (e.button & 2) { b = 3; }
- else if (e.button & 4) { b = 2; }
- }
- if (mac && e.ctrlKey && b == 1) { b = 3; }
- return b
- }
-
- // Detect drag-and-drop
- var dragAndDrop = function() {
- // There is *some* kind of drag-and-drop support in IE6-8, but I
- // couldn't get it to work yet.
- if (ie && ie_version < 9) { return false }
- var div = elt('div');
- return "draggable" in div || "dragDrop" in div
- }();
-
- var zwspSupported;
- function zeroWidthElement(measure) {
- if (zwspSupported == null) {
- var test = elt("span", "\u200b");
- removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
- if (measure.firstChild.offsetHeight != 0)
- { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
- }
- var node = zwspSupported ? elt("span", "\u200b") :
- elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
- node.setAttribute("cm-text", "");
- return node
- }
-
- // Feature-detect IE's crummy client rect reporting for bidi text
- var badBidiRects;
- function hasBadBidiRects(measure) {
- if (badBidiRects != null) { return badBidiRects }
- var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
- var r0 = range(txt, 0, 1).getBoundingClientRect();
- var r1 = range(txt, 1, 2).getBoundingClientRect();
- removeChildren(measure);
- if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
- return badBidiRects = (r1.right - r0.right < 3)
- }
-
- // See if "".split is the broken IE version, if so, provide an
- // alternative way to split lines.
- var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
- var pos = 0, result = [], l = string.length;
- while (pos <= l) {
- var nl = string.indexOf("\n", pos);
- if (nl == -1) { nl = string.length; }
- var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
- var rt = line.indexOf("\r");
- if (rt != -1) {
- result.push(line.slice(0, rt));
- pos += rt + 1;
- } else {
- result.push(line);
- pos = nl + 1;
- }
- }
- return result
- } : function (string) { return string.split(/\r\n?|\n/); };
-
- var hasSelection = window.getSelection ? function (te) {
- try { return te.selectionStart != te.selectionEnd }
- catch(e) { return false }
- } : function (te) {
- var range$$1;
- try {range$$1 = te.ownerDocument.selection.createRange();}
- catch(e) {}
- if (!range$$1 || range$$1.parentElement() != te) { return false }
- return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
- };
-
- var hasCopyEvent = (function () {
- var e = elt("div");
- if ("oncopy" in e) { return true }
- e.setAttribute("oncopy", "return;");
- return typeof e.oncopy == "function"
- })();
-
- var badZoomedRects = null;
- function hasBadZoomedRects(measure) {
- if (badZoomedRects != null) { return badZoomedRects }
- var node = removeChildrenAndAdd(measure, elt("span", "x"));
- var normal = node.getBoundingClientRect();
- var fromRange = range(node, 0, 1).getBoundingClientRect();
- return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
- }
-
- // Known modes, by name and by MIME
- var modes = {}, mimeModes = {};
-
- // Extra arguments are stored as the mode's dependencies, which is
- // used by (legacy) mechanisms like loadmode.js to automatically
- // load a mode. (Preferred mechanism is the require/define calls.)
- function defineMode(name, mode) {
- if (arguments.length > 2)
- { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
- modes[name] = mode;
- }
-
- function defineMIME(mime, spec) {
- mimeModes[mime] = spec;
- }
-
- // Given a MIME type, a {name, ...options} config object, or a name
- // string, return a mode config object.
- function resolveMode(spec) {
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
- spec = mimeModes[spec];
- } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
- var found = mimeModes[spec.name];
- if (typeof found == "string") { found = {name: found}; }
- spec = createObj(found, spec);
- spec.name = found.name;
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
- return resolveMode("application/xml")
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
- return resolveMode("application/json")
- }
- if (typeof spec == "string") { return {name: spec} }
- else { return spec || {name: "null"} }
- }
-
- // Given a mode spec (anything that resolveMode accepts), find and
- // initialize an actual mode object.
- function getMode(options, spec) {
- spec = resolveMode(spec);
- var mfactory = modes[spec.name];
- if (!mfactory) { return getMode(options, "text/plain") }
- var modeObj = mfactory(options, spec);
- if (modeExtensions.hasOwnProperty(spec.name)) {
- var exts = modeExtensions[spec.name];
- for (var prop in exts) {
- if (!exts.hasOwnProperty(prop)) { continue }
- if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
- modeObj[prop] = exts[prop];
- }
- }
- modeObj.name = spec.name;
- if (spec.helperType) { modeObj.helperType = spec.helperType; }
- if (spec.modeProps) { for (var prop$1 in spec.modeProps)
- { modeObj[prop$1] = spec.modeProps[prop$1]; } }
-
- return modeObj
- }
-
- // This can be used to attach properties to mode objects from
- // outside the actual mode definition.
- var modeExtensions = {};
- function extendMode(mode, properties) {
- var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
- copyObj(properties, exts);
- }
-
- function copyState(mode, state) {
- if (state === true) { return state }
- if (mode.copyState) { return mode.copyState(state) }
- var nstate = {};
- for (var n in state) {
- var val = state[n];
- if (val instanceof Array) { val = val.concat([]); }
- nstate[n] = val;
- }
- return nstate
- }
-
- // Given a mode and a state (for that mode), find the inner mode and
- // state at the position that the state refers to.
- function innerMode(mode, state) {
- var info;
- while (mode.innerMode) {
- info = mode.innerMode(state);
- if (!info || info.mode == mode) { break }
- state = info.state;
- mode = info.mode;
- }
- return info || {mode: mode, state: state}
- }
-
- function startState(mode, a1, a2) {
- return mode.startState ? mode.startState(a1, a2) : true
- }
-
- // STRING STREAM
-
- // Fed to the mode parsers, provides helper functions to make
- // parsers more succinct.
-
- var StringStream = function(string, tabSize, lineOracle) {
- this.pos = this.start = 0;
- this.string = string;
- this.tabSize = tabSize || 8;
- this.lastColumnPos = this.lastColumnValue = 0;
- this.lineStart = 0;
- this.lineOracle = lineOracle;
- };
-
- StringStream.prototype.eol = function () {return this.pos >= this.string.length};
- StringStream.prototype.sol = function () {return this.pos == this.lineStart};
- StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
- StringStream.prototype.next = function () {
- if (this.pos < this.string.length)
- { return this.string.charAt(this.pos++) }
- };
- StringStream.prototype.eat = function (match) {
- var ch = this.string.charAt(this.pos);
- var ok;
- if (typeof match == "string") { ok = ch == match; }
- else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
- if (ok) {++this.pos; return ch}
- };
- StringStream.prototype.eatWhile = function (match) {
- var start = this.pos;
- while (this.eat(match)){}
- return this.pos > start
- };
- StringStream.prototype.eatSpace = function () {
- var this$1 = this;
-
- var start = this.pos;
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
- return this.pos > start
- };
- StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
- StringStream.prototype.skipTo = function (ch) {
- var found = this.string.indexOf(ch, this.pos);
- if (found > -1) {this.pos = found; return true}
- };
- StringStream.prototype.backUp = function (n) {this.pos -= n;};
- StringStream.prototype.column = function () {
- if (this.lastColumnPos < this.start) {
- this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
- this.lastColumnPos = this.start;
- }
- return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
- };
- StringStream.prototype.indentation = function () {
- return countColumn(this.string, null, this.tabSize) -
- (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
- };
- StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
- if (typeof pattern == "string") {
- var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
- var substr = this.string.substr(this.pos, pattern.length);
- if (cased(substr) == cased(pattern)) {
- if (consume !== false) { this.pos += pattern.length; }
- return true
- }
- } else {
- var match = this.string.slice(this.pos).match(pattern);
- if (match && match.index > 0) { return null }
- if (match && consume !== false) { this.pos += match[0].length; }
- return match
- }
- };
- StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
- StringStream.prototype.hideFirstChars = function (n, inner) {
- this.lineStart += n;
- try { return inner() }
- finally { this.lineStart -= n; }
- };
- StringStream.prototype.lookAhead = function (n) {
- var oracle = this.lineOracle;
- return oracle && oracle.lookAhead(n)
- };
- StringStream.prototype.baseToken = function () {
- var oracle = this.lineOracle;
- return oracle && oracle.baseToken(this.pos)
- };
-
- var SavedContext = function(state, lookAhead) {
- this.state = state;
- this.lookAhead = lookAhead;
- };
-
- var Context = function(doc, state, line, lookAhead) {
- this.state = state;
- this.doc = doc;
- this.line = line;
- this.maxLookAhead = lookAhead || 0;
- this.baseTokens = null;
- this.baseTokenPos = 1;
- };
-
- Context.prototype.lookAhead = function (n) {
- var line = this.doc.getLine(this.line + n);
- if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
- return line
- };
-
- Context.prototype.baseToken = function (n) {
- var this$1 = this;
-
- if (!this.baseTokens) { return null }
- while (this.baseTokens[this.baseTokenPos] <= n)
- { this$1.baseTokenPos += 2; }
- var type = this.baseTokens[this.baseTokenPos + 1];
- return {type: type && type.replace(/( |^)overlay .*/, ""),
- size: this.baseTokens[this.baseTokenPos] - n}
- };
-
- Context.prototype.nextLine = function () {
- this.line++;
- if (this.maxLookAhead > 0) { this.maxLookAhead--; }
- };
-
- Context.fromSaved = function (doc, saved, line) {
- if (saved instanceof SavedContext)
- { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
- else
- { return new Context(doc, copyState(doc.mode, saved), line) }
- };
-
- Context.prototype.save = function (copy) {
- var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
- return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
- };
-
-
- // Compute a style array (an array starting with a mode generation
- // -- for invalidation -- followed by pairs of end positions and
- // style strings), which is used to highlight the tokens on the
- // line.
- function highlightLine(cm, line, context, forceToEnd) {
- // A styles array always starts with a number identifying the
- // mode/overlays that it is based on (for easy invalidation).
- var st = [cm.state.modeGen], lineClasses = {};
- // Compute the base array of styles
- runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
- lineClasses, forceToEnd);
- var state = context.state;
-
- // Run overlays, adjust style array.
- var loop = function ( o ) {
- context.baseTokens = st;
- var overlay = cm.state.overlays[o], i = 1, at = 0;
- context.state = true;
- runMode(cm, line.text, overlay.mode, context, function (end, style) {
- var start = i;
- // Ensure there's a token end at the current position, and that i points at it
- while (at < end) {
- var i_end = st[i];
- if (i_end > end)
- { st.splice(i, 1, end, st[i+1], i_end); }
- i += 2;
- at = Math.min(end, i_end);
- }
- if (!style) { return }
- if (overlay.opaque) {
- st.splice(start, i - start, end, "overlay " + style);
- i = start + 2;
- } else {
- for (; start < i; start += 2) {
- var cur = st[start+1];
- st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
- }
- }
- }, lineClasses);
- context.state = state;
- context.baseTokens = null;
- context.baseTokenPos = 1;
- };
-
- for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
-
- return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
- }
-
- function getLineStyles(cm, line, updateFrontier) {
- if (!line.styles || line.styles[0] != cm.state.modeGen) {
- var context = getContextBefore(cm, lineNo(line));
- var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
- var result = highlightLine(cm, line, context);
- if (resetState) { context.state = resetState; }
- line.stateAfter = context.save(!resetState);
- line.styles = result.styles;
- if (result.classes) { line.styleClasses = result.classes; }
- else if (line.styleClasses) { line.styleClasses = null; }
- if (updateFrontier === cm.doc.highlightFrontier)
- { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
- }
- return line.styles
- }
-
- function getContextBefore(cm, n, precise) {
- var doc = cm.doc, display = cm.display;
- if (!doc.mode.startState) { return new Context(doc, true, n) }
- var start = findStartLine(cm, n, precise);
- var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
- var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
-
- doc.iter(start, n, function (line) {
- processLine(cm, line.text, context);
- var pos = context.line;
- line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
- context.nextLine();
- });
- if (precise) { doc.modeFrontier = context.line; }
- return context
- }
-
- // Lightweight form of highlight -- proceed over this line and
- // update state, but don't save a style array. Used for lines that
- // aren't currently visible.
- function processLine(cm, text, context, startAt) {
- var mode = cm.doc.mode;
- var stream = new StringStream(text, cm.options.tabSize, context);
- stream.start = stream.pos = startAt || 0;
- if (text == "") { callBlankLine(mode, context.state); }
- while (!stream.eol()) {
- readToken(mode, stream, context.state);
- stream.start = stream.pos;
- }
- }
-
- function callBlankLine(mode, state) {
- if (mode.blankLine) { return mode.blankLine(state) }
- if (!mode.innerMode) { return }
- var inner = innerMode(mode, state);
- if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
- }
-
- function readToken(mode, stream, state, inner) {
- for (var i = 0; i < 10; i++) {
- if (inner) { inner[0] = innerMode(mode, state).mode; }
- var style = mode.token(stream, state);
- if (stream.pos > stream.start) { return style }
- }
- throw new Error("Mode " + mode.name + " failed to advance stream.")
- }
-
- var Token = function(stream, type, state) {
- this.start = stream.start; this.end = stream.pos;
- this.string = stream.current();
- this.type = type || null;
- this.state = state;
- };
-
- // Utility for getTokenAt and getLineTokens
- function takeToken(cm, pos, precise, asArray) {
- var doc = cm.doc, mode = doc.mode, style;
- pos = clipPos(doc, pos);
- var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
- var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
- if (asArray) { tokens = []; }
- while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
- stream.start = stream.pos;
- style = readToken(mode, stream, context.state);
- if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
- }
- return asArray ? tokens : new Token(stream, style, context.state)
- }
-
- function extractLineClasses(type, output) {
- if (type) { for (;;) {
- var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
- if (!lineClass) { break }
- type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
- var prop = lineClass[1] ? "bgClass" : "textClass";
- if (output[prop] == null)
- { output[prop] = lineClass[2]; }
- else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
- { output[prop] += " " + lineClass[2]; }
- } }
- return type
- }
-
- // Run the given mode's parser over a line, calling f for each token.
- function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
- var flattenSpans = mode.flattenSpans;
- if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
- var curStart = 0, curStyle = null;
- var stream = new StringStream(text, cm.options.tabSize, context), style;
- var inner = cm.options.addModeClass && [null];
- if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
- while (!stream.eol()) {
- if (stream.pos > cm.options.maxHighlightLength) {
- flattenSpans = false;
- if (forceToEnd) { processLine(cm, text, context, stream.pos); }
- stream.pos = text.length;
- style = null;
- } else {
- style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
- }
- if (inner) {
- var mName = inner[0].name;
- if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
- }
- if (!flattenSpans || curStyle != style) {
- while (curStart < stream.start) {
- curStart = Math.min(stream.start, curStart + 5000);
- f(curStart, curStyle);
- }
- curStyle = style;
- }
- stream.start = stream.pos;
- }
- while (curStart < stream.pos) {
- // Webkit seems to refuse to render text nodes longer than 57444
- // characters, and returns inaccurate measurements in nodes
- // starting around 5000 chars.
- var pos = Math.min(stream.pos, curStart + 5000);
- f(pos, curStyle);
- curStart = pos;
- }
- }
-
- // Finds the line to start with when starting a parse. Tries to
- // find a line with a stateAfter, so that it can start with a
- // valid state. If that fails, it returns the line with the
- // smallest indentation, which tends to need the least context to
- // parse correctly.
- function findStartLine(cm, n, precise) {
- var minindent, minline, doc = cm.doc;
- var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
- for (var search = n; search > lim; --search) {
- if (search <= doc.first) { return doc.first }
- var line = getLine(doc, search - 1), after = line.stateAfter;
- if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
- { return search }
- var indented = countColumn(line.text, null, cm.options.tabSize);
- if (minline == null || minindent > indented) {
- minline = search - 1;
- minindent = indented;
- }
- }
- return minline
- }
-
- function retreatFrontier(doc, n) {
- doc.modeFrontier = Math.min(doc.modeFrontier, n);
- if (doc.highlightFrontier < n - 10) { return }
- var start = doc.first;
- for (var line = n - 1; line > start; line--) {
- var saved = getLine(doc, line).stateAfter;
- // change is on 3
- // state on line 1 looked ahead 2 -- so saw 3
- // test 1 + 2 < 3 should cover this
- if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
- start = line + 1;
- break
- }
- }
- doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
- }
-
- // LINE DATA STRUCTURE
-
- // Line objects. These hold state related to a line, including
- // highlighting info (the styles array).
- var Line = function(text, markedSpans, estimateHeight) {
- this.text = text;
- attachMarkedSpans(this, markedSpans);
- this.height = estimateHeight ? estimateHeight(this) : 1;
- };
-
- Line.prototype.lineNo = function () { return lineNo(this) };
- eventMixin(Line);
-
- // Change the content (text, markers) of a line. Automatically
- // invalidates cached information and tries to re-estimate the
- // line's height.
- function updateLine(line, text, markedSpans, estimateHeight) {
- line.text = text;
- if (line.stateAfter) { line.stateAfter = null; }
- if (line.styles) { line.styles = null; }
- if (line.order != null) { line.order = null; }
- detachMarkedSpans(line);
- attachMarkedSpans(line, markedSpans);
- var estHeight = estimateHeight ? estimateHeight(line) : 1;
- if (estHeight != line.height) { updateLineHeight(line, estHeight); }
- }
-
- // Detach a line from the document tree and its markers.
- function cleanUpLine(line) {
- line.parent = null;
- detachMarkedSpans(line);
- }
-
- // Convert a style as returned by a mode (either null, or a string
- // containing one or more styles) to a CSS style. This is cached,
- // and also looks for line-wide styles.
- var styleToClassCache = {}, styleToClassCacheWithMode = {};
- function interpretTokenStyle(style, options) {
- if (!style || /^\s*$/.test(style)) { return null }
- var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
- return cache[style] ||
- (cache[style] = style.replace(/\S+/g, "cm-$&"))
- }
-
- // Render the DOM representation of the text of a line. Also builds
- // up a 'line map', which points at the DOM nodes that represent
- // specific stretches of text, and is used by the measuring code.
- // The returned object contains the DOM node, this map, and
- // information about line-wide styles that were set by the mode.
- function buildLineContent(cm, lineView) {
- // The padding-right forces the element to have a 'border', which
- // is needed on Webkit to be able to get line-level bounding
- // rectangles for it (in measureChar).
- var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
- var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
- col: 0, pos: 0, cm: cm,
- trailingSpace: false,
- splitSpaces: cm.getOption("lineWrapping")};
- lineView.measure = {};
-
- // Iterate over the logical lines that make up this visual line.
- for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
- var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
- builder.pos = 0;
- builder.addToken = buildToken;
- // Optionally wire in some hacks into the token-rendering
- // algorithm, to deal with browser quirks.
- if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
- { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
- builder.map = [];
- var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
- insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
- if (line.styleClasses) {
- if (line.styleClasses.bgClass)
- { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
- if (line.styleClasses.textClass)
- { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
- }
-
- // Ensure at least a single node is present, for measuring.
- if (builder.map.length == 0)
- { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
-
- // Store the map and a cache object for the current logical line
- if (i == 0) {
- lineView.measure.map = builder.map;
- lineView.measure.cache = {};
- } else {
- (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
- ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
- }
- }
-
- // See issue #2901
- if (webkit) {
- var last = builder.content.lastChild;
- if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
- { builder.content.className = "cm-tab-wrap-hack"; }
- }
-
- signal(cm, "renderLine", cm, lineView.line, builder.pre);
- if (builder.pre.className)
- { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
-
- return builder
- }
-
- function defaultSpecialCharPlaceholder(ch) {
- var token = elt("span", "\u2022", "cm-invalidchar");
- token.title = "\\u" + ch.charCodeAt(0).toString(16);
- token.setAttribute("aria-label", token.title);
- return token
- }
-
- // Build up the DOM representation for a single token, and add it to
- // the line map. Takes care to render special characters separately.
- function buildToken(builder, text, style, startStyle, endStyle, title, css) {
- if (!text) { return }
- var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
- var special = builder.cm.state.specialChars, mustWrap = false;
- var content;
- if (!special.test(text)) {
- builder.col += text.length;
- content = document.createTextNode(displayText);
- builder.map.push(builder.pos, builder.pos + text.length, content);
- if (ie && ie_version < 9) { mustWrap = true; }
- builder.pos += text.length;
- } else {
- content = document.createDocumentFragment();
- var pos = 0;
- while (true) {
- special.lastIndex = pos;
- var m = special.exec(text);
- var skipped = m ? m.index - pos : text.length - pos;
- if (skipped) {
- var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
- if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
- else { content.appendChild(txt); }
- builder.map.push(builder.pos, builder.pos + skipped, txt);
- builder.col += skipped;
- builder.pos += skipped;
- }
- if (!m) { break }
- pos += skipped + 1;
- var txt$1 = (void 0);
- if (m[0] == "\t") {
- var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
- txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
- txt$1.setAttribute("role", "presentation");
- txt$1.setAttribute("cm-text", "\t");
- builder.col += tabWidth;
- } else if (m[0] == "\r" || m[0] == "\n") {
- txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
- txt$1.setAttribute("cm-text", m[0]);
- builder.col += 1;
- } else {
- txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
- txt$1.setAttribute("cm-text", m[0]);
- if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
- else { content.appendChild(txt$1); }
- builder.col += 1;
- }
- builder.map.push(builder.pos, builder.pos + 1, txt$1);
- builder.pos++;
- }
- }
- builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
- if (style || startStyle || endStyle || mustWrap || css) {
- var fullStyle = style || "";
- if (startStyle) { fullStyle += startStyle; }
- if (endStyle) { fullStyle += endStyle; }
- var token = elt("span", [content], fullStyle, css);
- if (title) { token.title = title; }
- return builder.content.appendChild(token)
- }
- builder.content.appendChild(content);
- }
-
- // Change some spaces to NBSP to prevent the browser from collapsing
- // trailing spaces at the end of a line when rendering text (issue #1362).
- function splitSpaces(text, trailingBefore) {
- if (text.length > 1 && !/ /.test(text)) { return text }
- var spaceBefore = trailingBefore, result = "";
- for (var i = 0; i < text.length; i++) {
- var ch = text.charAt(i);
- if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
- { ch = "\u00a0"; }
- result += ch;
- spaceBefore = ch == " ";
- }
- return result
- }
-
- // Work around nonsense dimensions being reported for stretches of
- // right-to-left text.
- function buildTokenBadBidi(inner, order) {
- return function (builder, text, style, startStyle, endStyle, title, css) {
- style = style ? style + " cm-force-border" : "cm-force-border";
- var start = builder.pos, end = start + text.length;
- for (;;) {
- // Find the part that overlaps with the start of this text
- var part = (void 0);
- for (var i = 0; i < order.length; i++) {
- part = order[i];
- if (part.to > start && part.from <= start) { break }
- }
- if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
- inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
- startStyle = null;
- text = text.slice(part.to - start);
- start = part.to;
- }
- }
- }
-
- function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
- var widget = !ignoreWidget && marker.widgetNode;
- if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
- if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
- if (!widget)
- { widget = builder.content.appendChild(document.createElement("span")); }
- widget.setAttribute("cm-marker", marker.id);
- }
- if (widget) {
- builder.cm.display.input.setUneditable(widget);
- builder.content.appendChild(widget);
- }
- builder.pos += size;
- builder.trailingSpace = false;
- }
-
- // Outputs a number of spans to make up a line, taking highlighting
- // and marked text into account.
- function insertLineContent(line, builder, styles) {
- var spans = line.markedSpans, allText = line.text, at = 0;
- if (!spans) {
- for (var i$1 = 1; i$1 < styles.length; i$1+=2)
- { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
- return
- }
-
- var len = allText.length, pos = 0, i = 1, text = "", style, css;
- var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
- for (;;) {
- if (nextChange == pos) { // Update current marker set
- spanStyle = spanEndStyle = spanStartStyle = title = css = "";
- collapsed = null; nextChange = Infinity;
- var foundBookmarks = [], endStyles = (void 0);
- for (var j = 0; j < spans.length; ++j) {
- var sp = spans[j], m = sp.marker;
- if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
- foundBookmarks.push(m);
- } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
- if (sp.to != null && sp.to != pos && nextChange > sp.to) {
- nextChange = sp.to;
- spanEndStyle = "";
- }
- if (m.className) { spanStyle += " " + m.className; }
- if (m.css) { css = (css ? css + ";" : "") + m.css; }
- if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
- if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
- if (m.title && !title) { title = m.title; }
- if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
- { collapsed = sp; }
- } else if (sp.from > pos && nextChange > sp.from) {
- nextChange = sp.from;
- }
- }
- if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
- { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
-
- if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
- { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
- if (collapsed && (collapsed.from || 0) == pos) {
- buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
- collapsed.marker, collapsed.from == null);
- if (collapsed.to == null) { return }
- if (collapsed.to == pos) { collapsed = false; }
- }
- }
- if (pos >= len) { break }
-
- var upto = Math.min(len, nextChange);
- while (true) {
- if (text) {
- var end = pos + text.length;
- if (!collapsed) {
- var tokenText = end > upto ? text.slice(0, upto - pos) : text;
- builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
- spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
- }
- if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
- pos = end;
- spanStartStyle = "";
- }
- text = allText.slice(at, at = styles[i++]);
- style = interpretTokenStyle(styles[i++], builder.cm.options);
- }
- }
- }
-
-
- // These objects are used to represent the visible (currently drawn)
- // part of the document. A LineView may correspond to multiple
- // logical lines, if those are connected by collapsed ranges.
- function LineView(doc, line, lineN) {
- // The starting line
- this.line = line;
- // Continuing lines, if any
- this.rest = visualLineContinued(line);
- // Number of logical lines in this visual line
- this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
- this.node = this.text = null;
- this.hidden = lineIsHidden(doc, line);
- }
-
- // Create a range of LineView objects for the given lines.
- function buildViewArray(cm, from, to) {
- var array = [], nextPos;
- for (var pos = from; pos < to; pos = nextPos) {
- var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
- nextPos = pos + view.size;
- array.push(view);
- }
- return array
- }
-
- var operationGroup = null;
-
- function pushOperation(op) {
- if (operationGroup) {
- operationGroup.ops.push(op);
- } else {
- op.ownsGroup = operationGroup = {
- ops: [op],
- delayedCallbacks: []
- };
- }
- }
-
- function fireCallbacksForOps(group) {
- // Calls delayed callbacks and cursorActivity handlers until no
- // new ones appear
- var callbacks = group.delayedCallbacks, i = 0;
- do {
- for (; i < callbacks.length; i++)
- { callbacks[i].call(null); }
- for (var j = 0; j < group.ops.length; j++) {
- var op = group.ops[j];
- if (op.cursorActivityHandlers)
- { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
- { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
- }
- } while (i < callbacks.length)
- }
-
- function finishOperation(op, endCb) {
- var group = op.ownsGroup;
- if (!group) { return }
-
- try { fireCallbacksForOps(group); }
- finally {
- operationGroup = null;
- endCb(group);
- }
- }
-
- var orphanDelayedCallbacks = null;
-
- // Often, we want to signal events at a point where we are in the
- // middle of some work, but don't want the handler to start calling
- // other methods on the editor, which might be in an inconsistent
- // state or simply not expect any other events to happen.
- // signalLater looks whether there are any handlers, and schedules
- // them to be executed when the last operation ends, or, if no
- // operation is active, when a timeout fires.
- function signalLater(emitter, type /*, values...*/) {
- var arr = getHandlers(emitter, type);
- if (!arr.length) { return }
- var args = Array.prototype.slice.call(arguments, 2), list;
- if (operationGroup) {
- list = operationGroup.delayedCallbacks;
- } else if (orphanDelayedCallbacks) {
- list = orphanDelayedCallbacks;
- } else {
- list = orphanDelayedCallbacks = [];
- setTimeout(fireOrphanDelayed, 0);
- }
- var loop = function ( i ) {
- list.push(function () { return arr[i].apply(null, args); });
- };
-
- for (var i = 0; i < arr.length; ++i)
- loop( i );
- }
-
- function fireOrphanDelayed() {
- var delayed = orphanDelayedCallbacks;
- orphanDelayedCallbacks = null;
- for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
- }
-
- // When an aspect of a line changes, a string is added to
- // lineView.changes. This updates the relevant part of the line's
- // DOM structure.
- function updateLineForChanges(cm, lineView, lineN, dims) {
- for (var j = 0; j < lineView.changes.length; j++) {
- var type = lineView.changes[j];
- if (type == "text") { updateLineText(cm, lineView); }
- else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
- else if (type == "class") { updateLineClasses(cm, lineView); }
- else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
- }
- lineView.changes = null;
- }
-
- // Lines with gutter elements, widgets or a background class need to
- // be wrapped, and have the extra elements added to the wrapper div
- function ensureLineWrapped(lineView) {
- if (lineView.node == lineView.text) {
- lineView.node = elt("div", null, null, "position: relative");
- if (lineView.text.parentNode)
- { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
- lineView.node.appendChild(lineView.text);
- if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
- }
- return lineView.node
- }
-
- function updateLineBackground(cm, lineView) {
- var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
- if (cls) { cls += " CodeMirror-linebackground"; }
- if (lineView.background) {
- if (cls) { lineView.background.className = cls; }
- else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
- } else if (cls) {
- var wrap = ensureLineWrapped(lineView);
- lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
- cm.display.input.setUneditable(lineView.background);
- }
- }
-
- // Wrapper around buildLineContent which will reuse the structure
- // in display.externalMeasured when possible.
- function getLineContent(cm, lineView) {
- var ext = cm.display.externalMeasured;
- if (ext && ext.line == lineView.line) {
- cm.display.externalMeasured = null;
- lineView.measure = ext.measure;
- return ext.built
- }
- return buildLineContent(cm, lineView)
- }
-
- // Redraw the line's text. Interacts with the background and text
- // classes because the mode may output tokens that influence these
- // classes.
- function updateLineText(cm, lineView) {
- var cls = lineView.text.className;
- var built = getLineContent(cm, lineView);
- if (lineView.text == lineView.node) { lineView.node = built.pre; }
- lineView.text.parentNode.replaceChild(built.pre, lineView.text);
- lineView.text = built.pre;
- if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
- lineView.bgClass = built.bgClass;
- lineView.textClass = built.textClass;
- updateLineClasses(cm, lineView);
- } else if (cls) {
- lineView.text.className = cls;
- }
- }
-
- function updateLineClasses(cm, lineView) {
- updateLineBackground(cm, lineView);
- if (lineView.line.wrapClass)
- { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
- else if (lineView.node != lineView.text)
- { lineView.node.className = ""; }
- var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
- lineView.text.className = textClass || "";
- }
-
- function updateLineGutter(cm, lineView, lineN, dims) {
- if (lineView.gutter) {
- lineView.node.removeChild(lineView.gutter);
- lineView.gutter = null;
- }
- if (lineView.gutterBackground) {
- lineView.node.removeChild(lineView.gutterBackground);
- lineView.gutterBackground = null;
- }
- if (lineView.line.gutterClass) {
- var wrap = ensureLineWrapped(lineView);
- lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
- ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
- cm.display.input.setUneditable(lineView.gutterBackground);
- wrap.insertBefore(lineView.gutterBackground, lineView.text);
- }
- var markers = lineView.line.gutterMarkers;
- if (cm.options.lineNumbers || markers) {
- var wrap$1 = ensureLineWrapped(lineView);
- var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
- cm.display.input.setUneditable(gutterWrap);
- wrap$1.insertBefore(gutterWrap, lineView.text);
- if (lineView.line.gutterClass)
- { gutterWrap.className += " " + lineView.line.gutterClass; }
- if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
- { lineView.lineNumber = gutterWrap.appendChild(
- elt("div", lineNumberFor(cm.options, lineN),
- "CodeMirror-linenumber CodeMirror-gutter-elt",
- ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
- if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
- var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
- if (found)
- { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
- ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
- } }
- }
- }
-
- function updateLineWidgets(cm, lineView, dims) {
- if (lineView.alignable) { lineView.alignable = null; }
- for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
- next = node.nextSibling;
- if (node.className == "CodeMirror-linewidget")
- { lineView.node.removeChild(node); }
- }
- insertLineWidgets(cm, lineView, dims);
- }
-
- // Build a line's DOM representation from scratch
- function buildLineElement(cm, lineView, lineN, dims) {
- var built = getLineContent(cm, lineView);
- lineView.text = lineView.node = built.pre;
- if (built.bgClass) { lineView.bgClass = built.bgClass; }
- if (built.textClass) { lineView.textClass = built.textClass; }
-
- updateLineClasses(cm, lineView);
- updateLineGutter(cm, lineView, lineN, dims);
- insertLineWidgets(cm, lineView, dims);
- return lineView.node
- }
-
- // A lineView may contain multiple logical lines (when merged by
- // collapsed spans). The widgets for all of them need to be drawn.
- function insertLineWidgets(cm, lineView, dims) {
- insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
- if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
- { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
- }
-
- function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
- if (!line.widgets) { return }
- var wrap = ensureLineWrapped(lineView);
- for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
- var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
- if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
- positionLineWidget(widget, node, lineView, dims);
- cm.display.input.setUneditable(node);
- if (allowAbove && widget.above)
- { wrap.insertBefore(node, lineView.gutter || lineView.text); }
- else
- { wrap.appendChild(node); }
- signalLater(widget, "redraw");
- }
- }
-
- function positionLineWidget(widget, node, lineView, dims) {
- if (widget.noHScroll) {
- (lineView.alignable || (lineView.alignable = [])).push(node);
- var width = dims.wrapperWidth;
- node.style.left = dims.fixedPos + "px";
- if (!widget.coverGutter) {
- width -= dims.gutterTotalWidth;
- node.style.paddingLeft = dims.gutterTotalWidth + "px";
- }
- node.style.width = width + "px";
- }
- if (widget.coverGutter) {
- node.style.zIndex = 5;
- node.style.position = "relative";
- if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
- }
- }
-
- function widgetHeight(widget) {
- if (widget.height != null) { return widget.height }
- var cm = widget.doc.cm;
- if (!cm) { return 0 }
- if (!contains(document.body, widget.node)) {
- var parentStyle = "position: relative;";
- if (widget.coverGutter)
- { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
- if (widget.noHScroll)
- { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
- removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
- }
- return widget.height = widget.node.parentNode.offsetHeight
- }
-
- // Return true when the given mouse event happened in a widget
- function eventInWidget(display, e) {
- for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
- if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
- (n.parentNode == display.sizer && n != display.mover))
- { return true }
- }
- }
-
- // POSITION MEASUREMENT
-
- function paddingTop(display) {return display.lineSpace.offsetTop}
- function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
- function paddingH(display) {
- if (display.cachedPaddingH) { return display.cachedPaddingH }
- var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
- var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
- var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
- if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
- return data
- }
-
- function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
- function displayWidth(cm) {
- return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
- }
- function displayHeight(cm) {
- return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
- }
-
- // Ensure the lineView.wrapping.heights array is populated. This is
- // an array of bottom offsets for the lines that make up a drawn
- // line. When lineWrapping is on, there might be more than one
- // height.
- function ensureLineHeights(cm, lineView, rect) {
- var wrapping = cm.options.lineWrapping;
- var curWidth = wrapping && displayWidth(cm);
- if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
- var heights = lineView.measure.heights = [];
- if (wrapping) {
- lineView.measure.width = curWidth;
- var rects = lineView.text.firstChild.getClientRects();
- for (var i = 0; i < rects.length - 1; i++) {
- var cur = rects[i], next = rects[i + 1];
- if (Math.abs(cur.bottom - next.bottom) > 2)
- { heights.push((cur.bottom + next.top) / 2 - rect.top); }
- }
- }
- heights.push(rect.bottom - rect.top);
- }
- }
-
- // Find a line map (mapping character offsets to text nodes) and a
- // measurement cache for the given line number. (A line view might
- // contain multiple lines when collapsed ranges are present.)
- function mapFromLineView(lineView, line, lineN) {
- if (lineView.line == line)
- { return {map: lineView.measure.map, cache: lineView.measure.cache} }
- for (var i = 0; i < lineView.rest.length; i++)
- { if (lineView.rest[i] == line)
- { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
- for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
- { if (lineNo(lineView.rest[i$1]) > lineN)
- { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
- }
-
- // Render a line into the hidden node display.externalMeasured. Used
- // when measurement is needed for a line that's not in the viewport.
- function updateExternalMeasurement(cm, line) {
- line = visualLine(line);
- var lineN = lineNo(line);
- var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
- view.lineN = lineN;
- var built = view.built = buildLineContent(cm, view);
- view.text = built.pre;
- removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
- return view
- }
-
- // Get a {top, bottom, left, right} box (in line-local coordinates)
- // for a given character.
- function measureChar(cm, line, ch, bias) {
- return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
- }
-
- // Find a line view that corresponds to the given line number.
- function findViewForLine(cm, lineN) {
- if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
- { return cm.display.view[findViewIndex(cm, lineN)] }
- var ext = cm.display.externalMeasured;
- if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
- { return ext }
- }
-
- // Measurement can be split in two steps, the set-up work that
- // applies to the whole line, and the measurement of the actual
- // character. Functions like coordsChar, that need to do a lot of
- // measurements in a row, can thus ensure that the set-up work is
- // only done once.
- function prepareMeasureForLine(cm, line) {
- var lineN = lineNo(line);
- var view = findViewForLine(cm, lineN);
- if (view && !view.text) {
- view = null;
- } else if (view && view.changes) {
- updateLineForChanges(cm, view, lineN, getDimensions(cm));
- cm.curOp.forceUpdate = true;
- }
- if (!view)
- { view = updateExternalMeasurement(cm, line); }
-
- var info = mapFromLineView(view, line, lineN);
- return {
- line: line, view: view, rect: null,
- map: info.map, cache: info.cache, before: info.before,
- hasHeights: false
- }
- }
-
- // Given a prepared measurement object, measures the position of an
- // actual character (or fetches it from the cache).
- function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
- if (prepared.before) { ch = -1; }
- var key = ch + (bias || ""), found;
- if (prepared.cache.hasOwnProperty(key)) {
- found = prepared.cache[key];
- } else {
- if (!prepared.rect)
- { prepared.rect = prepared.view.text.getBoundingClientRect(); }
- if (!prepared.hasHeights) {
- ensureLineHeights(cm, prepared.view, prepared.rect);
- prepared.hasHeights = true;
- }
- found = measureCharInner(cm, prepared, ch, bias);
- if (!found.bogus) { prepared.cache[key] = found; }
- }
- return {left: found.left, right: found.right,
- top: varHeight ? found.rtop : found.top,
- bottom: varHeight ? found.rbottom : found.bottom}
- }
-
- var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
-
- function nodeAndOffsetInLineMap(map$$1, ch, bias) {
- var node, start, end, collapse, mStart, mEnd;
- // First, search the line map for the text node corresponding to,
- // or closest to, the target character.
- for (var i = 0; i < map$$1.length; i += 3) {
- mStart = map$$1[i];
- mEnd = map$$1[i + 1];
- if (ch < mStart) {
- start = 0; end = 1;
- collapse = "left";
- } else if (ch < mEnd) {
- start = ch - mStart;
- end = start + 1;
- } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
- end = mEnd - mStart;
- start = end - 1;
- if (ch >= mEnd) { collapse = "right"; }
- }
- if (start != null) {
- node = map$$1[i + 2];
- if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
- { collapse = bias; }
- if (bias == "left" && start == 0)
- { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
- node = map$$1[(i -= 3) + 2];
- collapse = "left";
- } }
- if (bias == "right" && start == mEnd - mStart)
- { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
- node = map$$1[(i += 3) + 2];
- collapse = "right";
- } }
- break
- }
- }
- return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
- }
-
- function getUsefulRect(rects, bias) {
- var rect = nullRect;
- if (bias == "left") { for (var i = 0; i < rects.length; i++) {
- if ((rect = rects[i]).left != rect.right) { break }
- } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
- if ((rect = rects[i$1]).left != rect.right) { break }
- } }
- return rect
- }
-
- function measureCharInner(cm, prepared, ch, bias) {
- var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
- var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
-
- var rect;
- if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
- for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
- while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
- while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
- if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
- { rect = node.parentNode.getBoundingClientRect(); }
- else
- { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
- if (rect.left || rect.right || start == 0) { break }
- end = start;
- start = start - 1;
- collapse = "right";
- }
- if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
- } else { // If it is a widget, simply get the box for the whole widget.
- if (start > 0) { collapse = bias = "right"; }
- var rects;
- if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
- { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
- else
- { rect = node.getBoundingClientRect(); }
- }
- if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
- var rSpan = node.parentNode.getClientRects()[0];
- if (rSpan)
- { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
- else
- { rect = nullRect; }
- }
-
- var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
- var mid = (rtop + rbot) / 2;
- var heights = prepared.view.measure.heights;
- var i = 0;
- for (; i < heights.length - 1; i++)
- { if (mid < heights[i]) { break } }
- var top = i ? heights[i - 1] : 0, bot = heights[i];
- var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
- right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
- top: top, bottom: bot};
- if (!rect.left && !rect.right) { result.bogus = true; }
- if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
-
- return result
- }
-
- // Work around problem with bounding client rects on ranges being
- // returned incorrectly when zoomed on IE10 and below.
- function maybeUpdateRectForZooming(measure, rect) {
- if (!window.screen || screen.logicalXDPI == null ||
- screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
- { return rect }
- var scaleX = screen.logicalXDPI / screen.deviceXDPI;
- var scaleY = screen.logicalYDPI / screen.deviceYDPI;
- return {left: rect.left * scaleX, right: rect.right * scaleX,
- top: rect.top * scaleY, bottom: rect.bottom * scaleY}
- }
-
- function clearLineMeasurementCacheFor(lineView) {
- if (lineView.measure) {
- lineView.measure.cache = {};
- lineView.measure.heights = null;
- if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
- { lineView.measure.caches[i] = {}; } }
- }
- }
-
- function clearLineMeasurementCache(cm) {
- cm.display.externalMeasure = null;
- removeChildren(cm.display.lineMeasure);
- for (var i = 0; i < cm.display.view.length; i++)
- { clearLineMeasurementCacheFor(cm.display.view[i]); }
- }
-
- function clearCaches(cm) {
- clearLineMeasurementCache(cm);
- cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
- if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
- cm.display.lineNumChars = null;
- }
-
- function pageScrollX() {
- // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
- // which causes page_Offset and bounding client rects to use
- // different reference viewports and invalidate our calculations.
- if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
- return window.pageXOffset || (document.documentElement || document.body).scrollLeft
- }
- function pageScrollY() {
- if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
- return window.pageYOffset || (document.documentElement || document.body).scrollTop
- }
-
- function widgetTopHeight(lineObj) {
- var height = 0;
- if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
- { height += widgetHeight(lineObj.widgets[i]); } } }
- return height
- }
-
- // Converts a {top, bottom, left, right} box from line-local
- // coordinates into another coordinate system. Context may be one of
- // "line", "div" (display.lineDiv), "local"./null (editor), "window",
- // or "page".
- function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
- if (!includeWidgets) {
- var height = widgetTopHeight(lineObj);
- rect.top += height; rect.bottom += height;
- }
- if (context == "line") { return rect }
- if (!context) { context = "local"; }
- var yOff = heightAtLine(lineObj);
- if (context == "local") { yOff += paddingTop(cm.display); }
- else { yOff -= cm.display.viewOffset; }
- if (context == "page" || context == "window") {
- var lOff = cm.display.lineSpace.getBoundingClientRect();
- yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
- var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
- rect.left += xOff; rect.right += xOff;
- }
- rect.top += yOff; rect.bottom += yOff;
- return rect
- }
-
- // Coverts a box from "div" coords to another coordinate system.
- // Context may be "window", "page", "div", or "local"./null.
- function fromCoordSystem(cm, coords, context) {
- if (context == "div") { return coords }
- var left = coords.left, top = coords.top;
- // First move into "page" coordinate system
- if (context == "page") {
- left -= pageScrollX();
- top -= pageScrollY();
- } else if (context == "local" || !context) {
- var localBox = cm.display.sizer.getBoundingClientRect();
- left += localBox.left;
- top += localBox.top;
- }
-
- var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
- return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
- }
-
- function charCoords(cm, pos, context, lineObj, bias) {
- if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
- return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
- }
-
- // Returns a box for a given cursor position, which may have an
- // 'other' property containing the position of the secondary cursor
- // on a bidi boundary.
- // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
- // and after `char - 1` in writing order of `char - 1`
- // A cursor Pos(line, char, "after") is on the same visual line as `char`
- // and before `char` in writing order of `char`
- // Examples (upper-case letters are RTL, lower-case are LTR):
- // Pos(0, 1, ...)
- // before after
- // ab a|b a|b
- // aB a|B aB|
- // Ab |Ab A|b
- // AB B|A B|A
- // Every position after the last character on a line is considered to stick
- // to the last character on the line.
- function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
- lineObj = lineObj || getLine(cm.doc, pos.line);
- if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
- function get(ch, right) {
- var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
- if (right) { m.left = m.right; } else { m.right = m.left; }
- return intoCoordSystem(cm, lineObj, m, context)
- }
- var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
- if (ch >= lineObj.text.length) {
- ch = lineObj.text.length;
- sticky = "before";
- } else if (ch <= 0) {
- ch = 0;
- sticky = "after";
- }
- if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
-
- function getBidi(ch, partPos, invert) {
- var part = order[partPos], right = part.level == 1;
- return get(invert ? ch - 1 : ch, right != invert)
- }
- var partPos = getBidiPartAt(order, ch, sticky);
- var other = bidiOther;
- var val = getBidi(ch, partPos, sticky == "before");
- if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
- return val
- }
-
- // Used to cheaply estimate the coordinates for a position. Used for
- // intermediate scroll updates.
- function estimateCoords(cm, pos) {
- var left = 0;
- pos = clipPos(cm.doc, pos);
- if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
- var lineObj = getLine(cm.doc, pos.line);
- var top = heightAtLine(lineObj) + paddingTop(cm.display);
- return {left: left, right: left, top: top, bottom: top + lineObj.height}
- }
-
- // Positions returned by coordsChar contain some extra information.
- // xRel is the relative x position of the input coordinates compared
- // to the found position (so xRel > 0 means the coordinates are to
- // the right of the character position, for example). When outside
- // is true, that means the coordinates lie outside the line's
- // vertical range.
- function PosWithInfo(line, ch, sticky, outside, xRel) {
- var pos = Pos(line, ch, sticky);
- pos.xRel = xRel;
- if (outside) { pos.outside = true; }
- return pos
- }
-
- // Compute the character position closest to the given coordinates.
- // Input must be lineSpace-local ("div" coordinate system).
- function coordsChar(cm, x, y) {
- var doc = cm.doc;
- y += cm.display.viewOffset;
- if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
- var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
- if (lineN > last)
- { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
- if (x < 0) { x = 0; }
-
- var lineObj = getLine(doc, lineN);
- for (;;) {
- var found = coordsCharInner(cm, lineObj, lineN, x, y);
- var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));
- if (!collapsed) { return found }
- var rangeEnd = collapsed.find(1);
- if (rangeEnd.line == lineN) { return rangeEnd }
- lineObj = getLine(doc, lineN = rangeEnd.line);
- }
- }
-
- function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
- y -= widgetTopHeight(lineObj);
- var end = lineObj.text.length;
- var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
- end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
- return {begin: begin, end: end}
- }
-
- function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
- if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
- var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
- return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
- }
-
- // Returns true if the given side of a box is after the given
- // coordinates, in top-to-bottom, left-to-right order.
- function boxIsAfter(box, x, y, left) {
- return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
- }
-
- function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
- // Move y into line-local coordinate space
- y -= heightAtLine(lineObj);
- var preparedMeasure = prepareMeasureForLine(cm, lineObj);
- // When directly calling `measureCharPrepared`, we have to adjust
- // for the widgets at this line.
- var widgetHeight$$1 = widgetTopHeight(lineObj);
- var begin = 0, end = lineObj.text.length, ltr = true;
-
- var order = getOrder(lineObj, cm.doc.direction);
- // If the line isn't plain left-to-right text, first figure out
- // which bidi section the coordinates fall into.
- if (order) {
- var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
- (cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);
- ltr = part.level != 1;
- // The awkward -1 offsets are needed because findFirst (called
- // on these below) will treat its first bound as inclusive,
- // second as exclusive, but we want to actually address the
- // characters in the part's range
- begin = ltr ? part.from : part.to - 1;
- end = ltr ? part.to : part.from - 1;
- }
-
- // A binary search to find the first character whose bounding box
- // starts after the coordinates. If we run across any whose box wrap
- // the coordinates, store that.
- var chAround = null, boxAround = null;
- var ch = findFirst(function (ch) {
- var box = measureCharPrepared(cm, preparedMeasure, ch);
- box.top += widgetHeight$$1; box.bottom += widgetHeight$$1;
- if (!boxIsAfter(box, x, y, false)) { return false }
- if (box.top <= y && box.left <= x) {
- chAround = ch;
- boxAround = box;
- }
- return true
- }, begin, end);
-
- var baseX, sticky, outside = false;
- // If a box around the coordinates was found, use that
- if (boxAround) {
- // Distinguish coordinates nearer to the left or right side of the box
- var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
- ch = chAround + (atStart ? 0 : 1);
- sticky = atStart ? "after" : "before";
- baseX = atLeft ? boxAround.left : boxAround.right;
- } else {
- // (Adjust for extended bound, if necessary.)
- if (!ltr && (ch == end || ch == begin)) { ch++; }
- // To determine which side to associate with, get the box to the
- // left of the character and compare it's vertical position to the
- // coordinates
- sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
- (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?
- "after" : "before";
- // Now get accurate coordinates for this place, in order to get a
- // base X position
- var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
- baseX = coords.left;
- outside = y < coords.top || y >= coords.bottom;
- }
-
- ch = skipExtendingChars(lineObj.text, ch, 1);
- return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)
- }
-
- function coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {
- // Bidi parts are sorted left-to-right, and in a non-line-wrapping
- // situation, we can take this ordering to correspond to the visual
- // ordering. This finds the first part whose end is after the given
- // coordinates.
- var index = findFirst(function (i) {
- var part = order[i], ltr = part.level != 1;
- return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? "before" : "after"),
- "line", lineObj, preparedMeasure), x, y, true)
- }, 0, order.length - 1);
- var part = order[index];
- // If this isn't the first part, the part's start is also after
- // the coordinates, and the coordinates aren't on the same line as
- // that start, move one part back.
- if (index > 0) {
- var ltr = part.level != 1;
- var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? "after" : "before"),
- "line", lineObj, preparedMeasure);
- if (boxIsAfter(start, x, y, true) && start.top > y)
- { part = order[index - 1]; }
- }
- return part
- }
-
- function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
- // In a wrapped line, rtl text on wrapping boundaries can do things
- // that don't correspond to the ordering in our `order` array at
- // all, so a binary search doesn't work, and we want to return a
- // part that only spans one line so that the binary search in
- // coordsCharInner is safe. As such, we first find the extent of the
- // wrapped line, and then do a flat search in which we discard any
- // spans that aren't on the line.
- var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
- var begin = ref.begin;
- var end = ref.end;
- if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
- var part = null, closestDist = null;
- for (var i = 0; i < order.length; i++) {
- var p = order[i];
- if (p.from >= end || p.to <= begin) { continue }
- var ltr = p.level != 1;
- var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
- // Weigh against spans ending before this, so that they are only
- // picked if nothing ends after
- var dist = endX < x ? x - endX + 1e9 : endX - x;
- if (!part || closestDist > dist) {
- part = p;
- closestDist = dist;
- }
- }
- if (!part) { part = order[order.length - 1]; }
- // Clip the part to the wrapped line.
- if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
- if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
- return part
- }
-
- var measureText;
- // Compute the default text height.
- function textHeight(display) {
- if (display.cachedTextHeight != null) { return display.cachedTextHeight }
- if (measureText == null) {
- measureText = elt("pre");
- // Measure a bunch of lines, for browsers that compute
- // fractional heights.
- for (var i = 0; i < 49; ++i) {
- measureText.appendChild(document.createTextNode("x"));
- measureText.appendChild(elt("br"));
- }
- measureText.appendChild(document.createTextNode("x"));
- }
- removeChildrenAndAdd(display.measure, measureText);
- var height = measureText.offsetHeight / 50;
- if (height > 3) { display.cachedTextHeight = height; }
- removeChildren(display.measure);
- return height || 1
- }
-
- // Compute the default character width.
- function charWidth(display) {
- if (display.cachedCharWidth != null) { return display.cachedCharWidth }
- var anchor = elt("span", "xxxxxxxxxx");
- var pre = elt("pre", [anchor]);
- removeChildrenAndAdd(display.measure, pre);
- var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
- if (width > 2) { display.cachedCharWidth = width; }
- return width || 10
- }
-
- // Do a bulk-read of the DOM positions and sizes needed to draw the
- // view, so that we don't interleave reading and writing to the DOM.
- function getDimensions(cm) {
- var d = cm.display, left = {}, width = {};
- var gutterLeft = d.gutters.clientLeft;
- for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
- left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
- width[cm.options.gutters[i]] = n.clientWidth;
- }
- return {fixedPos: compensateForHScroll(d),
- gutterTotalWidth: d.gutters.offsetWidth,
- gutterLeft: left,
- gutterWidth: width,
- wrapperWidth: d.wrapper.clientWidth}
- }
-
- // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
- // but using getBoundingClientRect to get a sub-pixel-accurate
- // result.
- function compensateForHScroll(display) {
- return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
- }
-
- // Returns a function that estimates the height of a line, to use as
- // first approximation until the line becomes visible (and is thus
- // properly measurable).
- function estimateHeight(cm) {
- var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
- var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
- return function (line) {
- if (lineIsHidden(cm.doc, line)) { return 0 }
-
- var widgetsHeight = 0;
- if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
- if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
- } }
-
- if (wrapping)
- { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
- else
- { return widgetsHeight + th }
- }
- }
-
- function estimateLineHeights(cm) {
- var doc = cm.doc, est = estimateHeight(cm);
- doc.iter(function (line) {
- var estHeight = est(line);
- if (estHeight != line.height) { updateLineHeight(line, estHeight); }
- });
- }
-
- // Given a mouse event, find the corresponding position. If liberal
- // is false, it checks whether a gutter or scrollbar was clicked,
- // and returns null if it was. forRect is used by rectangular
- // selections, and tries to estimate a character position even for
- // coordinates beyond the right of the text.
- function posFromMouse(cm, e, liberal, forRect) {
- var display = cm.display;
- if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
-
- var x, y, space = display.lineSpace.getBoundingClientRect();
- // Fails unpredictably on IE[67] when mouse is dragged around quickly.
- try { x = e.clientX - space.left; y = e.clientY - space.top; }
- catch (e) { return null }
- var coords = coordsChar(cm, x, y), line;
- if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
- var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
- coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
- }
- return coords
- }
-
- // Find the view element corresponding to a given line. Return null
- // when the line isn't visible.
- function findViewIndex(cm, n) {
- if (n >= cm.display.viewTo) { return null }
- n -= cm.display.viewFrom;
- if (n < 0) { return null }
- var view = cm.display.view;
- for (var i = 0; i < view.length; i++) {
- n -= view[i].size;
- if (n < 0) { return i }
- }
- }
-
- function updateSelection(cm) {
- cm.display.input.showSelection(cm.display.input.prepareSelection());
- }
-
- function prepareSelection(cm, primary) {
- if ( primary === void 0 ) primary = true;
-
- var doc = cm.doc, result = {};
- var curFragment = result.cursors = document.createDocumentFragment();
- var selFragment = result.selection = document.createDocumentFragment();
-
- for (var i = 0; i < doc.sel.ranges.length; i++) {
- if (!primary && i == doc.sel.primIndex) { continue }
- var range$$1 = doc.sel.ranges[i];
- if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
- var collapsed = range$$1.empty();
- if (collapsed || cm.options.showCursorWhenSelecting)
- { drawSelectionCursor(cm, range$$1.head, curFragment); }
- if (!collapsed)
- { drawSelectionRange(cm, range$$1, selFragment); }
- }
- return result
- }
-
- // Draws a cursor for the given range
- function drawSelectionCursor(cm, head, output) {
- var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
-
- var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
- cursor.style.left = pos.left + "px";
- cursor.style.top = pos.top + "px";
- cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
-
- if (pos.other) {
- // Secondary cursor, shown when on a 'jump' in bi-directional text
- var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
- otherCursor.style.display = "";
- otherCursor.style.left = pos.other.left + "px";
- otherCursor.style.top = pos.other.top + "px";
- otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
- }
- }
-
- function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
-
- // Draws the given range as a highlighted selection
- function drawSelectionRange(cm, range$$1, output) {
- var display = cm.display, doc = cm.doc;
- var fragment = document.createDocumentFragment();
- var padding = paddingH(cm.display), leftSide = padding.left;
- var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
- var docLTR = doc.direction == "ltr";
-
- function add(left, top, width, bottom) {
- if (top < 0) { top = 0; }
- top = Math.round(top);
- bottom = Math.round(bottom);
- fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
- }
-
- function drawForLine(line, fromArg, toArg) {
- var lineObj = getLine(doc, line);
- var lineLen = lineObj.text.length;
- var start, end;
- function coords(ch, bias) {
- return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
- }
-
- function wrapX(pos, dir, side) {
- var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
- var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
- var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
- return coords(ch, prop)[prop]
- }
-
- var order = getOrder(lineObj, doc.direction);
- iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
- var ltr = dir == "ltr";
- var fromPos = coords(from, ltr ? "left" : "right");
- var toPos = coords(to - 1, ltr ? "right" : "left");
-
- var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
- var first = i == 0, last = !order || i == order.length - 1;
- if (toPos.top - fromPos.top <= 3) { // Single line
- var openLeft = (docLTR ? openStart : openEnd) && first;
- var openRight = (docLTR ? openEnd : openStart) && last;
- var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
- var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
- add(left, fromPos.top, right - left, fromPos.bottom);
- } else { // Multiple lines
- var topLeft, topRight, botLeft, botRight;
- if (ltr) {
- topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
- topRight = docLTR ? rightSide : wrapX(from, dir, "before");
- botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
- botRight = docLTR && openEnd && last ? rightSide : toPos.right;
- } else {
- topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
- topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
- botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
- botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
- }
- add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
- if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
- add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
- }
-
- if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
- if (cmpCoords(toPos, start) < 0) { start = toPos; }
- if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
- if (cmpCoords(toPos, end) < 0) { end = toPos; }
- });
- return {start: start, end: end}
- }
-
- var sFrom = range$$1.from(), sTo = range$$1.to();
- if (sFrom.line == sTo.line) {
- drawForLine(sFrom.line, sFrom.ch, sTo.ch);
- } else {
- var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
- var singleVLine = visualLine(fromLine) == visualLine(toLine);
- var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
- var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
- if (singleVLine) {
- if (leftEnd.top < rightStart.top - 2) {
- add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
- add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
- } else {
- add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
- }
- }
- if (leftEnd.bottom < rightStart.top)
- { add(leftSide, leftEnd.bottom, null, rightStart.top); }
- }
-
- output.appendChild(fragment);
- }
-
- // Cursor-blinking
- function restartBlink(cm) {
- if (!cm.state.focused) { return }
- var display = cm.display;
- clearInterval(display.blinker);
- var on = true;
- display.cursorDiv.style.visibility = "";
- if (cm.options.cursorBlinkRate > 0)
- { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
- cm.options.cursorBlinkRate); }
- else if (cm.options.cursorBlinkRate < 0)
- { display.cursorDiv.style.visibility = "hidden"; }
- }
-
- function ensureFocus(cm) {
- if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
- }
-
- function delayBlurEvent(cm) {
- cm.state.delayingBlurEvent = true;
- setTimeout(function () { if (cm.state.delayingBlurEvent) {
- cm.state.delayingBlurEvent = false;
- onBlur(cm);
- } }, 100);
- }
-
- function onFocus(cm, e) {
- if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
-
- if (cm.options.readOnly == "nocursor") { return }
- if (!cm.state.focused) {
- signal(cm, "focus", cm, e);
- cm.state.focused = true;
- addClass(cm.display.wrapper, "CodeMirror-focused");
- // This test prevents this from firing when a context
- // menu is closed (since the input reset would kill the
- // select-all detection hack)
- if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
- cm.display.input.reset();
- if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
- }
- cm.display.input.receivedFocus();
- }
- restartBlink(cm);
- }
- function onBlur(cm, e) {
- if (cm.state.delayingBlurEvent) { return }
-
- if (cm.state.focused) {
- signal(cm, "blur", cm, e);
- cm.state.focused = false;
- rmClass(cm.display.wrapper, "CodeMirror-focused");
- }
- clearInterval(cm.display.blinker);
- setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
- }
-
- // Read the actual heights of the rendered lines, and update their
- // stored heights to match.
- function updateHeightsInViewport(cm) {
- var display = cm.display;
- var prevBottom = display.lineDiv.offsetTop;
- for (var i = 0; i < display.view.length; i++) {
- var cur = display.view[i], height = (void 0);
- if (cur.hidden) { continue }
- if (ie && ie_version < 8) {
- var bot = cur.node.offsetTop + cur.node.offsetHeight;
- height = bot - prevBottom;
- prevBottom = bot;
- } else {
- var box = cur.node.getBoundingClientRect();
- height = box.bottom - box.top;
- }
- var diff = cur.line.height - height;
- if (height < 2) { height = textHeight(display); }
- if (diff > .005 || diff < -.005) {
- updateLineHeight(cur.line, height);
- updateWidgetHeight(cur.line);
- if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
- { updateWidgetHeight(cur.rest[j]); } }
- }
- }
- }
-
- // Read and store the height of line widgets associated with the
- // given line.
- function updateWidgetHeight(line) {
- if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
- var w = line.widgets[i], parent = w.node.parentNode;
- if (parent) { w.height = parent.offsetHeight; }
- } }
- }
-
- // Compute the lines that are visible in a given viewport (defaults
- // the the current scroll position). viewport may contain top,
- // height, and ensure (see op.scrollToPos) properties.
- function visibleLines(display, doc, viewport) {
- var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
- top = Math.floor(top - paddingTop(display));
- var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
-
- var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
- // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
- // forces those lines into the viewport (if possible).
- if (viewport && viewport.ensure) {
- var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
- if (ensureFrom < from) {
- from = ensureFrom;
- to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
- } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
- from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
- to = ensureTo;
- }
- }
- return {from: from, to: Math.max(to, from + 1)}
- }
-
- // Re-align line numbers and gutter marks to compensate for
- // horizontal scrolling.
- function alignHorizontally(cm) {
- var display = cm.display, view = display.view;
- if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
- var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
- var gutterW = display.gutters.offsetWidth, left = comp + "px";
- for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
- if (cm.options.fixedGutter) {
- if (view[i].gutter)
- { view[i].gutter.style.left = left; }
- if (view[i].gutterBackground)
- { view[i].gutterBackground.style.left = left; }
- }
- var align = view[i].alignable;
- if (align) { for (var j = 0; j < align.length; j++)
- { align[j].style.left = left; } }
- } }
- if (cm.options.fixedGutter)
- { display.gutters.style.left = (comp + gutterW) + "px"; }
- }
-
- // Used to ensure that the line number gutter is still the right
- // size for the current document size. Returns true when an update
- // is needed.
- function maybeUpdateLineNumberWidth(cm) {
- if (!cm.options.lineNumbers) { return false }
- var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
- if (last.length != display.lineNumChars) {
- var test = display.measure.appendChild(elt("div", [elt("div", last)],
- "CodeMirror-linenumber CodeMirror-gutter-elt"));
- var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
- display.lineGutter.style.width = "";
- display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
- display.lineNumWidth = display.lineNumInnerWidth + padding;
- display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
- display.lineGutter.style.width = display.lineNumWidth + "px";
- updateGutterSpace(cm);
- return true
- }
- return false
- }
-
- // SCROLLING THINGS INTO VIEW
-
- // If an editor sits on the top or bottom of the window, partially
- // scrolled out of view, this ensures that the cursor is visible.
- function maybeScrollWindow(cm, rect) {
- if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
-
- var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
- if (rect.top + box.top < 0) { doScroll = true; }
- else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
- if (doScroll != null && !phantom) {
- var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
- cm.display.lineSpace.appendChild(scrollNode);
- scrollNode.scrollIntoView(doScroll);
- cm.display.lineSpace.removeChild(scrollNode);
- }
- }
-
- // Scroll a given position into view (immediately), verifying that
- // it actually became visible (as line heights are accurately
- // measured, the position of something may 'drift' during drawing).
- function scrollPosIntoView(cm, pos, end, margin) {
- if (margin == null) { margin = 0; }
- var rect;
- if (!cm.options.lineWrapping && pos == end) {
- // Set pos and end to the cursor positions around the character pos sticks to
- // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
- // If pos == Pos(_, 0, "before"), pos and end are unchanged
- pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
- end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
- }
- for (var limit = 0; limit < 5; limit++) {
- var changed = false;
- var coords = cursorCoords(cm, pos);
- var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
- rect = {left: Math.min(coords.left, endCoords.left),
- top: Math.min(coords.top, endCoords.top) - margin,
- right: Math.max(coords.left, endCoords.left),
- bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
- var scrollPos = calculateScrollPos(cm, rect);
- var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
- if (scrollPos.scrollTop != null) {
- updateScrollTop(cm, scrollPos.scrollTop);
- if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
- }
- if (scrollPos.scrollLeft != null) {
- setScrollLeft(cm, scrollPos.scrollLeft);
- if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
- }
- if (!changed) { break }
- }
- return rect
- }
-
- // Scroll a given set of coordinates into view (immediately).
- function scrollIntoView(cm, rect) {
- var scrollPos = calculateScrollPos(cm, rect);
- if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
- if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
- }
-
- // Calculate a new scroll position needed to scroll the given
- // rectangle into view. Returns an object with scrollTop and
- // scrollLeft properties. When these are undefined, the
- // vertical/horizontal position does not need to be adjusted.
- function calculateScrollPos(cm, rect) {
- var display = cm.display, snapMargin = textHeight(cm.display);
- if (rect.top < 0) { rect.top = 0; }
- var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
- var screen = displayHeight(cm), result = {};
- if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
- var docBottom = cm.doc.height + paddingVert(display);
- var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
- if (rect.top < screentop) {
- result.scrollTop = atTop ? 0 : rect.top;
- } else if (rect.bottom > screentop + screen) {
- var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
- if (newTop != screentop) { result.scrollTop = newTop; }
- }
-
- var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
- var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
- var tooWide = rect.right - rect.left > screenw;
- if (tooWide) { rect.right = rect.left + screenw; }
- if (rect.left < 10)
- { result.scrollLeft = 0; }
- else if (rect.left < screenleft)
- { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
- else if (rect.right > screenw + screenleft - 3)
- { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
- return result
- }
-
- // Store a relative adjustment to the scroll position in the current
- // operation (to be applied when the operation finishes).
- function addToScrollTop(cm, top) {
- if (top == null) { return }
- resolveScrollToPos(cm);
- cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
- }
-
- // Make sure that at the end of the operation the current cursor is
- // shown.
- function ensureCursorVisible(cm) {
- resolveScrollToPos(cm);
- var cur = cm.getCursor();
- cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
- }
-
- function scrollToCoords(cm, x, y) {
- if (x != null || y != null) { resolveScrollToPos(cm); }
- if (x != null) { cm.curOp.scrollLeft = x; }
- if (y != null) { cm.curOp.scrollTop = y; }
- }
-
- function scrollToRange(cm, range$$1) {
- resolveScrollToPos(cm);
- cm.curOp.scrollToPos = range$$1;
- }
-
- // When an operation has its scrollToPos property set, and another
- // scroll action is applied before the end of the operation, this
- // 'simulates' scrolling that position into view in a cheap way, so
- // that the effect of intermediate scroll commands is not ignored.
- function resolveScrollToPos(cm) {
- var range$$1 = cm.curOp.scrollToPos;
- if (range$$1) {
- cm.curOp.scrollToPos = null;
- var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
- scrollToCoordsRange(cm, from, to, range$$1.margin);
- }
- }
-
- function scrollToCoordsRange(cm, from, to, margin) {
- var sPos = calculateScrollPos(cm, {
- left: Math.min(from.left, to.left),
- top: Math.min(from.top, to.top) - margin,
- right: Math.max(from.right, to.right),
- bottom: Math.max(from.bottom, to.bottom) + margin
- });
- scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
- }
-
- // Sync the scrollable area and scrollbars, ensure the viewport
- // covers the visible area.
- function updateScrollTop(cm, val) {
- if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
- if (!gecko) { updateDisplaySimple(cm, {top: val}); }
- setScrollTop(cm, val, true);
- if (gecko) { updateDisplaySimple(cm); }
- startWorker(cm, 100);
- }
-
- function setScrollTop(cm, val, forceScroll) {
- val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val);
- if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
- cm.doc.scrollTop = val;
- cm.display.scrollbars.setScrollTop(val);
- if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
- }
-
- // Sync scroller and scrollbar, ensure the gutter elements are
- // aligned.
- function setScrollLeft(cm, val, isScroller, forceScroll) {
- val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
- if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
- cm.doc.scrollLeft = val;
- alignHorizontally(cm);
- if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
- cm.display.scrollbars.setScrollLeft(val);
- }
-
- // SCROLLBARS
-
- // Prepare DOM reads needed to update the scrollbars. Done in one
- // shot to minimize update/measure roundtrips.
- function measureForScrollbars(cm) {
- var d = cm.display, gutterW = d.gutters.offsetWidth;
- var docH = Math.round(cm.doc.height + paddingVert(cm.display));
- return {
- clientHeight: d.scroller.clientHeight,
- viewHeight: d.wrapper.clientHeight,
- scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
- viewWidth: d.wrapper.clientWidth,
- barLeft: cm.options.fixedGutter ? gutterW : 0,
- docHeight: docH,
- scrollHeight: docH + scrollGap(cm) + d.barHeight,
- nativeBarWidth: d.nativeBarWidth,
- gutterWidth: gutterW
- }
- }
-
- var NativeScrollbars = function(place, scroll, cm) {
- this.cm = cm;
- var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
- var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
- vert.tabIndex = horiz.tabIndex = -1;
- place(vert); place(horiz);
-
- on(vert, "scroll", function () {
- if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
- });
- on(horiz, "scroll", function () {
- if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
- });
-
- this.checkedZeroWidth = false;
- // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
- if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
- };
-
- NativeScrollbars.prototype.update = function (measure) {
- var needsH = measure.scrollWidth > measure.clientWidth + 1;
- var needsV = measure.scrollHeight > measure.clientHeight + 1;
- var sWidth = measure.nativeBarWidth;
-
- if (needsV) {
- this.vert.style.display = "block";
- this.vert.style.bottom = needsH ? sWidth + "px" : "0";
- var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
- // A bug in IE8 can cause this value to be negative, so guard it.
- this.vert.firstChild.style.height =
- Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
- } else {
- this.vert.style.display = "";
- this.vert.firstChild.style.height = "0";
- }
-
- if (needsH) {
- this.horiz.style.display = "block";
- this.horiz.style.right = needsV ? sWidth + "px" : "0";
- this.horiz.style.left = measure.barLeft + "px";
- var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
- this.horiz.firstChild.style.width =
- Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
- } else {
- this.horiz.style.display = "";
- this.horiz.firstChild.style.width = "0";
- }
-
- if (!this.checkedZeroWidth && measure.clientHeight > 0) {
- if (sWidth == 0) { this.zeroWidthHack(); }
- this.checkedZeroWidth = true;
- }
-
- return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
- };
-
- NativeScrollbars.prototype.setScrollLeft = function (pos) {
- if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
- if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
- };
-
- NativeScrollbars.prototype.setScrollTop = function (pos) {
- if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
- if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
- };
-
- NativeScrollbars.prototype.zeroWidthHack = function () {
- var w = mac && !mac_geMountainLion ? "12px" : "18px";
- this.horiz.style.height = this.vert.style.width = w;
- this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
- this.disableHoriz = new Delayed;
- this.disableVert = new Delayed;
- };
-
- NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
- bar.style.pointerEvents = "auto";
- function maybeDisable() {
- // To find out whether the scrollbar is still visible, we
- // check whether the element under the pixel in the bottom
- // right corner of the scrollbar box is the scrollbar box
- // itself (when the bar is still visible) or its filler child
- // (when the bar is hidden). If it is still visible, we keep
- // it enabled, if it's hidden, we disable pointer events.
- var box = bar.getBoundingClientRect();
- var elt$$1 = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
- : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
- if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
- else { delay.set(1000, maybeDisable); }
- }
- delay.set(1000, maybeDisable);
- };
-
- NativeScrollbars.prototype.clear = function () {
- var parent = this.horiz.parentNode;
- parent.removeChild(this.horiz);
- parent.removeChild(this.vert);
- };
-
- var NullScrollbars = function () {};
-
- NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
- NullScrollbars.prototype.setScrollLeft = function () {};
- NullScrollbars.prototype.setScrollTop = function () {};
- NullScrollbars.prototype.clear = function () {};
-
- function updateScrollbars(cm, measure) {
- if (!measure) { measure = measureForScrollbars(cm); }
- var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
- updateScrollbarsInner(cm, measure);
- for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
- if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
- { updateHeightsInViewport(cm); }
- updateScrollbarsInner(cm, measureForScrollbars(cm));
- startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
- }
- }
-
- // Re-synchronize the fake scrollbars with the actual size of the
- // content.
- function updateScrollbarsInner(cm, measure) {
- var d = cm.display;
- var sizes = d.scrollbars.update(measure);
-
- d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
- d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
- d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
-
- if (sizes.right && sizes.bottom) {
- d.scrollbarFiller.style.display = "block";
- d.scrollbarFiller.style.height = sizes.bottom + "px";
- d.scrollbarFiller.style.width = sizes.right + "px";
- } else { d.scrollbarFiller.style.display = ""; }
- if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
- d.gutterFiller.style.display = "block";
- d.gutterFiller.style.height = sizes.bottom + "px";
- d.gutterFiller.style.width = measure.gutterWidth + "px";
- } else { d.gutterFiller.style.display = ""; }
- }
-
- var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
-
- function initScrollbars(cm) {
- if (cm.display.scrollbars) {
- cm.display.scrollbars.clear();
- if (cm.display.scrollbars.addClass)
- { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
- }
-
- cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
- cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
- // Prevent clicks in the scrollbars from killing focus
- on(node, "mousedown", function () {
- if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
- });
- node.setAttribute("cm-not-content", "true");
- }, function (pos, axis) {
- if (axis == "horizontal") { setScrollLeft(cm, pos); }
- else { updateScrollTop(cm, pos); }
- }, cm);
- if (cm.display.scrollbars.addClass)
- { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
- }
-
- // Operations are used to wrap a series of changes to the editor
- // state in such a way that each change won't have to update the
- // cursor and display (which would be awkward, slow, and
- // error-prone). Instead, display updates are batched and then all
- // combined and executed at once.
-
- var nextOpId = 0;
- // Start a new operation.
- function startOperation(cm) {
- cm.curOp = {
- cm: cm,
- viewChanged: false, // Flag that indicates that lines might need to be redrawn
- startHeight: cm.doc.height, // Used to detect need to update scrollbar
- forceUpdate: false, // Used to force a redraw
- updateInput: null, // Whether to reset the input textarea
- typing: false, // Whether this reset should be careful to leave existing text (for compositing)
- changeObjs: null, // Accumulated changes, for firing change events
- cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
- cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
- selectionChanged: false, // Whether the selection needs to be redrawn
- updateMaxLine: false, // Set when the widest line needs to be determined anew
- scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
- scrollToPos: null, // Used to scroll to a specific position
- focus: false,
- id: ++nextOpId // Unique ID
- };
- pushOperation(cm.curOp);
- }
-
- // Finish an operation, updating the display and signalling delayed events
- function endOperation(cm) {
- var op = cm.curOp;
- if (op) { finishOperation(op, function (group) {
- for (var i = 0; i < group.ops.length; i++)
- { group.ops[i].cm.curOp = null; }
- endOperations(group);
- }); }
- }
-
- // The DOM updates done when an operation finishes are batched so
- // that the minimum number of relayouts are required.
- function endOperations(group) {
- var ops = group.ops;
- for (var i = 0; i < ops.length; i++) // Read DOM
- { endOperation_R1(ops[i]); }
- for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
- { endOperation_W1(ops[i$1]); }
- for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
- { endOperation_R2(ops[i$2]); }
- for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
- { endOperation_W2(ops[i$3]); }
- for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
- { endOperation_finish(ops[i$4]); }
- }
-
- function endOperation_R1(op) {
- var cm = op.cm, display = cm.display;
- maybeClipScrollbars(cm);
- if (op.updateMaxLine) { findMaxLine(cm); }
-
- op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
- op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
- op.scrollToPos.to.line >= display.viewTo) ||
- display.maxLineChanged && cm.options.lineWrapping;
- op.update = op.mustUpdate &&
- new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
- }
-
- function endOperation_W1(op) {
- op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
- }
-
- function endOperation_R2(op) {
- var cm = op.cm, display = cm.display;
- if (op.updatedDisplay) { updateHeightsInViewport(cm); }
-
- op.barMeasure = measureForScrollbars(cm);
-
- // If the max line changed since it was last measured, measure it,
- // and ensure the document's width matches it.
- // updateDisplay_W2 will use these properties to do the actual resizing
- if (display.maxLineChanged && !cm.options.lineWrapping) {
- op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
- cm.display.sizerWidth = op.adjustWidthTo;
- op.barMeasure.scrollWidth =
- Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
- op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
- }
-
- if (op.updatedDisplay || op.selectionChanged)
- { op.preparedSelection = display.input.prepareSelection(); }
- }
-
- function endOperation_W2(op) {
- var cm = op.cm;
-
- if (op.adjustWidthTo != null) {
- cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
- if (op.maxScrollLeft < cm.doc.scrollLeft)
- { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
- cm.display.maxLineChanged = false;
- }
-
- var takeFocus = op.focus && op.focus == activeElt();
- if (op.preparedSelection)
- { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
- if (op.updatedDisplay || op.startHeight != cm.doc.height)
- { updateScrollbars(cm, op.barMeasure); }
- if (op.updatedDisplay)
- { setDocumentHeight(cm, op.barMeasure); }
-
- if (op.selectionChanged) { restartBlink(cm); }
-
- if (cm.state.focused && op.updateInput)
- { cm.display.input.reset(op.typing); }
- if (takeFocus) { ensureFocus(op.cm); }
- }
-
- function endOperation_finish(op) {
- var cm = op.cm, display = cm.display, doc = cm.doc;
-
- if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
-
- // Abort mouse wheel delta measurement, when scrolling explicitly
- if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
- { display.wheelStartX = display.wheelStartY = null; }
-
- // Propagate the scroll position to the actual DOM scroller
- if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
-
- if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
- // If we need to scroll a specific position into view, do so.
- if (op.scrollToPos) {
- var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
- clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
- maybeScrollWindow(cm, rect);
- }
-
- // Fire events for markers that are hidden/unidden by editing or
- // undoing
- var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
- if (hidden) { for (var i = 0; i < hidden.length; ++i)
- { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
- if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
- { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
-
- if (display.wrapper.offsetHeight)
- { doc.scrollTop = cm.display.scroller.scrollTop; }
-
- // Fire change events, and delayed event handlers
- if (op.changeObjs)
- { signal(cm, "changes", cm, op.changeObjs); }
- if (op.update)
- { op.update.finish(); }
- }
-
- // Run the given function in an operation
- function runInOp(cm, f) {
- if (cm.curOp) { return f() }
- startOperation(cm);
- try { return f() }
- finally { endOperation(cm); }
- }
- // Wraps a function in an operation. Returns the wrapped function.
- function operation(cm, f) {
- return function() {
- if (cm.curOp) { return f.apply(cm, arguments) }
- startOperation(cm);
- try { return f.apply(cm, arguments) }
- finally { endOperation(cm); }
- }
- }
- // Used to add methods to editor and doc instances, wrapping them in
- // operations.
- function methodOp(f) {
- return function() {
- if (this.curOp) { return f.apply(this, arguments) }
- startOperation(this);
- try { return f.apply(this, arguments) }
- finally { endOperation(this); }
- }
- }
- function docMethodOp(f) {
- return function() {
- var cm = this.cm;
- if (!cm || cm.curOp) { return f.apply(this, arguments) }
- startOperation(cm);
- try { return f.apply(this, arguments) }
- finally { endOperation(cm); }
- }
- }
-
- // Updates the display.view data structure for a given change to the
- // document. From and to are in pre-change coordinates. Lendiff is
- // the amount of lines added or subtracted by the change. This is
- // used for changes that span multiple lines, or change the way
- // lines are divided into visual lines. regLineChange (below)
- // registers single-line changes.
- function regChange(cm, from, to, lendiff) {
- if (from == null) { from = cm.doc.first; }
- if (to == null) { to = cm.doc.first + cm.doc.size; }
- if (!lendiff) { lendiff = 0; }
-
- var display = cm.display;
- if (lendiff && to < display.viewTo &&
- (display.updateLineNumbers == null || display.updateLineNumbers > from))
- { display.updateLineNumbers = from; }
-
- cm.curOp.viewChanged = true;
-
- if (from >= display.viewTo) { // Change after
- if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
- { resetView(cm); }
- } else if (to <= display.viewFrom) { // Change before
- if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
- resetView(cm);
- } else {
- display.viewFrom += lendiff;
- display.viewTo += lendiff;
- }
- } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
- resetView(cm);
- } else if (from <= display.viewFrom) { // Top overlap
- var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
- if (cut) {
- display.view = display.view.slice(cut.index);
- display.viewFrom = cut.lineN;
- display.viewTo += lendiff;
- } else {
- resetView(cm);
- }
- } else if (to >= display.viewTo) { // Bottom overlap
- var cut$1 = viewCuttingPoint(cm, from, from, -1);
- if (cut$1) {
- display.view = display.view.slice(0, cut$1.index);
- display.viewTo = cut$1.lineN;
- } else {
- resetView(cm);
- }
- } else { // Gap in the middle
- var cutTop = viewCuttingPoint(cm, from, from, -1);
- var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
- if (cutTop && cutBot) {
- display.view = display.view.slice(0, cutTop.index)
- .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
- .concat(display.view.slice(cutBot.index));
- display.viewTo += lendiff;
- } else {
- resetView(cm);
- }
- }
-
- var ext = display.externalMeasured;
- if (ext) {
- if (to < ext.lineN)
- { ext.lineN += lendiff; }
- else if (from < ext.lineN + ext.size)
- { display.externalMeasured = null; }
- }
- }
-
- // Register a change to a single line. Type must be one of "text",
- // "gutter", "class", "widget"
- function regLineChange(cm, line, type) {
- cm.curOp.viewChanged = true;
- var display = cm.display, ext = cm.display.externalMeasured;
- if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
- { display.externalMeasured = null; }
-
- if (line < display.viewFrom || line >= display.viewTo) { return }
- var lineView = display.view[findViewIndex(cm, line)];
- if (lineView.node == null) { return }
- var arr = lineView.changes || (lineView.changes = []);
- if (indexOf(arr, type) == -1) { arr.push(type); }
- }
-
- // Clear the view.
- function resetView(cm) {
- cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
- cm.display.view = [];
- cm.display.viewOffset = 0;
- }
-
- function viewCuttingPoint(cm, oldN, newN, dir) {
- var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
- if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
- { return {index: index, lineN: newN} }
- var n = cm.display.viewFrom;
- for (var i = 0; i < index; i++)
- { n += view[i].size; }
- if (n != oldN) {
- if (dir > 0) {
- if (index == view.length - 1) { return null }
- diff = (n + view[index].size) - oldN;
- index++;
- } else {
- diff = n - oldN;
- }
- oldN += diff; newN += diff;
- }
- while (visualLineNo(cm.doc, newN) != newN) {
- if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
- newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
- index += dir;
- }
- return {index: index, lineN: newN}
- }
-
- // Force the view to cover a given range, adding empty view element
- // or clipping off existing ones as needed.
- function adjustView(cm, from, to) {
- var display = cm.display, view = display.view;
- if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
- display.view = buildViewArray(cm, from, to);
- display.viewFrom = from;
- } else {
- if (display.viewFrom > from)
- { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
- else if (display.viewFrom < from)
- { display.view = display.view.slice(findViewIndex(cm, from)); }
- display.viewFrom = from;
- if (display.viewTo < to)
- { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
- else if (display.viewTo > to)
- { display.view = display.view.slice(0, findViewIndex(cm, to)); }
- }
- display.viewTo = to;
- }
-
- // Count the number of lines in the view whose DOM representation is
- // out of date (or nonexistent).
- function countDirtyView(cm) {
- var view = cm.display.view, dirty = 0;
- for (var i = 0; i < view.length; i++) {
- var lineView = view[i];
- if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
- }
- return dirty
- }
-
- // HIGHLIGHT WORKER
-
- function startWorker(cm, time) {
- if (cm.doc.highlightFrontier < cm.display.viewTo)
- { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
- }
-
- function highlightWorker(cm) {
- var doc = cm.doc;
- if (doc.highlightFrontier >= cm.display.viewTo) { return }
- var end = +new Date + cm.options.workTime;
- var context = getContextBefore(cm, doc.highlightFrontier);
- var changedLines = [];
-
- doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
- if (context.line >= cm.display.viewFrom) { // Visible
- var oldStyles = line.styles;
- var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
- var highlighted = highlightLine(cm, line, context, true);
- if (resetState) { context.state = resetState; }
- line.styles = highlighted.styles;
- var oldCls = line.styleClasses, newCls = highlighted.classes;
- if (newCls) { line.styleClasses = newCls; }
- else if (oldCls) { line.styleClasses = null; }
- var ischange = !oldStyles || oldStyles.length != line.styles.length ||
- oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
- for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
- if (ischange) { changedLines.push(context.line); }
- line.stateAfter = context.save();
- context.nextLine();
- } else {
- if (line.text.length <= cm.options.maxHighlightLength)
- { processLine(cm, line.text, context); }
- line.stateAfter = context.line % 5 == 0 ? context.save() : null;
- context.nextLine();
- }
- if (+new Date > end) {
- startWorker(cm, cm.options.workDelay);
- return true
- }
- });
- doc.highlightFrontier = context.line;
- doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
- if (changedLines.length) { runInOp(cm, function () {
- for (var i = 0; i < changedLines.length; i++)
- { regLineChange(cm, changedLines[i], "text"); }
- }); }
- }
-
- // DISPLAY DRAWING
-
- var DisplayUpdate = function(cm, viewport, force) {
- var display = cm.display;
-
- this.viewport = viewport;
- // Store some values that we'll need later (but don't want to force a relayout for)
- this.visible = visibleLines(display, cm.doc, viewport);
- this.editorIsHidden = !display.wrapper.offsetWidth;
- this.wrapperHeight = display.wrapper.clientHeight;
- this.wrapperWidth = display.wrapper.clientWidth;
- this.oldDisplayWidth = displayWidth(cm);
- this.force = force;
- this.dims = getDimensions(cm);
- this.events = [];
- };
-
- DisplayUpdate.prototype.signal = function (emitter, type) {
- if (hasHandler(emitter, type))
- { this.events.push(arguments); }
- };
- DisplayUpdate.prototype.finish = function () {
- var this$1 = this;
-
- for (var i = 0; i < this.events.length; i++)
- { signal.apply(null, this$1.events[i]); }
- };
-
- function maybeClipScrollbars(cm) {
- var display = cm.display;
- if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
- display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
- display.heightForcer.style.height = scrollGap(cm) + "px";
- display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
- display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
- display.scrollbarsClipped = true;
- }
- }
-
- function selectionSnapshot(cm) {
- if (cm.hasFocus()) { return null }
- var active = activeElt();
- if (!active || !contains(cm.display.lineDiv, active)) { return null }
- var result = {activeElt: active};
- if (window.getSelection) {
- var sel = window.getSelection();
- if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
- result.anchorNode = sel.anchorNode;
- result.anchorOffset = sel.anchorOffset;
- result.focusNode = sel.focusNode;
- result.focusOffset = sel.focusOffset;
- }
- }
- return result
- }
-
- function restoreSelection(snapshot) {
- if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
- snapshot.activeElt.focus();
- if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
- var sel = window.getSelection(), range$$1 = document.createRange();
- range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
- range$$1.collapse(false);
- sel.removeAllRanges();
- sel.addRange(range$$1);
- sel.extend(snapshot.focusNode, snapshot.focusOffset);
- }
- }
-
- // Does the actual updating of the line display. Bails out
- // (returning false) when there is nothing to be done and forced is
- // false.
- function updateDisplayIfNeeded(cm, update) {
- var display = cm.display, doc = cm.doc;
-
- if (update.editorIsHidden) {
- resetView(cm);
- return false
- }
-
- // Bail out if the visible area is already rendered and nothing changed.
- if (!update.force &&
- update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
- (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
- display.renderedView == display.view && countDirtyView(cm) == 0)
- { return false }
-
- if (maybeUpdateLineNumberWidth(cm)) {
- resetView(cm);
- update.dims = getDimensions(cm);
- }
-
- // Compute a suitable new viewport (from & to)
- var end = doc.first + doc.size;
- var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
- var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
- if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
- if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
- if (sawCollapsedSpans) {
- from = visualLineNo(cm.doc, from);
- to = visualLineEndNo(cm.doc, to);
- }
-
- var different = from != display.viewFrom || to != display.viewTo ||
- display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
- adjustView(cm, from, to);
-
- display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
- // Position the mover div to align with the current scroll position
- cm.display.mover.style.top = display.viewOffset + "px";
-
- var toUpdate = countDirtyView(cm);
- if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
- (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
- { return false }
-
- // For big changes, we hide the enclosing element during the
- // update, since that speeds up the operations on most browsers.
- var selSnapshot = selectionSnapshot(cm);
- if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
- patchDisplay(cm, display.updateLineNumbers, update.dims);
- if (toUpdate > 4) { display.lineDiv.style.display = ""; }
- display.renderedView = display.view;
- // There might have been a widget with a focused element that got
- // hidden or updated, if so re-focus it.
- restoreSelection(selSnapshot);
-
- // Prevent selection and cursors from interfering with the scroll
- // width and height.
- removeChildren(display.cursorDiv);
- removeChildren(display.selectionDiv);
- display.gutters.style.height = display.sizer.style.minHeight = 0;
-
- if (different) {
- display.lastWrapHeight = update.wrapperHeight;
- display.lastWrapWidth = update.wrapperWidth;
- startWorker(cm, 400);
- }
-
- display.updateLineNumbers = null;
-
- return true
- }
-
- function postUpdateDisplay(cm, update) {
- var viewport = update.viewport;
-
- for (var first = true;; first = false) {
- if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
- // Clip forced viewport to actual scrollable area.
- if (viewport && viewport.top != null)
- { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
- // Updated line heights might result in the drawn area not
- // actually covering the viewport. Keep looping until it does.
- update.visible = visibleLines(cm.display, cm.doc, viewport);
- if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
- { break }
- }
- if (!updateDisplayIfNeeded(cm, update)) { break }
- updateHeightsInViewport(cm);
- var barMeasure = measureForScrollbars(cm);
- updateSelection(cm);
- updateScrollbars(cm, barMeasure);
- setDocumentHeight(cm, barMeasure);
- update.force = false;
- }
-
- update.signal(cm, "update", cm);
- if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
- update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
- cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
- }
- }
-
- function updateDisplaySimple(cm, viewport) {
- var update = new DisplayUpdate(cm, viewport);
- if (updateDisplayIfNeeded(cm, update)) {
- updateHeightsInViewport(cm);
- postUpdateDisplay(cm, update);
- var barMeasure = measureForScrollbars(cm);
- updateSelection(cm);
- updateScrollbars(cm, barMeasure);
- setDocumentHeight(cm, barMeasure);
- update.finish();
- }
- }
-
- // Sync the actual display DOM structure with display.view, removing
- // nodes for lines that are no longer in view, and creating the ones
- // that are not there yet, and updating the ones that are out of
- // date.
- function patchDisplay(cm, updateNumbersFrom, dims) {
- var display = cm.display, lineNumbers = cm.options.lineNumbers;
- var container = display.lineDiv, cur = container.firstChild;
-
- function rm(node) {
- var next = node.nextSibling;
- // Works around a throw-scroll bug in OS X Webkit
- if (webkit && mac && cm.display.currentWheelTarget == node)
- { node.style.display = "none"; }
- else
- { node.parentNode.removeChild(node); }
- return next
- }
-
- var view = display.view, lineN = display.viewFrom;
- // Loop over the elements in the view, syncing cur (the DOM nodes
- // in display.lineDiv) with the view as we go.
- for (var i = 0; i < view.length; i++) {
- var lineView = view[i];
- if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
- var node = buildLineElement(cm, lineView, lineN, dims);
- container.insertBefore(node, cur);
- } else { // Already drawn
- while (cur != lineView.node) { cur = rm(cur); }
- var updateNumber = lineNumbers && updateNumbersFrom != null &&
- updateNumbersFrom <= lineN && lineView.lineNumber;
- if (lineView.changes) {
- if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
- updateLineForChanges(cm, lineView, lineN, dims);
- }
- if (updateNumber) {
- removeChildren(lineView.lineNumber);
- lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
- }
- cur = lineView.node.nextSibling;
- }
- lineN += lineView.size;
- }
- while (cur) { cur = rm(cur); }
- }
-
- function updateGutterSpace(cm) {
- var width = cm.display.gutters.offsetWidth;
- cm.display.sizer.style.marginLeft = width + "px";
- }
-
- function setDocumentHeight(cm, measure) {
- cm.display.sizer.style.minHeight = measure.docHeight + "px";
- cm.display.heightForcer.style.top = measure.docHeight + "px";
- cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
- }
-
- // Rebuild the gutter elements, ensure the margin to the left of the
- // code matches their width.
- function updateGutters(cm) {
- var gutters = cm.display.gutters, specs = cm.options.gutters;
- removeChildren(gutters);
- var i = 0;
- for (; i < specs.length; ++i) {
- var gutterClass = specs[i];
- var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
- if (gutterClass == "CodeMirror-linenumbers") {
- cm.display.lineGutter = gElt;
- gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
- }
- }
- gutters.style.display = i ? "" : "none";
- updateGutterSpace(cm);
- }
-
- // Make sure the gutters options contains the element
- // "CodeMirror-linenumbers" when the lineNumbers option is true.
- function setGuttersForLineNumbers(options) {
- var found = indexOf(options.gutters, "CodeMirror-linenumbers");
- if (found == -1 && options.lineNumbers) {
- options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
- } else if (found > -1 && !options.lineNumbers) {
- options.gutters = options.gutters.slice(0);
- options.gutters.splice(found, 1);
- }
- }
-
- // Since the delta values reported on mouse wheel events are
- // unstandardized between browsers and even browser versions, and
- // generally horribly unpredictable, this code starts by measuring
- // the scroll effect that the first few mouse wheel events have,
- // and, from that, detects the way it can convert deltas to pixel
- // offsets afterwards.
- //
- // The reason we want to know the amount a wheel event will scroll
- // is that it gives us a chance to update the display before the
- // actual scrolling happens, reducing flickering.
-
- var wheelSamples = 0, wheelPixelsPerUnit = null;
- // Fill in a browser-detected starting value on browsers where we
- // know one. These don't have to be accurate -- the result of them
- // being wrong would just be a slight flicker on the first wheel
- // scroll (if it is large enough).
- if (ie) { wheelPixelsPerUnit = -.53; }
- else if (gecko) { wheelPixelsPerUnit = 15; }
- else if (chrome) { wheelPixelsPerUnit = -.7; }
- else if (safari) { wheelPixelsPerUnit = -1/3; }
-
- function wheelEventDelta(e) {
- var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
- if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
- if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
- else if (dy == null) { dy = e.wheelDelta; }
- return {x: dx, y: dy}
- }
- function wheelEventPixels(e) {
- var delta = wheelEventDelta(e);
- delta.x *= wheelPixelsPerUnit;
- delta.y *= wheelPixelsPerUnit;
- return delta
- }
-
- function onScrollWheel(cm, e) {
- var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
-
- var display = cm.display, scroll = display.scroller;
- // Quit if there's nothing to scroll here
- var canScrollX = scroll.scrollWidth > scroll.clientWidth;
- var canScrollY = scroll.scrollHeight > scroll.clientHeight;
- if (!(dx && canScrollX || dy && canScrollY)) { return }
-
- // Webkit browsers on OS X abort momentum scrolls when the target
- // of the scroll event is removed from the scrollable element.
- // This hack (see related code in patchDisplay) makes sure the
- // element is kept around.
- if (dy && mac && webkit) {
- outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
- for (var i = 0; i < view.length; i++) {
- if (view[i].node == cur) {
- cm.display.currentWheelTarget = cur;
- break outer
- }
- }
- }
- }
-
- // On some browsers, horizontal scrolling will cause redraws to
- // happen before the gutter has been realigned, causing it to
- // wriggle around in a most unseemly way. When we have an
- // estimated pixels/delta value, we just handle horizontal
- // scrolling entirely here. It'll be slightly off from native, but
- // better than glitching out.
- if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
- if (dy && canScrollY)
- { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
- setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
- // Only prevent default scrolling if vertical scrolling is
- // actually possible. Otherwise, it causes vertical scroll
- // jitter on OSX trackpads when deltaX is small and deltaY
- // is large (issue #3579)
- if (!dy || (dy && canScrollY))
- { e_preventDefault(e); }
- display.wheelStartX = null; // Abort measurement, if in progress
- return
- }
-
- // 'Project' the visible viewport to cover the area that is being
- // scrolled into view (if we know enough to estimate it).
- if (dy && wheelPixelsPerUnit != null) {
- var pixels = dy * wheelPixelsPerUnit;
- var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
- if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
- else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
- updateDisplaySimple(cm, {top: top, bottom: bot});
- }
-
- if (wheelSamples < 20) {
- if (display.wheelStartX == null) {
- display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
- display.wheelDX = dx; display.wheelDY = dy;
- setTimeout(function () {
- if (display.wheelStartX == null) { return }
- var movedX = scroll.scrollLeft - display.wheelStartX;
- var movedY = scroll.scrollTop - display.wheelStartY;
- var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
- (movedX && display.wheelDX && movedX / display.wheelDX);
- display.wheelStartX = display.wheelStartY = null;
- if (!sample) { return }
- wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
- ++wheelSamples;
- }, 200);
- } else {
- display.wheelDX += dx; display.wheelDY += dy;
- }
- }
- }
-
- // Selection objects are immutable. A new one is created every time
- // the selection changes. A selection is one or more non-overlapping
- // (and non-touching) ranges, sorted, and an integer that indicates
- // which one is the primary selection (the one that's scrolled into
- // view, that getCursor returns, etc).
- var Selection = function(ranges, primIndex) {
- this.ranges = ranges;
- this.primIndex = primIndex;
- };
-
- Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
-
- Selection.prototype.equals = function (other) {
- var this$1 = this;
-
- if (other == this) { return true }
- if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
- for (var i = 0; i < this.ranges.length; i++) {
- var here = this$1.ranges[i], there = other.ranges[i];
- if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
- }
- return true
- };
-
- Selection.prototype.deepCopy = function () {
- var this$1 = this;
-
- var out = [];
- for (var i = 0; i < this.ranges.length; i++)
- { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
- return new Selection(out, this.primIndex)
- };
-
- Selection.prototype.somethingSelected = function () {
- var this$1 = this;
-
- for (var i = 0; i < this.ranges.length; i++)
- { if (!this$1.ranges[i].empty()) { return true } }
- return false
- };
-
- Selection.prototype.contains = function (pos, end) {
- var this$1 = this;
-
- if (!end) { end = pos; }
- for (var i = 0; i < this.ranges.length; i++) {
- var range = this$1.ranges[i];
- if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
- { return i }
- }
- return -1
- };
-
- var Range = function(anchor, head) {
- this.anchor = anchor; this.head = head;
- };
-
- Range.prototype.from = function () { return minPos(this.anchor, this.head) };
- Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
- Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
-
- // Take an unsorted, potentially overlapping set of ranges, and
- // build a selection out of it. 'Consumes' ranges array (modifying
- // it).
- function normalizeSelection(cm, ranges, primIndex) {
- var mayTouch = cm && cm.options.selectionsMayTouch;
- var prim = ranges[primIndex];
- ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
- primIndex = indexOf(ranges, prim);
- for (var i = 1; i < ranges.length; i++) {
- var cur = ranges[i], prev = ranges[i - 1];
- var diff = cmp(prev.to(), cur.from());
- if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
- var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
- var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
- if (i <= primIndex) { --primIndex; }
- ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
- }
- }
- return new Selection(ranges, primIndex)
- }
-
- function simpleSelection(anchor, head) {
- return new Selection([new Range(anchor, head || anchor)], 0)
- }
-
- // Compute the position of the end of a change (its 'to' property
- // refers to the pre-change end).
- function changeEnd(change) {
- if (!change.text) { return change.to }
- return Pos(change.from.line + change.text.length - 1,
- lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
- }
-
- // Adjust a position to refer to the post-change position of the
- // same text, or the end of the change if the change covers it.
- function adjustForChange(pos, change) {
- if (cmp(pos, change.from) < 0) { return pos }
- if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
-
- var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
- if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
- return Pos(line, ch)
- }
-
- function computeSelAfterChange(doc, change) {
- var out = [];
- for (var i = 0; i < doc.sel.ranges.length; i++) {
- var range = doc.sel.ranges[i];
- out.push(new Range(adjustForChange(range.anchor, change),
- adjustForChange(range.head, change)));
- }
- return normalizeSelection(doc.cm, out, doc.sel.primIndex)
- }
-
- function offsetPos(pos, old, nw) {
- if (pos.line == old.line)
- { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
- else
- { return Pos(nw.line + (pos.line - old.line), pos.ch) }
- }
-
- // Used by replaceSelections to allow moving the selection to the
- // start or around the replaced test. Hint may be "start" or "around".
- function computeReplacedSel(doc, changes, hint) {
- var out = [];
- var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- var from = offsetPos(change.from, oldPrev, newPrev);
- var to = offsetPos(changeEnd(change), oldPrev, newPrev);
- oldPrev = change.to;
- newPrev = to;
- if (hint == "around") {
- var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
- out[i] = new Range(inv ? to : from, inv ? from : to);
- } else {
- out[i] = new Range(from, from);
- }
- }
- return new Selection(out, doc.sel.primIndex)
- }
-
- // Used to get the editor into a consistent state again when options change.
-
- function loadMode(cm) {
- cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
- resetModeState(cm);
- }
-
- function resetModeState(cm) {
- cm.doc.iter(function (line) {
- if (line.stateAfter) { line.stateAfter = null; }
- if (line.styles) { line.styles = null; }
- });
- cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
- startWorker(cm, 100);
- cm.state.modeGen++;
- if (cm.curOp) { regChange(cm); }
- }
-
- // DOCUMENT DATA STRUCTURE
-
- // By default, updates that start and end at the beginning of a line
- // are treated specially, in order to make the association of line
- // widgets and marker elements with the text behave more intuitive.
- function isWholeLineUpdate(doc, change) {
- return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
- (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
- }
-
- // Perform a change on the document data structure.
- function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
- function spansFor(n) {return markedSpans ? markedSpans[n] : null}
- function update(line, text, spans) {
- updateLine(line, text, spans, estimateHeight$$1);
- signalLater(line, "change", line, change);
- }
- function linesFor(start, end) {
- var result = [];
- for (var i = start; i < end; ++i)
- { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
- return result
- }
-
- var from = change.from, to = change.to, text = change.text;
- var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
- var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
-
- // Adjust the line structure
- if (change.full) {
- doc.insert(0, linesFor(0, text.length));
- doc.remove(text.length, doc.size - text.length);
- } else if (isWholeLineUpdate(doc, change)) {
- // This is a whole-line replace. Treated specially to make
- // sure line objects move the way they are supposed to.
- var added = linesFor(0, text.length - 1);
- update(lastLine, lastLine.text, lastSpans);
- if (nlines) { doc.remove(from.line, nlines); }
- if (added.length) { doc.insert(from.line, added); }
- } else if (firstLine == lastLine) {
- if (text.length == 1) {
- update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
- } else {
- var added$1 = linesFor(1, text.length - 1);
- added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
- doc.insert(from.line + 1, added$1);
- }
- } else if (text.length == 1) {
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
- doc.remove(from.line + 1, nlines);
- } else {
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
- update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
- var added$2 = linesFor(1, text.length - 1);
- if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
- doc.insert(from.line + 1, added$2);
- }
-
- signalLater(doc, "change", doc, change);
- }
-
- // Call f for all linked documents.
- function linkedDocs(doc, f, sharedHistOnly) {
- function propagate(doc, skip, sharedHist) {
- if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
- var rel = doc.linked[i];
- if (rel.doc == skip) { continue }
- var shared = sharedHist && rel.sharedHist;
- if (sharedHistOnly && !shared) { continue }
- f(rel.doc, shared);
- propagate(rel.doc, doc, shared);
- } }
- }
- propagate(doc, null, true);
- }
-
- // Attach a document to an editor.
- function attachDoc(cm, doc) {
- if (doc.cm) { throw new Error("This document is already in use.") }
- cm.doc = doc;
- doc.cm = cm;
- estimateLineHeights(cm);
- loadMode(cm);
- setDirectionClass(cm);
- if (!cm.options.lineWrapping) { findMaxLine(cm); }
- cm.options.mode = doc.modeOption;
- regChange(cm);
- }
-
- function setDirectionClass(cm) {
- (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
- }
-
- function directionChanged(cm) {
- runInOp(cm, function () {
- setDirectionClass(cm);
- regChange(cm);
- });
- }
-
- function History(startGen) {
- // Arrays of change events and selections. Doing something adds an
- // event to done and clears undo. Undoing moves events from done
- // to undone, redoing moves them in the other direction.
- this.done = []; this.undone = [];
- this.undoDepth = Infinity;
- // Used to track when changes can be merged into a single undo
- // event
- this.lastModTime = this.lastSelTime = 0;
- this.lastOp = this.lastSelOp = null;
- this.lastOrigin = this.lastSelOrigin = null;
- // Used by the isClean() method
- this.generation = this.maxGeneration = startGen || 1;
- }
-
- // Create a history change event from an updateDoc-style change
- // object.
- function historyChangeFromChange(doc, change) {
- var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
- attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
- linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
- return histChange
- }
-
- // Pop all selection events off the end of a history array. Stop at
- // a change event.
- function clearSelectionEvents(array) {
- while (array.length) {
- var last = lst(array);
- if (last.ranges) { array.pop(); }
- else { break }
- }
- }
-
- // Find the top change event in the history. Pop off selection
- // events that are in the way.
- function lastChangeEvent(hist, force) {
- if (force) {
- clearSelectionEvents(hist.done);
- return lst(hist.done)
- } else if (hist.done.length && !lst(hist.done).ranges) {
- return lst(hist.done)
- } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
- hist.done.pop();
- return lst(hist.done)
- }
- }
-
- // Register a change in the history. Merges changes that are within
- // a single operation, or are close together with an origin that
- // allows merging (starting with "+") into a single event.
- function addChangeToHistory(doc, change, selAfter, opId) {
- var hist = doc.history;
- hist.undone.length = 0;
- var time = +new Date, cur;
- var last;
-
- if ((hist.lastOp == opId ||
- hist.lastOrigin == change.origin && change.origin &&
- ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
- change.origin.charAt(0) == "*")) &&
- (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
- // Merge this change into the last event
- last = lst(cur.changes);
- if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
- // Optimized case for simple insertion -- don't want to add
- // new changesets for every character typed
- last.to = changeEnd(change);
- } else {
- // Add new sub-event
- cur.changes.push(historyChangeFromChange(doc, change));
- }
- } else {
- // Can not be merged, start a new event.
- var before = lst(hist.done);
- if (!before || !before.ranges)
- { pushSelectionToHistory(doc.sel, hist.done); }
- cur = {changes: [historyChangeFromChange(doc, change)],
- generation: hist.generation};
- hist.done.push(cur);
- while (hist.done.length > hist.undoDepth) {
- hist.done.shift();
- if (!hist.done[0].ranges) { hist.done.shift(); }
- }
- }
- hist.done.push(selAfter);
- hist.generation = ++hist.maxGeneration;
- hist.lastModTime = hist.lastSelTime = time;
- hist.lastOp = hist.lastSelOp = opId;
- hist.lastOrigin = hist.lastSelOrigin = change.origin;
-
- if (!last) { signal(doc, "historyAdded"); }
- }
-
- function selectionEventCanBeMerged(doc, origin, prev, sel) {
- var ch = origin.charAt(0);
- return ch == "*" ||
- ch == "+" &&
- prev.ranges.length == sel.ranges.length &&
- prev.somethingSelected() == sel.somethingSelected() &&
- new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
- }
-
- // Called whenever the selection changes, sets the new selection as
- // the pending selection in the history, and pushes the old pending
- // selection into the 'done' array when it was significantly
- // different (in number of selected ranges, emptiness, or time).
- function addSelectionToHistory(doc, sel, opId, options) {
- var hist = doc.history, origin = options && options.origin;
-
- // A new event is started when the previous origin does not match
- // the current, or the origins don't allow matching. Origins
- // starting with * are always merged, those starting with + are
- // merged when similar and close together in time.
- if (opId == hist.lastSelOp ||
- (origin && hist.lastSelOrigin == origin &&
- (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
- selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
- { hist.done[hist.done.length - 1] = sel; }
- else
- { pushSelectionToHistory(sel, hist.done); }
-
- hist.lastSelTime = +new Date;
- hist.lastSelOrigin = origin;
- hist.lastSelOp = opId;
- if (options && options.clearRedo !== false)
- { clearSelectionEvents(hist.undone); }
- }
-
- function pushSelectionToHistory(sel, dest) {
- var top = lst(dest);
- if (!(top && top.ranges && top.equals(sel)))
- { dest.push(sel); }
- }
-
- // Used to store marked span information in the history.
- function attachLocalSpans(doc, change, from, to) {
- var existing = change["spans_" + doc.id], n = 0;
- doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
- if (line.markedSpans)
- { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
- ++n;
- });
- }
-
- // When un/re-doing restores text containing marked spans, those
- // that have been explicitly cleared should not be restored.
- function removeClearedSpans(spans) {
- if (!spans) { return null }
- var out;
- for (var i = 0; i < spans.length; ++i) {
- if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
- else if (out) { out.push(spans[i]); }
- }
- return !out ? spans : out.length ? out : null
- }
-
- // Retrieve and filter the old marked spans stored in a change event.
- function getOldSpans(doc, change) {
- var found = change["spans_" + doc.id];
- if (!found) { return null }
- var nw = [];
- for (var i = 0; i < change.text.length; ++i)
- { nw.push(removeClearedSpans(found[i])); }
- return nw
- }
-
- // Used for un/re-doing changes from the history. Combines the
- // result of computing the existing spans with the set of spans that
- // existed in the history (so that deleting around a span and then
- // undoing brings back the span).
- function mergeOldSpans(doc, change) {
- var old = getOldSpans(doc, change);
- var stretched = stretchSpansOverChange(doc, change);
- if (!old) { return stretched }
- if (!stretched) { return old }
-
- for (var i = 0; i < old.length; ++i) {
- var oldCur = old[i], stretchCur = stretched[i];
- if (oldCur && stretchCur) {
- spans: for (var j = 0; j < stretchCur.length; ++j) {
- var span = stretchCur[j];
- for (var k = 0; k < oldCur.length; ++k)
- { if (oldCur[k].marker == span.marker) { continue spans } }
- oldCur.push(span);
- }
- } else if (stretchCur) {
- old[i] = stretchCur;
- }
- }
- return old
- }
-
- // Used both to provide a JSON-safe object in .getHistory, and, when
- // detaching a document, to split the history in two
- function copyHistoryArray(events, newGroup, instantiateSel) {
- var copy = [];
- for (var i = 0; i < events.length; ++i) {
- var event = events[i];
- if (event.ranges) {
- copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
- continue
- }
- var changes = event.changes, newChanges = [];
- copy.push({changes: newChanges});
- for (var j = 0; j < changes.length; ++j) {
- var change = changes[j], m = (void 0);
- newChanges.push({from: change.from, to: change.to, text: change.text});
- if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
- if (indexOf(newGroup, Number(m[1])) > -1) {
- lst(newChanges)[prop] = change[prop];
- delete change[prop];
- }
- } } }
- }
- }
- return copy
- }
-
- // The 'scroll' parameter given to many of these indicated whether
- // the new cursor position should be scrolled into view after
- // modifying the selection.
-
- // If shift is held or the extend flag is set, extends a range to
- // include a given position (and optionally a second position).
- // Otherwise, simply returns the range between the given positions.
- // Used for cursor motion and such.
- function extendRange(range, head, other, extend) {
- if (extend) {
- var anchor = range.anchor;
- if (other) {
- var posBefore = cmp(head, anchor) < 0;
- if (posBefore != (cmp(other, anchor) < 0)) {
- anchor = head;
- head = other;
- } else if (posBefore != (cmp(head, other) < 0)) {
- head = other;
- }
- }
- return new Range(anchor, head)
- } else {
- return new Range(other || head, head)
- }
- }
-
- // Extend the primary selection range, discard the rest.
- function extendSelection(doc, head, other, options, extend) {
- if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
- setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
- }
-
- // Extend all selections (pos is an array of selections with length
- // equal the number of selections)
- function extendSelections(doc, heads, options) {
- var out = [];
- var extend = doc.cm && (doc.cm.display.shift || doc.extend);
- for (var i = 0; i < doc.sel.ranges.length; i++)
- { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
- var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
- setSelection(doc, newSel, options);
- }
-
- // Updates a single range in the selection.
- function replaceOneSelection(doc, i, range, options) {
- var ranges = doc.sel.ranges.slice(0);
- ranges[i] = range;
- setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
- }
-
- // Reset the selection to a single range.
- function setSimpleSelection(doc, anchor, head, options) {
- setSelection(doc, simpleSelection(anchor, head), options);
- }
-
- // Give beforeSelectionChange handlers a change to influence a
- // selection update.
- function filterSelectionChange(doc, sel, options) {
- var obj = {
- ranges: sel.ranges,
- update: function(ranges) {
- var this$1 = this;
-
- this.ranges = [];
- for (var i = 0; i < ranges.length; i++)
- { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
- clipPos(doc, ranges[i].head)); }
- },
- origin: options && options.origin
- };
- signal(doc, "beforeSelectionChange", doc, obj);
- if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
- if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
- else { return sel }
- }
-
- function setSelectionReplaceHistory(doc, sel, options) {
- var done = doc.history.done, last = lst(done);
- if (last && last.ranges) {
- done[done.length - 1] = sel;
- setSelectionNoUndo(doc, sel, options);
- } else {
- setSelection(doc, sel, options);
- }
- }
-
- // Set a new selection.
- function setSelection(doc, sel, options) {
- setSelectionNoUndo(doc, sel, options);
- addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
- }
-
- function setSelectionNoUndo(doc, sel, options) {
- if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
- { sel = filterSelectionChange(doc, sel, options); }
-
- var bias = options && options.bias ||
- (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
- setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
-
- if (!(options && options.scroll === false) && doc.cm)
- { ensureCursorVisible(doc.cm); }
- }
-
- function setSelectionInner(doc, sel) {
- if (sel.equals(doc.sel)) { return }
-
- doc.sel = sel;
-
- if (doc.cm) {
- doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
- signalCursorActivity(doc.cm);
- }
- signalLater(doc, "cursorActivity", doc);
- }
-
- // Verify that the selection does not partially select any atomic
- // marked ranges.
- function reCheckSelection(doc) {
- setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
- }
-
- // Return a selection that does not partially select any atomic
- // ranges.
- function skipAtomicInSelection(doc, sel, bias, mayClear) {
- var out;
- for (var i = 0; i < sel.ranges.length; i++) {
- var range = sel.ranges[i];
- var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
- var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
- var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
- if (out || newAnchor != range.anchor || newHead != range.head) {
- if (!out) { out = sel.ranges.slice(0, i); }
- out[i] = new Range(newAnchor, newHead);
- }
- }
- return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
- }
-
- function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
- var line = getLine(doc, pos.line);
- if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
- var sp = line.markedSpans[i], m = sp.marker;
- if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
- (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
- if (mayClear) {
- signal(m, "beforeCursorEnter");
- if (m.explicitlyCleared) {
- if (!line.markedSpans) { break }
- else {--i; continue}
- }
- }
- if (!m.atomic) { continue }
-
- if (oldPos) {
- var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
- if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
- { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
- if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
- { return skipAtomicInner(doc, near, pos, dir, mayClear) }
- }
-
- var far = m.find(dir < 0 ? -1 : 1);
- if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
- { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
- return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
- }
- } }
- return pos
- }
-
- // Ensure a given position is not inside an atomic range.
- function skipAtomic(doc, pos, oldPos, bias, mayClear) {
- var dir = bias || 1;
- var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
- (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
- skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
- (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
- if (!found) {
- doc.cantEdit = true;
- return Pos(doc.first, 0)
- }
- return found
- }
-
- function movePos(doc, pos, dir, line) {
- if (dir < 0 && pos.ch == 0) {
- if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
- else { return null }
- } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
- if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
- else { return null }
- } else {
- return new Pos(pos.line, pos.ch + dir)
- }
- }
-
- function selectAll(cm) {
- cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
- }
-
- // UPDATING
-
- // Allow "beforeChange" event handlers to influence a change
- function filterChange(doc, change, update) {
- var obj = {
- canceled: false,
- from: change.from,
- to: change.to,
- text: change.text,
- origin: change.origin,
- cancel: function () { return obj.canceled = true; }
- };
- if (update) { obj.update = function (from, to, text, origin) {
- if (from) { obj.from = clipPos(doc, from); }
- if (to) { obj.to = clipPos(doc, to); }
- if (text) { obj.text = text; }
- if (origin !== undefined) { obj.origin = origin; }
- }; }
- signal(doc, "beforeChange", doc, obj);
- if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
-
- if (obj.canceled) { return null }
- return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
- }
-
- // Apply a change to a document, and add it to the document's
- // history, and propagating it to all linked documents.
- function makeChange(doc, change, ignoreReadOnly) {
- if (doc.cm) {
- if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
- if (doc.cm.state.suppressEdits) { return }
- }
-
- if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
- change = filterChange(doc, change, true);
- if (!change) { return }
- }
-
- // Possibly split or suppress the update based on the presence
- // of read-only spans in its range.
- var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
- if (split) {
- for (var i = split.length - 1; i >= 0; --i)
- { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
- } else {
- makeChangeInner(doc, change);
- }
- }
-
- function makeChangeInner(doc, change) {
- if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
- var selAfter = computeSelAfterChange(doc, change);
- addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
-
- makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
- var rebased = [];
-
- linkedDocs(doc, function (doc, sharedHist) {
- if (!sharedHist && indexOf(rebased, doc.history) == -1) {
- rebaseHist(doc.history, change);
- rebased.push(doc.history);
- }
- makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
- });
- }
-
- // Revert a change stored in a document's history.
- function makeChangeFromHistory(doc, type, allowSelectionOnly) {
- var suppress = doc.cm && doc.cm.state.suppressEdits;
- if (suppress && !allowSelectionOnly) { return }
-
- var hist = doc.history, event, selAfter = doc.sel;
- var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
-
- // Verify that there is a useable event (so that ctrl-z won't
- // needlessly clear selection events)
- var i = 0;
- for (; i < source.length; i++) {
- event = source[i];
- if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
- { break }
- }
- if (i == source.length) { return }
- hist.lastOrigin = hist.lastSelOrigin = null;
-
- for (;;) {
- event = source.pop();
- if (event.ranges) {
- pushSelectionToHistory(event, dest);
- if (allowSelectionOnly && !event.equals(doc.sel)) {
- setSelection(doc, event, {clearRedo: false});
- return
- }
- selAfter = event;
- } else if (suppress) {
- source.push(event);
- return
- } else { break }
- }
-
- // Build up a reverse change object to add to the opposite history
- // stack (redo when undoing, and vice versa).
- var antiChanges = [];
- pushSelectionToHistory(selAfter, dest);
- dest.push({changes: antiChanges, generation: hist.generation});
- hist.generation = event.generation || ++hist.maxGeneration;
-
- var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
-
- var loop = function ( i ) {
- var change = event.changes[i];
- change.origin = type;
- if (filter && !filterChange(doc, change, false)) {
- source.length = 0;
- return {}
- }
-
- antiChanges.push(historyChangeFromChange(doc, change));
-
- var after = i ? computeSelAfterChange(doc, change) : lst(source);
- makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
- if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
- var rebased = [];
-
- // Propagate to the linked documents
- linkedDocs(doc, function (doc, sharedHist) {
- if (!sharedHist && indexOf(rebased, doc.history) == -1) {
- rebaseHist(doc.history, change);
- rebased.push(doc.history);
- }
- makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
- });
- };
-
- for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
- var returned = loop( i$1 );
-
- if ( returned ) return returned.v;
- }
- }
-
- // Sub-views need their line numbers shifted when text is added
- // above or below them in the parent document.
- function shiftDoc(doc, distance) {
- if (distance == 0) { return }
- doc.first += distance;
- doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
- Pos(range.anchor.line + distance, range.anchor.ch),
- Pos(range.head.line + distance, range.head.ch)
- ); }), doc.sel.primIndex);
- if (doc.cm) {
- regChange(doc.cm, doc.first, doc.first - distance, distance);
- for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
- { regLineChange(doc.cm, l, "gutter"); }
- }
- }
-
- // More lower-level change function, handling only a single document
- // (not linked ones).
- function makeChangeSingleDoc(doc, change, selAfter, spans) {
- if (doc.cm && !doc.cm.curOp)
- { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
-
- if (change.to.line < doc.first) {
- shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
- return
- }
- if (change.from.line > doc.lastLine()) { return }
-
- // Clip the change to the size of this doc
- if (change.from.line < doc.first) {
- var shift = change.text.length - 1 - (doc.first - change.from.line);
- shiftDoc(doc, shift);
- change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
- text: [lst(change.text)], origin: change.origin};
- }
- var last = doc.lastLine();
- if (change.to.line > last) {
- change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
- text: [change.text[0]], origin: change.origin};
- }
-
- change.removed = getBetween(doc, change.from, change.to);
-
- if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
- if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
- else { updateDoc(doc, change, spans); }
- setSelectionNoUndo(doc, selAfter, sel_dontScroll);
- }
-
- // Handle the interaction of a change to a document with the editor
- // that this document is part of.
- function makeChangeSingleDocInEditor(cm, change, spans) {
- var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
-
- var recomputeMaxLength = false, checkWidthStart = from.line;
- if (!cm.options.lineWrapping) {
- checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
- doc.iter(checkWidthStart, to.line + 1, function (line) {
- if (line == display.maxLine) {
- recomputeMaxLength = true;
- return true
- }
- });
- }
-
- if (doc.sel.contains(change.from, change.to) > -1)
- { signalCursorActivity(cm); }
-
- updateDoc(doc, change, spans, estimateHeight(cm));
-
- if (!cm.options.lineWrapping) {
- doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
- var len = lineLength(line);
- if (len > display.maxLineLength) {
- display.maxLine = line;
- display.maxLineLength = len;
- display.maxLineChanged = true;
- recomputeMaxLength = false;
- }
- });
- if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
- }
-
- retreatFrontier(doc, from.line);
- startWorker(cm, 400);
-
- var lendiff = change.text.length - (to.line - from.line) - 1;
- // Remember that these lines changed, for updating the display
- if (change.full)
- { regChange(cm); }
- else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
- { regLineChange(cm, from.line, "text"); }
- else
- { regChange(cm, from.line, to.line + 1, lendiff); }
-
- var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
- if (changeHandler || changesHandler) {
- var obj = {
- from: from, to: to,
- text: change.text,
- removed: change.removed,
- origin: change.origin
- };
- if (changeHandler) { signalLater(cm, "change", cm, obj); }
- if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
- }
- cm.display.selForContextMenu = null;
- }
-
- function replaceRange(doc, code, from, to, origin) {
- var assign;
-
- if (!to) { to = from; }
- if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
- if (typeof code == "string") { code = doc.splitLines(code); }
- makeChange(doc, {from: from, to: to, text: code, origin: origin});
- }
-
- // Rebasing/resetting history to deal with externally-sourced changes
-
- function rebaseHistSelSingle(pos, from, to, diff) {
- if (to < pos.line) {
- pos.line += diff;
- } else if (from < pos.line) {
- pos.line = from;
- pos.ch = 0;
- }
- }
-
- // Tries to rebase an array of history events given a change in the
- // document. If the change touches the same lines as the event, the
- // event, and everything 'behind' it, is discarded. If the change is
- // before the event, the event's positions are updated. Uses a
- // copy-on-write scheme for the positions, to avoid having to
- // reallocate them all on every rebase, but also avoid problems with
- // shared position objects being unsafely updated.
- function rebaseHistArray(array, from, to, diff) {
- for (var i = 0; i < array.length; ++i) {
- var sub = array[i], ok = true;
- if (sub.ranges) {
- if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
- for (var j = 0; j < sub.ranges.length; j++) {
- rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
- rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
- }
- continue
- }
- for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
- var cur = sub.changes[j$1];
- if (to < cur.from.line) {
- cur.from = Pos(cur.from.line + diff, cur.from.ch);
- cur.to = Pos(cur.to.line + diff, cur.to.ch);
- } else if (from <= cur.to.line) {
- ok = false;
- break
- }
- }
- if (!ok) {
- array.splice(0, i + 1);
- i = 0;
- }
- }
- }
-
- function rebaseHist(hist, change) {
- var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
- rebaseHistArray(hist.done, from, to, diff);
- rebaseHistArray(hist.undone, from, to, diff);
- }
-
- // Utility for applying a change to a line by handle or number,
- // returning the number and optionally registering the line as
- // changed.
- function changeLine(doc, handle, changeType, op) {
- var no = handle, line = handle;
- if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
- else { no = lineNo(handle); }
- if (no == null) { return null }
- if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
- return line
- }
-
- // The document is represented as a BTree consisting of leaves, with
- // chunk of lines in them, and branches, with up to ten leaves or
- // other branch nodes below them. The top node is always a branch
- // node, and is the document object itself (meaning it has
- // additional methods and properties).
- //
- // All nodes have parent links. The tree is used both to go from
- // line numbers to line objects, and to go from objects to numbers.
- // It also indexes by height, and is used to convert between height
- // and line object, and to find the total height of the document.
- //
- // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
-
- function LeafChunk(lines) {
- var this$1 = this;
-
- this.lines = lines;
- this.parent = null;
- var height = 0;
- for (var i = 0; i < lines.length; ++i) {
- lines[i].parent = this$1;
- height += lines[i].height;
- }
- this.height = height;
- }
-
- LeafChunk.prototype = {
- chunkSize: function() { return this.lines.length },
-
- // Remove the n lines at offset 'at'.
- removeInner: function(at, n) {
- var this$1 = this;
-
- for (var i = at, e = at + n; i < e; ++i) {
- var line = this$1.lines[i];
- this$1.height -= line.height;
- cleanUpLine(line);
- signalLater(line, "delete");
- }
- this.lines.splice(at, n);
- },
-
- // Helper used to collapse a small branch into a single leaf.
- collapse: function(lines) {
- lines.push.apply(lines, this.lines);
- },
-
- // Insert the given array of lines at offset 'at', count them as
- // having the given height.
- insertInner: function(at, lines, height) {
- var this$1 = this;
-
- this.height += height;
- this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
- for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
- },
-
- // Used to iterate over a part of the tree.
- iterN: function(at, n, op) {
- var this$1 = this;
-
- for (var e = at + n; at < e; ++at)
- { if (op(this$1.lines[at])) { return true } }
- }
- };
-
- function BranchChunk(children) {
- var this$1 = this;
-
- this.children = children;
- var size = 0, height = 0;
- for (var i = 0; i < children.length; ++i) {
- var ch = children[i];
- size += ch.chunkSize(); height += ch.height;
- ch.parent = this$1;
- }
- this.size = size;
- this.height = height;
- this.parent = null;
- }
-
- BranchChunk.prototype = {
- chunkSize: function() { return this.size },
-
- removeInner: function(at, n) {
- var this$1 = this;
-
- this.size -= n;
- for (var i = 0; i < this.children.length; ++i) {
- var child = this$1.children[i], sz = child.chunkSize();
- if (at < sz) {
- var rm = Math.min(n, sz - at), oldHeight = child.height;
- child.removeInner(at, rm);
- this$1.height -= oldHeight - child.height;
- if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
- if ((n -= rm) == 0) { break }
- at = 0;
- } else { at -= sz; }
- }
- // If the result is smaller than 25 lines, ensure that it is a
- // single leaf node.
- if (this.size - n < 25 &&
- (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
- var lines = [];
- this.collapse(lines);
- this.children = [new LeafChunk(lines)];
- this.children[0].parent = this;
- }
- },
-
- collapse: function(lines) {
- var this$1 = this;
-
- for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
- },
-
- insertInner: function(at, lines, height) {
- var this$1 = this;
-
- this.size += lines.length;
- this.height += height;
- for (var i = 0; i < this.children.length; ++i) {
- var child = this$1.children[i], sz = child.chunkSize();
- if (at <= sz) {
- child.insertInner(at, lines, height);
- if (child.lines && child.lines.length > 50) {
- // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
- // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
- var remaining = child.lines.length % 25 + 25;
- for (var pos = remaining; pos < child.lines.length;) {
- var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
- child.height -= leaf.height;
- this$1.children.splice(++i, 0, leaf);
- leaf.parent = this$1;
- }
- child.lines = child.lines.slice(0, remaining);
- this$1.maybeSpill();
- }
- break
- }
- at -= sz;
- }
- },
-
- // When a node has grown, check whether it should be split.
- maybeSpill: function() {
- if (this.children.length <= 10) { return }
- var me = this;
- do {
- var spilled = me.children.splice(me.children.length - 5, 5);
- var sibling = new BranchChunk(spilled);
- if (!me.parent) { // Become the parent node
- var copy = new BranchChunk(me.children);
- copy.parent = me;
- me.children = [copy, sibling];
- me = copy;
- } else {
- me.size -= sibling.size;
- me.height -= sibling.height;
- var myIndex = indexOf(me.parent.children, me);
- me.parent.children.splice(myIndex + 1, 0, sibling);
- }
- sibling.parent = me.parent;
- } while (me.children.length > 10)
- me.parent.maybeSpill();
- },
-
- iterN: function(at, n, op) {
- var this$1 = this;
-
- for (var i = 0; i < this.children.length; ++i) {
- var child = this$1.children[i], sz = child.chunkSize();
- if (at < sz) {
- var used = Math.min(n, sz - at);
- if (child.iterN(at, used, op)) { return true }
- if ((n -= used) == 0) { break }
- at = 0;
- } else { at -= sz; }
- }
- }
- };
-
- // Line widgets are block elements displayed above or below a line.
-
- var LineWidget = function(doc, node, options) {
- var this$1 = this;
-
- if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
- { this$1[opt] = options[opt]; } } }
- this.doc = doc;
- this.node = node;
- };
-
- LineWidget.prototype.clear = function () {
- var this$1 = this;
-
- var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
- if (no == null || !ws) { return }
- for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
- if (!ws.length) { line.widgets = null; }
- var height = widgetHeight(this);
- updateLineHeight(line, Math.max(0, line.height - height));
- if (cm) {
- runInOp(cm, function () {
- adjustScrollWhenAboveVisible(cm, line, -height);
- regLineChange(cm, no, "widget");
- });
- signalLater(cm, "lineWidgetCleared", cm, this, no);
- }
- };
-
- LineWidget.prototype.changed = function () {
- var this$1 = this;
-
- var oldH = this.height, cm = this.doc.cm, line = this.line;
- this.height = null;
- var diff = widgetHeight(this) - oldH;
- if (!diff) { return }
- if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
- if (cm) {
- runInOp(cm, function () {
- cm.curOp.forceUpdate = true;
- adjustScrollWhenAboveVisible(cm, line, diff);
- signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
- });
- }
- };
- eventMixin(LineWidget);
-
- function adjustScrollWhenAboveVisible(cm, line, diff) {
- if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
- { addToScrollTop(cm, diff); }
- }
-
- function addLineWidget(doc, handle, node, options) {
- var widget = new LineWidget(doc, node, options);
- var cm = doc.cm;
- if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
- changeLine(doc, handle, "widget", function (line) {
- var widgets = line.widgets || (line.widgets = []);
- if (widget.insertAt == null) { widgets.push(widget); }
- else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
- widget.line = line;
- if (cm && !lineIsHidden(doc, line)) {
- var aboveVisible = heightAtLine(line) < doc.scrollTop;
- updateLineHeight(line, line.height + widgetHeight(widget));
- if (aboveVisible) { addToScrollTop(cm, widget.height); }
- cm.curOp.forceUpdate = true;
- }
- return true
- });
- if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
- return widget
- }
-
- // TEXTMARKERS
-
- // Created with markText and setBookmark methods. A TextMarker is a
- // handle that can be used to clear or find a marked position in the
- // document. Line objects hold arrays (markedSpans) containing
- // {from, to, marker} object pointing to such marker objects, and
- // indicating that such a marker is present on that line. Multiple
- // lines may point to the same marker when it spans across lines.
- // The spans will have null for their from/to properties when the
- // marker continues beyond the start/end of the line. Markers have
- // links back to the lines they currently touch.
-
- // Collapsed markers have unique ids, in order to be able to order
- // them, which is needed for uniquely determining an outer marker
- // when they overlap (they may nest, but not partially overlap).
- var nextMarkerId = 0;
-
- var TextMarker = function(doc, type) {
- this.lines = [];
- this.type = type;
- this.doc = doc;
- this.id = ++nextMarkerId;
- };
-
- // Clear the marker.
- TextMarker.prototype.clear = function () {
- var this$1 = this;
-
- if (this.explicitlyCleared) { return }
- var cm = this.doc.cm, withOp = cm && !cm.curOp;
- if (withOp) { startOperation(cm); }
- if (hasHandler(this, "clear")) {
- var found = this.find();
- if (found) { signalLater(this, "clear", found.from, found.to); }
- }
- var min = null, max = null;
- for (var i = 0; i < this.lines.length; ++i) {
- var line = this$1.lines[i];
- var span = getMarkedSpanFor(line.markedSpans, this$1);
- if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
- else if (cm) {
- if (span.to != null) { max = lineNo(line); }
- if (span.from != null) { min = lineNo(line); }
- }
- line.markedSpans = removeMarkedSpan(line.markedSpans, span);
- if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
- { updateLineHeight(line, textHeight(cm.display)); }
- }
- if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
- var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
- if (len > cm.display.maxLineLength) {
- cm.display.maxLine = visual;
- cm.display.maxLineLength = len;
- cm.display.maxLineChanged = true;
- }
- } }
-
- if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
- this.lines.length = 0;
- this.explicitlyCleared = true;
- if (this.atomic && this.doc.cantEdit) {
- this.doc.cantEdit = false;
- if (cm) { reCheckSelection(cm.doc); }
- }
- if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
- if (withOp) { endOperation(cm); }
- if (this.parent) { this.parent.clear(); }
- };
-
- // Find the position of the marker in the document. Returns a {from,
- // to} object by default. Side can be passed to get a specific side
- // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
- // Pos objects returned contain a line object, rather than a line
- // number (used to prevent looking up the same line twice).
- TextMarker.prototype.find = function (side, lineObj) {
- var this$1 = this;
-
- if (side == null && this.type == "bookmark") { side = 1; }
- var from, to;
- for (var i = 0; i < this.lines.length; ++i) {
- var line = this$1.lines[i];
- var span = getMarkedSpanFor(line.markedSpans, this$1);
- if (span.from != null) {
- from = Pos(lineObj ? line : lineNo(line), span.from);
- if (side == -1) { return from }
- }
- if (span.to != null) {
- to = Pos(lineObj ? line : lineNo(line), span.to);
- if (side == 1) { return to }
- }
- }
- return from && {from: from, to: to}
- };
-
- // Signals that the marker's widget changed, and surrounding layout
- // should be recomputed.
- TextMarker.prototype.changed = function () {
- var this$1 = this;
-
- var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
- if (!pos || !cm) { return }
- runInOp(cm, function () {
- var line = pos.line, lineN = lineNo(pos.line);
- var view = findViewForLine(cm, lineN);
- if (view) {
- clearLineMeasurementCacheFor(view);
- cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
- }
- cm.curOp.updateMaxLine = true;
- if (!lineIsHidden(widget.doc, line) && widget.height != null) {
- var oldHeight = widget.height;
- widget.height = null;
- var dHeight = widgetHeight(widget) - oldHeight;
- if (dHeight)
- { updateLineHeight(line, line.height + dHeight); }
- }
- signalLater(cm, "markerChanged", cm, this$1);
- });
- };
-
- TextMarker.prototype.attachLine = function (line) {
- if (!this.lines.length && this.doc.cm) {
- var op = this.doc.cm.curOp;
- if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
- { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
- }
- this.lines.push(line);
- };
-
- TextMarker.prototype.detachLine = function (line) {
- this.lines.splice(indexOf(this.lines, line), 1);
- if (!this.lines.length && this.doc.cm) {
- var op = this.doc.cm.curOp
- ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
- }
- };
- eventMixin(TextMarker);
-
- // Create a marker, wire it up to the right lines, and
- function markText(doc, from, to, options, type) {
- // Shared markers (across linked documents) are handled separately
- // (markTextShared will call out to this again, once per
- // document).
- if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
- // Ensure we are in an operation.
- if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
-
- var marker = new TextMarker(doc, type), diff = cmp(from, to);
- if (options) { copyObj(options, marker, false); }
- // Don't connect empty markers unless clearWhenEmpty is false
- if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
- { return marker }
- if (marker.replacedWith) {
- // Showing up as a widget implies collapsed (widget replaces text)
- marker.collapsed = true;
- marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
- if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
- if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
- }
- if (marker.collapsed) {
- if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
- from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
- { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
- seeCollapsedSpans();
- }
-
- if (marker.addToHistory)
- { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
-
- var curLine = from.line, cm = doc.cm, updateMaxLine;
- doc.iter(curLine, to.line + 1, function (line) {
- if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
- { updateMaxLine = true; }
- if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
- addMarkedSpan(line, new MarkedSpan(marker,
- curLine == from.line ? from.ch : null,
- curLine == to.line ? to.ch : null));
- ++curLine;
- });
- // lineIsHidden depends on the presence of the spans, so needs a second pass
- if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
- if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
- }); }
-
- if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
-
- if (marker.readOnly) {
- seeReadOnlySpans();
- if (doc.history.done.length || doc.history.undone.length)
- { doc.clearHistory(); }
- }
- if (marker.collapsed) {
- marker.id = ++nextMarkerId;
- marker.atomic = true;
- }
- if (cm) {
- // Sync editor state
- if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
- if (marker.collapsed)
- { regChange(cm, from.line, to.line + 1); }
- else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
- { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
- if (marker.atomic) { reCheckSelection(cm.doc); }
- signalLater(cm, "markerAdded", cm, marker);
- }
- return marker
- }
-
- // SHARED TEXTMARKERS
-
- // A shared marker spans multiple linked documents. It is
- // implemented as a meta-marker-object controlling multiple normal
- // markers.
- var SharedTextMarker = function(markers, primary) {
- var this$1 = this;
-
- this.markers = markers;
- this.primary = primary;
- for (var i = 0; i < markers.length; ++i)
- { markers[i].parent = this$1; }
- };
-
- SharedTextMarker.prototype.clear = function () {
- var this$1 = this;
-
- if (this.explicitlyCleared) { return }
- this.explicitlyCleared = true;
- for (var i = 0; i < this.markers.length; ++i)
- { this$1.markers[i].clear(); }
- signalLater(this, "clear");
- };
-
- SharedTextMarker.prototype.find = function (side, lineObj) {
- return this.primary.find(side, lineObj)
- };
- eventMixin(SharedTextMarker);
-
- function markTextShared(doc, from, to, options, type) {
- options = copyObj(options);
- options.shared = false;
- var markers = [markText(doc, from, to, options, type)], primary = markers[0];
- var widget = options.widgetNode;
- linkedDocs(doc, function (doc) {
- if (widget) { options.widgetNode = widget.cloneNode(true); }
- markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
- for (var i = 0; i < doc.linked.length; ++i)
- { if (doc.linked[i].isParent) { return } }
- primary = lst(markers);
- });
- return new SharedTextMarker(markers, primary)
- }
-
- function findSharedMarkers(doc) {
- return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
- }
-
- function copySharedMarkers(doc, markers) {
- for (var i = 0; i < markers.length; i++) {
- var marker = markers[i], pos = marker.find();
- var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
- if (cmp(mFrom, mTo)) {
- var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
- marker.markers.push(subMark);
- subMark.parent = marker;
- }
- }
- }
-
- function detachSharedMarkers(markers) {
- var loop = function ( i ) {
- var marker = markers[i], linked = [marker.primary.doc];
- linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
- for (var j = 0; j < marker.markers.length; j++) {
- var subMarker = marker.markers[j];
- if (indexOf(linked, subMarker.doc) == -1) {
- subMarker.parent = null;
- marker.markers.splice(j--, 1);
- }
- }
- };
-
- for (var i = 0; i < markers.length; i++) loop( i );
- }
-
- var nextDocId = 0;
- var Doc = function(text, mode, firstLine, lineSep, direction) {
- if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
- if (firstLine == null) { firstLine = 0; }
-
- BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
- this.first = firstLine;
- this.scrollTop = this.scrollLeft = 0;
- this.cantEdit = false;
- this.cleanGeneration = 1;
- this.modeFrontier = this.highlightFrontier = firstLine;
- var start = Pos(firstLine, 0);
- this.sel = simpleSelection(start);
- this.history = new History(null);
- this.id = ++nextDocId;
- this.modeOption = mode;
- this.lineSep = lineSep;
- this.direction = (direction == "rtl") ? "rtl" : "ltr";
- this.extend = false;
-
- if (typeof text == "string") { text = this.splitLines(text); }
- updateDoc(this, {from: start, to: start, text: text});
- setSelection(this, simpleSelection(start), sel_dontScroll);
- };
-
- Doc.prototype = createObj(BranchChunk.prototype, {
- constructor: Doc,
- // Iterate over the document. Supports two forms -- with only one
- // argument, it calls that for each line in the document. With
- // three, it iterates over the range given by the first two (with
- // the second being non-inclusive).
- iter: function(from, to, op) {
- if (op) { this.iterN(from - this.first, to - from, op); }
- else { this.iterN(this.first, this.first + this.size, from); }
- },
-
- // Non-public interface for adding and removing lines.
- insert: function(at, lines) {
- var height = 0;
- for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
- this.insertInner(at - this.first, lines, height);
- },
- remove: function(at, n) { this.removeInner(at - this.first, n); },
-
- // From here, the methods are part of the public interface. Most
- // are also available from CodeMirror (editor) instances.
-
- getValue: function(lineSep) {
- var lines = getLines(this, this.first, this.first + this.size);
- if (lineSep === false) { return lines }
- return lines.join(lineSep || this.lineSeparator())
- },
- setValue: docMethodOp(function(code) {
- var top = Pos(this.first, 0), last = this.first + this.size - 1;
- makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
- text: this.splitLines(code), origin: "setValue", full: true}, true);
- if (this.cm) { scrollToCoords(this.cm, 0, 0); }
- setSelection(this, simpleSelection(top), sel_dontScroll);
- }),
- replaceRange: function(code, from, to, origin) {
- from = clipPos(this, from);
- to = to ? clipPos(this, to) : from;
- replaceRange(this, code, from, to, origin);
- },
- getRange: function(from, to, lineSep) {
- var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
- if (lineSep === false) { return lines }
- return lines.join(lineSep || this.lineSeparator())
- },
-
- getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
-
- getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
- getLineNumber: function(line) {return lineNo(line)},
-
- getLineHandleVisualStart: function(line) {
- if (typeof line == "number") { line = getLine(this, line); }
- return visualLine(line)
- },
-
- lineCount: function() {return this.size},
- firstLine: function() {return this.first},
- lastLine: function() {return this.first + this.size - 1},
-
- clipPos: function(pos) {return clipPos(this, pos)},
-
- getCursor: function(start) {
- var range$$1 = this.sel.primary(), pos;
- if (start == null || start == "head") { pos = range$$1.head; }
- else if (start == "anchor") { pos = range$$1.anchor; }
- else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
- else { pos = range$$1.from(); }
- return pos
- },
- listSelections: function() { return this.sel.ranges },
- somethingSelected: function() {return this.sel.somethingSelected()},
-
- setCursor: docMethodOp(function(line, ch, options) {
- setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
- }),
- setSelection: docMethodOp(function(anchor, head, options) {
- setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
- }),
- extendSelection: docMethodOp(function(head, other, options) {
- extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
- }),
- extendSelections: docMethodOp(function(heads, options) {
- extendSelections(this, clipPosArray(this, heads), options);
- }),
- extendSelectionsBy: docMethodOp(function(f, options) {
- var heads = map(this.sel.ranges, f);
- extendSelections(this, clipPosArray(this, heads), options);
- }),
- setSelections: docMethodOp(function(ranges, primary, options) {
- var this$1 = this;
-
- if (!ranges.length) { return }
- var out = [];
- for (var i = 0; i < ranges.length; i++)
- { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
- clipPos(this$1, ranges[i].head)); }
- if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
- setSelection(this, normalizeSelection(this.cm, out, primary), options);
- }),
- addSelection: docMethodOp(function(anchor, head, options) {
- var ranges = this.sel.ranges.slice(0);
- ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
- setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
- }),
-
- getSelection: function(lineSep) {
- var this$1 = this;
-
- var ranges = this.sel.ranges, lines;
- for (var i = 0; i < ranges.length; i++) {
- var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
- lines = lines ? lines.concat(sel) : sel;
- }
- if (lineSep === false) { return lines }
- else { return lines.join(lineSep || this.lineSeparator()) }
- },
- getSelections: function(lineSep) {
- var this$1 = this;
-
- var parts = [], ranges = this.sel.ranges;
- for (var i = 0; i < ranges.length; i++) {
- var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
- if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
- parts[i] = sel;
- }
- return parts
- },
- replaceSelection: function(code, collapse, origin) {
- var dup = [];
- for (var i = 0; i < this.sel.ranges.length; i++)
- { dup[i] = code; }
- this.replaceSelections(dup, collapse, origin || "+input");
- },
- replaceSelections: docMethodOp(function(code, collapse, origin) {
- var this$1 = this;
-
- var changes = [], sel = this.sel;
- for (var i = 0; i < sel.ranges.length; i++) {
- var range$$1 = sel.ranges[i];
- changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
- }
- var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
- for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
- { makeChange(this$1, changes[i$1]); }
- if (newSel) { setSelectionReplaceHistory(this, newSel); }
- else if (this.cm) { ensureCursorVisible(this.cm); }
- }),
- undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
- redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
- undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
- redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
-
- setExtending: function(val) {this.extend = val;},
- getExtending: function() {return this.extend},
-
- historySize: function() {
- var hist = this.history, done = 0, undone = 0;
- for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
- for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
- return {undo: done, redo: undone}
- },
- clearHistory: function() {this.history = new History(this.history.maxGeneration);},
-
- markClean: function() {
- this.cleanGeneration = this.changeGeneration(true);
- },
- changeGeneration: function(forceSplit) {
- if (forceSplit)
- { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
- return this.history.generation
- },
- isClean: function (gen) {
- return this.history.generation == (gen || this.cleanGeneration)
- },
-
- getHistory: function() {
- return {done: copyHistoryArray(this.history.done),
- undone: copyHistoryArray(this.history.undone)}
- },
- setHistory: function(histData) {
- var hist = this.history = new History(this.history.maxGeneration);
- hist.done = copyHistoryArray(histData.done.slice(0), null, true);
- hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
- },
-
- setGutterMarker: docMethodOp(function(line, gutterID, value) {
- return changeLine(this, line, "gutter", function (line) {
- var markers = line.gutterMarkers || (line.gutterMarkers = {});
- markers[gutterID] = value;
- if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
- return true
- })
- }),
-
- clearGutter: docMethodOp(function(gutterID) {
- var this$1 = this;
-
- this.iter(function (line) {
- if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
- changeLine(this$1, line, "gutter", function () {
- line.gutterMarkers[gutterID] = null;
- if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
- return true
- });
- }
- });
- }),
-
- lineInfo: function(line) {
- var n;
- if (typeof line == "number") {
- if (!isLine(this, line)) { return null }
- n = line;
- line = getLine(this, line);
- if (!line) { return null }
- } else {
- n = lineNo(line);
- if (n == null) { return null }
- }
- return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
- textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
- widgets: line.widgets}
- },
-
- addLineClass: docMethodOp(function(handle, where, cls) {
- return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
- var prop = where == "text" ? "textClass"
- : where == "background" ? "bgClass"
- : where == "gutter" ? "gutterClass" : "wrapClass";
- if (!line[prop]) { line[prop] = cls; }
- else if (classTest(cls).test(line[prop])) { return false }
- else { line[prop] += " " + cls; }
- return true
- })
- }),
- removeLineClass: docMethodOp(function(handle, where, cls) {
- return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
- var prop = where == "text" ? "textClass"
- : where == "background" ? "bgClass"
- : where == "gutter" ? "gutterClass" : "wrapClass";
- var cur = line[prop];
- if (!cur) { return false }
- else if (cls == null) { line[prop] = null; }
- else {
- var found = cur.match(classTest(cls));
- if (!found) { return false }
- var end = found.index + found[0].length;
- line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
- }
- return true
- })
- }),
-
- addLineWidget: docMethodOp(function(handle, node, options) {
- return addLineWidget(this, handle, node, options)
- }),
- removeLineWidget: function(widget) { widget.clear(); },
-
- markText: function(from, to, options) {
- return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
- },
- setBookmark: function(pos, options) {
- var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
- insertLeft: options && options.insertLeft,
- clearWhenEmpty: false, shared: options && options.shared,
- handleMouseEvents: options && options.handleMouseEvents};
- pos = clipPos(this, pos);
- return markText(this, pos, pos, realOpts, "bookmark")
- },
- findMarksAt: function(pos) {
- pos = clipPos(this, pos);
- var markers = [], spans = getLine(this, pos.line).markedSpans;
- if (spans) { for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if ((span.from == null || span.from <= pos.ch) &&
- (span.to == null || span.to >= pos.ch))
- { markers.push(span.marker.parent || span.marker); }
- } }
- return markers
- },
- findMarks: function(from, to, filter) {
- from = clipPos(this, from); to = clipPos(this, to);
- var found = [], lineNo$$1 = from.line;
- this.iter(from.line, to.line + 1, function (line) {
- var spans = line.markedSpans;
- if (spans) { for (var i = 0; i < spans.length; i++) {
- var span = spans[i];
- if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
- span.from == null && lineNo$$1 != from.line ||
- span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
- (!filter || filter(span.marker)))
- { found.push(span.marker.parent || span.marker); }
- } }
- ++lineNo$$1;
- });
- return found
- },
- getAllMarks: function() {
- var markers = [];
- this.iter(function (line) {
- var sps = line.markedSpans;
- if (sps) { for (var i = 0; i < sps.length; ++i)
- { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
- });
- return markers
- },
-
- posFromIndex: function(off) {
- var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
- this.iter(function (line) {
- var sz = line.text.length + sepSize;
- if (sz > off) { ch = off; return true }
- off -= sz;
- ++lineNo$$1;
- });
- return clipPos(this, Pos(lineNo$$1, ch))
- },
- indexFromPos: function (coords) {
- coords = clipPos(this, coords);
- var index = coords.ch;
- if (coords.line < this.first || coords.ch < 0) { return 0 }
- var sepSize = this.lineSeparator().length;
- this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
- index += line.text.length + sepSize;
- });
- return index
- },
-
- copy: function(copyHistory) {
- var doc = new Doc(getLines(this, this.first, this.first + this.size),
- this.modeOption, this.first, this.lineSep, this.direction);
- doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
- doc.sel = this.sel;
- doc.extend = false;
- if (copyHistory) {
- doc.history.undoDepth = this.history.undoDepth;
- doc.setHistory(this.getHistory());
- }
- return doc
- },
-
- linkedDoc: function(options) {
- if (!options) { options = {}; }
- var from = this.first, to = this.first + this.size;
- if (options.from != null && options.from > from) { from = options.from; }
- if (options.to != null && options.to < to) { to = options.to; }
- var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
- if (options.sharedHist) { copy.history = this.history
- ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
- copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
- copySharedMarkers(copy, findSharedMarkers(this));
- return copy
- },
- unlinkDoc: function(other) {
- var this$1 = this;
-
- if (other instanceof CodeMirror) { other = other.doc; }
- if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
- var link = this$1.linked[i];
- if (link.doc != other) { continue }
- this$1.linked.splice(i, 1);
- other.unlinkDoc(this$1);
- detachSharedMarkers(findSharedMarkers(this$1));
- break
- } }
- // If the histories were shared, split them again
- if (other.history == this.history) {
- var splitIds = [other.id];
- linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
- other.history = new History(null);
- other.history.done = copyHistoryArray(this.history.done, splitIds);
- other.history.undone = copyHistoryArray(this.history.undone, splitIds);
- }
- },
- iterLinkedDocs: function(f) {linkedDocs(this, f);},
-
- getMode: function() {return this.mode},
- getEditor: function() {return this.cm},
-
- splitLines: function(str) {
- if (this.lineSep) { return str.split(this.lineSep) }
- return splitLinesAuto(str)
- },
- lineSeparator: function() { return this.lineSep || "\n" },
-
- setDirection: docMethodOp(function (dir) {
- if (dir != "rtl") { dir = "ltr"; }
- if (dir == this.direction) { return }
- this.direction = dir;
- this.iter(function (line) { return line.order = null; });
- if (this.cm) { directionChanged(this.cm); }
- })
- });
-
- // Public alias.
- Doc.prototype.eachLine = Doc.prototype.iter;
-
- // Kludge to work around strange IE behavior where it'll sometimes
- // re-fire a series of drag-related events right after the drop (#1551)
- var lastDrop = 0;
-
- function onDrop(e) {
- var cm = this;
- clearDragCursor(cm);
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
- { return }
- e_preventDefault(e);
- if (ie) { lastDrop = +new Date; }
- var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
- if (!pos || cm.isReadOnly()) { return }
- // Might be a file drop, in which case we simply extract the text
- // and insert it.
- if (files && files.length && window.FileReader && window.File) {
- var n = files.length, text = Array(n), read = 0;
- var loadFile = function (file, i) {
- if (cm.options.allowDropFileTypes &&
- indexOf(cm.options.allowDropFileTypes, file.type) == -1)
- { return }
-
- var reader = new FileReader;
- reader.onload = operation(cm, function () {
- var content = reader.result;
- if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
- text[i] = content;
- if (++read == n) {
- pos = clipPos(cm.doc, pos);
- var change = {from: pos, to: pos,
- text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
- origin: "paste"};
- makeChange(cm.doc, change);
- setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
- }
- });
- reader.readAsText(file);
- };
- for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
- } else { // Normal drop
- // Don't do a replace if the drop happened inside of the selected text.
- if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
- cm.state.draggingText(e);
- // Ensure the editor is re-focused
- setTimeout(function () { return cm.display.input.focus(); }, 20);
- return
- }
- try {
- var text$1 = e.dataTransfer.getData("Text");
- if (text$1) {
- var selected;
- if (cm.state.draggingText && !cm.state.draggingText.copy)
- { selected = cm.listSelections(); }
- setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
- if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
- { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
- cm.replaceSelection(text$1, "around", "paste");
- cm.display.input.focus();
- }
- }
- catch(e){}
- }
- }
-
- function onDragStart(cm, e) {
- if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
-
- e.dataTransfer.setData("Text", cm.getSelection());
- e.dataTransfer.effectAllowed = "copyMove";
-
- // Use dummy image instead of default browsers image.
- // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
- if (e.dataTransfer.setDragImage && !safari) {
- var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
- img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
- if (presto) {
- img.width = img.height = 1;
- cm.display.wrapper.appendChild(img);
- // Force a relayout, or Opera won't use our image for some obscure reason
- img._top = img.offsetTop;
- }
- e.dataTransfer.setDragImage(img, 0, 0);
- if (presto) { img.parentNode.removeChild(img); }
- }
- }
-
- function onDragOver(cm, e) {
- var pos = posFromMouse(cm, e);
- if (!pos) { return }
- var frag = document.createDocumentFragment();
- drawSelectionCursor(cm, pos, frag);
- if (!cm.display.dragCursor) {
- cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
- cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
- }
- removeChildrenAndAdd(cm.display.dragCursor, frag);
- }
-
- function clearDragCursor(cm) {
- if (cm.display.dragCursor) {
- cm.display.lineSpace.removeChild(cm.display.dragCursor);
- cm.display.dragCursor = null;
- }
- }
-
- // These must be handled carefully, because naively registering a
- // handler for each editor will cause the editors to never be
- // garbage collected.
-
- function forEachCodeMirror(f) {
- if (!document.getElementsByClassName) { return }
- var byClass = document.getElementsByClassName("CodeMirror");
- for (var i = 0; i < byClass.length; i++) {
- var cm = byClass[i].CodeMirror;
- if (cm) { f(cm); }
- }
- }
-
- var globalsRegistered = false;
- function ensureGlobalHandlers() {
- if (globalsRegistered) { return }
- registerGlobalHandlers();
- globalsRegistered = true;
- }
- function registerGlobalHandlers() {
- // When the window resizes, we need to refresh active editors.
- var resizeTimer;
- on(window, "resize", function () {
- if (resizeTimer == null) { resizeTimer = setTimeout(function () {
- resizeTimer = null;
- forEachCodeMirror(onResize);
- }, 100); }
- });
- // When the window loses focus, we want to show the editor as blurred
- on(window, "blur", function () { return forEachCodeMirror(onBlur); });
- }
- // Called when the window resizes
- function onResize(cm) {
- var d = cm.display;
- // Might be a text scaling operation, clear size caches.
- d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
- d.scrollbarsClipped = false;
- cm.setSize();
- }
-
- var keyNames = {
- 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
- 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
- 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
- 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
- 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", 145: "ScrollLock",
- 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
- 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
- 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
- };
-
- // Number keys
- for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
- // Alphabetic keys
- for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
- // Function keys
- for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
-
- var keyMap = {};
-
- keyMap.basic = {
- "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
- "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
- "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
- "Tab": "defaultTab", "Shift-Tab": "indentAuto",
- "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
- "Esc": "singleSelection"
- };
- // Note that the save and find-related commands aren't defined by
- // default. User code or addons can define them. Unknown commands
- // are simply ignored.
- keyMap.pcDefault = {
- "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
- "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
- "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
- "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
- "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
- "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
- "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
- "fallthrough": "basic"
- };
- // Very basic readline/emacs-style bindings, which are standard on Mac.
- keyMap.emacsy = {
- "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
- "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
- "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
- "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
- "Ctrl-O": "openLine"
- };
- keyMap.macDefault = {
- "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
- "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
- "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
- "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
- "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
- "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
- "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
- "fallthrough": ["basic", "emacsy"]
- };
- keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
-
- // KEYMAP DISPATCH
-
- function normalizeKeyName(name) {
- var parts = name.split(/-(?!$)/);
- name = parts[parts.length - 1];
- var alt, ctrl, shift, cmd;
- for (var i = 0; i < parts.length - 1; i++) {
- var mod = parts[i];
- if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
- else if (/^a(lt)?$/i.test(mod)) { alt = true; }
- else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
- else if (/^s(hift)?$/i.test(mod)) { shift = true; }
- else { throw new Error("Unrecognized modifier name: " + mod) }
- }
- if (alt) { name = "Alt-" + name; }
- if (ctrl) { name = "Ctrl-" + name; }
- if (cmd) { name = "Cmd-" + name; }
- if (shift) { name = "Shift-" + name; }
- return name
- }
-
- // This is a kludge to keep keymaps mostly working as raw objects
- // (backwards compatibility) while at the same time support features
- // like normalization and multi-stroke key bindings. It compiles a
- // new normalized keymap, and then updates the old object to reflect
- // this.
- function normalizeKeyMap(keymap) {
- var copy = {};
- for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
- var value = keymap[keyname];
- if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
- if (value == "...") { delete keymap[keyname]; continue }
-
- var keys = map(keyname.split(" "), normalizeKeyName);
- for (var i = 0; i < keys.length; i++) {
- var val = (void 0), name = (void 0);
- if (i == keys.length - 1) {
- name = keys.join(" ");
- val = value;
- } else {
- name = keys.slice(0, i + 1).join(" ");
- val = "...";
- }
- var prev = copy[name];
- if (!prev) { copy[name] = val; }
- else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
- }
- delete keymap[keyname];
- } }
- for (var prop in copy) { keymap[prop] = copy[prop]; }
- return keymap
- }
-
- function lookupKey(key, map$$1, handle, context) {
- map$$1 = getKeyMap(map$$1);
- var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
- if (found === false) { return "nothing" }
- if (found === "...") { return "multi" }
- if (found != null && handle(found)) { return "handled" }
-
- if (map$$1.fallthrough) {
- if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
- { return lookupKey(key, map$$1.fallthrough, handle, context) }
- for (var i = 0; i < map$$1.fallthrough.length; i++) {
- var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
- if (result) { return result }
- }
- }
- }
-
- // Modifier key presses don't count as 'real' key presses for the
- // purpose of keymap fallthrough.
- function isModifierKey(value) {
- var name = typeof value == "string" ? value : keyNames[value.keyCode];
- return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
- }
-
- function addModifierNames(name, event, noShift) {
- var base = name;
- if (event.altKey && base != "Alt") { name = "Alt-" + name; }
- if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
- if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
- if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
- return name
- }
-
- // Look up the name of a key as indicated by an event object.
- function keyName(event, noShift) {
- if (presto && event.keyCode == 34 && event["char"]) { return false }
- var name = keyNames[event.keyCode];
- if (name == null || event.altGraphKey) { return false }
- // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
- // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
- if (event.keyCode == 3 && event.code) { name = event.code; }
- return addModifierNames(name, event, noShift)
- }
-
- function getKeyMap(val) {
- return typeof val == "string" ? keyMap[val] : val
- }
-
- // Helper for deleting text near the selection(s), used to implement
- // backspace, delete, and similar functionality.
- function deleteNearSelection(cm, compute) {
- var ranges = cm.doc.sel.ranges, kill = [];
- // Build up a set of ranges to kill first, merging overlapping
- // ranges.
- for (var i = 0; i < ranges.length; i++) {
- var toKill = compute(ranges[i]);
- while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
- var replaced = kill.pop();
- if (cmp(replaced.from, toKill.from) < 0) {
- toKill.from = replaced.from;
- break
- }
- }
- kill.push(toKill);
- }
- // Next, remove those actual ranges.
- runInOp(cm, function () {
- for (var i = kill.length - 1; i >= 0; i--)
- { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
- ensureCursorVisible(cm);
- });
- }
-
- function moveCharLogically(line, ch, dir) {
- var target = skipExtendingChars(line.text, ch + dir, dir);
- return target < 0 || target > line.text.length ? null : target
- }
-
- function moveLogically(line, start, dir) {
- var ch = moveCharLogically(line, start.ch, dir);
- return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
- }
-
- function endOfLine(visually, cm, lineObj, lineNo, dir) {
- if (visually) {
- var order = getOrder(lineObj, cm.doc.direction);
- if (order) {
- var part = dir < 0 ? lst(order) : order[0];
- var moveInStorageOrder = (dir < 0) == (part.level == 1);
- var sticky = moveInStorageOrder ? "after" : "before";
- var ch;
- // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
- // it could be that the last bidi part is not on the last visual line,
- // since visual lines contain content order-consecutive chunks.
- // Thus, in rtl, we are looking for the first (content-order) character
- // in the rtl chunk that is on the last line (that is, the same line
- // as the last (content-order) character).
- if (part.level > 0 || cm.doc.direction == "rtl") {
- var prep = prepareMeasureForLine(cm, lineObj);
- ch = dir < 0 ? lineObj.text.length - 1 : 0;
- var targetTop = measureCharPrepared(cm, prep, ch).top;
- ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
- if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
- } else { ch = dir < 0 ? part.to : part.from; }
- return new Pos(lineNo, ch, sticky)
- }
- }
- return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
- }
-
- function moveVisually(cm, line, start, dir) {
- var bidi = getOrder(line, cm.doc.direction);
- if (!bidi) { return moveLogically(line, start, dir) }
- if (start.ch >= line.text.length) {
- start.ch = line.text.length;
- start.sticky = "before";
- } else if (start.ch <= 0) {
- start.ch = 0;
- start.sticky = "after";
- }
- var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
- if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
- // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
- // nothing interesting happens.
- return moveLogically(line, start, dir)
- }
-
- var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
- var prep;
- var getWrappedLineExtent = function (ch) {
- if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
- prep = prep || prepareMeasureForLine(cm, line);
- return wrappedLineExtentChar(cm, line, prep, ch)
- };
- var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
-
- if (cm.doc.direction == "rtl" || part.level == 1) {
- var moveInStorageOrder = (part.level == 1) == (dir < 0);
- var ch = mv(start, moveInStorageOrder ? 1 : -1);
- if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
- // Case 2: We move within an rtl part or in an rtl editor on the same visual line
- var sticky = moveInStorageOrder ? "before" : "after";
- return new Pos(start.line, ch, sticky)
- }
- }
-
- // Case 3: Could not move within this bidi part in this visual line, so leave
- // the current bidi part
-
- var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
- var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
- ? new Pos(start.line, mv(ch, 1), "before")
- : new Pos(start.line, ch, "after"); };
-
- for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
- var part = bidi[partPos];
- var moveInStorageOrder = (dir > 0) == (part.level != 1);
- var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
- if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
- ch = moveInStorageOrder ? part.from : mv(part.to, -1);
- if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
- }
- };
-
- // Case 3a: Look for other bidi parts on the same visual line
- var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
- if (res) { return res }
-
- // Case 3b: Look for other bidi parts on the next visual line
- var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
- if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
- res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
- if (res) { return res }
- }
-
- // Case 4: Nowhere to move
- return null
- }
-
- // Commands are parameter-less actions that can be performed on an
- // editor, mostly used for keybindings.
- var commands = {
- selectAll: selectAll,
- singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
- killLine: function (cm) { return deleteNearSelection(cm, function (range) {
- if (range.empty()) {
- var len = getLine(cm.doc, range.head.line).text.length;
- if (range.head.ch == len && range.head.line < cm.lastLine())
- { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
- else
- { return {from: range.head, to: Pos(range.head.line, len)} }
- } else {
- return {from: range.from(), to: range.to()}
- }
- }); },
- deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
- from: Pos(range.from().line, 0),
- to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
- }); }); },
- delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
- from: Pos(range.from().line, 0), to: range.from()
- }); }); },
- delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
- var top = cm.charCoords(range.head, "div").top + 5;
- var leftPos = cm.coordsChar({left: 0, top: top}, "div");
- return {from: leftPos, to: range.from()}
- }); },
- delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
- var top = cm.charCoords(range.head, "div").top + 5;
- var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
- return {from: range.from(), to: rightPos }
- }); },
- undo: function (cm) { return cm.undo(); },
- redo: function (cm) { return cm.redo(); },
- undoSelection: function (cm) { return cm.undoSelection(); },
- redoSelection: function (cm) { return cm.redoSelection(); },
- goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
- goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
- goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
- {origin: "+move", bias: 1}
- ); },
- goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
- {origin: "+move", bias: 1}
- ); },
- goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
- {origin: "+move", bias: -1}
- ); },
- goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
- }, sel_move); },
- goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- return cm.coordsChar({left: 0, top: top}, "div")
- }, sel_move); },
- goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- var pos = cm.coordsChar({left: 0, top: top}, "div");
- if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
- return pos
- }, sel_move); },
- goLineUp: function (cm) { return cm.moveV(-1, "line"); },
- goLineDown: function (cm) { return cm.moveV(1, "line"); },
- goPageUp: function (cm) { return cm.moveV(-1, "page"); },
- goPageDown: function (cm) { return cm.moveV(1, "page"); },
- goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
- goCharRight: function (cm) { return cm.moveH(1, "char"); },
- goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
- goColumnRight: function (cm) { return cm.moveH(1, "column"); },
- goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
- goGroupRight: function (cm) { return cm.moveH(1, "group"); },
- goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
- goWordRight: function (cm) { return cm.moveH(1, "word"); },
- delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
- delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
- delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
- delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
- delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
- delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
- indentAuto: function (cm) { return cm.indentSelection("smart"); },
- indentMore: function (cm) { return cm.indentSelection("add"); },
- indentLess: function (cm) { return cm.indentSelection("subtract"); },
- insertTab: function (cm) { return cm.replaceSelection("\t"); },
- insertSoftTab: function (cm) {
- var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
- for (var i = 0; i < ranges.length; i++) {
- var pos = ranges[i].from();
- var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
- spaces.push(spaceStr(tabSize - col % tabSize));
- }
- cm.replaceSelections(spaces);
- },
- defaultTab: function (cm) {
- if (cm.somethingSelected()) { cm.indentSelection("add"); }
- else { cm.execCommand("insertTab"); }
- },
- // Swap the two chars left and right of each selection's head.
- // Move cursor behind the two swapped characters afterwards.
- //
- // Doesn't consider line feeds a character.
- // Doesn't scan more than one line above to find a character.
- // Doesn't do anything on an empty line.
- // Doesn't do anything with non-empty selections.
- transposeChars: function (cm) { return runInOp(cm, function () {
- var ranges = cm.listSelections(), newSel = [];
- for (var i = 0; i < ranges.length; i++) {
- if (!ranges[i].empty()) { continue }
- var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
- if (line) {
- if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
- if (cur.ch > 0) {
- cur = new Pos(cur.line, cur.ch + 1);
- cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
- Pos(cur.line, cur.ch - 2), cur, "+transpose");
- } else if (cur.line > cm.doc.first) {
- var prev = getLine(cm.doc, cur.line - 1).text;
- if (prev) {
- cur = new Pos(cur.line, 1);
- cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
- prev.charAt(prev.length - 1),
- Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
- }
- }
- }
- newSel.push(new Range(cur, cur));
- }
- cm.setSelections(newSel);
- }); },
- newlineAndIndent: function (cm) { return runInOp(cm, function () {
- var sels = cm.listSelections();
- for (var i = sels.length - 1; i >= 0; i--)
- { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
- sels = cm.listSelections();
- for (var i$1 = 0; i$1 < sels.length; i$1++)
- { cm.indentLine(sels[i$1].from().line, null, true); }
- ensureCursorVisible(cm);
- }); },
- openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
- toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
- };
-
-
- function lineStart(cm, lineN) {
- var line = getLine(cm.doc, lineN);
- var visual = visualLine(line);
- if (visual != line) { lineN = lineNo(visual); }
- return endOfLine(true, cm, visual, lineN, 1)
- }
- function lineEnd(cm, lineN) {
- var line = getLine(cm.doc, lineN);
- var visual = visualLineEnd(line);
- if (visual != line) { lineN = lineNo(visual); }
- return endOfLine(true, cm, line, lineN, -1)
- }
- function lineStartSmart(cm, pos) {
- var start = lineStart(cm, pos.line);
- var line = getLine(cm.doc, start.line);
- var order = getOrder(line, cm.doc.direction);
- if (!order || order[0].level == 0) {
- var firstNonWS = Math.max(0, line.text.search(/\S/));
- var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
- return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
- }
- return start
- }
-
- // Run a handler that was bound to a key.
- function doHandleBinding(cm, bound, dropShift) {
- if (typeof bound == "string") {
- bound = commands[bound];
- if (!bound) { return false }
- }
- // Ensure previous input has been read, so that the handler sees a
- // consistent view of the document
- cm.display.input.ensurePolled();
- var prevShift = cm.display.shift, done = false;
- try {
- if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
- if (dropShift) { cm.display.shift = false; }
- done = bound(cm) != Pass;
- } finally {
- cm.display.shift = prevShift;
- cm.state.suppressEdits = false;
- }
- return done
- }
-
- function lookupKeyForEditor(cm, name, handle) {
- for (var i = 0; i < cm.state.keyMaps.length; i++) {
- var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
- if (result) { return result }
- }
- return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
- || lookupKey(name, cm.options.keyMap, handle, cm)
- }
-
- // Note that, despite the name, this function is also used to check
- // for bound mouse clicks.
-
- var stopSeq = new Delayed;
-
- function dispatchKey(cm, name, e, handle) {
- var seq = cm.state.keySeq;
- if (seq) {
- if (isModifierKey(name)) { return "handled" }
- if (/\'$/.test(name))
- { cm.state.keySeq = null; }
- else
- { stopSeq.set(50, function () {
- if (cm.state.keySeq == seq) {
- cm.state.keySeq = null;
- cm.display.input.reset();
- }
- }); }
- if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
- }
- return dispatchKeyInner(cm, name, e, handle)
- }
-
- function dispatchKeyInner(cm, name, e, handle) {
- var result = lookupKeyForEditor(cm, name, handle);
-
- if (result == "multi")
- { cm.state.keySeq = name; }
- if (result == "handled")
- { signalLater(cm, "keyHandled", cm, name, e); }
-
- if (result == "handled" || result == "multi") {
- e_preventDefault(e);
- restartBlink(cm);
- }
-
- return !!result
- }
-
- // Handle a key from the keydown event.
- function handleKeyBinding(cm, e) {
- var name = keyName(e, true);
- if (!name) { return false }
-
- if (e.shiftKey && !cm.state.keySeq) {
- // First try to resolve full name (including 'Shift-'). Failing
- // that, see if there is a cursor-motion command (starting with
- // 'go') bound to the keyname without 'Shift-'.
- return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
- || dispatchKey(cm, name, e, function (b) {
- if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
- { return doHandleBinding(cm, b) }
- })
- } else {
- return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
- }
- }
-
- // Handle a key from the keypress event
- function handleCharBinding(cm, e, ch) {
- return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
- }
-
- var lastStoppedKey = null;
- function onKeyDown(e) {
- var cm = this;
- cm.curOp.focus = activeElt();
- if (signalDOMEvent(cm, e)) { return }
- // IE does strange things with escape.
- if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
- var code = e.keyCode;
- cm.display.shift = code == 16 || e.shiftKey;
- var handled = handleKeyBinding(cm, e);
- if (presto) {
- lastStoppedKey = handled ? code : null;
- // Opera has no cut event... we try to at least catch the key combo
- if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
- { cm.replaceSelection("", null, "cut"); }
- }
-
- // Turn mouse into crosshair when Alt is held on Mac.
- if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
- { showCrossHair(cm); }
- }
-
- function showCrossHair(cm) {
- var lineDiv = cm.display.lineDiv;
- addClass(lineDiv, "CodeMirror-crosshair");
-
- function up(e) {
- if (e.keyCode == 18 || !e.altKey) {
- rmClass(lineDiv, "CodeMirror-crosshair");
- off(document, "keyup", up);
- off(document, "mouseover", up);
- }
- }
- on(document, "keyup", up);
- on(document, "mouseover", up);
- }
-
- function onKeyUp(e) {
- if (e.keyCode == 16) { this.doc.sel.shift = false; }
- signalDOMEvent(this, e);
- }
-
- function onKeyPress(e) {
- var cm = this;
- if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
- var keyCode = e.keyCode, charCode = e.charCode;
- if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
- if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
- var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
- // Some browsers fire keypress events for backspace
- if (ch == "\x08") { return }
- if (handleCharBinding(cm, e, ch)) { return }
- cm.display.input.onKeyPress(e);
- }
-
- var DOUBLECLICK_DELAY = 400;
-
- var PastClick = function(time, pos, button) {
- this.time = time;
- this.pos = pos;
- this.button = button;
- };
-
- PastClick.prototype.compare = function (time, pos, button) {
- return this.time + DOUBLECLICK_DELAY > time &&
- cmp(pos, this.pos) == 0 && button == this.button
- };
-
- var lastClick, lastDoubleClick;
- function clickRepeat(pos, button) {
- var now = +new Date;
- if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
- lastClick = lastDoubleClick = null;
- return "triple"
- } else if (lastClick && lastClick.compare(now, pos, button)) {
- lastDoubleClick = new PastClick(now, pos, button);
- lastClick = null;
- return "double"
- } else {
- lastClick = new PastClick(now, pos, button);
- lastDoubleClick = null;
- return "single"
- }
- }
-
- // A mouse down can be a single click, double click, triple click,
- // start of selection drag, start of text drag, new cursor
- // (ctrl-click), rectangle drag (alt-drag), or xwin
- // middle-click-paste. Or it might be a click on something we should
- // not interfere with, such as a scrollbar or widget.
- function onMouseDown(e) {
- var cm = this, display = cm.display;
- if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
- display.input.ensurePolled();
- display.shift = e.shiftKey;
-
- if (eventInWidget(display, e)) {
- if (!webkit) {
- // Briefly turn off draggability, to allow widgets to do
- // normal dragging things.
- display.scroller.draggable = false;
- setTimeout(function () { return display.scroller.draggable = true; }, 100);
- }
- return
- }
- if (clickInGutter(cm, e)) { return }
- var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
- window.focus();
-
- // #3261: make sure, that we're not starting a second selection
- if (button == 1 && cm.state.selectingText)
- { cm.state.selectingText(e); }
-
- if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }
-
- if (button == 1) {
- if (pos) { leftButtonDown(cm, pos, repeat, e); }
- else if (e_target(e) == display.scroller) { e_preventDefault(e); }
- } else if (button == 2) {
- if (pos) { extendSelection(cm.doc, pos); }
- setTimeout(function () { return display.input.focus(); }, 20);
- } else if (button == 3) {
- if (captureRightClick) { cm.display.input.onContextMenu(e); }
- else { delayBlurEvent(cm); }
- }
- }
-
- function handleMappedButton(cm, button, pos, repeat, event) {
- var name = "Click";
- if (repeat == "double") { name = "Double" + name; }
- else if (repeat == "triple") { name = "Triple" + name; }
- name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;
-
- return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {
- if (typeof bound == "string") { bound = commands[bound]; }
- if (!bound) { return false }
- var done = false;
- try {
- if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
- done = bound(cm, pos) != Pass;
- } finally {
- cm.state.suppressEdits = false;
- }
- return done
- })
- }
-
- function configureMouse(cm, repeat, event) {
- var option = cm.getOption("configureMouse");
- var value = option ? option(cm, repeat, event) : {};
- if (value.unit == null) {
- var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
- value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
- }
- if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
- if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
- if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
- return value
- }
-
- function leftButtonDown(cm, pos, repeat, event) {
- if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
- else { cm.curOp.focus = activeElt(); }
-
- var behavior = configureMouse(cm, repeat, event);
-
- var sel = cm.doc.sel, contained;
- if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
- repeat == "single" && (contained = sel.contains(pos)) > -1 &&
- (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
- (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
- { leftButtonStartDrag(cm, event, pos, behavior); }
- else
- { leftButtonSelect(cm, event, pos, behavior); }
- }
-
- // Start a text drag. When it ends, see if any dragging actually
- // happen, and treat as a click if it didn't.
- function leftButtonStartDrag(cm, event, pos, behavior) {
- var display = cm.display, moved = false;
- var dragEnd = operation(cm, function (e) {
- if (webkit) { display.scroller.draggable = false; }
- cm.state.draggingText = false;
- off(display.wrapper.ownerDocument, "mouseup", dragEnd);
- off(display.wrapper.ownerDocument, "mousemove", mouseMove);
- off(display.scroller, "dragstart", dragStart);
- off(display.scroller, "drop", dragEnd);
- if (!moved) {
- e_preventDefault(e);
- if (!behavior.addNew)
- { extendSelection(cm.doc, pos, null, null, behavior.extend); }
- // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
- if (webkit || ie && ie_version == 9)
- { setTimeout(function () {display.wrapper.ownerDocument.body.focus(); display.input.focus();}, 20); }
- else
- { display.input.focus(); }
- }
- });
- var mouseMove = function(e2) {
- moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
- };
- var dragStart = function () { return moved = true; };
- // Let the drag handler handle this.
- if (webkit) { display.scroller.draggable = true; }
- cm.state.draggingText = dragEnd;
- dragEnd.copy = !behavior.moveOnDrag;
- // IE's approach to draggable
- if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
- on(display.wrapper.ownerDocument, "mouseup", dragEnd);
- on(display.wrapper.ownerDocument, "mousemove", mouseMove);
- on(display.scroller, "dragstart", dragStart);
- on(display.scroller, "drop", dragEnd);
-
- delayBlurEvent(cm);
- setTimeout(function () { return display.input.focus(); }, 20);
- }
-
- function rangeForUnit(cm, pos, unit) {
- if (unit == "char") { return new Range(pos, pos) }
- if (unit == "word") { return cm.findWordAt(pos) }
- if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
- var result = unit(cm, pos);
- return new Range(result.from, result.to)
- }
-
- // Normal selection, as opposed to text dragging.
- function leftButtonSelect(cm, event, start, behavior) {
- var display = cm.display, doc = cm.doc;
- e_preventDefault(event);
-
- var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
- if (behavior.addNew && !behavior.extend) {
- ourIndex = doc.sel.contains(start);
- if (ourIndex > -1)
- { ourRange = ranges[ourIndex]; }
- else
- { ourRange = new Range(start, start); }
- } else {
- ourRange = doc.sel.primary();
- ourIndex = doc.sel.primIndex;
- }
-
- if (behavior.unit == "rectangle") {
- if (!behavior.addNew) { ourRange = new Range(start, start); }
- start = posFromMouse(cm, event, true, true);
- ourIndex = -1;
- } else {
- var range$$1 = rangeForUnit(cm, start, behavior.unit);
- if (behavior.extend)
- { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }
- else
- { ourRange = range$$1; }
- }
-
- if (!behavior.addNew) {
- ourIndex = 0;
- setSelection(doc, new Selection([ourRange], 0), sel_mouse);
- startSel = doc.sel;
- } else if (ourIndex == -1) {
- ourIndex = ranges.length;
- setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
- {scroll: false, origin: "*mouse"});
- } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
- setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
- {scroll: false, origin: "*mouse"});
- startSel = doc.sel;
- } else {
- replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
- }
-
- var lastPos = start;
- function extendTo(pos) {
- if (cmp(lastPos, pos) == 0) { return }
- lastPos = pos;
-
- if (behavior.unit == "rectangle") {
- var ranges = [], tabSize = cm.options.tabSize;
- var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
- var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
- var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
- for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
- line <= end; line++) {
- var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
- if (left == right)
- { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
- else if (text.length > leftPos)
- { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
- }
- if (!ranges.length) { ranges.push(new Range(start, start)); }
- setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
- {origin: "*mouse", scroll: false});
- cm.scrollIntoView(pos);
- } else {
- var oldRange = ourRange;
- var range$$1 = rangeForUnit(cm, pos, behavior.unit);
- var anchor = oldRange.anchor, head;
- if (cmp(range$$1.anchor, anchor) > 0) {
- head = range$$1.head;
- anchor = minPos(oldRange.from(), range$$1.anchor);
- } else {
- head = range$$1.anchor;
- anchor = maxPos(oldRange.to(), range$$1.head);
- }
- var ranges$1 = startSel.ranges.slice(0);
- ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
- setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
- }
- }
-
- var editorSize = display.wrapper.getBoundingClientRect();
- // Used to ensure timeout re-tries don't fire when another extend
- // happened in the meantime (clearTimeout isn't reliable -- at
- // least on Chrome, the timeouts still happen even when cleared,
- // if the clear happens after their scheduled firing time).
- var counter = 0;
-
- function extend(e) {
- var curCount = ++counter;
- var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
- if (!cur) { return }
- if (cmp(cur, lastPos) != 0) {
- cm.curOp.focus = activeElt();
- extendTo(cur);
- var visible = visibleLines(display, doc);
- if (cur.line >= visible.to || cur.line < visible.from)
- { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
- } else {
- var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
- if (outside) { setTimeout(operation(cm, function () {
- if (counter != curCount) { return }
- display.scroller.scrollTop += outside;
- extend(e);
- }), 50); }
- }
- }
-
- function done(e) {
- cm.state.selectingText = false;
- counter = Infinity;
- e_preventDefault(e);
- display.input.focus();
- off(display.wrapper.ownerDocument, "mousemove", move);
- off(display.wrapper.ownerDocument, "mouseup", up);
- doc.history.lastSelOrigin = null;
- }
-
- var move = operation(cm, function (e) {
- if (e.buttons === 0 || !e_button(e)) { done(e); }
- else { extend(e); }
- });
- var up = operation(cm, done);
- cm.state.selectingText = up;
- on(display.wrapper.ownerDocument, "mousemove", move);
- on(display.wrapper.ownerDocument, "mouseup", up);
- }
-
- // Used when mouse-selecting to adjust the anchor to the proper side
- // of a bidi jump depending on the visual position of the head.
- function bidiSimplify(cm, range$$1) {
- var anchor = range$$1.anchor;
- var head = range$$1.head;
- var anchorLine = getLine(cm.doc, anchor.line);
- if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 }
- var order = getOrder(anchorLine);
- if (!order) { return range$$1 }
- var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
- if (part.from != anchor.ch && part.to != anchor.ch) { return range$$1 }
- var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
- if (boundary == 0 || boundary == order.length) { return range$$1 }
-
- // Compute the relative visual position of the head compared to the
- // anchor (<0 is to the left, >0 to the right)
- var leftSide;
- if (head.line != anchor.line) {
- leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
- } else {
- var headIndex = getBidiPartAt(order, head.ch, head.sticky);
- var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
- if (headIndex == boundary - 1 || headIndex == boundary)
- { leftSide = dir < 0; }
- else
- { leftSide = dir > 0; }
- }
-
- var usePart = order[boundary + (leftSide ? -1 : 0)];
- var from = leftSide == (usePart.level == 1);
- var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
- return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head)
- }
-
-
- // Determines whether an event happened in the gutter, and fires the
- // handlers for the corresponding event.
- function gutterEvent(cm, e, type, prevent) {
- var mX, mY;
- if (e.touches) {
- mX = e.touches[0].clientX;
- mY = e.touches[0].clientY;
- } else {
- try { mX = e.clientX; mY = e.clientY; }
- catch(e) { return false }
- }
- if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
- if (prevent) { e_preventDefault(e); }
-
- var display = cm.display;
- var lineBox = display.lineDiv.getBoundingClientRect();
-
- if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
- mY -= lineBox.top - display.viewOffset;
-
- for (var i = 0; i < cm.options.gutters.length; ++i) {
- var g = display.gutters.childNodes[i];
- if (g && g.getBoundingClientRect().right >= mX) {
- var line = lineAtHeight(cm.doc, mY);
- var gutter = cm.options.gutters[i];
- signal(cm, type, cm, line, gutter, e);
- return e_defaultPrevented(e)
- }
- }
- }
-
- function clickInGutter(cm, e) {
- return gutterEvent(cm, e, "gutterClick", true)
- }
-
- // CONTEXT MENU HANDLING
-
- // To make the context menu work, we need to briefly unhide the
- // textarea (making it as unobtrusive as possible) to let the
- // right-click take effect on it.
- function onContextMenu(cm, e) {
- if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
- if (signalDOMEvent(cm, e, "contextmenu")) { return }
- if (!captureRightClick) { cm.display.input.onContextMenu(e); }
- }
-
- function contextMenuInGutter(cm, e) {
- if (!hasHandler(cm, "gutterContextMenu")) { return false }
- return gutterEvent(cm, e, "gutterContextMenu", false)
- }
-
- function themeChanged(cm) {
- cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
- cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
- clearCaches(cm);
- }
-
- var Init = {toString: function(){return "CodeMirror.Init"}};
-
- var defaults = {};
- var optionHandlers = {};
-
- function defineOptions(CodeMirror) {
- var optionHandlers = CodeMirror.optionHandlers;
-
- function option(name, deflt, handle, notOnInit) {
- CodeMirror.defaults[name] = deflt;
- if (handle) { optionHandlers[name] =
- notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
- }
-
- CodeMirror.defineOption = option;
-
- // Passed to option handlers when there is no old value.
- CodeMirror.Init = Init;
-
- // These two are, on init, called from the constructor because they
- // have to be initialized before the editor can start at all.
- option("value", "", function (cm, val) { return cm.setValue(val); }, true);
- option("mode", null, function (cm, val) {
- cm.doc.modeOption = val;
- loadMode(cm);
- }, true);
-
- option("indentUnit", 2, loadMode, true);
- option("indentWithTabs", false);
- option("smartIndent", true);
- option("tabSize", 4, function (cm) {
- resetModeState(cm);
- clearCaches(cm);
- regChange(cm);
- }, true);
-
- option("lineSeparator", null, function (cm, val) {
- cm.doc.lineSep = val;
- if (!val) { return }
- var newBreaks = [], lineNo = cm.doc.first;
- cm.doc.iter(function (line) {
- for (var pos = 0;;) {
- var found = line.text.indexOf(val, pos);
- if (found == -1) { break }
- pos = found + val.length;
- newBreaks.push(Pos(lineNo, found));
- }
- lineNo++;
- });
- for (var i = newBreaks.length - 1; i >= 0; i--)
- { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
- });
- option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
- cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
- if (old != Init) { cm.refresh(); }
- });
- option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
- option("electricChars", true);
- option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
- throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
- }, true);
- option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
- option("rtlMoveVisually", !windows);
- option("wholeLineUpdateBefore", true);
-
- option("theme", "default", function (cm) {
- themeChanged(cm);
- guttersChanged(cm);
- }, true);
- option("keyMap", "default", function (cm, val, old) {
- var next = getKeyMap(val);
- var prev = old != Init && getKeyMap(old);
- if (prev && prev.detach) { prev.detach(cm, next); }
- if (next.attach) { next.attach(cm, prev || null); }
- });
- option("extraKeys", null);
- option("configureMouse", null);
-
- option("lineWrapping", false, wrappingChanged, true);
- option("gutters", [], function (cm) {
- setGuttersForLineNumbers(cm.options);
- guttersChanged(cm);
- }, true);
- option("fixedGutter", true, function (cm, val) {
- cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
- cm.refresh();
- }, true);
- option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
- option("scrollbarStyle", "native", function (cm) {
- initScrollbars(cm);
- updateScrollbars(cm);
- cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
- cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
- }, true);
- option("lineNumbers", false, function (cm) {
- setGuttersForLineNumbers(cm.options);
- guttersChanged(cm);
- }, true);
- option("firstLineNumber", 1, guttersChanged, true);
- option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true);
- option("showCursorWhenSelecting", false, updateSelection, true);
-
- option("resetSelectionOnContextMenu", true);
- option("lineWiseCopyCut", true);
- option("pasteLinesPerSelection", true);
- option("selectionsMayTouch", false);
-
- option("readOnly", false, function (cm, val) {
- if (val == "nocursor") {
- onBlur(cm);
- cm.display.input.blur();
- }
- cm.display.input.readOnlyChanged(val);
- });
- option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
- option("dragDrop", true, dragDropChanged);
- option("allowDropFileTypes", null);
-
- option("cursorBlinkRate", 530);
- option("cursorScrollMargin", 0);
- option("cursorHeight", 1, updateSelection, true);
- option("singleCursorHeightPerLine", true, updateSelection, true);
- option("workTime", 100);
- option("workDelay", 100);
- option("flattenSpans", true, resetModeState, true);
- option("addModeClass", false, resetModeState, true);
- option("pollInterval", 100);
- option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
- option("historyEventDelay", 1250);
- option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
- option("maxHighlightLength", 10000, resetModeState, true);
- option("moveInputWithCursor", true, function (cm, val) {
- if (!val) { cm.display.input.resetPosition(); }
- });
-
- option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
- option("autofocus", null);
- option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
- option("phrases", null);
- }
-
- function guttersChanged(cm) {
- updateGutters(cm);
- regChange(cm);
- alignHorizontally(cm);
- }
-
- function dragDropChanged(cm, value, old) {
- var wasOn = old && old != Init;
- if (!value != !wasOn) {
- var funcs = cm.display.dragFunctions;
- var toggle = value ? on : off;
- toggle(cm.display.scroller, "dragstart", funcs.start);
- toggle(cm.display.scroller, "dragenter", funcs.enter);
- toggle(cm.display.scroller, "dragover", funcs.over);
- toggle(cm.display.scroller, "dragleave", funcs.leave);
- toggle(cm.display.scroller, "drop", funcs.drop);
- }
- }
-
- function wrappingChanged(cm) {
- if (cm.options.lineWrapping) {
- addClass(cm.display.wrapper, "CodeMirror-wrap");
- cm.display.sizer.style.minWidth = "";
- cm.display.sizerWidth = null;
- } else {
- rmClass(cm.display.wrapper, "CodeMirror-wrap");
- findMaxLine(cm);
- }
- estimateLineHeights(cm);
- regChange(cm);
- clearCaches(cm);
- setTimeout(function () { return updateScrollbars(cm); }, 100);
- }
-
- // A CodeMirror instance represents an editor. This is the object
- // that user code is usually dealing with.
-
- function CodeMirror(place, options) {
- var this$1 = this;
-
- if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
-
- this.options = options = options ? copyObj(options) : {};
- // Determine effective options based on given values and defaults.
- copyObj(defaults, options, false);
- setGuttersForLineNumbers(options);
-
- var doc = options.value;
- if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
- else if (options.mode) { doc.modeOption = options.mode; }
- this.doc = doc;
-
- var input = new CodeMirror.inputStyles[options.inputStyle](this);
- var display = this.display = new Display(place, doc, input);
- display.wrapper.CodeMirror = this;
- updateGutters(this);
- themeChanged(this);
- if (options.lineWrapping)
- { this.display.wrapper.className += " CodeMirror-wrap"; }
- initScrollbars(this);
-
- this.state = {
- keyMaps: [], // stores maps added by addKeyMap
- overlays: [], // highlighting overlays, as added by addOverlay
- modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
- overwrite: false,
- delayingBlurEvent: false,
- focused: false,
- suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
- pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
- selectingText: false,
- draggingText: false,
- highlight: new Delayed(), // stores highlight worker timeout
- keySeq: null, // Unfinished key sequence
- specialChars: null
- };
-
- if (options.autofocus && !mobile) { display.input.focus(); }
-
- // Override magic textarea content restore that IE sometimes does
- // on our hidden textarea on reload
- if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
-
- registerEventHandlers(this);
- ensureGlobalHandlers();
-
- startOperation(this);
- this.curOp.forceUpdate = true;
- attachDoc(this, doc);
-
- if ((options.autofocus && !mobile) || this.hasFocus())
- { setTimeout(bind(onFocus, this), 20); }
- else
- { onBlur(this); }
-
- for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
- { optionHandlers[opt](this$1, options[opt], Init); } }
- maybeUpdateLineNumberWidth(this);
- if (options.finishInit) { options.finishInit(this); }
- for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
- endOperation(this);
- // Suppress optimizelegibility in Webkit, since it breaks text
- // measuring on line wrapping boundaries.
- if (webkit && options.lineWrapping &&
- getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
- { display.lineDiv.style.textRendering = "auto"; }
- }
-
- // The default configuration options.
- CodeMirror.defaults = defaults;
- // Functions to run when options are changed.
- CodeMirror.optionHandlers = optionHandlers;
-
- // Attach the necessary event handlers when initializing the editor
- function registerEventHandlers(cm) {
- var d = cm.display;
- on(d.scroller, "mousedown", operation(cm, onMouseDown));
- // Older IE's will not fire a second mousedown for a double click
- if (ie && ie_version < 11)
- { on(d.scroller, "dblclick", operation(cm, function (e) {
- if (signalDOMEvent(cm, e)) { return }
- var pos = posFromMouse(cm, e);
- if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
- e_preventDefault(e);
- var word = cm.findWordAt(pos);
- extendSelection(cm.doc, word.anchor, word.head);
- })); }
- else
- { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
- // Some browsers fire contextmenu *after* opening the menu, at
- // which point we can't mess with it anymore. Context menu is
- // handled in onMouseDown for these browsers.
- on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
-
- // Used to suppress mouse event handling when a touch happens
- var touchFinished, prevTouch = {end: 0};
- function finishTouch() {
- if (d.activeTouch) {
- touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
- prevTouch = d.activeTouch;
- prevTouch.end = +new Date;
- }
- }
- function isMouseLikeTouchEvent(e) {
- if (e.touches.length != 1) { return false }
- var touch = e.touches[0];
- return touch.radiusX <= 1 && touch.radiusY <= 1
- }
- function farAway(touch, other) {
- if (other.left == null) { return true }
- var dx = other.left - touch.left, dy = other.top - touch.top;
- return dx * dx + dy * dy > 20 * 20
- }
- on(d.scroller, "touchstart", function (e) {
- if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
- d.input.ensurePolled();
- clearTimeout(touchFinished);
- var now = +new Date;
- d.activeTouch = {start: now, moved: false,
- prev: now - prevTouch.end <= 300 ? prevTouch : null};
- if (e.touches.length == 1) {
- d.activeTouch.left = e.touches[0].pageX;
- d.activeTouch.top = e.touches[0].pageY;
- }
- }
- });
- on(d.scroller, "touchmove", function () {
- if (d.activeTouch) { d.activeTouch.moved = true; }
- });
- on(d.scroller, "touchend", function (e) {
- var touch = d.activeTouch;
- if (touch && !eventInWidget(d, e) && touch.left != null &&
- !touch.moved && new Date - touch.start < 300) {
- var pos = cm.coordsChar(d.activeTouch, "page"), range;
- if (!touch.prev || farAway(touch, touch.prev)) // Single tap
- { range = new Range(pos, pos); }
- else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
- { range = cm.findWordAt(pos); }
- else // Triple tap
- { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
- cm.setSelection(range.anchor, range.head);
- cm.focus();
- e_preventDefault(e);
- }
- finishTouch();
- });
- on(d.scroller, "touchcancel", finishTouch);
-
- // Sync scrolling between fake scrollbars and real scrollable
- // area, ensure viewport is updated when scrolling.
- on(d.scroller, "scroll", function () {
- if (d.scroller.clientHeight) {
- updateScrollTop(cm, d.scroller.scrollTop);
- setScrollLeft(cm, d.scroller.scrollLeft, true);
- signal(cm, "scroll", cm);
- }
- });
-
- // Listen to wheel events in order to try and update the viewport on time.
- on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
- on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
-
- // Prevent wrapper from ever scrolling
- on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
-
- d.dragFunctions = {
- enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
- over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
- start: function (e) { return onDragStart(cm, e); },
- drop: operation(cm, onDrop),
- leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
- };
-
- var inp = d.input.getField();
- on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
- on(inp, "keydown", operation(cm, onKeyDown));
- on(inp, "keypress", operation(cm, onKeyPress));
- on(inp, "focus", function (e) { return onFocus(cm, e); });
- on(inp, "blur", function (e) { return onBlur(cm, e); });
- }
-
- var initHooks = [];
- CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
-
- // Indent the given line. The how parameter can be "smart",
- // "add"/null, "subtract", or "prev". When aggressive is false
- // (typically set to true for forced single-line indents), empty
- // lines are not indented, and places where the mode returns Pass
- // are left alone.
- function indentLine(cm, n, how, aggressive) {
- var doc = cm.doc, state;
- if (how == null) { how = "add"; }
- if (how == "smart") {
- // Fall back to "prev" when the mode doesn't have an indentation
- // method.
- if (!doc.mode.indent) { how = "prev"; }
- else { state = getContextBefore(cm, n).state; }
- }
-
- var tabSize = cm.options.tabSize;
- var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
- if (line.stateAfter) { line.stateAfter = null; }
- var curSpaceString = line.text.match(/^\s*/)[0], indentation;
- if (!aggressive && !/\S/.test(line.text)) {
- indentation = 0;
- how = "not";
- } else if (how == "smart") {
- indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
- if (indentation == Pass || indentation > 150) {
- if (!aggressive) { return }
- how = "prev";
- }
- }
- if (how == "prev") {
- if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
- else { indentation = 0; }
- } else if (how == "add") {
- indentation = curSpace + cm.options.indentUnit;
- } else if (how == "subtract") {
- indentation = curSpace - cm.options.indentUnit;
- } else if (typeof how == "number") {
- indentation = curSpace + how;
- }
- indentation = Math.max(0, indentation);
-
- var indentString = "", pos = 0;
- if (cm.options.indentWithTabs)
- { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
- if (pos < indentation) { indentString += spaceStr(indentation - pos); }
-
- if (indentString != curSpaceString) {
- replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
- line.stateAfter = null;
- return true
- } else {
- // Ensure that, if the cursor was in the whitespace at the start
- // of the line, it is moved to the end of that space.
- for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
- var range = doc.sel.ranges[i$1];
- if (range.head.line == n && range.head.ch < curSpaceString.length) {
- var pos$1 = Pos(n, curSpaceString.length);
- replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
- break
- }
- }
- }
- }
-
- // This will be set to a {lineWise: bool, text: [string]} object, so
- // that, when pasting, we know what kind of selections the copied
- // text was made out of.
- var lastCopied = null;
-
- function setLastCopied(newLastCopied) {
- lastCopied = newLastCopied;
- }
-
- function applyTextInput(cm, inserted, deleted, sel, origin) {
- var doc = cm.doc;
- cm.display.shift = false;
- if (!sel) { sel = doc.sel; }
-
- var paste = cm.state.pasteIncoming || origin == "paste";
- var textLines = splitLinesAuto(inserted), multiPaste = null;
- // When pasting N lines into N selections, insert one line per selection
- if (paste && sel.ranges.length > 1) {
- if (lastCopied && lastCopied.text.join("\n") == inserted) {
- if (sel.ranges.length % lastCopied.text.length == 0) {
- multiPaste = [];
- for (var i = 0; i < lastCopied.text.length; i++)
- { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
- }
- } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
- multiPaste = map(textLines, function (l) { return [l]; });
- }
- }
-
- var updateInput;
- // Normal behavior is to insert the new text into every selection
- for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
- var range$$1 = sel.ranges[i$1];
- var from = range$$1.from(), to = range$$1.to();
- if (range$$1.empty()) {
- if (deleted && deleted > 0) // Handle deletion
- { from = Pos(from.line, from.ch - deleted); }
- else if (cm.state.overwrite && !paste) // Handle overwrite
- { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
- else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
- { from = to = Pos(from.line, 0); }
- }
- updateInput = cm.curOp.updateInput;
- var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
- origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
- makeChange(cm.doc, changeEvent);
- signalLater(cm, "inputRead", cm, changeEvent);
- }
- if (inserted && !paste)
- { triggerElectric(cm, inserted); }
-
- ensureCursorVisible(cm);
- cm.curOp.updateInput = updateInput;
- cm.curOp.typing = true;
- cm.state.pasteIncoming = cm.state.cutIncoming = false;
- }
-
- function handlePaste(e, cm) {
- var pasted = e.clipboardData && e.clipboardData.getData("Text");
- if (pasted) {
- e.preventDefault();
- if (!cm.isReadOnly() && !cm.options.disableInput)
- { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
- return true
- }
- }
-
- function triggerElectric(cm, inserted) {
- // When an 'electric' character is inserted, immediately trigger a reindent
- if (!cm.options.electricChars || !cm.options.smartIndent) { return }
- var sel = cm.doc.sel;
-
- for (var i = sel.ranges.length - 1; i >= 0; i--) {
- var range$$1 = sel.ranges[i];
- if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
- var mode = cm.getModeAt(range$$1.head);
- var indented = false;
- if (mode.electricChars) {
- for (var j = 0; j < mode.electricChars.length; j++)
- { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
- indented = indentLine(cm, range$$1.head.line, "smart");
- break
- } }
- } else if (mode.electricInput) {
- if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
- { indented = indentLine(cm, range$$1.head.line, "smart"); }
- }
- if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
- }
- }
-
- function copyableRanges(cm) {
- var text = [], ranges = [];
- for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
- var line = cm.doc.sel.ranges[i].head.line;
- var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
- ranges.push(lineRange);
- text.push(cm.getRange(lineRange.anchor, lineRange.head));
- }
- return {text: text, ranges: ranges}
- }
-
- function disableBrowserMagic(field, spellcheck) {
- field.setAttribute("autocorrect", "off");
- field.setAttribute("autocapitalize", "off");
- field.setAttribute("spellcheck", !!spellcheck);
- }
-
- function hiddenTextarea() {
- var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
- var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
- // The textarea is kept positioned near the cursor to prevent the
- // fact that it'll be scrolled into view on input from scrolling
- // our fake cursor out of view. On webkit, when wrap=off, paste is
- // very slow. So make the area wide instead.
- if (webkit) { te.style.width = "1000px"; }
- else { te.setAttribute("wrap", "off"); }
- // If border: 0; -- iOS fails to open keyboard (issue #1287)
- if (ios) { te.style.border = "1px solid black"; }
- disableBrowserMagic(te);
- return div
- }
-
- // The publicly visible API. Note that methodOp(f) means
- // 'wrap f in an operation, performed on its `this` parameter'.
-
- // This is not the complete set of editor methods. Most of the
- // methods defined on the Doc type are also injected into
- // CodeMirror.prototype, for backwards compatibility and
- // convenience.
-
- function addEditorMethods(CodeMirror) {
- var optionHandlers = CodeMirror.optionHandlers;
-
- var helpers = CodeMirror.helpers = {};
-
- CodeMirror.prototype = {
- constructor: CodeMirror,
- focus: function(){window.focus(); this.display.input.focus();},
-
- setOption: function(option, value) {
- var options = this.options, old = options[option];
- if (options[option] == value && option != "mode") { return }
- options[option] = value;
- if (optionHandlers.hasOwnProperty(option))
- { operation(this, optionHandlers[option])(this, value, old); }
- signal(this, "optionChange", this, option);
- },
-
- getOption: function(option) {return this.options[option]},
- getDoc: function() {return this.doc},
-
- addKeyMap: function(map$$1, bottom) {
- this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
- },
- removeKeyMap: function(map$$1) {
- var maps = this.state.keyMaps;
- for (var i = 0; i < maps.length; ++i)
- { if (maps[i] == map$$1 || maps[i].name == map$$1) {
- maps.splice(i, 1);
- return true
- } }
- },
-
- addOverlay: methodOp(function(spec, options) {
- var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
- if (mode.startState) { throw new Error("Overlays may not be stateful.") }
- insertSorted(this.state.overlays,
- {mode: mode, modeSpec: spec, opaque: options && options.opaque,
- priority: (options && options.priority) || 0},
- function (overlay) { return overlay.priority; });
- this.state.modeGen++;
- regChange(this);
- }),
- removeOverlay: methodOp(function(spec) {
- var this$1 = this;
-
- var overlays = this.state.overlays;
- for (var i = 0; i < overlays.length; ++i) {
- var cur = overlays[i].modeSpec;
- if (cur == spec || typeof spec == "string" && cur.name == spec) {
- overlays.splice(i, 1);
- this$1.state.modeGen++;
- regChange(this$1);
- return
- }
- }
- }),
-
- indentLine: methodOp(function(n, dir, aggressive) {
- if (typeof dir != "string" && typeof dir != "number") {
- if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
- else { dir = dir ? "add" : "subtract"; }
- }
- if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
- }),
- indentSelection: methodOp(function(how) {
- var this$1 = this;
-
- var ranges = this.doc.sel.ranges, end = -1;
- for (var i = 0; i < ranges.length; i++) {
- var range$$1 = ranges[i];
- if (!range$$1.empty()) {
- var from = range$$1.from(), to = range$$1.to();
- var start = Math.max(end, from.line);
- end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
- for (var j = start; j < end; ++j)
- { indentLine(this$1, j, how); }
- var newRanges = this$1.doc.sel.ranges;
- if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
- { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
- } else if (range$$1.head.line > end) {
- indentLine(this$1, range$$1.head.line, how, true);
- end = range$$1.head.line;
- if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
- }
- }
- }),
-
- // Fetch the parser token for a given character. Useful for hacks
- // that want to inspect the mode state (say, for completion).
- getTokenAt: function(pos, precise) {
- return takeToken(this, pos, precise)
- },
-
- getLineTokens: function(line, precise) {
- return takeToken(this, Pos(line), precise, true)
- },
-
- getTokenTypeAt: function(pos) {
- pos = clipPos(this.doc, pos);
- var styles = getLineStyles(this, getLine(this.doc, pos.line));
- var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
- var type;
- if (ch == 0) { type = styles[2]; }
- else { for (;;) {
- var mid = (before + after) >> 1;
- if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
- else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
- else { type = styles[mid * 2 + 2]; break }
- } }
- var cut = type ? type.indexOf("overlay ") : -1;
- return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
- },
-
- getModeAt: function(pos) {
- var mode = this.doc.mode;
- if (!mode.innerMode) { return mode }
- return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
- },
-
- getHelper: function(pos, type) {
- return this.getHelpers(pos, type)[0]
- },
-
- getHelpers: function(pos, type) {
- var this$1 = this;
-
- var found = [];
- if (!helpers.hasOwnProperty(type)) { return found }
- var help = helpers[type], mode = this.getModeAt(pos);
- if (typeof mode[type] == "string") {
- if (help[mode[type]]) { found.push(help[mode[type]]); }
- } else if (mode[type]) {
- for (var i = 0; i < mode[type].length; i++) {
- var val = help[mode[type][i]];
- if (val) { found.push(val); }
- }
- } else if (mode.helperType && help[mode.helperType]) {
- found.push(help[mode.helperType]);
- } else if (help[mode.name]) {
- found.push(help[mode.name]);
- }
- for (var i$1 = 0; i$1 < help._global.length; i$1++) {
- var cur = help._global[i$1];
- if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
- { found.push(cur.val); }
- }
- return found
- },
-
- getStateAfter: function(line, precise) {
- var doc = this.doc;
- line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
- return getContextBefore(this, line + 1, precise).state
- },
-
- cursorCoords: function(start, mode) {
- var pos, range$$1 = this.doc.sel.primary();
- if (start == null) { pos = range$$1.head; }
- else if (typeof start == "object") { pos = clipPos(this.doc, start); }
- else { pos = start ? range$$1.from() : range$$1.to(); }
- return cursorCoords(this, pos, mode || "page")
- },
-
- charCoords: function(pos, mode) {
- return charCoords(this, clipPos(this.doc, pos), mode || "page")
- },
-
- coordsChar: function(coords, mode) {
- coords = fromCoordSystem(this, coords, mode || "page");
- return coordsChar(this, coords.left, coords.top)
- },
-
- lineAtHeight: function(height, mode) {
- height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
- return lineAtHeight(this.doc, height + this.display.viewOffset)
- },
- heightAtLine: function(line, mode, includeWidgets) {
- var end = false, lineObj;
- if (typeof line == "number") {
- var last = this.doc.first + this.doc.size - 1;
- if (line < this.doc.first) { line = this.doc.first; }
- else if (line > last) { line = last; end = true; }
- lineObj = getLine(this.doc, line);
- } else {
- lineObj = line;
- }
- return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
- (end ? this.doc.height - heightAtLine(lineObj) : 0)
- },
-
- defaultTextHeight: function() { return textHeight(this.display) },
- defaultCharWidth: function() { return charWidth(this.display) },
-
- getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
-
- addWidget: function(pos, node, scroll, vert, horiz) {
- var display = this.display;
- pos = cursorCoords(this, clipPos(this.doc, pos));
- var top = pos.bottom, left = pos.left;
- node.style.position = "absolute";
- node.setAttribute("cm-ignore-events", "true");
- this.display.input.setUneditable(node);
- display.sizer.appendChild(node);
- if (vert == "over") {
- top = pos.top;
- } else if (vert == "above" || vert == "near") {
- var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
- hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
- // Default to positioning above (if specified and possible); otherwise default to positioning below
- if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
- { top = pos.top - node.offsetHeight; }
- else if (pos.bottom + node.offsetHeight <= vspace)
- { top = pos.bottom; }
- if (left + node.offsetWidth > hspace)
- { left = hspace - node.offsetWidth; }
- }
- node.style.top = top + "px";
- node.style.left = node.style.right = "";
- if (horiz == "right") {
- left = display.sizer.clientWidth - node.offsetWidth;
- node.style.right = "0px";
- } else {
- if (horiz == "left") { left = 0; }
- else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
- node.style.left = left + "px";
- }
- if (scroll)
- { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
- },
-
- triggerOnKeyDown: methodOp(onKeyDown),
- triggerOnKeyPress: methodOp(onKeyPress),
- triggerOnKeyUp: onKeyUp,
- triggerOnMouseDown: methodOp(onMouseDown),
-
- execCommand: function(cmd) {
- if (commands.hasOwnProperty(cmd))
- { return commands[cmd].call(null, this) }
- },
-
- triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
-
- findPosH: function(from, amount, unit, visually) {
- var this$1 = this;
-
- var dir = 1;
- if (amount < 0) { dir = -1; amount = -amount; }
- var cur = clipPos(this.doc, from);
- for (var i = 0; i < amount; ++i) {
- cur = findPosH(this$1.doc, cur, dir, unit, visually);
- if (cur.hitSide) { break }
- }
- return cur
- },
-
- moveH: methodOp(function(dir, unit) {
- var this$1 = this;
-
- this.extendSelectionsBy(function (range$$1) {
- if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
- { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
- else
- { return dir < 0 ? range$$1.from() : range$$1.to() }
- }, sel_move);
- }),
-
- deleteH: methodOp(function(dir, unit) {
- var sel = this.doc.sel, doc = this.doc;
- if (sel.somethingSelected())
- { doc.replaceSelection("", null, "+delete"); }
- else
- { deleteNearSelection(this, function (range$$1) {
- var other = findPosH(doc, range$$1.head, dir, unit, false);
- return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
- }); }
- }),
-
- findPosV: function(from, amount, unit, goalColumn) {
- var this$1 = this;
-
- var dir = 1, x = goalColumn;
- if (amount < 0) { dir = -1; amount = -amount; }
- var cur = clipPos(this.doc, from);
- for (var i = 0; i < amount; ++i) {
- var coords = cursorCoords(this$1, cur, "div");
- if (x == null) { x = coords.left; }
- else { coords.left = x; }
- cur = findPosV(this$1, coords, dir, unit);
- if (cur.hitSide) { break }
- }
- return cur
- },
-
- moveV: methodOp(function(dir, unit) {
- var this$1 = this;
-
- var doc = this.doc, goals = [];
- var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
- doc.extendSelectionsBy(function (range$$1) {
- if (collapse)
- { return dir < 0 ? range$$1.from() : range$$1.to() }
- var headPos = cursorCoords(this$1, range$$1.head, "div");
- if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
- goals.push(headPos.left);
- var pos = findPosV(this$1, headPos, dir, unit);
- if (unit == "page" && range$$1 == doc.sel.primary())
- { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
- return pos
- }, sel_move);
- if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
- { doc.sel.ranges[i].goalColumn = goals[i]; } }
- }),
-
- // Find the word at the given position (as returned by coordsChar).
- findWordAt: function(pos) {
- var doc = this.doc, line = getLine(doc, pos.line).text;
- var start = pos.ch, end = pos.ch;
- if (line) {
- var helper = this.getHelper(pos, "wordChars");
- if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
- var startChar = line.charAt(start);
- var check = isWordChar(startChar, helper)
- ? function (ch) { return isWordChar(ch, helper); }
- : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
- : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
- while (start > 0 && check(line.charAt(start - 1))) { --start; }
- while (end < line.length && check(line.charAt(end))) { ++end; }
- }
- return new Range(Pos(pos.line, start), Pos(pos.line, end))
- },
-
- toggleOverwrite: function(value) {
- if (value != null && value == this.state.overwrite) { return }
- if (this.state.overwrite = !this.state.overwrite)
- { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
- else
- { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
-
- signal(this, "overwriteToggle", this, this.state.overwrite);
- },
- hasFocus: function() { return this.display.input.getField() == activeElt() },
- isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
-
- scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
- getScrollInfo: function() {
- var scroller = this.display.scroller;
- return {left: scroller.scrollLeft, top: scroller.scrollTop,
- height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
- width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
- clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
- },
-
- scrollIntoView: methodOp(function(range$$1, margin) {
- if (range$$1 == null) {
- range$$1 = {from: this.doc.sel.primary().head, to: null};
- if (margin == null) { margin = this.options.cursorScrollMargin; }
- } else if (typeof range$$1 == "number") {
- range$$1 = {from: Pos(range$$1, 0), to: null};
- } else if (range$$1.from == null) {
- range$$1 = {from: range$$1, to: null};
- }
- if (!range$$1.to) { range$$1.to = range$$1.from; }
- range$$1.margin = margin || 0;
-
- if (range$$1.from.line != null) {
- scrollToRange(this, range$$1);
- } else {
- scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);
- }
- }),
-
- setSize: methodOp(function(width, height) {
- var this$1 = this;
-
- var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
- if (width != null) { this.display.wrapper.style.width = interpret(width); }
- if (height != null) { this.display.wrapper.style.height = interpret(height); }
- if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
- var lineNo$$1 = this.display.viewFrom;
- this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
- if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
- { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
- ++lineNo$$1;
- });
- this.curOp.forceUpdate = true;
- signal(this, "refresh", this);
- }),
-
- operation: function(f){return runInOp(this, f)},
- startOperation: function(){return startOperation(this)},
- endOperation: function(){return endOperation(this)},
-
- refresh: methodOp(function() {
- var oldHeight = this.display.cachedTextHeight;
- regChange(this);
- this.curOp.forceUpdate = true;
- clearCaches(this);
- scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
- updateGutterSpace(this);
- if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
- { estimateLineHeights(this); }
- signal(this, "refresh", this);
- }),
-
- swapDoc: methodOp(function(doc) {
- var old = this.doc;
- old.cm = null;
- attachDoc(this, doc);
- clearCaches(this);
- this.display.input.reset();
- scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
- this.curOp.forceScroll = true;
- signalLater(this, "swapDoc", this, old);
- return old
- }),
-
- phrase: function(phraseText) {
- var phrases = this.options.phrases;
- return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
- },
-
- getInputField: function(){return this.display.input.getField()},
- getWrapperElement: function(){return this.display.wrapper},
- getScrollerElement: function(){return this.display.scroller},
- getGutterElement: function(){return this.display.gutters}
- };
- eventMixin(CodeMirror);
-
- CodeMirror.registerHelper = function(type, name, value) {
- if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
- helpers[type][name] = value;
- };
- CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
- CodeMirror.registerHelper(type, name, value);
- helpers[type]._global.push({pred: predicate, val: value});
- };
- }
-
- // Used for horizontal relative motion. Dir is -1 or 1 (left or
- // right), unit can be "char", "column" (like char, but doesn't
- // cross line boundaries), "word" (across next word), or "group" (to
- // the start of next group of word or non-word-non-whitespace
- // chars). The visually param controls whether, in right-to-left
- // text, direction 1 means to move towards the next index in the
- // string, or towards the character to the right of the current
- // position. The resulting position will have a hitSide=true
- // property if it reached the end of the document.
- function findPosH(doc, pos, dir, unit, visually) {
- var oldPos = pos;
- var origDir = dir;
- var lineObj = getLine(doc, pos.line);
- function findNextLine() {
- var l = pos.line + dir;
- if (l < doc.first || l >= doc.first + doc.size) { return false }
- pos = new Pos(l, pos.ch, pos.sticky);
- return lineObj = getLine(doc, l)
- }
- function moveOnce(boundToLine) {
- var next;
- if (visually) {
- next = moveVisually(doc.cm, lineObj, pos, dir);
- } else {
- next = moveLogically(lineObj, pos, dir);
- }
- if (next == null) {
- if (!boundToLine && findNextLine())
- { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
- else
- { return false }
- } else {
- pos = next;
- }
- return true
- }
-
- if (unit == "char") {
- moveOnce();
- } else if (unit == "column") {
- moveOnce(true);
- } else if (unit == "word" || unit == "group") {
- var sawType = null, group = unit == "group";
- var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
- for (var first = true;; first = false) {
- if (dir < 0 && !moveOnce(!first)) { break }
- var cur = lineObj.text.charAt(pos.ch) || "\n";
- var type = isWordChar(cur, helper) ? "w"
- : group && cur == "\n" ? "n"
- : !group || /\s/.test(cur) ? null
- : "p";
- if (group && !first && !type) { type = "s"; }
- if (sawType && sawType != type) {
- if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
- break
- }
-
- if (type) { sawType = type; }
- if (dir > 0 && !moveOnce(!first)) { break }
- }
- }
- var result = skipAtomic(doc, pos, oldPos, origDir, true);
- if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
- return result
- }
-
- // For relative vertical movement. Dir may be -1 or 1. Unit can be
- // "page" or "line". The resulting position will have a hitSide=true
- // property if it reached the end of the document.
- function findPosV(cm, pos, dir, unit) {
- var doc = cm.doc, x = pos.left, y;
- if (unit == "page") {
- var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
- var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
- y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
-
- } else if (unit == "line") {
- y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
- }
- var target;
- for (;;) {
- target = coordsChar(cm, x, y);
- if (!target.outside) { break }
- if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
- y += dir * 5;
- }
- return target
- }
-
- // CONTENTEDITABLE INPUT STYLE
-
- var ContentEditableInput = function(cm) {
- this.cm = cm;
- this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
- this.polling = new Delayed();
- this.composing = null;
- this.gracePeriod = false;
- this.readDOMTimeout = null;
- };
-
- ContentEditableInput.prototype.init = function (display) {
- var this$1 = this;
-
- var input = this, cm = input.cm;
- var div = input.div = display.lineDiv;
- disableBrowserMagic(div, cm.options.spellcheck);
-
- on(div, "paste", function (e) {
- if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
- // IE doesn't fire input events, so we schedule a read for the pasted content in this way
- if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
- });
-
- on(div, "compositionstart", function (e) {
- this$1.composing = {data: e.data, done: false};
- });
- on(div, "compositionupdate", function (e) {
- if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
- });
- on(div, "compositionend", function (e) {
- if (this$1.composing) {
- if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
- this$1.composing.done = true;
- }
- });
-
- on(div, "touchstart", function () { return input.forceCompositionEnd(); });
-
- on(div, "input", function () {
- if (!this$1.composing) { this$1.readFromDOMSoon(); }
- });
-
- function onCopyCut(e) {
- if (signalDOMEvent(cm, e)) { return }
- if (cm.somethingSelected()) {
- setLastCopied({lineWise: false, text: cm.getSelections()});
- if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
- } else if (!cm.options.lineWiseCopyCut) {
- return
- } else {
- var ranges = copyableRanges(cm);
- setLastCopied({lineWise: true, text: ranges.text});
- if (e.type == "cut") {
- cm.operation(function () {
- cm.setSelections(ranges.ranges, 0, sel_dontScroll);
- cm.replaceSelection("", null, "cut");
- });
- }
- }
- if (e.clipboardData) {
- e.clipboardData.clearData();
- var content = lastCopied.text.join("\n");
- // iOS exposes the clipboard API, but seems to discard content inserted into it
- e.clipboardData.setData("Text", content);
- if (e.clipboardData.getData("Text") == content) {
- e.preventDefault();
- return
- }
- }
- // Old-fashioned briefly-focus-a-textarea hack
- var kludge = hiddenTextarea(), te = kludge.firstChild;
- cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
- te.value = lastCopied.text.join("\n");
- var hadFocus = document.activeElement;
- selectInput(te);
- setTimeout(function () {
- cm.display.lineSpace.removeChild(kludge);
- hadFocus.focus();
- if (hadFocus == div) { input.showPrimarySelection(); }
- }, 50);
- }
- on(div, "copy", onCopyCut);
- on(div, "cut", onCopyCut);
- };
-
- ContentEditableInput.prototype.prepareSelection = function () {
- var result = prepareSelection(this.cm, false);
- result.focus = this.cm.state.focused;
- return result
- };
-
- ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
- if (!info || !this.cm.display.view.length) { return }
- if (info.focus || takeFocus) { this.showPrimarySelection(); }
- this.showMultipleSelections(info);
- };
-
- ContentEditableInput.prototype.getSelection = function () {
- return this.cm.display.wrapper.ownerDocument.getSelection()
- };
-
- ContentEditableInput.prototype.showPrimarySelection = function () {
- var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
- var from = prim.from(), to = prim.to();
-
- if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
- sel.removeAllRanges();
- return
- }
-
- var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
- var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
- if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
- cmp(minPos(curAnchor, curFocus), from) == 0 &&
- cmp(maxPos(curAnchor, curFocus), to) == 0)
- { return }
-
- var view = cm.display.view;
- var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
- {node: view[0].measure.map[2], offset: 0};
- var end = to.line < cm.display.viewTo && posToDOM(cm, to);
- if (!end) {
- var measure = view[view.length - 1].measure;
- var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
- end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
- }
-
- if (!start || !end) {
- sel.removeAllRanges();
- return
- }
-
- var old = sel.rangeCount && sel.getRangeAt(0), rng;
- try { rng = range(start.node, start.offset, end.offset, end.node); }
- catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
- if (rng) {
- if (!gecko && cm.state.focused) {
- sel.collapse(start.node, start.offset);
- if (!rng.collapsed) {
- sel.removeAllRanges();
- sel.addRange(rng);
- }
- } else {
- sel.removeAllRanges();
- sel.addRange(rng);
- }
- if (old && sel.anchorNode == null) { sel.addRange(old); }
- else if (gecko) { this.startGracePeriod(); }
- }
- this.rememberSelection();
- };
-
- ContentEditableInput.prototype.startGracePeriod = function () {
- var this$1 = this;
-
- clearTimeout(this.gracePeriod);
- this.gracePeriod = setTimeout(function () {
- this$1.gracePeriod = false;
- if (this$1.selectionChanged())
- { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
- }, 20);
- };
-
- ContentEditableInput.prototype.showMultipleSelections = function (info) {
- removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
- removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
- };
-
- ContentEditableInput.prototype.rememberSelection = function () {
- var sel = this.getSelection();
- this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
- this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
- };
-
- ContentEditableInput.prototype.selectionInEditor = function () {
- var sel = this.getSelection();
- if (!sel.rangeCount) { return false }
- var node = sel.getRangeAt(0).commonAncestorContainer;
- return contains(this.div, node)
- };
-
- ContentEditableInput.prototype.focus = function () {
- if (this.cm.options.readOnly != "nocursor") {
- if (!this.selectionInEditor())
- { this.showSelection(this.prepareSelection(), true); }
- this.div.focus();
- }
- };
- ContentEditableInput.prototype.blur = function () { this.div.blur(); };
- ContentEditableInput.prototype.getField = function () { return this.div };
-
- ContentEditableInput.prototype.supportsTouch = function () { return true };
-
- ContentEditableInput.prototype.receivedFocus = function () {
- var input = this;
- if (this.selectionInEditor())
- { this.pollSelection(); }
- else
- { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
-
- function poll() {
- if (input.cm.state.focused) {
- input.pollSelection();
- input.polling.set(input.cm.options.pollInterval, poll);
- }
- }
- this.polling.set(this.cm.options.pollInterval, poll);
- };
-
- ContentEditableInput.prototype.selectionChanged = function () {
- var sel = this.getSelection();
- return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
- sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
- };
-
- ContentEditableInput.prototype.pollSelection = function () {
- if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
- var sel = this.getSelection(), cm = this.cm;
- // On Android Chrome (version 56, at least), backspacing into an
- // uneditable block element will put the cursor in that element,
- // and then, because it's not editable, hide the virtual keyboard.
- // Because Android doesn't allow us to actually detect backspace
- // presses in a sane way, this code checks for when that happens
- // and simulates a backspace press in this case.
- if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
- this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
- this.blur();
- this.focus();
- return
- }
- if (this.composing) { return }
- this.rememberSelection();
- var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
- var head = domToPos(cm, sel.focusNode, sel.focusOffset);
- if (anchor && head) { runInOp(cm, function () {
- setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
- if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
- }); }
- };
-
- ContentEditableInput.prototype.pollContent = function () {
- if (this.readDOMTimeout != null) {
- clearTimeout(this.readDOMTimeout);
- this.readDOMTimeout = null;
- }
-
- var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
- var from = sel.from(), to = sel.to();
- if (from.ch == 0 && from.line > cm.firstLine())
- { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
- if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
- { to = Pos(to.line + 1, 0); }
- if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
-
- var fromIndex, fromLine, fromNode;
- if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
- fromLine = lineNo(display.view[0].line);
- fromNode = display.view[0].node;
- } else {
- fromLine = lineNo(display.view[fromIndex].line);
- fromNode = display.view[fromIndex - 1].node.nextSibling;
- }
- var toIndex = findViewIndex(cm, to.line);
- var toLine, toNode;
- if (toIndex == display.view.length - 1) {
- toLine = display.viewTo - 1;
- toNode = display.lineDiv.lastChild;
- } else {
- toLine = lineNo(display.view[toIndex + 1].line) - 1;
- toNode = display.view[toIndex + 1].node.previousSibling;
- }
-
- if (!fromNode) { return false }
- var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
- var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
- while (newText.length > 1 && oldText.length > 1) {
- if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
- else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
- else { break }
- }
-
- var cutFront = 0, cutEnd = 0;
- var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
- while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
- { ++cutFront; }
- var newBot = lst(newText), oldBot = lst(oldText);
- var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
- oldBot.length - (oldText.length == 1 ? cutFront : 0));
- while (cutEnd < maxCutEnd &&
- newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
- { ++cutEnd; }
- // Try to move start of change to start of selection if ambiguous
- if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
- while (cutFront && cutFront > from.ch &&
- newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
- cutFront--;
- cutEnd++;
- }
- }
-
- newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
- newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
-
- var chFrom = Pos(fromLine, cutFront);
- var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
- if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
- replaceRange(cm.doc, newText, chFrom, chTo, "+input");
- return true
- }
- };
-
- ContentEditableInput.prototype.ensurePolled = function () {
- this.forceCompositionEnd();
- };
- ContentEditableInput.prototype.reset = function () {
- this.forceCompositionEnd();
- };
- ContentEditableInput.prototype.forceCompositionEnd = function () {
- if (!this.composing) { return }
- clearTimeout(this.readDOMTimeout);
- this.composing = null;
- this.updateFromDOM();
- this.div.blur();
- this.div.focus();
- };
- ContentEditableInput.prototype.readFromDOMSoon = function () {
- var this$1 = this;
-
- if (this.readDOMTimeout != null) { return }
- this.readDOMTimeout = setTimeout(function () {
- this$1.readDOMTimeout = null;
- if (this$1.composing) {
- if (this$1.composing.done) { this$1.composing = null; }
- else { return }
- }
- this$1.updateFromDOM();
- }, 80);
- };
-
- ContentEditableInput.prototype.updateFromDOM = function () {
- var this$1 = this;
-
- if (this.cm.isReadOnly() || !this.pollContent())
- { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
- };
-
- ContentEditableInput.prototype.setUneditable = function (node) {
- node.contentEditable = "false";
- };
-
- ContentEditableInput.prototype.onKeyPress = function (e) {
- if (e.charCode == 0 || this.composing) { return }
- e.preventDefault();
- if (!this.cm.isReadOnly())
- { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
- };
-
- ContentEditableInput.prototype.readOnlyChanged = function (val) {
- this.div.contentEditable = String(val != "nocursor");
- };
-
- ContentEditableInput.prototype.onContextMenu = function () {};
- ContentEditableInput.prototype.resetPosition = function () {};
-
- ContentEditableInput.prototype.needsContentAttribute = true;
-
- function posToDOM(cm, pos) {
- var view = findViewForLine(cm, pos.line);
- if (!view || view.hidden) { return null }
- var line = getLine(cm.doc, pos.line);
- var info = mapFromLineView(view, line, pos.line);
-
- var order = getOrder(line, cm.doc.direction), side = "left";
- if (order) {
- var partPos = getBidiPartAt(order, pos.ch);
- side = partPos % 2 ? "right" : "left";
- }
- var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
- result.offset = result.collapse == "right" ? result.end : result.start;
- return result
- }
-
- function isInGutter(node) {
- for (var scan = node; scan; scan = scan.parentNode)
- { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
- return false
- }
-
- function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
-
- function domTextBetween(cm, from, to, fromLine, toLine) {
- var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
- function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
- function close() {
- if (closing) {
- text += lineSep;
- if (extraLinebreak) { text += lineSep; }
- closing = extraLinebreak = false;
- }
- }
- function addText(str) {
- if (str) {
- close();
- text += str;
- }
- }
- function walk(node) {
- if (node.nodeType == 1) {
- var cmText = node.getAttribute("cm-text");
- if (cmText) {
- addText(cmText);
- return
- }
- var markerID = node.getAttribute("cm-marker"), range$$1;
- if (markerID) {
- var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
- if (found.length && (range$$1 = found[0].find(0)))
- { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
- return
- }
- if (node.getAttribute("contenteditable") == "false") { return }
- var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
- if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
-
- if (isBlock) { close(); }
- for (var i = 0; i < node.childNodes.length; i++)
- { walk(node.childNodes[i]); }
-
- if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
- if (isBlock) { closing = true; }
- } else if (node.nodeType == 3) {
- addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
- }
- }
- for (;;) {
- walk(from);
- if (from == to) { break }
- from = from.nextSibling;
- extraLinebreak = false;
- }
- return text
- }
-
- function domToPos(cm, node, offset) {
- var lineNode;
- if (node == cm.display.lineDiv) {
- lineNode = cm.display.lineDiv.childNodes[offset];
- if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
- node = null; offset = 0;
- } else {
- for (lineNode = node;; lineNode = lineNode.parentNode) {
- if (!lineNode || lineNode == cm.display.lineDiv) { return null }
- if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
- }
- }
- for (var i = 0; i < cm.display.view.length; i++) {
- var lineView = cm.display.view[i];
- if (lineView.node == lineNode)
- { return locateNodeInLineView(lineView, node, offset) }
- }
- }
-
- function locateNodeInLineView(lineView, node, offset) {
- var wrapper = lineView.text.firstChild, bad = false;
- if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
- if (node == wrapper) {
- bad = true;
- node = wrapper.childNodes[offset];
- offset = 0;
- if (!node) {
- var line = lineView.rest ? lst(lineView.rest) : lineView.line;
- return badPos(Pos(lineNo(line), line.text.length), bad)
- }
- }
-
- var textNode = node.nodeType == 3 ? node : null, topNode = node;
- if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
- textNode = node.firstChild;
- if (offset) { offset = textNode.nodeValue.length; }
- }
- while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
- var measure = lineView.measure, maps = measure.maps;
-
- function find(textNode, topNode, offset) {
- for (var i = -1; i < (maps ? maps.length : 0); i++) {
- var map$$1 = i < 0 ? measure.map : maps[i];
- for (var j = 0; j < map$$1.length; j += 3) {
- var curNode = map$$1[j + 2];
- if (curNode == textNode || curNode == topNode) {
- var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
- var ch = map$$1[j] + offset;
- if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
- return Pos(line, ch)
- }
- }
- }
- }
- var found = find(textNode, topNode, offset);
- if (found) { return badPos(found, bad) }
-
- // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
- for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
- found = find(after, after.firstChild, 0);
- if (found)
- { return badPos(Pos(found.line, found.ch - dist), bad) }
- else
- { dist += after.textContent.length; }
- }
- for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
- found = find(before, before.firstChild, -1);
- if (found)
- { return badPos(Pos(found.line, found.ch + dist$1), bad) }
- else
- { dist$1 += before.textContent.length; }
- }
- }
-
- // TEXTAREA INPUT STYLE
-
- var TextareaInput = function(cm) {
- this.cm = cm;
- // See input.poll and input.reset
- this.prevInput = "";
-
- // Flag that indicates whether we expect input to appear real soon
- // now (after some event like 'keypress' or 'input') and are
- // polling intensively.
- this.pollingFast = false;
- // Self-resetting timeout for the poller
- this.polling = new Delayed();
- // Used to work around IE issue with selection being forgotten when focus moves away from textarea
- this.hasSelection = false;
- this.composing = null;
- };
-
- TextareaInput.prototype.init = function (display) {
- var this$1 = this;
-
- var input = this, cm = this.cm;
- this.createField(display);
- var te = this.textarea;
-
- display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
-
- // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
- if (ios) { te.style.width = "0px"; }
-
- on(te, "input", function () {
- if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
- input.poll();
- });
-
- on(te, "paste", function (e) {
- if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
-
- cm.state.pasteIncoming = true;
- input.fastPoll();
- });
-
- function prepareCopyCut(e) {
- if (signalDOMEvent(cm, e)) { return }
- if (cm.somethingSelected()) {
- setLastCopied({lineWise: false, text: cm.getSelections()});
- } else if (!cm.options.lineWiseCopyCut) {
- return
- } else {
- var ranges = copyableRanges(cm);
- setLastCopied({lineWise: true, text: ranges.text});
- if (e.type == "cut") {
- cm.setSelections(ranges.ranges, null, sel_dontScroll);
- } else {
- input.prevInput = "";
- te.value = ranges.text.join("\n");
- selectInput(te);
- }
- }
- if (e.type == "cut") { cm.state.cutIncoming = true; }
- }
- on(te, "cut", prepareCopyCut);
- on(te, "copy", prepareCopyCut);
-
- on(display.scroller, "paste", function (e) {
- if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
- cm.state.pasteIncoming = true;
- input.focus();
- });
-
- // Prevent normal selection in the editor (we handle our own)
- on(display.lineSpace, "selectstart", function (e) {
- if (!eventInWidget(display, e)) { e_preventDefault(e); }
- });
-
- on(te, "compositionstart", function () {
- var start = cm.getCursor("from");
- if (input.composing) { input.composing.range.clear(); }
- input.composing = {
- start: start,
- range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
- };
- });
- on(te, "compositionend", function () {
- if (input.composing) {
- input.poll();
- input.composing.range.clear();
- input.composing = null;
- }
- });
- };
-
- TextareaInput.prototype.createField = function (_display) {
- // Wraps and hides input textarea
- this.wrapper = hiddenTextarea();
- // The semihidden textarea that is focused when the editor is
- // focused, and receives input.
- this.textarea = this.wrapper.firstChild;
- };
-
- TextareaInput.prototype.prepareSelection = function () {
- // Redraw the selection and/or cursor
- var cm = this.cm, display = cm.display, doc = cm.doc;
- var result = prepareSelection(cm);
-
- // Move the hidden textarea near the cursor to prevent scrolling artifacts
- if (cm.options.moveInputWithCursor) {
- var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
- var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
- result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
- headPos.top + lineOff.top - wrapOff.top));
- result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
- headPos.left + lineOff.left - wrapOff.left));
- }
-
- return result
- };
-
- TextareaInput.prototype.showSelection = function (drawn) {
- var cm = this.cm, display = cm.display;
- removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
- removeChildrenAndAdd(display.selectionDiv, drawn.selection);
- if (drawn.teTop != null) {
- this.wrapper.style.top = drawn.teTop + "px";
- this.wrapper.style.left = drawn.teLeft + "px";
- }
- };
-
- // Reset the input to correspond to the selection (or to be empty,
- // when not typing and nothing is selected)
- TextareaInput.prototype.reset = function (typing) {
- if (this.contextMenuPending || this.composing) { return }
- var cm = this.cm;
- if (cm.somethingSelected()) {
- this.prevInput = "";
- var content = cm.getSelection();
- this.textarea.value = content;
- if (cm.state.focused) { selectInput(this.textarea); }
- if (ie && ie_version >= 9) { this.hasSelection = content; }
- } else if (!typing) {
- this.prevInput = this.textarea.value = "";
- if (ie && ie_version >= 9) { this.hasSelection = null; }
- }
- };
-
- TextareaInput.prototype.getField = function () { return this.textarea };
-
- TextareaInput.prototype.supportsTouch = function () { return false };
-
- TextareaInput.prototype.focus = function () {
- if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
- try { this.textarea.focus(); }
- catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
- }
- };
-
- TextareaInput.prototype.blur = function () { this.textarea.blur(); };
-
- TextareaInput.prototype.resetPosition = function () {
- this.wrapper.style.top = this.wrapper.style.left = 0;
- };
-
- TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
-
- // Poll for input changes, using the normal rate of polling. This
- // runs as long as the editor is focused.
- TextareaInput.prototype.slowPoll = function () {
- var this$1 = this;
-
- if (this.pollingFast) { return }
- this.polling.set(this.cm.options.pollInterval, function () {
- this$1.poll();
- if (this$1.cm.state.focused) { this$1.slowPoll(); }
- });
- };
-
- // When an event has just come in that is likely to add or change
- // something in the input textarea, we poll faster, to ensure that
- // the change appears on the screen quickly.
- TextareaInput.prototype.fastPoll = function () {
- var missed = false, input = this;
- input.pollingFast = true;
- function p() {
- var changed = input.poll();
- if (!changed && !missed) {missed = true; input.polling.set(60, p);}
- else {input.pollingFast = false; input.slowPoll();}
- }
- input.polling.set(20, p);
- };
-
- // Read input from the textarea, and update the document to match.
- // When something is selected, it is present in the textarea, and
- // selected (unless it is huge, in which case a placeholder is
- // used). When nothing is selected, the cursor sits after previously
- // seen text (can be empty), which is stored in prevInput (we must
- // not reset the textarea when typing, because that breaks IME).
- TextareaInput.prototype.poll = function () {
- var this$1 = this;
-
- var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
- // Since this is called a *lot*, try to bail out as cheaply as
- // possible when it is clear that nothing happened. hasSelection
- // will be the case when there is a lot of text in the textarea,
- // in which case reading its value would be expensive.
- if (this.contextMenuPending || !cm.state.focused ||
- (hasSelection(input) && !prevInput && !this.composing) ||
- cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
- { return false }
-
- var text = input.value;
- // If nothing changed, bail.
- if (text == prevInput && !cm.somethingSelected()) { return false }
- // Work around nonsensical selection resetting in IE9/10, and
- // inexplicable appearance of private area unicode characters on
- // some key combos in Mac (#2689).
- if (ie && ie_version >= 9 && this.hasSelection === text ||
- mac && /[\uf700-\uf7ff]/.test(text)) {
- cm.display.input.reset();
- return false
- }
-
- if (cm.doc.sel == cm.display.selForContextMenu) {
- var first = text.charCodeAt(0);
- if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
- if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
- }
- // Find the part of the input that is actually new
- var same = 0, l = Math.min(prevInput.length, text.length);
- while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
-
- runInOp(cm, function () {
- applyTextInput(cm, text.slice(same), prevInput.length - same,
- null, this$1.composing ? "*compose" : null);
-
- // Don't leave long text in the textarea, since it makes further polling slow
- if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
- else { this$1.prevInput = text; }
-
- if (this$1.composing) {
- this$1.composing.range.clear();
- this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
- {className: "CodeMirror-composing"});
- }
- });
- return true
- };
-
- TextareaInput.prototype.ensurePolled = function () {
- if (this.pollingFast && this.poll()) { this.pollingFast = false; }
- };
-
- TextareaInput.prototype.onKeyPress = function () {
- if (ie && ie_version >= 9) { this.hasSelection = null; }
- this.fastPoll();
- };
-
- TextareaInput.prototype.onContextMenu = function (e) {
- var input = this, cm = input.cm, display = cm.display, te = input.textarea;
- var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
- if (!pos || presto) { return } // Opera is difficult.
-
- // Reset the current text selection only if the click is done outside of the selection
- // and 'resetSelectionOnContextMenu' option is true.
- var reset = cm.options.resetSelectionOnContextMenu;
- if (reset && cm.doc.sel.contains(pos) == -1)
- { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
-
- var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
- input.wrapper.style.cssText = "position: absolute";
- var wrapperBox = input.wrapper.getBoundingClientRect();
- te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
- var oldScrollY;
- if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
- display.input.focus();
- if (webkit) { window.scrollTo(null, oldScrollY); }
- display.input.reset();
- // Adds "Select all" to context menu in FF
- if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
- input.contextMenuPending = true;
- display.selForContextMenu = cm.doc.sel;
- clearTimeout(display.detectingSelectAll);
-
- // Select-all will be greyed out if there's nothing to select, so
- // this adds a zero-width space so that we can later check whether
- // it got selected.
- function prepareSelectAllHack() {
- if (te.selectionStart != null) {
- var selected = cm.somethingSelected();
- var extval = "\u200b" + (selected ? te.value : "");
- te.value = "\u21da"; // Used to catch context-menu undo
- te.value = extval;
- input.prevInput = selected ? "" : "\u200b";
- te.selectionStart = 1; te.selectionEnd = extval.length;
- // Re-set this, in case some other handler touched the
- // selection in the meantime.
- display.selForContextMenu = cm.doc.sel;
- }
- }
- function rehide() {
- input.contextMenuPending = false;
- input.wrapper.style.cssText = oldWrapperCSS;
- te.style.cssText = oldCSS;
- if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
-
- // Try to detect the user choosing select-all
- if (te.selectionStart != null) {
- if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
- var i = 0, poll = function () {
- if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
- te.selectionEnd > 0 && input.prevInput == "\u200b") {
- operation(cm, selectAll)(cm);
- } else if (i++ < 10) {
- display.detectingSelectAll = setTimeout(poll, 500);
- } else {
- display.selForContextMenu = null;
- display.input.reset();
- }
- };
- display.detectingSelectAll = setTimeout(poll, 200);
- }
- }
-
- if (ie && ie_version >= 9) { prepareSelectAllHack(); }
- if (captureRightClick) {
- e_stop(e);
- var mouseup = function () {
- off(window, "mouseup", mouseup);
- setTimeout(rehide, 20);
- };
- on(window, "mouseup", mouseup);
- } else {
- setTimeout(rehide, 50);
- }
- };
-
- TextareaInput.prototype.readOnlyChanged = function (val) {
- if (!val) { this.reset(); }
- this.textarea.disabled = val == "nocursor";
- };
-
- TextareaInput.prototype.setUneditable = function () {};
-
- TextareaInput.prototype.needsContentAttribute = false;
-
- function fromTextArea(textarea, options) {
- options = options ? copyObj(options) : {};
- options.value = textarea.value;
- if (!options.tabindex && textarea.tabIndex)
- { options.tabindex = textarea.tabIndex; }
- if (!options.placeholder && textarea.placeholder)
- { options.placeholder = textarea.placeholder; }
- // Set autofocus to true if this textarea is focused, or if it has
- // autofocus and no other element is focused.
- if (options.autofocus == null) {
- var hasFocus = activeElt();
- options.autofocus = hasFocus == textarea ||
- textarea.getAttribute("autofocus") != null && hasFocus == document.body;
- }
-
- function save() {textarea.value = cm.getValue();}
-
- var realSubmit;
- if (textarea.form) {
- on(textarea.form, "submit", save);
- // Deplorable hack to make the submit method do the right thing.
- if (!options.leaveSubmitMethodAlone) {
- var form = textarea.form;
- realSubmit = form.submit;
- try {
- var wrappedSubmit = form.submit = function () {
- save();
- form.submit = realSubmit;
- form.submit();
- form.submit = wrappedSubmit;
- };
- } catch(e) {}
- }
- }
-
- options.finishInit = function (cm) {
- cm.save = save;
- cm.getTextArea = function () { return textarea; };
- cm.toTextArea = function () {
- cm.toTextArea = isNaN; // Prevent this from being ran twice
- save();
- textarea.parentNode.removeChild(cm.getWrapperElement());
- textarea.style.display = "";
- if (textarea.form) {
- off(textarea.form, "submit", save);
- if (typeof textarea.form.submit == "function")
- { textarea.form.submit = realSubmit; }
- }
- };
- };
-
- textarea.style.display = "none";
- var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
- options);
- return cm
- }
-
- function addLegacyProps(CodeMirror) {
- CodeMirror.off = off;
- CodeMirror.on = on;
- CodeMirror.wheelEventPixels = wheelEventPixels;
- CodeMirror.Doc = Doc;
- CodeMirror.splitLines = splitLinesAuto;
- CodeMirror.countColumn = countColumn;
- CodeMirror.findColumn = findColumn;
- CodeMirror.isWordChar = isWordCharBasic;
- CodeMirror.Pass = Pass;
- CodeMirror.signal = signal;
- CodeMirror.Line = Line;
- CodeMirror.changeEnd = changeEnd;
- CodeMirror.scrollbarModel = scrollbarModel;
- CodeMirror.Pos = Pos;
- CodeMirror.cmpPos = cmp;
- CodeMirror.modes = modes;
- CodeMirror.mimeModes = mimeModes;
- CodeMirror.resolveMode = resolveMode;
- CodeMirror.getMode = getMode;
- CodeMirror.modeExtensions = modeExtensions;
- CodeMirror.extendMode = extendMode;
- CodeMirror.copyState = copyState;
- CodeMirror.startState = startState;
- CodeMirror.innerMode = innerMode;
- CodeMirror.commands = commands;
- CodeMirror.keyMap = keyMap;
- CodeMirror.keyName = keyName;
- CodeMirror.isModifierKey = isModifierKey;
- CodeMirror.lookupKey = lookupKey;
- CodeMirror.normalizeKeyMap = normalizeKeyMap;
- CodeMirror.StringStream = StringStream;
- CodeMirror.SharedTextMarker = SharedTextMarker;
- CodeMirror.TextMarker = TextMarker;
- CodeMirror.LineWidget = LineWidget;
- CodeMirror.e_preventDefault = e_preventDefault;
- CodeMirror.e_stopPropagation = e_stopPropagation;
- CodeMirror.e_stop = e_stop;
- CodeMirror.addClass = addClass;
- CodeMirror.contains = contains;
- CodeMirror.rmClass = rmClass;
- CodeMirror.keyNames = keyNames;
- }
-
- // EDITOR CONSTRUCTOR
-
- defineOptions(CodeMirror);
-
- addEditorMethods(CodeMirror);
-
- // Set up methods on CodeMirror's prototype to redirect to the editor's document.
- var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
- for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
- { CodeMirror.prototype[prop] = (function(method) {
- return function() {return method.apply(this.doc, arguments)}
- })(Doc.prototype[prop]); } }
-
- eventMixin(Doc);
- CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
-
- // Extra arguments are stored as the mode's dependencies, which is
- // used by (legacy) mechanisms like loadmode.js to automatically
- // load a mode. (Preferred mechanism is the require/define calls.)
- CodeMirror.defineMode = function(name/*, mode, …*/) {
- if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
- defineMode.apply(this, arguments);
- };
-
- CodeMirror.defineMIME = defineMIME;
-
- // Minimal default mode.
- CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
- CodeMirror.defineMIME("text/plain", "null");
-
- // EXTENSIONS
-
- CodeMirror.defineExtension = function (name, func) {
- CodeMirror.prototype[name] = func;
- };
- CodeMirror.defineDocExtension = function (name, func) {
- Doc.prototype[name] = func;
- };
-
- CodeMirror.fromTextArea = fromTextArea;
-
- addLegacyProps(CodeMirror);
-
- CodeMirror.version = "5.41.0";
-
- return CodeMirror;
-
-})));
diff --git a/docs/assets/js/common.js b/docs/assets/js/common.js
index e6f8414e0..8e359d68a 100644
--- a/docs/assets/js/common.js
+++ b/docs/assets/js/common.js
@@ -20,13 +20,17 @@
window.consoleLog(document.querySelector('.console'));
- var mirror = CodeMirror($codeMirror, {
- lineNumbers: true,
- mode: 'javascript',
- matchBrackets: true,
- styleActiveLine: true,
- theme: 'dracula',
- value: '',
+ var editor = null;
+ require.config({ paths: { vs: './assets/js/vs' } });
+ require(['vs/editor/editor.main'], function () {
+ editor = monaco.editor.create($codeMirror, {
+ theme: 'vs-dark',
+ model: monaco.editor.createModel(
+ ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
+ 'javascript',
+ ),
+ });
+ initApp();
});
function initArt(art) {
@@ -112,7 +116,7 @@
return response.text();
})
.then(function (text) {
- mirror.setValue(text);
+ editor.setValue(text);
runCode();
})
.catch(function (err) {
@@ -124,7 +128,7 @@
if (example) {
runExample(example);
} else if (code) {
- mirror.setValue(decodeURIComponent(code).trim());
+ editor.setValue(decodeURIComponent(code).trim());
runCode();
} else {
runExample('index');
@@ -146,7 +150,7 @@
Artplayer.instances.forEach(function (art) {
art.destroy(true);
});
- var code = mirror.getValue();
+ var code = editor.getValue();
eval(code);
initArt(Artplayer.instances[0]);
console.debug('Artplayer@' + Artplayer.version);
@@ -180,7 +184,7 @@
$run.addEventListener('click', function (e) {
var libs = encodeURIComponent($lib.value);
- var code = encodeURIComponent(mirror.getValue());
+ var code = encodeURIComponent(editor.getValue());
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
history.pushState(null, null, url);
initApp();
@@ -191,6 +195,4 @@
this.style.display = 'none';
}
});
-
- initApp();
})();
diff --git a/docs/assets/js/vs/base/browser/ui/codicons/codicon/codicon.ttf b/docs/assets/js/vs/base/browser/ui/codicons/codicon/codicon.ttf
new file mode 100644
index 000000000..2bca0f7b4
Binary files /dev/null and b/docs/assets/js/vs/base/browser/ui/codicons/codicon/codicon.ttf differ
diff --git a/docs/assets/js/vs/base/worker/workerMain.js b/docs/assets/js/vs/base/worker/workerMain.js
new file mode 100644
index 000000000..03e1030a1
--- /dev/null
+++ b/docs/assets/js/vs/base/worker/workerMain.js
@@ -0,0 +1,18 @@
+/*!-----------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Version: 0.30.1(829382514cb1065f5ebb90f436e1c6103e153953)
+ * Released under the MIT license
+ * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
+ *-----------------------------------------------------------*/(function(){var z=["require","exports","vs/base/common/platform","vs/editor/common/core/position","vs/base/common/strings","vs/base/common/event","vs/editor/common/core/range","vs/base/common/errors","vs/base/common/lifecycle","vs/base/common/stopwatch","vs/base/common/diff/diff","vs/base/common/types","vs/base/common/uint","vs/base/common/uri","vs/base/common/diff/diffChange","vs/base/common/functional","vs/base/common/iterator","vs/base/common/keyCodes","vs/base/common/linkedList","vs/base/common/process","vs/base/common/path","vs/base/common/cancellation","vs/base/common/hash","vs/editor/common/core/characterClassifier","vs/editor/common/core/selection","vs/editor/common/core/token","vs/editor/common/diff/diffComputer","vs/editor/common/model/wordHelper","vs/editor/common/modes/linkComputer","vs/editor/common/modes/supports/inplaceReplaceSupport","vs/editor/common/standalone/standaloneEnums","vs/editor/common/standalone/standaloneBase","vs/editor/common/viewModel/prefixSumComputer","vs/editor/common/model/mirrorTextModel","vs/base/common/worker/simpleWorker","vs/editor/common/services/editorSimpleWorker"],G=function(F){for(var n=[],A=0,D=F.length;A w(p,S),h)}function c(b,h){return h=s(181387,h),Object.keys(b).sort().reduce((S,p)=>(S=a(p,S),w(b[p],S)),h)}function C(b,h,S=32){const p=S-h,i=~((1< >>p)>>>0}function e(b,h=0,S=b.byteLength,p=0){for(let i=0;i "+me+`{const r=this._stacks.get(p)||0;this._stacks.set(p,r-1)}}}class C{constructor(h){var S;this._disposed=!1,this._options=h,this._leakageMon=u>0?new c(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=((S=this._options)===null||S===void 0?void 0:S._profName)?new a(this._options._profName):void 0}get event(){return this._event||(this._event=(h,S,p)=>{var i;this._listeners||(this._listeners=new w.LinkedList);const r=this._listeners.isEmpty();r&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const l=this._listeners.push(S?[h,S]:h);r&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,h,S);const g=(i=this._leakageMon)===null||i===void 0?void 0:i.check(this._listeners.size),v=(0,D.toDisposable)(()=>{g&&g(),this._disposed||(l(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return p instanceof D.DisposableStore?p.add(v):Array.isArray(p)&&p.push(v),v}),this._event}fire(h){var S,p;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new w.LinkedList);for(let i of this._listeners)this._deliveryQueue.push([i,h]);for((S=this._perfMon)===null||S===void 0||S.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[i,r]=this._deliveryQueue.shift();try{typeof i=="function"?i.call(void 0,r):i[0].call(i[1],r)}catch(l){(0,A.onUnexpectedError)(l)}}(p=this._perfMon)===null||p===void 0||p.stop()}}dispose(){var h,S,p,i,r;this._disposed||(this._disposed=!0,(h=this._listeners)===null||h===void 0||h.clear(),(S=this._deliveryQueue)===null||S===void 0||S.clear(),(i=(p=this._options)===null||p===void 0?void 0:p.onLastListenerRemove)===null||i===void 0||i.call(p),(r=this._leakageMon)===null||r===void 0||r.dispose())}}n.Emitter=C;class e extends C{constructor(h){super(h);this._isPaused=0,this._eventQueue=new w.LinkedList,this._mergeFn=h==null?void 0:h.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused==0)if(this._mergeFn){const h=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(h))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(h){this._listeners&&(this._isPaused!==0?this._eventQueue.push(h):super.fire(h))}}n.PauseableEmitter=e;class f extends e{constructor(h){var S;super(h);this._delay=(S=h.delay)!==null&&S!==void 0?S:100}fire(h){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(h)}}n.DebounceEmitter=f;class m{constructor(){this.buffers=[]}wrapEvent(h){return(S,p,i)=>h(r=>{const l=this.buffers[this.buffers.length-1];l?l.push(()=>S.call(p,r)):S.call(p,r)},void 0,i)}bufferEvents(h){const S=[];this.buffers.push(S);const p=h();return this.buffers.pop(),S.forEach(i=>i()),p}}n.EventBufferer=m;class N{constructor(){this.listening=!1,this.inputEvent=d.None,this.inputEventListener=D.Disposable.None,this.emitter=new C({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(h){this.inputEvent=h,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=h(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}n.Relay=N}),j(z[21],G([0,1,5]),function(F,n,A){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.CancellationTokenSource=n.CancellationToken=void 0;const D=Object.freeze(function(a,u){const c=setTimeout(a.bind(u),0);return{dispose(){clearTimeout(c)}}});var w;(function(a){function u(c){return c===a.None||c===a.Cancelled||c instanceof s?!0:!c||typeof c!="object"?!1:typeof c.isCancellationRequested=="boolean"&&typeof c.onCancellationRequested=="function"}a.isCancellationToken=u,a.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:A.Event.None}),a.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:D})})(w=n.CancellationToken||(n.CancellationToken={}));class s{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?D:(this._emitter||(this._emitter=new A.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}class d{constructor(u){this._token=void 0,this._parentListener=void 0,this._parentListener=u&&u.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token instanceof s&&this._token.cancel():this._token=w.Cancelled}dispose(u=!1){u&&this.cancel(),this._parentListener&&this._parentListener.dispose(),this._token?this._token instanceof s&&this._token.dispose():this._token=w.None}}n.CancellationTokenSource=d}),j(z[4],G([0,1]),function(F,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getLeftDeleteOffset=n.breakBetweenGraphemeBreakType=n.getGraphemeBreakType=n.singleLetterHash=n.containsUppercaseCharacter=n.startsWithUTF8BOM=n.UTF8_BOM_CHARACTER=n.isEmojiImprecise=n.isFullWidthCharacter=n.containsFullWidthCharacter=n.containsUnusualLineTerminators=n.UNUSUAL_LINE_TERMINATORS=n.isBasicASCII=n.containsEmoji=n.containsRTL=n.prevCharLength=n.nextCharLength=n.getNextCodePoint=n.computeCodePoint=n.isLowSurrogate=n.isHighSurrogate=n.commonSuffixLength=n.commonPrefixLength=n.startsWithIgnoreCase=n.equalsIgnoreCase=n.isUpperAsciiLetter=n.isLowerAsciiLetter=n.compareSubstringIgnoreCase=n.compareIgnoreCase=n.compareSubstring=n.compare=n.lastNonWhitespaceIndex=n.getLeadingWhitespace=n.firstNonWhitespaceIndex=n.splitLines=n.regExpFlags=n.regExpLeadsToEndlessLoop=n.createRegExp=n.stripWildcards=n.convertSimple2RegExpPattern=n.rtrim=n.ltrim=n.trim=n.escapeRegExpCharacters=n.escape=n.format=n.isFalsyOrWhitespace=void 0;function A(M){return!M||typeof M!="string"?!0:M.trim().length===0}n.isFalsyOrWhitespace=A;const D=/{(\d+)}/g;function w(M,...I){return I.length===0?M:M.replace(D,function(k,H){const $=parseInt(H,10);return isNaN($)||$<0||$>=I.length?k:I[$]})}n.format=w;function s(M){return M.replace(/[<>&]/g,function(I){switch(I){case"<":return"<";case">":return">";case"&":return"&";default:return I}})}n.escape=s;function d(M){return M.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}n.escapeRegExpCharacters=d;function a(M,I=" "){const k=u(M,I);return c(k,I)}n.trim=a;function u(M,I){if(!M||!I)return M;const k=I.length;if(k===0||M.length===0)return M;let H=0;for(;M.indexOf(I,H)===H;)H=H+k;return M.substring(H)}n.ltrim=u;function c(M,I){if(!M||!I)return M;const k=I.length,H=M.length;if(k===0||H===0)return M;let $=H,X=-1;for(;X=M.lastIndexOf(I,$-1),!(X===-1||X+k!==$);){if(X===0)return"";$=X}return M.substring(0,$)}n.rtrim=c;function C(M){return M.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}n.convertSimple2RegExpPattern=C;function e(M){return M.replace(/\*/g,"")}n.stripWildcards=e;function f(M,I,k={}){if(!M)throw new Error("Cannot create regex from empty string");I||(M=d(M)),k.wholeWord&&(/\B/.test(M.charAt(0))||(M="\\b"+M),/\B/.test(M.charAt(M.length-1))||(M=M+"\\b"));let H="";return k.global&&(H+="g"),k.matchCase||(H+="i"),k.multiline&&(H+="m"),k.unicode&&(H+="u"),new RegExp(M,H)}n.createRegExp=f;function m(M){return M.source==="^"||M.source==="^$"||M.source==="$"||M.source==="^\\s*$"?!1:!!(M.exec("")&&M.lastIndex===0)}n.regExpLeadsToEndlessLoop=m;function N(M){return(M.global?"g":"")+(M.ignoreCase?"i":"")+(M.multiline?"m":"")+(M.unicode?"u":"")}n.regExpFlags=N;function b(M){return M.split(/\r\n|\r|\n/)}n.splitLines=b;function h(M){for(let I=0,k=M.length;IS.toString(16).padStart(2,"0")).join(""):f((b>>>0).toString(16),h/4)}n.toHexString=m;class N{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(64+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(h){const S=h.length;if(S===0)return;const p=this._buff;let i=this._buffLen,r=this._leftoverHighSurrogate,l,g;for(r!==0?(l=r,g=-1,r=0):(l=h.charCodeAt(0),g=0);;){let v=l;if(A.isHighSurrogate(l))if(g+1>>6,h[S++]=128|(p&63)>>>0):p<65536?(h[S++]=224|(p&61440)>>>12,h[S++]=128|(p&4032)>>>6,h[S++]=128|(p&63)>>>0):(h[S++]=240|(p&1835008)>>>18,h[S++]=128|(p&258048)>>>12,h[S++]=128|(p&4032)>>>6,h[S++]=128|(p&63)>>>0),S>=64&&(this._step(),S-=64,this._totalLen+=64,h[0]=h[64+0],h[1]=h[64+1],h[2]=h[64+2]),S}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),m(this._h0)+m(this._h1)+m(this._h2)+m(this._h3)+m(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,e(this._buff,this._buffLen),this._buffLen>56&&(this._step(),e(this._buff));const h=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(h/4294967296),!1),this._buffDV.setUint32(60,h%4294967296,!1),this._step()}_step(){const h=N._bigBlock32,S=this._buffDV;for(let L=0;L<64;L+=4)h.setUint32(L,S.getUint32(L,!1),!1);for(let L=64;L<320;L+=4)h.setUint32(L,C(h.getUint32(L-12,!1)^h.getUint32(L-32,!1)^h.getUint32(L-56,!1)^h.getUint32(L-64,!1),1),!1);let p=this._h0,i=this._h1,r=this._h2,l=this._h3,g=this._h4,v,o,_;for(let L=0;L<80;L++)L<20?(v=i&r|~i&l,o=1518500249):L<40?(v=i^r^l,o=1859775393):L<60?(v=i&r|i&l|r&l,o=2400959708):(v=i^r^l,o=3395469782),_=C(p,5)+v+g+o+h.getUint32(L*4,!1)&4294967295,g=l,l=r,r=C(i,30),i=p,p=_;this._h0=this._h0+p&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+r&4294967295,this._h3=this._h3+l&4294967295,this._h4=this._h4+g&4294967295}}n.StringSHA1=N,N._bigBlock32=new DataView(new ArrayBuffer(320))}),j(z[10],G([0,1,14,22]),function(F,n,A,D){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LcsDiff=n.MyArray=n.Debug=n.stringDiff=n.StringDiffSequence=void 0;class w{constructor(e){this.source=e}getElements(){const e=this.source,f=new Int32Array(e.length);for(let m=0,N=e.length;mm&&(m=i),p>N&&(N=p),r>N&&(N=r)}m++,N++;let b=new D(N,m,0);for(let h=0,S=f.length;h=this._maxCharCode?0:this._states.get(f,m)}}n.StateMachine=w;let s=null;function d(){return s===null&&(s=new w([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),s}let a=null;function u(){if(a===null){a=new A.CharacterClassifier(0);const e=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026`;for(let m=0;m
+`:"'+(De?me:q(me,!0))+`
+`},Ie.blockquote=function(me){return`"+(De?me:q(me,!0))+`
+`+me+`
+`},Ie.html=function(me){return me},Ie.heading=function(me,be,De,we){return this.options.headerIds?"
+`:`
+`},Ie.list=function(me,be,De){var we=be?"ol":"ul",_e=be&&De!==1?' start="'+De+'"':"";return"<"+we+_e+`>
+`+me+""+we+`>
+`},Ie.listitem=function(me){return"
+
+`+me+`
+`+be+`
+`},Ie.tablerow=function(me){return`
+`+me+`
+`},Ie.tablecell=function(me,be){var De=be.header?"th":"td",we=be.align?"<"+De+' align="'+be.align+'">':"<"+De+">";return we+me+""+De+`>
+`},Ie.strong=function(me){return""+me+""},Ie.em=function(me){return""+me+""},Ie.codespan=function(me){return""+me+""},Ie.br=function(){return this.options.xhtml?"
":"
"},Ie.del=function(me){return""+me+""},Ie.link=function(me,be,De){if(me=ae(this.options.sanitize,this.options.baseUrl,me),me===null)return De;var we='"+De+"",we},Ie.image=function(me,be,De){if(me=ae(this.options.sanitize,this.options.baseUrl,me),me===null)return De;var we='":">",we},Ie.text=function(me){return me},ke}(),ce=function(){function ke(){}var Ie=ke.prototype;return Ie.strong=function(me){return me},Ie.em=function(me){return me},Ie.codespan=function(me){return me},Ie.del=function(me){return me},Ie.html=function(me){return me},Ie.text=function(me){return me},Ie.link=function(me,be,De){return""+De},Ie.image=function(me,be,De){return""+De},Ie.br=function(){return""},ke}(),le=function(){function ke(){this.seen={}}var Ie=ke.prototype;return Ie.serialize=function(me){return me.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},Ie.getNextSafeSlug=function(me,be){var De=me,we=0;if(this.seen.hasOwnProperty(De)){we=this.seen[me];do we++,De=me+"-"+we;while(this.seen.hasOwnProperty(De))}return be||(this.seen[me]=we,this.seen[De]=0),De},Ie.slug=function(me,be){be===void 0&&(be={});var De=this.serialize(me);return this.getNextSafeSlug(De,be.dryrun)},ke}(),de=ne,z=ce,te=le,he=D.exports.defaults,ge=R.unescape,ve=function(){function ke(Me){this.options=Me||he,this.options.renderer=this.options.renderer||new de,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new z,this.slugger=new te}ke.parse=function(me,be){var De=new ke(be);return De.parse(me)},ke.parseInline=function(me,be){var De=new ke(be);return De.parseInline(me)};var Ie=ke.prototype;return Ie.parse=function(me,be){be===void 0&&(be=!0);var De="",we,_e,Pe,Te,Ve,je,qe,Ge,Ze,$e,Je,Ye,et,it,Qe,rt,mt,ht,pt,hi=me.length;for(we=0;we
0&&Qe.tokens[0].type==="paragraph"?(Qe.tokens[0].text=ht+" "+Qe.tokens[0].text,Qe.tokens[0].tokens&&Qe.tokens[0].tokens.length>0&&Qe.tokens[0].tokens[0].type==="text"&&(Qe.tokens[0].tokens[0].text=ht+" "+Qe.tokens[0].tokens[0].text)):Qe.tokens.unshift({type:"text",text:ht}):it+=ht),it+=this.parse(Qe.tokens,et),Ze+=this.renderer.listitem(it,mt,rt);De+=this.renderer.list(Ze,Je,Ye);continue}case"html":{De+=this.renderer.html($e.text);continue}case"paragraph":{De+=this.renderer.paragraph(this.parseInline($e.tokens));continue}case"text":{for(Ze=$e.tokens?this.parseInline($e.tokens):$e.text;we+1 An error occurred:
"+Le(Pe.message+"",!0)+"";throw Pe}}Be.options=Be.setOptions=function(ke){return We(Be.defaults,ke),Oe(Be.defaults),Be},Be.getDefaults=ye,Be.defaults=He,Be.use=function(){for(var ke=this,Ie=arguments.length,Me=new Array(Ie),me=0;me
"+Le(me.message+"",!0)+"";throw me}},Be.Parser=Ee,Be.parser=Ee.parse,Be.Renderer=Ne,Be.TextRenderer=ze,Be.Lexer=Se,Be.lexer=Se.lex,Be.Tokenizer=Ae,Be.Slugger=xe,Be.parse=Be;var Ke=Be;return Ke}),define(J[298],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayNavigator=void 0;class w{constructor(T,D=0,S=T.length,p=D-1){this.items=T,this.start=D,this.end=S,this.index=p}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}e.ArrayNavigator=w}),define(J[299],ee([0,1,298]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HistoryNavigator=void 0;class N{constructor(D=[],S=10){this._initialize(D),this._limit=S,this._onChange()}getHistory(){return this._elements}add(D){this._history.delete(D),this._history.add(D),this._onChange()}next(){return this._currentPosition()!==this._elements.length-1?this._navigator.next():null}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}has(D){return this._history.has(D)}_onChange(){this._reduceToLimit();const D=this._elements;this._navigator=new w.ArrayNavigator(D,0,D.length,D.length)}_reduceToLimit(){const D=this._elements;D.length>this._limit&&this._initialize(D.slice(D.length-this._limit))}_currentPosition(){const D=this._navigator.current();return D?this._elements.indexOf(D):-1}_initialize(D){this._history=new Set;for(const S of D)this._history.add(S)}get _elements(){const D=[];return this._history.forEach(S=>D.push(S)),D}}e.HistoryNavigator=N}),define(J[106],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MovingAverage=e.clamp=void 0;function w(T,D,S){return Math.min(Math.max(T,D),S)}e.clamp=w;class N{constructor(){this._n=1,this._val=0}update(D){return this._val=this._val+(D-this._val)/this._n,this._n+=1,this}get value(){return this._val}}e.MovingAverage=N}),define(J[17],ee([0,1]),function(j,e){"use strict";var w;Object.defineProperty(e,"__esModule",{value:!0}),e.isLittleEndian=e.OS=e.setImmediate=e.userAgent=e.isIOS=e.isWeb=e.isNative=e.isLinux=e.isMacintosh=e.isWindows=e.globals=void 0;const N="en";let T=!1,D=!1,S=!1,p=!1,C=!1,n=!1,g=!1,t,s=N,c,u;e.globals=typeof self=="object"?self:typeof global=="object"?global:{};let d;typeof e.globals.vscode!="undefined"&&typeof e.globals.vscode.process!="undefined"?d=e.globals.vscode.process:typeof process!="undefined"&&(d=process);const a=typeof((w=d==null?void 0:d.versions)===null||w===void 0?void 0:w.electron)=="string"&&d.type==="renderer";if(typeof navigator=="object"&&!a)u=navigator.userAgent,T=u.indexOf("Windows")>=0,D=u.indexOf("Macintosh")>=0,g=(u.indexOf("Macintosh")>=0||u.indexOf("iPad")>=0||u.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,S=u.indexOf("Linux")>=0,n=!0,t=navigator.language,s=t;else if(typeof d=="object"){T=d.platform==="win32",D=d.platform==="darwin",S=d.platform==="linux",p=S&&!!d.env.SNAP&&!!d.env.SNAP_REVISION,t=N,s=N;const h=d.env.VSCODE_NLS_CONFIG;if(h)try{const f=JSON.parse(h),y=f.availableLanguages["*"];t=f.locale,s=y||N,c=f._translationsConfigFile}catch(f){}C=!0}else console.error("Unable to resolve platform.");let r=0;D?r=1:T?r=3:S&&(r=2),e.isWindows=T,e.isMacintosh=D,e.isLinux=S,e.isNative=C,e.isWeb=n,e.isIOS=g,e.userAgent=u,e.setImmediate=function(){if(e.globals.setImmediate)return e.globals.setImmediate.bind(e.globals);if(typeof e.globals.postMessage=="function"&&!e.globals.importScripts){let y=[];e.globals.addEventListener("message",b=>{if(b.data&&b.data.vscodeSetImmediateId)for(let v=0,m=y.length;v
=0;q--){const ne=ie.charCodeAt(q);if(ne!==32&&ne!==9)return q}return-1}e.lastNonWhitespaceIndex=o;function i(ie,ae){return ieae?1:0}e.compare=i;function l(ie,ae,q=0,ne=ie.length,ce=0,le=ae.length){for(;q he)return 1}const de=ne-q,z=le-ce;return de z?1:0}e.compareSubstring=l;function h(ie,ae){return f(ie,ae,0,ie.length,0,ae.length)}e.compareIgnoreCase=h;function f(ie,ae,q=0,ne=ie.length,ce=0,le=ae.length){for(;q =128||he>=128)return l(ie.toLowerCase(),ae.toLowerCase(),q,ne,ce,le);y(te)&&(te-=32),y(he)&&(he-=32);const ge=te-he;if(ge!==0)return ge}const de=ne-q,z=le-ce;return de z?1:0}e.compareSubstringIgnoreCase=f;function y(ie){return ie>=97&&ie<=122}e.isLowerAsciiLetter=y;function _(ie){return ie>=65&&ie<=90}e.isUpperAsciiLetter=_;function b(ie,ae){return ie.length===ae.length&&f(ie,ae)===0}e.equalsIgnoreCase=b;function v(ie,ae){const q=ae.length;return ae.length>ie.length?!1:f(ie,ae,0,q)===0}e.startsWithIgnoreCase=v;function m(ie,ae){let q,ne=Math.min(ie.length,ae.length);for(q=0;q 1){const ne=ie.charCodeAt(ae-2);if(I(ne))return M(ne,q)}return q}function R(ie,ae){const q=V.getInstance(),ne=ae,ce=ie.length,le=P(ie,ce,ae);ae+=le>=65536?2:1;let de=q.getGraphemeBreakType(le);for(;ae =65536?2:1,de=te}return ae-ne}e.nextCharLength=R;function A(ie,ae){const q=V.getInstance(),ne=ae,ce=F(ie,ae);ae-=ce>=65536?2:1;let le=q.getGraphemeBreakType(ce);for(;ae>0;){const de=F(ie,ae),z=q.getGraphemeBreakType(de);if($(z,le))break;ae-=de>=65536?2:1,le=z}return ne-ae}e.prevCharLength=A;const O=/(?:[\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])/;function L(ie){return O.test(ie)}e.containsRTL=L;const B=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function W(ie){return B.test(ie)}e.containsEmoji=W;const K=/^[\t\n\r\x20-\x7E]*$/;function H(ie){return K.test(ie)}e.isBasicASCII=H,e.UNUSUAL_LINE_TERMINATORS=/[\u2028\u2029]/;function Y(ie){return e.UNUSUAL_LINE_TERMINATORS.test(ie)}e.containsUnusualLineTerminators=Y;function X(ie){for(let ae=0,q=ie.length;ae =11904&&ie<=55215||ie>=63744&&ie<=64255||ie>=65281&&ie<=65374}e.isFullWidthCharacter=Z;function se(ie){return ie>=127462&&ie<=127487||ie===8986||ie===8987||ie===9200||ie===9203||ie>=9728&&ie<=10175||ie===11088||ie===11093||ie>=127744&&ie<=128591||ie>=128640&&ie<=128764||ie>=128992&&ie<=129003||ie>=129280&&ie<=129535||ie>=129648&&ie<=129750}e.isEmojiImprecise=se,e.UTF8_BOM_CHARACTER=String.fromCharCode(65279);function oe(ie){return!!(ie&&ie.length>0&&ie.charCodeAt(0)===65279)}e.startsWithUTF8BOM=oe;function G(ie,ae=!1){return ie?(ae&&(ie=ie.replace(/\\./g,"")),ie.toLowerCase()!==ie):!1}e.containsUppercaseCharacter=G;function x(ie){const ae=90-65+1;return ie=ie%(2*ae),ieq[3*ce+1])ce=2*ce+1;else return q[3*ce+2];return 0}}V._INSTANCE=null;function Q(){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]")}function ue(ie,ae){if(ie===0)return 0;const q=pe(ie,ae);if(q!==void 0)return q;const ne=F(ae,ie);return ie-=fe(ne),ie}e.getLeftDeleteOffset=ue;function pe(ie,ae){let q=F(ae,ie);for(ie-=fe(q);re(q)||q===65039||q===8419;){if(ie===0)return;q=F(ae,ie),ie-=fe(q)}if(!!se(q)){if(ie>=0){const ne=F(ae,ie);ne===8205&&(ie-=fe(ne))}return ie}}function fe(ie){return ie>=65536?2:1}function re(ie){return 127995<=ie&&ie<=127999}}),define(J[162],ee([0,1,75,17,8]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hasDriveLetter=e.isRootOrDriveLetter=e.isWindowsDriveLetter=e.isEqualOrParent=e.toPosixPath=e.toSlashes=void 0;function D(t){return t.replace(/[\\/]/g,w.posix.sep)}e.toSlashes=D;function S(t){return t.indexOf("/")===-1&&(t=D(t)),/^[a-zA-Z]:(\/|$)/.test(t)&&(t="/"+t),t}e.toPosixPath=S;function p(t,s,c,u=w.sep){if(t===s)return!0;if(!t||!s||s.length>t.length)return!1;if(c){if(!(0,T.startsWithIgnoreCase)(t,s))return!1;if(s.length===t.length)return!0;let a=s.length;return s.charAt(s.length-1)===u&&a--,t.charAt(a)===u}return s.charAt(s.length-1)!==u&&(s+=u),t.indexOf(s)===0}e.isEqualOrParent=p;function C(t){return t>=65&&t<=90||t>=97&&t<=122}e.isWindowsDriveLetter=C;function n(t){const s=(0,w.normalize)(t);return N.isWindows?t.length>3?!1:g(s)&&(t.length===2||s.charCodeAt(2)===92):s===w.posix.sep}e.isRootOrDriveLetter=n;function g(t){return N.isWindows?C(t.charCodeAt(0))&&t.charCodeAt(1)===58:!1}e.hasDriveLetter=g}),define(J[95],ee([0,1,8]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StringSHA1=e.toHexString=e.stringHash=e.numberHash=e.doHash=e.hash=void 0;function N(d){return T(d,0)}e.hash=N;function T(d,a){switch(typeof d){case"object":return d===null?D(349,a):Array.isArray(d)?C(d,a):n(d,a);case"string":return p(d,a);case"boolean":return S(d,a);case"number":return D(d,a);case"undefined":return D(937,a);default:return D(617,a)}}e.doHash=T;function D(d,a){return(a<<5)-a+d|0}e.numberHash=D;function S(d,a){return D(d?433:863,a)}function p(d,a){a=D(149417,a);for(let r=0,o=d.length;r T(o,r),a)}function n(d,a){return a=D(181387,a),Object.keys(d).sort().reduce((r,o)=>(r=p(o,r),T(d[o],r)),a)}function g(d,a,r=32){const o=r-a,i=~((1< >>o)>>>0}function t(d,a=0,r=d.byteLength,o=0){for(let i=0;i r.toString(16).padStart(2,"0")).join(""):s((d>>>0).toString(16),a/4)}e.toHexString=c;class u{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(64+3),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(a){const r=a.length;if(r===0)return;const o=this._buff;let i=this._buffLen,l=this._leftoverHighSurrogate,h,f;for(l!==0?(h=l,f=-1,l=0):(h=a.charCodeAt(0),f=0);;){let y=h;if(w.isHighSurrogate(h))if(f+1 >>6,a[r++]=128|(o&63)>>>0):o<65536?(a[r++]=224|(o&61440)>>>12,a[r++]=128|(o&4032)>>>6,a[r++]=128|(o&63)>>>0):(a[r++]=240|(o&1835008)>>>18,a[r++]=128|(o&258048)>>>12,a[r++]=128|(o&4032)>>>6,a[r++]=128|(o&63)>>>0),r>=64&&(this._step(),r-=64,this._totalLen+=64,a[0]=a[64+0],a[1]=a[64+1],a[2]=a[64+2]),r}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),c(this._h0)+c(this._h1)+c(this._h2)+c(this._h3)+c(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,t(this._buff,this._buffLen),this._buffLen>56&&(this._step(),t(this._buff));const a=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(a/4294967296),!1),this._buffDV.setUint32(60,a%4294967296,!1),this._step()}_step(){const a=u._bigBlock32,r=this._buffDV;for(let v=0;v<64;v+=4)a.setUint32(v,r.getUint32(v,!1),!1);for(let v=64;v<320;v+=4)a.setUint32(v,g(a.getUint32(v-12,!1)^a.getUint32(v-32,!1)^a.getUint32(v-56,!1)^a.getUint32(v-64,!1),1),!1);let o=this._h0,i=this._h1,l=this._h2,h=this._h3,f=this._h4,y,_,b;for(let v=0;v<80;v++)v<20?(y=i&l|~i&h,_=1518500249):v<40?(y=i^l^h,_=1859775393):v<60?(y=i&l|i&h|l&h,_=2400959708):(y=i^l^h,_=3395469782),b=g(o,5)+y+f+_+a.getUint32(v*4,!1)&4294967295,f=h,h=l,l=g(i,30),i=o,o=b;this._h0=this._h0+o&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+l&4294967295,this._h3=this._h3+h&4294967295,this._h4=this._h4+f&4294967295}}e.StringSHA1=u,u._bigBlock32=new DataView(new ArrayBuffer(320))}),define(J[134],ee([0,1,297,95]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LcsDiff=e.MyArray=e.Debug=e.stringDiff=e.StringDiffSequence=void 0;class T{constructor(t){this.source=t}getElements(){const t=this.source,s=new Int32Array(t.length);for(let c=0,u=t.length;c0||this.m_modifiedCount>0)&&this.m_changes.push(new w.DiffChange(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(t,s){this.m_originalStart=Math.min(this.m_originalStart,t),this.m_modifiedStart=Math.min(this.m_modifiedStart,s),this.m_originalCount++}AddModifiedElement(t,s){this.m_originalStart=Math.min(this.m_originalStart,t),this.m_modifiedStart=Math.min(this.m_modifiedStart,s),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}}class n{constructor(t,s,c=null){this.ContinueProcessingPredicate=c,this._originalSequence=t,this._modifiedSequence=s;const[u,d,a]=n._getElements(t),[r,o,i]=n._getElements(s);this._hasStrings=a&&i,this._originalStringElements=u,this._originalElementsOrHash=d,this._modifiedStringElements=r,this._modifiedElementsOrHash=o,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(t){return t.length>0&&typeof t[0]=="string"}static _getElements(t){const s=t.getElements();if(n._isStringArray(s)){const c=new Int32Array(s.length);for(let u=0,d=s.length;u =t&&u>=c&&this.ElementsAreEqual(s,u);)s--,u--;if(t>s||c>u){let h;return c<=u?(S.Assert(t===s+1,"originalStart should only be one more than originalEnd"),h=[new w.DiffChange(t,0,c,u-c+1)]):t<=s?(S.Assert(c===u+1,"modifiedStart should only be one more than modifiedEnd"),h=[new w.DiffChange(t,s-t+1,c,0)]):(S.Assert(t===s+1,"originalStart should only be one more than originalEnd"),S.Assert(c===u+1,"modifiedStart should only be one more than modifiedEnd"),h=[]),h}const a=[0],r=[0],o=this.ComputeRecursionPoint(t,s,c,u,a,r,d),i=a[0],l=r[0];if(o!==null)return o;if(!d[0]){const h=this.ComputeDiffRecursive(t,i,c,l,d);let f=[];return d[0]?f=[new w.DiffChange(i+1,s-(i+1)+1,l+1,u-(l+1)+1)]:f=this.ComputeDiffRecursive(i+1,s,l+1,u,d),this.ConcatenateChanges(h,f)}return[new w.DiffChange(t,s-t+1,c,u-c+1)]}WALKTRACE(t,s,c,u,d,a,r,o,i,l,h,f,y,_,b,v,m,E){let I=null,k=null,M=new C,P=s,F=c,R=y[0]-v[0]-u,A=-1073741824,O=this.m_forwardHistory.length-1;do{const L=R+t;L===P||L =0&&(i=this.m_forwardHistory[O],t=i[0],P=1,F=i.length-1)}while(--O>=-1);if(I=M.getReverseChanges(),E[0]){let L=y[0]+1,B=v[0]+1;if(I!==null&&I.length>0){const W=I[I.length-1];L=Math.max(L,W.getOriginalEnd()),B=Math.max(B,W.getModifiedEnd())}k=[new w.DiffChange(L,f-L+1,B,b-B+1)]}else{M=new C,P=a,F=r,R=y[0]-v[0]-o,A=1073741824,O=m?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const L=R+d;L===P||L =l[L+1]?(h=l[L+1]-1,_=h-R-o,h>A&&M.MarkNextChange(),A=h+1,M.AddOriginalElement(h+1,_+1),R=L+1-d):(h=l[L-1],_=h-R-o,h>A&&M.MarkNextChange(),A=h,M.AddModifiedElement(h+1,_+1),R=L-1-d),O>=0&&(l=this.m_reverseHistory[O],d=l[0],P=1,F=l.length-1)}while(--O>=-1);k=M.getChanges()}return this.ConcatenateChanges(I,k)}ComputeRecursionPoint(t,s,c,u,d,a,r){let o=0,i=0,l=0,h=0,f=0,y=0;t--,c--,d[0]=0,a[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const _=s-t+(u-c),b=_+1,v=new Int32Array(b),m=new Int32Array(b),E=u-c,I=s-t,k=t-c,M=s-u,F=(I-E)%2==0;v[E]=t,m[I]=s,r[0]=!1;for(let R=1;R<=_/2+1;R++){let A=0,O=0;l=this.ClipDiagonalBound(E-R,R,E,b),h=this.ClipDiagonalBound(E+R,R,E,b);for(let B=l;B<=h;B+=2){B===l||B A+O&&(A=o,O=i),!F&&Math.abs(B-I)<=R-1&&o>=m[B])return d[0]=o,a[0]=i,W<=m[B]&&1447>0&&R<=1447+1?this.WALKTRACE(E,l,h,k,I,f,y,M,v,m,o,s,d,i,u,a,F,r):null}const L=(A-t+(O-c)-R)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(A,L))return r[0]=!0,d[0]=A,a[0]=O,L>0&&1447>0&&R<=1447+1?this.WALKTRACE(E,l,h,k,I,f,y,M,v,m,o,s,d,i,u,a,F,r):(t++,c++,[new w.DiffChange(t,s-t+1,c,u-c+1)]);f=this.ClipDiagonalBound(I-R,R,I,b),y=this.ClipDiagonalBound(I+R,R,I,b);for(let B=f;B<=y;B+=2){B===f||B =m[B+1]?o=m[B+1]-1:o=m[B-1],i=o-(B-I)-M;const W=o;for(;o>t&&i>c&&this.ElementsAreEqual(o,i);)o--,i--;if(m[B]=o,F&&Math.abs(B-E)<=R&&o<=v[B])return d[0]=o,a[0]=i,W>=v[B]&&1447>0&&R<=1447+1?this.WALKTRACE(E,l,h,k,I,f,y,M,v,m,o,s,d,i,u,a,F,r):null}if(R<=1447){let B=new Int32Array(h-l+2);B[0]=E-l+1,p.Copy2(v,l,B,1,h-l+1),this.m_forwardHistory.push(B),B=new Int32Array(y-f+2),B[0]=I-f+1,p.Copy2(m,f,B,1,y-f+1),this.m_reverseHistory.push(B)}}return this.WALKTRACE(E,l,h,k,I,f,y,M,v,m,o,s,d,i,u,a,F,r)}PrettifyChanges(t){for(let s=0;s 0,r=c.modifiedLength>0;for(;c.originalStart+c.originalLength=0;s--){const c=t[s];let u=0,d=0;if(s>0){const h=t[s-1];u=h.originalStart+h.originalLength,d=h.modifiedStart+h.modifiedLength}const a=c.originalLength>0,r=c.modifiedLength>0;let o=0,i=this._boundaryScore(c.originalStart,c.originalLength,c.modifiedStart,c.modifiedLength);for(let h=1;;h++){const f=c.originalStart-h,y=c.modifiedStart-h;if(fi&&(i=b,o=h)}c.originalStart-=o,c.modifiedStart-=o;const l=[null];if(s>0&&this.ChangesOverlap(t[s-1],t[s],l)){t[s-1]=l[0],t.splice(s,1),s++;continue}}if(this._hasStrings)for(let s=1,c=t.length;s 0&&y>o&&(o=y,i=h,l=f)}return o>0?[i,l]:null}_contiguousSequenceScore(t,s,c){let u=0;for(let d=0;d =this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[t])}_OriginalRegionIsBoundary(t,s){if(this._OriginalIsBoundary(t)||this._OriginalIsBoundary(t-1))return!0;if(s>0){const c=t+s;if(this._OriginalIsBoundary(c-1)||this._OriginalIsBoundary(c))return!0}return!1}_ModifiedIsBoundary(t){return t<=0||t>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[t])}_ModifiedRegionIsBoundary(t,s){if(this._ModifiedIsBoundary(t)||this._ModifiedIsBoundary(t-1))return!0;if(s>0){const c=t+s;if(this._ModifiedIsBoundary(c-1)||this._ModifiedIsBoundary(c))return!0}return!1}_boundaryScore(t,s,c,u){const d=this._OriginalRegionIsBoundary(t,s)?1:0,a=this._ModifiedRegionIsBoundary(c,u)?1:0;return d+a}ConcatenateChanges(t,s){let c=[];if(t.length===0||s.length===0)return s.length>0?s:t;if(this.ChangesOverlap(t[t.length-1],s[0],c)){const u=new Array(t.length+s.length-1);return p.Copy(t,0,u,0,t.length-1),u[t.length-1]=c[0],p.Copy(s,1,u,t.length,s.length-1),u}else{const u=new Array(t.length+s.length);return p.Copy(t,0,u,0,t.length),p.Copy(s,0,u,t.length,s.length),u}}ChangesOverlap(t,s,c){if(S.Assert(t.originalStart<=s.originalStart,"Left change is not less than or equal to right change"),S.Assert(t.modifiedStart<=s.modifiedStart,"Left change is not less than or equal to right change"),t.originalStart+t.originalLength>=s.originalStart||t.modifiedStart+t.modifiedLength>=s.modifiedStart){const u=t.originalStart;let d=t.originalLength;const a=t.modifiedStart;let r=t.modifiedLength;return t.originalStart+t.originalLength>=s.originalStart&&(d=s.originalStart+s.originalLength-t.originalStart),t.modifiedStart+t.modifiedLength>=s.modifiedStart&&(r=s.modifiedStart+s.modifiedLength-t.modifiedStart),c[0]=new w.DiffChange(u,d,a,r),!0}else return c[0]=null,!1}ClipDiagonalBound(t,s,c,u){if(t>=0&&ti.lastDiffIds},{getElements:()=>[...i.children.slice(0,h),...l,...i.children.slice(h+u)].map(m=>s.getId(m.element).toString())}).ComputeDiff(!1);if(f.quitEarly)return i.lastDiffIds=void 0,this.spliceSimple(c,u,l,a);const y=c.slice(0,-1),_=(m,E,I)=>{if(r>0)for(let k=0;kI.originalStart-E.originalStart))_(b,v,b-(m.originalStart+m.originalLength)),b=m.originalStart,v=m.modifiedStart-h,this.spliceSimple([...y,b],m.originalLength,S.Iterable.slice(l,v,v+m.modifiedLength),a);_(b,v,b)}spliceSimple(s,c,u=S.Iterable.empty(),{onDidCreateNode:d,onDidDeleteNode:a,diffIdentityProvider:r}){const{parentNode:o,listIndex:i,revealed:l,visible:h}=this.getParentNodeWithListIndex(s),f=[],y=S.Iterable.map(u,R=>this.createTreeNode(R,o,o.visible?1:0,l,f,d)),_=s[s.length-1],b=o.children.length>0;let v=0;for(let R=_;R>=0&&R r.getId(R.element).toString())):o.lastDiffIds=o.children.map(R=>r.getId(R.element).toString()):o.lastDiffIds=void 0;let M=0;for(const R of k)R.visible&&M++;if(M!==0)for(let R=_+m.length;R A+(O.visible?O.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(o,I-R),this.list.splice(i,R,f)}if(k.length>0&&a){const R=A=>{a(A),A.children.forEach(R)};k.forEach(R)}const P=o.children.length>0;b!==P&&this.setCollapsible(s.slice(0,-1),P),this._onDidSplice.fire({insertedNodes:m,deletedNodes:k});let F=o;for(;F;){if(F.visibility===2){this.refilter();break}F=F.parent}}rerender(s){if(s.length===0)throw new w.TreeError(this.user,"Invalid tree location");const{node:c,listIndex:u,revealed:d}=this.getTreeNodeWithListIndex(s);c.visible&&d&&this.list.splice(u,1,[c])}has(s){return this.hasTreeNode(s)}getListIndex(s){const{listIndex:c,visible:u,revealed:d}=this.getTreeNodeWithListIndex(s);return u&&d?c:-1}getListRenderCount(s){return this.getTreeNode(s).renderNodeCount}isCollapsible(s){return this.getTreeNode(s).collapsible}setCollapsible(s,c){const u=this.getTreeNode(s);typeof c=="undefined"&&(c=!u.collapsible);const d={collapsible:c};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(s,d))}isCollapsed(s){return this.getTreeNode(s).collapsed}setCollapsed(s,c,u){const d=this.getTreeNode(s);typeof c=="undefined"&&(c=!d.collapsed);const a={collapsed:c,recursive:u||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(s,a))}_setCollapseState(s,c){const{node:u,listIndex:d,revealed:a}=this.getTreeNodeWithListIndex(s),r=this._setListNodeCollapseState(u,d,a,c);if(u!==this.root&&this.autoExpandSingleChildren&&r&&!n(c)&&u.collapsible&&!u.collapsed&&!c.recursive){let o=-1;for(let i=0;i -1){o=-1;break}else o=i;o>-1&&this._setCollapseState([...s,o],c)}return r}_setListNodeCollapseState(s,c,u,d){const a=this._setNodeCollapseState(s,d,!1);if(!u||!s.visible||!a)return a;const r=s.renderNodeCount,o=this.updateNodeAfterCollapseChange(s),i=r-(c===-1?0:1);return this.list.splice(c+1,i,o.slice(1)),a}_setNodeCollapseState(s,c,u){let d;if(s===this.root?d=!1:(n(c)?(d=s.collapsible!==c.collapsible,s.collapsible=c.collapsible):s.collapsible?(d=s.collapsed!==c.collapsed,s.collapsed=c.collapsed):d=!1,d&&this._onDidChangeCollapseState.fire({node:s,deep:u})),!n(c)&&c.recursive)for(const a of s.children)d=this._setNodeCollapseState(a,c,!0)||d;return d}expandTo(s){this.eventBufferer.bufferEvents(()=>{let c=this.getTreeNode(s);for(;c.parent;)c=c.parent,s=s.slice(0,s.length-1),c.collapsed&&this._setCollapseState(s,{collapsed:!1,recursive:!1})})}refilter(){const s=this.root.renderNodeCount,c=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,s,c)}createTreeNode(s,c,u,d,a,r){const o={parent:c,element:s.element,children:[],depth:c.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof s.collapsible=="boolean"?s.collapsible:typeof s.collapsed!="undefined",collapsed:typeof s.collapsed=="undefined"?this.collapseByDefault:s.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},i=this._filterNode(o,u);o.visibility=i,d&&a.push(o);const l=s.children||S.Iterable.empty(),h=d&&i!==0&&!o.collapsed,f=S.Iterable.map(l,b=>this.createTreeNode(b,o,i,h,a,r));let y=0,_=1;for(const b of f)o.children.push(b),_+=b.renderNodeCount,b.visible&&(b.visibleChildIndex=y++);return o.collapsible=o.collapsible||o.children.length>0,o.visibleChildrenCount=y,o.visible=i===2?y>0:i===1,o.visible?o.collapsed||(o.renderNodeCount=_):(o.renderNodeCount=0,d&&a.pop()),r&&r(o),o}updateNodeAfterCollapseChange(s){const c=s.renderNodeCount,u=[];return this._updateNodeAfterCollapseChange(s,u),this._updateAncestorsRenderNodeCount(s.parent,u.length-c),u}_updateNodeAfterCollapseChange(s,c){if(s.visible===!1)return 0;if(c.push(s),s.renderNodeCount=1,!s.collapsed)for(const u of s.children)s.renderNodeCount+=this._updateNodeAfterCollapseChange(u,c);return this._onDidChangeRenderNodeCount.fire(s),s.renderNodeCount}updateNodeAfterFilterChange(s){const c=s.renderNodeCount,u=[];return this._updateNodeAfterFilterChange(s,s.visible?1:0,u),this._updateAncestorsRenderNodeCount(s.parent,u.length-c),u}_updateNodeAfterFilterChange(s,c,u,d=!0){let a;if(s!==this.root){if(a=this._filterNode(s,c),a===0)return s.visible=!1,s.renderNodeCount=0,!1;d&&u.push(s)}const r=u.length;s.renderNodeCount=s===this.root?0:1;let o=!1;if(!s.collapsed||a!==0){let i=0;for(const l of s.children)o=this._updateNodeAfterFilterChange(l,a,u,d&&!s.collapsed)||o,l.visible&&(l.visibleChildIndex=i++);s.visibleChildrenCount=i}else s.visibleChildrenCount=0;return s!==this.root&&(s.visible=a===2?o:a===1,s.visibility=a),s.visible?s.collapsed||(s.renderNodeCount+=u.length-r):(s.renderNodeCount=0,d&&u.pop()),this._onDidChangeRenderNodeCount.fire(s),s.visible}_updateAncestorsRenderNodeCount(s,c){if(c!==0)for(;s;)s.renderNodeCount+=c,this._onDidChangeRenderNodeCount.fire(s),s=s.parent}_filterNode(s,c){const u=this.filter?this.filter.filter(s.element,c):1;return typeof u=="boolean"?(s.filterData=void 0,u?1:0):p(u)?(s.filterData=u.data,C(u.visibility)):(s.filterData=void 0,C(u))}hasTreeNode(s,c=this.root){if(!s||s.length===0)return!0;const[u,...d]=s;return u<0||u>c.children.length?!1:this.hasTreeNode(d,c.children[u])}getTreeNode(s,c=this.root){if(!s||s.length===0)return c;const[u,...d]=s;if(u<0||u>c.children.length)throw new w.TreeError(this.user,"Invalid tree location");return this.getTreeNode(d,c.children[u])}getTreeNodeWithListIndex(s){if(s.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:c,listIndex:u,revealed:d,visible:a}=this.getParentNodeWithListIndex(s),r=s[s.length-1];if(r<0||r>c.children.length)throw new w.TreeError(this.user,"Invalid tree location");const o=c.children[r];return{node:o,listIndex:u,revealed:d,visible:a&&o.visible}}getParentNodeWithListIndex(s,c=this.root,u=0,d=!0,a=!0){const[r,...o]=s;if(r<0||r>c.children.length)throw new w.TreeError(this.user,"Invalid tree location");for(let i=0;i {var d;if(u.element===null)return;const a=u;if(g.add(a.element),this.nodes.set(a.element,a),this.identityProvider){const r=this.identityProvider.getId(a.element).toString();t.add(r),this.nodesByIdentity.set(r,a)}(d=n.onDidCreateNode)===null||d===void 0||d.call(n,a)},c=u=>{var d;if(u.element===null)return;const a=u;if(g.has(a.element)||this.nodes.delete(a.element),this.identityProvider){const r=this.identityProvider.getId(a.element).toString();t.has(r)||this.nodesByIdentity.delete(r)}(d=n.onDidDeleteNode)===null||d===void 0||d.call(n,a)};this.model.splice([...p,0],Number.MAX_VALUE,C,Object.assign(Object.assign({},n),{onDidCreateNode:s,onDidDeleteNode:c}))}preserveCollapseState(p=T.Iterable.empty()){return this.sorter&&(p=[...p].sort(this.sorter.compare.bind(this.sorter))),T.Iterable.map(p,C=>{let n=this.nodes.get(C.element);if(!n&&this.identityProvider){const s=this.identityProvider.getId(C.element).toString();n=this.nodesByIdentity.get(s)}if(!n)return Object.assign(Object.assign({},C),{children:this.preserveCollapseState(C.children)});const g=typeof C.collapsible=="boolean"?C.collapsible:n.collapsible,t=typeof C.collapsed!="undefined"?C.collapsed:n.collapsed;return Object.assign(Object.assign({},C),{collapsible:g,collapsed:t,children:this.preserveCollapseState(C.children)})})}rerender(p){const C=this.getElementLocation(p);this.model.rerender(C)}has(p){return this.nodes.has(p)}getListIndex(p){const C=this.getElementLocation(p);return this.model.getListIndex(C)}getListRenderCount(p){const C=this.getElementLocation(p);return this.model.getListRenderCount(C)}isCollapsible(p){const C=this.getElementLocation(p);return this.model.isCollapsible(C)}setCollapsible(p,C){const n=this.getElementLocation(p);return this.model.setCollapsible(n,C)}isCollapsed(p){const C=this.getElementLocation(p);return this.model.isCollapsed(C)}setCollapsed(p,C,n){const g=this.getElementLocation(p);return this.model.setCollapsed(g,C,n)}expandTo(p){const C=this.getElementLocation(p);this.model.expandTo(C)}refilter(){this.model.refilter()}getNode(p=null){if(p===null)return this.model.getNode(this.model.rootRef);const C=this.nodes.get(p);if(!C)throw new N.TreeError(this.user,`Tree element not found: ${p}`);return C}getNodeLocation(p){return p.element}getParentNodeLocation(p){if(p===null)throw new N.TreeError(this.user,"Invalid getParentNodeLocation call");const C=this.nodes.get(p);if(!C)throw new N.TreeError(this.user,`Tree element not found: ${p}`);const n=this.model.getNodeLocation(C),g=this.model.getParentNodeLocation(n);return this.model.getNode(g).element}getElementLocation(p){if(p===null)return[];const C=this.nodes.get(p);if(!C)throw new N.TreeError(this.user,`Tree element not found: ${p}`);return this.model.getNodeLocation(C)}}e.ObjectTreeModel=D}),define(J[304],ee([0,1,164,104,4,54]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CompressibleObjectTreeModel=e.DefaultElementMapper=e.CompressedObjectTreeModel=e.decompress=e.compress=void 0;function S(o){const i=[o.element],l=o.incompressible||!1;return{element:{elements:i,incompressible:l},children:D.Iterable.map(D.Iterable.from(o.children),S),collapsible:o.collapsible,collapsed:o.collapsed}}function p(o){const i=[o.element],l=o.incompressible||!1;let h,f;for(;[f,h]=D.Iterable.consume(D.Iterable.from(o.children),2),!(f.length!==1||f[0].incompressible);)o=f[0],i.push(o.element);return{element:{elements:i,incompressible:l},children:D.Iterable.map(D.Iterable.concat(f,h),p),collapsible:o.collapsible,collapsed:o.collapsed}}e.compress=p;function C(o,i=0){let l;return i C(h,0)),i===0&&o.element.incompressible?{element:o.element.elements[i],children:l,incompressible:!0,collapsible:o.collapsible,collapsed:o.collapsed}:{element:o.element.elements[i],children:l,collapsible:o.collapsible,collapsed:o.collapsed}}function n(o){return C(o,0)}e.decompress=n;function g(o,i,l){return o.element===i?Object.assign(Object.assign({},o),{children:l}):Object.assign(Object.assign({},o),{children:D.Iterable.map(D.Iterable.from(o.children),h=>g(h,i,l))})}const t=o=>({getId(i){return i.elements.map(l=>o.getId(l).toString()).join("\0")}});class s{constructor(i,l,h={}){this.user=i,this.rootRef=null,this.nodes=new Map,this.model=new w.ObjectTreeModel(i,l,h),this.enabled=typeof h.compressionEnabled=="undefined"?!0:h.compressionEnabled,this.identityProvider=h.identityProvider}get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}setChildren(i,l=D.Iterable.empty(),h){const f=h.diffIdentityProvider&&t(h.diffIdentityProvider);if(i===null){const M=D.Iterable.map(l,this.enabled?p:S);this._setChildren(null,M,{diffIdentityProvider:f,diffDepth:Infinity});return}const y=this.nodes.get(i);if(!y)throw new Error("Unknown compressed tree node");const _=this.model.getNode(y),b=this.model.getParentNodeLocation(y),v=this.model.getNode(b),m=n(_),E=g(m,i,l),I=(this.enabled?p:S)(E),k=v.children.map(M=>M===_?I:M);this._setChildren(v.element,k,{diffIdentityProvider:f,diffDepth:_.depth-v.depth})}setCompressionEnabled(i){if(i===this.enabled)return;this.enabled=i;const h=this.model.getNode().children,f=D.Iterable.map(h,n),y=D.Iterable.map(f,i?p:S);this._setChildren(null,y,{diffIdentityProvider:this.identityProvider,diffDepth:Infinity})}_setChildren(i,l,h){const f=new Set,y=b=>{for(const v of b.element.elements)f.add(v),this.nodes.set(v,b.element)},_=b=>{for(const v of b.element.elements)f.has(v)||this.nodes.delete(v)};this.model.setChildren(i,l,Object.assign(Object.assign({},h),{onDidCreateNode:y,onDidDeleteNode:_}))}has(i){return this.nodes.has(i)}getListIndex(i){const l=this.getCompressedNode(i);return this.model.getListIndex(l)}getListRenderCount(i){const l=this.getCompressedNode(i);return this.model.getListRenderCount(l)}getNode(i){if(typeof i=="undefined")return this.model.getNode();const l=this.getCompressedNode(i);return this.model.getNode(l)}getNodeLocation(i){const l=this.model.getNodeLocation(i);return l===null?null:l.elements[l.elements.length-1]}getParentNodeLocation(i){const l=this.getCompressedNode(i),h=this.model.getParentNodeLocation(l);return h===null?null:h.elements[h.elements.length-1]}isCollapsible(i){const l=this.getCompressedNode(i);return this.model.isCollapsible(l)}setCollapsible(i,l){const h=this.getCompressedNode(i);return this.model.setCollapsible(h,l)}isCollapsed(i){const l=this.getCompressedNode(i);return this.model.isCollapsed(l)}setCollapsed(i,l,h){const f=this.getCompressedNode(i);return this.model.setCollapsed(f,l,h)}expandTo(i){const l=this.getCompressedNode(i);this.model.expandTo(l)}rerender(i){const l=this.getCompressedNode(i);this.model.rerender(l)}refilter(){this.model.refilter()}getCompressedNode(i){if(i===null)return null;const l=this.nodes.get(i);if(!l)throw new N.TreeError(this.user,`Tree element not found: ${i}`);return l}}e.CompressedObjectTreeModel=s;const c=o=>o[o.length-1];e.DefaultElementMapper=c;class u{constructor(i,l){this.unwrapper=i,this.node=l}get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(i=>new u(this.unwrapper,i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}}function d(o,i){return{splice(l,h,f){i.splice(l,h,f.map(y=>o.map(y)))},updateElementHeight(l,h){i.updateElementHeight(l,h)}}}function a(o,i){return Object.assign(Object.assign({},i),{identityProvider:i.identityProvider&&{getId(l){return i.identityProvider.getId(o(l))}},sorter:i.sorter&&{compare(l,h){return i.sorter.compare(l.elements[0],h.elements[0])}},filter:i.filter&&{filter(l,h){return i.filter.filter(o(l),h)}}})}class r{constructor(i,l,h={}){this.rootRef=null,this.elementMapper=h.elementMapper||e.DefaultElementMapper;const f=y=>this.elementMapper(y.elements);this.nodeMapper=new N.WeakMapper(y=>new u(f,y)),this.model=new s(i,d(this.nodeMapper,l),a(f,h))}get onDidSplice(){return T.Event.map(this.model.onDidSplice,({insertedNodes:i,deletedNodes:l})=>({insertedNodes:i.map(h=>this.nodeMapper.map(h)),deletedNodes:l.map(h=>this.nodeMapper.map(h))}))}get onDidChangeCollapseState(){return T.Event.map(this.model.onDidChangeCollapseState,({node:i,deep:l})=>({node:this.nodeMapper.map(i),deep:l}))}get onDidChangeRenderNodeCount(){return T.Event.map(this.model.onDidChangeRenderNodeCount,i=>this.nodeMapper.map(i))}setChildren(i,l=D.Iterable.empty(),h={}){this.model.setChildren(i,l,h)}setCompressionEnabled(i){this.model.setCompressionEnabled(i)}has(i){return this.model.has(i)}getListIndex(i){return this.model.getListIndex(i)}getListRenderCount(i){return this.model.getListRenderCount(i)}getNode(i){return this.nodeMapper.map(this.model.getNode(i))}getNodeLocation(i){return i.element}getParentNodeLocation(i){return this.model.getParentNodeLocation(i)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,l){return this.model.setCollapsible(i,l)}isCollapsed(i){return this.model.isCollapsed(i)}setCollapsed(i,l,h){return this.model.setCollapsed(i,l,h)}expandTo(i){return this.model.expandTo(i)}rerender(i){return this.model.rerender(i)}refilter(){return this.model.refilter()}getCompressedTreeNode(i=null){return this.model.getNode(i)}}e.CompressibleObjectTreeModel=r}),define(J[47],ee([0,1,8]),function(j,e,w){"use strict";var N,T;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.ResourceMap=e.TernarySearchTree=e.UriIterator=e.PathIterator=e.ConfigKeysIterator=e.StringIterator=void 0;class D{constructor(){this._value="",this._pos=0}reset(a){return this._value=a,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos !1){return new g(new C(a))}static forStrings(){return new g(new D)}static forConfigKeys(){return new g(new S)}clear(){this._root=void 0}set(a,r){const o=this._iter.reset(a);let i;this._root||(this._root=new n,this._root.segment=o.value());const l=[];for(i=this._root;;){const f=o.cmp(i.segment);if(f>0)i.left||(i.left=new n,i.left.segment=o.value()),l.push([-1,i]),i=i.left;else if(f<0)i.right||(i.right=new n,i.right.segment=o.value()),l.push([1,i]),i=i.right;else if(o.hasNext())o.next(),i.mid||(i.mid=new n,i.mid.segment=o.value()),l.push([0,i]),i=i.mid;else break}const h=i.value;i.value=r,i.key=a;for(let f=l.length-1;f>=0;f--){const y=l[f][1];y.updateHeight();const _=y.balanceFactor();if(_<-1||_>1){const b=l[f][0],v=l[f+1][0];if(b===1&&v===1)l[f][1]=y.rotateLeft();else if(b===-1&&v===-1)l[f][1]=y.rotateRight();else if(b===1&&v===-1)y.right=l[f+1][1]=l[f+1][1].rotateRight(),l[f][1]=y.rotateLeft();else if(b===-1&&v===1)y.left=l[f+1][1]=l[f+1][1].rotateLeft(),l[f][1]=y.rotateRight();else throw new Error;if(f>0)switch(l[f-1][0]){case-1:l[f-1][1].left=l[f][1];break;case 1:l[f-1][1].right=l[f][1];break;case 0:l[f-1][1].mid=l[f][1];break}else this._root=l[0][1]}}return h}get(a){var r;return(r=this._getNode(a))===null||r===void 0?void 0:r.value}_getNode(a){const r=this._iter.reset(a);let o=this._root;for(;o;){const i=r.cmp(o.segment);if(i>0)o=o.left;else if(i<0)o=o.right;else if(r.hasNext())r.next(),o=o.mid;else break}return o}has(a){const r=this._getNode(a);return!((r==null?void 0:r.value)===void 0&&(r==null?void 0:r.mid)===void 0)}delete(a){return this._delete(a,!1)}deleteSuperstr(a){return this._delete(a,!0)}_delete(a,r){var o;const i=this._iter.reset(a),l=[];let h=this._root;for(;h;){const f=i.cmp(h.segment);if(f>0)l.push([-1,h]),h=h.left;else if(f<0)l.push([1,h]),h=h.right;else if(i.hasNext())i.next(),l.push([0,h]),h=h.mid;else break}if(!!h){if(r?(h.left=void 0,h.mid=void 0,h.right=void 0,h.height=1):(h.key=void 0,h.value=void 0),!h.mid&&!h.value)if(h.left&&h.right){const f=this._min(h.right),{key:y,value:_,segment:b}=f;this._delete(f.key,!1),h.key=y,h.value=_,h.segment=b}else{const f=(o=h.left)!==null&&o!==void 0?o:h.right;if(l.length>0){const[y,_]=l[l.length-1];switch(y){case-1:_.left=f;break;case 0:_.mid=f;break;case 1:_.right=f;break}}else this._root=f}for(let f=l.length-1;f>=0;f--){const y=l[f][1];y.updateHeight();const _=y.balanceFactor();if(_>1?(y.right.balanceFactor()>=0||(y.right=l[f+1][1]=l[f+1][1].rotateRight()),l[f][1]=y.rotateLeft()):_<-1&&(y.left.balanceFactor()<=0||(y.left=l[f+1][1]=l[f+1][1].rotateLeft()),l[f][1]=y.rotateRight()),f>0)switch(l[f-1][0]){case-1:l[f-1][1].left=l[f][1];break;case 1:l[f-1][1].right=l[f][1];break;case 0:l[f-1][1].mid=l[f][1];break}else this._root=l[0][1]}}}_min(a){for(;a.left;)a=a.left;return a}findSubstr(a){const r=this._iter.reset(a);let o=this._root,i;for(;o;){const l=r.cmp(o.segment);if(l>0)o=o.left;else if(l<0)o=o.right;else if(r.hasNext())r.next(),i=o.value||i,o=o.mid;else break}return o&&o.value||i}findSuperstr(a){const r=this._iter.reset(a);let o=this._root;for(;o;){const i=r.cmp(o.segment);if(i>0)o=o.left;else if(i<0)o=o.right;else if(r.hasNext())r.next(),o=o.mid;else return o.mid?this._entries(o.mid):void 0}}forEach(a){for(const[r,o]of this)a(o,r)}*[Symbol.iterator](){yield*this._entries(this._root)}*_entries(a){!a||(a.left&&(yield*this._entries(a.left)),a.value&&(yield[a.key,a.value]),a.mid&&(yield*this._entries(a.mid)),a.right&&(yield*this._entries(a.right)))}}e.TernarySearchTree=g;class t{constructor(a,r){this.uri=a,this.value=r}}class s{constructor(a,r){this[N]="ResourceMap",a instanceof s?(this.map=new Map(a.map),this.toKey=r??s.defaultToKey):(this.map=new Map,this.toKey=a??s.defaultToKey)}set(a,r){return this.map.set(this.toKey(a),new t(a,r)),this}get(a){var r;return(r=this.map.get(this.toKey(a)))===null||r===void 0?void 0:r.value}has(a){return this.map.has(this.toKey(a))}get size(){return this.map.size}clear(){this.map.clear()}delete(a){return this.map.delete(this.toKey(a))}forEach(a,r){typeof r!="undefined"&&(a=a.bind(r));for(let[o,i]of this.map)a(i.value,i.uri,this)}*values(){for(let a of this.map.values())yield a.value}*keys(){for(let a of this.map.values())yield a.uri}*entries(){for(let a of this.map.values())yield[a.uri,a.value]}*[(N=Symbol.toStringTag,Symbol.iterator)](){for(let[,a]of this.map)yield[a.uri,a.value]}}e.ResourceMap=s,s.defaultToKey=d=>d.toString();class c{constructor(){this[T]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var a;return(a=this._head)===null||a===void 0?void 0:a.value}get last(){var a;return(a=this._tail)===null||a===void 0?void 0:a.value}has(a){return this._map.has(a)}get(a,r=0){const o=this._map.get(a);if(!!o)return r!==0&&this.touch(o,r),o.value}set(a,r,o=0){let i=this._map.get(a);if(i)i.value=r,o!==0&&this.touch(i,o);else{switch(i={key:a,value:r,next:void 0,previous:void 0},o){case 0:this.addItemLast(i);break;case 1:this.addItemFirst(i);break;case 2:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(a,i),this._size++}return this}delete(a){return!!this.remove(a)}remove(a){const r=this._map.get(a);if(!!r)return this._map.delete(a),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const a=this._head;return this._map.delete(a.key),this.removeItem(a),this._size--,a.value}forEach(a,r){const o=this._state;let i=this._head;for(;i;){if(r?a.bind(r)(i.value,i.key,this):a(i.value,i.key,this),this._state!==o)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){const a=this,r=this._state;let o=this._head;const i={[Symbol.iterator](){return i},next(){if(a._state!==r)throw new Error("LinkedMap got modified during iteration.");if(o){const l={value:o.key,done:!1};return o=o.next,l}else return{value:void 0,done:!0}}};return i}values(){const a=this,r=this._state;let o=this._head;const i={[Symbol.iterator](){return i},next(){if(a._state!==r)throw new Error("LinkedMap got modified during iteration.");if(o){const l={value:o.value,done:!1};return o=o.next,l}else return{value:void 0,done:!0}}};return i}entries(){const a=this,r=this._state;let o=this._head;const i={[Symbol.iterator](){return i},next(){if(a._state!==r)throw new Error("LinkedMap got modified during iteration.");if(o){const l={value:[o.key,o.value],done:!1};return o=o.next,l}else return{value:void 0,done:!0}}};return i}[(T=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(a){if(a>=this.size)return;if(a===0){this.clear();return}let r=this._head,o=this.size;for(;r&&o>a;)this._map.delete(r.key),r=r.next,o--;this._head=r,this._size=o,r&&(r.previous=void 0),this._state++}addItemFirst(a){if(!this._head&&!this._tail)this._tail=a;else if(this._head)a.next=this._head,this._head.previous=a;else throw new Error("Invalid list");this._head=a,this._state++}addItemLast(a){if(!this._head&&!this._tail)this._head=a;else if(this._tail)a.previous=this._tail,this._tail.next=a;else throw new Error("Invalid list");this._tail=a,this._state++}removeItem(a){if(a===this._head&&a===this._tail)this._head=void 0,this._tail=void 0;else if(a===this._head){if(!a.next)throw new Error("Invalid list");a.next.previous=void 0,this._head=a.next}else if(a===this._tail){if(!a.previous)throw new Error("Invalid list");a.previous.next=void 0,this._tail=a.previous}else{const r=a.next,o=a.previous;if(!r||!o)throw new Error("Invalid list");r.previous=o,o.next=r}a.next=void 0,a.previous=void 0,this._state++}touch(a,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==1&&r!==2)){if(r===1){if(a===this._head)return;const o=a.next,i=a.previous;a===this._tail?(i.next=void 0,this._tail=i):(o.previous=i,i.next=o),a.previous=void 0,a.next=this._head,this._head.previous=a,this._head=a,this._state++}else if(r===2){if(a===this._tail)return;const o=a.next,i=a.previous;a===this._head?(o.previous=void 0,this._head=o):(o.previous=i,i.next=o),a.next=void 0,a.previous=this._tail,this._tail.next=a,this._tail=a,this._state++}}}toJSON(){const a=[];return this.forEach((r,o)=>{a.push([o,r])}),a}fromJSON(a){this.clear();for(const[r,o]of a)this.set(r,o)}}e.LinkedMap=c;class u extends c{constructor(a,r=1){super();this._limit=a,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(a){this._limit=a,this.checkTrim()}get(a,r=2){return super.get(a,r)}peek(a){return super.get(a,0)}set(a,r){return super.set(a,r,2),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}e.LRUCache=u}),define(J[68],ee([0,1,47,8]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fuzzyScoreGracefulAggressive=e.fuzzyScore=e.FuzzyScore=e.isPatternInWord=e.createMatches=e.anyScore=e.matchesFuzzy=e.matchesWords=e.matchesCamelCase=e.isUpper=e.matchesSubString=e.matchesContiguousSubString=e.matchesPrefix=e.or=void 0;function T(...re){return function(ie,ae){for(let q=0,ne=re.length;q 0?[{start:0,end:ie.length}]:[]:null}function S(re,ie){const ae=ie.toLowerCase().indexOf(re.toLowerCase());return ae===-1?null:[{start:ae,end:ae+re.length}]}e.matchesContiguousSubString=S;function p(re,ie){return C(re.toLowerCase(),ie.toLowerCase(),0,0)}e.matchesSubString=p;function C(re,ie,ae,q){if(ae===re.length)return[];if(q===ie.length)return null;if(re[ae]===ie[q]){let ne=null;return(ne=C(re,ie,ae+1,q+1))?r({start:q,end:q+1},ne):null}return C(re,ie,ae,q+1)}function n(re){return 97<=re&&re<=122}function g(re){return 65<=re&&re<=90}e.isUpper=g;function t(re){return 48<=re&&re<=57}function s(re){return re===32||re===9||re===10||re===13}const c=new Set;"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?".split("").forEach(re=>c.add(re.charCodeAt(0)));function u(re){return s(re)||c.has(re)}function d(re,ie){return re===ie||u(re)&&u(ie)}function a(re){return n(re)||g(re)||t(re)}function r(re,ie){return ie.length===0?ie=[re]:re.end===ie[0].start?ie[0].start=re.start:ie.unshift(re),ie}function o(re,ie){for(let ae=ie;ae 0&&!a(re.charCodeAt(ae-1)))return ae}return re.length}function i(re,ie,ae,q){if(ae===re.length)return[];if(q===ie.length)return null;if(re[ae]!==ie[q].toLowerCase())return null;{let ne=null,ce=q+1;for(ne=i(re,ie,ae+1,q+1);!ne&&(ce=o(ie,ce)) .6}function f(re){const{upperPercent:ie,lowerPercent:ae,alphaPercent:q,numericPercent:ne}=re;return ae>.2&&ie<.8&&q>.6&&ne<.2}function y(re){let ie=0,ae=0,q=0,ne=0;for(let ce=0;ce 60)return null;const ae=l(ie);if(!f(ae)){if(!h(ae))return null;ie=ie.toLowerCase()}let q=null,ne=0;for(re=re.toLowerCase();ne 0&&u(re.charCodeAt(ae-1)))return ae;return re.length}const E=T(e.matchesPrefix,_,S),I=T(e.matchesPrefix,_,p),k=new w.LRUCache(1e4);function M(re,ie,ae=!1){if(typeof re!="string"||typeof ie!="string")return null;let q=k.get(re);q||(q=new RegExp(N.convertSimple2RegExpPattern(re),"i"),k.set(re,q));const ne=q.exec(ie);return ne?[{start:ne.index,end:ne.index+ne[0].length}]:ae?I(re,ie):E(re,ie)}e.matchesFuzzy=M;function P(re,ie,ae,q,ne,ce){const le=Math.min(13,re.length);for(;ae 1;q--){const ne=re[q]+ae,ce=ie[ie.length-1];ce&&ce.end===ne?ce.end=ne+1:ie.push({start:ne,end:ne+1})}return ie}e.createMatches=F;const R=128;function A(){const re=[],ie=[];for(let ae=0;ae<=R;ae++)ie[ae]=0;for(let ae=0;ae<=R;ae++)re.push(ie.slice(0));return re}function O(re){const ie=[];for(let ae=0;ae<=re;ae++)ie[ae]=0;return ie}const L=O(2*R),B=O(2*R),W=A(),K=A(),H=A(),Y=!1;function X(re,ie,ae,q,ne){function ce(de,z,te=" "){for(;de.length ce(de,3)).join("|")} +`;for(let de=0;de<=ae;de++)de===0?le+=" |":le+=`${ie[de-1]}|`,le+=re[de].slice(0,ne+1).map(z=>ce(z.toString(),3)).join("|")+` +`;return le}function Z(re,ie,ae,q){re=re.substr(ie),ae=ae.substr(q),console.log(X(K,re,re.length,ae,ae.length)),console.log(X(H,re,re.length,ae,ae.length)),console.log(X(W,re,re.length,ae,ae.length))}function se(re,ie){if(ie<0||ie>=re.length)return!1;const ae=re.codePointAt(ie);switch(ae){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 40:case 91:return!0;case void 0:return!1;default:return!!N.isEmojiImprecise(ae)}}function oe(re,ie){if(ie<0||ie>=re.length)return!1;switch(re.charCodeAt(ie)){case 32:case 9:return!0;default:return!1}}function G(re,ie,ae){return ie[re]!==ae[re]}function x(re,ie,ae,q,ne,ce,le=!1){for(;ie R?R:re.length,z=q.length>R?R:q.length;if(ae>=de||ce>=z||de-ae>z-ce||!x(ie,ae,de,ne,ce,z,!0))return;V(de,z,ae,ce,ie,ne);let te=1,he=1,ge=ae,ve=ce;const Se=[!1];for(te=1,ge=ae;ge xe,Be=He?K[te][he-1]+(W[te][he-1]>0?-5:0):0,Ke=ve>xe+1&&W[te][he-1]>0,ke=Ke?K[te][he-2]+(W[te][he-2]>0?-5:0):0;if(Ke&&(!He||ke>=Be)&&(!ye||ke>=Oe))K[te][he]=ke,H[te][he]=3,W[te][he]=0;else if(He&&(!ye||Be>=Oe))K[te][he]=Be,H[te][he]=2,W[te][he]=0;else if(ye)K[te][he]=Oe,H[te][he]=1,W[te][he]=W[te-1][he-1]+1;else throw new Error("not possible")}}if(Y&&Z(re,ae,q,ce),!Se[0]&&!le)return;te--,he--;const Ee=[K[te][he],ce];let Ae=0,Ne=0;for(;te>=1;){let xe=he;do{const We=H[te][xe];if(We===3)xe=xe-2;else if(We===2)xe=xe-1;else break}while(xe>=1);Ae>1&&ie[ae+te-1]===ne[ce+he-1]&&!G(xe+ce-1,q,ne)&&Ae+1>W[te][xe]&&(xe=he),xe===he?Ae++:Ae=1,Ne||(Ne=xe),te--,he=xe-1,Ee.push(he)}z===de&&(Ee[0]+=2);const ze=Ne-de;return Ee[0]-=ze,Ee}e.fuzzyScore=$;function V(re,ie,ae,q,ne,ce){let le=re-1,de=ie-1;for(;le>=ae&&de>=q;)ne[le]===ce[de]&&(B[le]=de,le--),de--}function Q(re,ie,ae,q,ne,ce,le,de,z,te,he){if(ie[ae]!==ce[le])return Number.MIN_SAFE_INTEGER;let ge=1,ve=!1;return le===ae-q?ge=re[ae]===ne[le]?7:5:G(le,ne,ce)&&(le===0||!G(le-1,ne,ce))?(ge=re[ae]===ne[le]?7:5,ve=!0):se(ce,le)&&(le===0||!se(ce,le-1))?ge=5:(se(ce,le-1)||oe(ce,le-1))&&(ge=5,ve=!0),ge>1&&ae===q&&(he[0]=!0),ve||(ve=G(le,ne,ce)||se(ce,le-1)||oe(ce,le-1)),ae===q?le>z&&(ge-=ve?3:5):te?ge+=ve?2:0:ge+=ve?0:1,le+1===de&&(ge-=ve?3:5),ge}function ue(re,ie,ae,q,ne,ce,le){return pe(re,ie,ae,q,ne,ce,!0,le)}e.fuzzyScoreGracefulAggressive=ue;function pe(re,ie,ae,q,ne,ce,le,de){let z=$(re,ie,ae,q,ne,ce,de);if(z&&!le)return z;if(re.length>=3){const te=Math.min(7,re.length-1);for(let he=ae+1;he z[0])&&(z=ve))}}}return z}function fe(re,ie){if(ie+1>=re.length)return;const ae=re[ie],q=re[ie+1];if(ae!==q)return re.slice(0,ie)+q+ae+re.slice(ie+2)}}),define(J[305],ee([0,1,68,75,17,8]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.pieceToQuery=e.prepareQuery=e.scoreFuzzy2=void 0;const S=[void 0,[]];function p(r,o,i=0,l=0){const h=o;return h.values&&h.values.length>1?C(r,h.values,i,l):n(r,o,i,l)}e.scoreFuzzy2=p;function C(r,o,i,l){let h=0;const f=[];for(const y of o){const[_,b]=n(r,y,i,l);if(typeof _!="number")return S;h+=_,f.push(...b)}return[h,g(f)]}function n(r,o,i,l){const h=(0,w.fuzzyScore)(o.original,o.originalLowercase,i,r,r.toLowerCase(),l,!0);return h?[h[0],(0,w.createMatches)(h)]:S}function g(r){const o=r.sort((h,f)=>h.start-f.start),i=[];let l;for(const h of o)!l||!t(l,h)?(l=h,i.push(h)):(l.start=Math.min(l.start,h.start),l.end=Math.max(l.end,h.end));return i}function t(r,o){return!(r.end =0,y=s(r);let _;const b=r.split(c);if(b.length>1)for(const v of b){const m=s(v),{pathNormalized:E,normalized:I,normalizedLowercase:k}=d(v);I&&(_||(_=[]),_.push({original:v,originalLowercase:v.toLowerCase(),pathNormalized:E,normalized:I,normalizedLowercase:k,expectContiguousMatch:m}))}return{original:r,originalLowercase:o,pathNormalized:i,normalized:l,normalizedLowercase:h,values:_,containsPathSeparator:f,expectContiguousMatch:y}}e.prepareQuery=u;function d(r){let o;T.isWindows?o=r.replace(/\//g,N.sep):o=r.replace(/\\/g,N.sep);const i=(0,D.stripWildcards)(o).replace(/\s|"/g,"");return{pathNormalized:o,normalized:i,normalizedLowercase:i.toLowerCase()}}function a(r){return Array.isArray(r)?u(r.map(o=>o.original).join(c)):u(r.original)}e.pieceToQuery=a}),define(J[209],ee([0,1,14,162,47,75,8]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isRelativePattern=e.parse=e.match=e.splitGlobAware=void 0;const p="**",C="/",n="[/\\\\]",g="[^/\\\\]",t=/\//g;function s(L){switch(L){case 0:return"";case 1:return`${g}*?`;default:return`(?:${n}|${g}+${n}|${n}${g}+)*?`}}function c(L,B){if(!L)return[];const W=[];let K=!1,H=!1,Y="";for(const X of L){switch(X){case B:if(!K&&!H){W.push(Y),Y="";continue}break;case"{":K=!0;break;case"}":K=!1;break;case"[":H=!0;break;case"]":H=!1;break}Y+=X}return Y&&W.push(Y),W}e.splitGlobAware=c;function u(L){if(!L)return"";let B="";const W=c(L,C);if(W.every(K=>K===p))B=".*";else{let K=!1;W.forEach((H,Y)=>{if(H===p){K||(B+=s(2),K=!0);return}let X=!1,Z="",se=!1,oe="";for(const G of H){if(G!=="}"&&X){Z+=G;continue}if(se&&(G!=="]"||!oe)){let x;G==="-"?x=G:(G==="^"||G==="!")&&!oe?x="^":G===C?x="":x=S.escapeRegExpCharacters(G),oe+=x;continue}switch(G){case"{":X=!0;continue;case"[":se=!0;continue;case"}":B+=`(?:${c(Z,",").map($=>u($)).join("|")})`,X=!1,Z="";break;case"]":B+="["+oe+"]",se=!1,oe="";break;case"?":B+=g;continue;case"*":B+=s(1);continue;default:B+=S.escapeRegExpCharacters(G)}}Y _(Z,B)).filter(Z=>Z!==y),L),K=W.length;if(!K)return y;if(K===1)return W[0];const H=function(Z,se){for(let oe=0,G=W.length;oe !!Z.allBasenames);Y&&(H.allBasenames=Y.allBasenames);const X=W.reduce((Z,se)=>se.allPaths?Z.concat(se.allPaths):Z,[]);return X.length&&(H.allPaths=X),H}function I(L,B,W){const K=D.sep===D.posix.sep,H=K?L:L.replace(t,D.sep),Y=D.sep+H,X=D.posix.sep+L,Z=W?function(se,oe){return typeof se=="string"&&(se===H||se.endsWith(Y)||!K&&(se===L||se.endsWith(X)))?B:null}:function(se,oe){return typeof se=="string"&&(se===H||!K&&se===L)?B:null};return Z.allPaths=[(W?"*/":"./")+L],Z}function k(L){try{const B=new RegExp(`^${u(L)}$`);return function(W){return B.lastIndex=0,typeof W=="string"&&B.test(W)?L:null}}catch(B){return y}}function M(L,B,W){return!L||typeof B!="string"?!1:P(L)(B,void 0,W)}e.match=M;function P(L,B={}){if(!L)return f;if(typeof L=="string"||F(L)){const W=_(L,B);if(W===y)return f;const K=function(H,Y){return!!W(H,Y)};return W.allBasenames&&(K.allBasenames=W.allBasenames),W.allPaths&&(K.allPaths=W.allPaths),K}return R(L,B)}e.parse=P;function F(L){const B=L;return B&&typeof B.base=="string"&&typeof B.pattern=="string"}e.isRelativePattern=F;function R(L,B){const W=O(Object.getOwnPropertyNames(L).map(Z=>A(Z,L[Z],B)).filter(Z=>Z!==y)),K=W.length;if(!K)return y;if(!W.some(Z=>!!Z.requiresSiblings)){if(K===1)return W[0];const Z=function(G,x){for(let U=0,$=W.length;U<$;U++){const V=W[U](G,x);if(V)return V}return null},se=W.find(G=>!!G.allBasenames);se&&(Z.allBasenames=se.allBasenames);const oe=W.reduce((G,x)=>x.allPaths?G.concat(x.allPaths):G,[]);return oe.length&&(Z.allPaths=oe),Z}const H=function(Z,se,oe){let G;for(let x=0,U=W.length;x!!Z.allBasenames);Y&&(H.allBasenames=Y.allBasenames);const X=W.reduce((Z,se)=>se.allPaths?Z.concat(se.allPaths):Z,[]);return X.length&&(H.allPaths=X),H}function A(L,B,W){if(B===!1)return y;const K=_(L,W);if(K===y)return y;if(typeof B=="boolean")return K;if(B){const H=B.when;if(typeof H=="string"){const Y=(X,Z,se,oe)=>{if(!oe||!K(X,Z))return null;const G=H.replace("$(basename)",se),x=oe(G);return(0,w.isThenable)(x)?x.then(U=>U?L:null):x?L:null};return Y.requiresSiblings=!0,Y}}return K}function O(L,B){const W=L.filter(Z=>!!Z.basenames);if(W.length<2)return L;const K=W.reduce((Z,se)=>{const oe=se.basenames;return oe?Z.concat(oe):Z},[]);let H;if(B){H=[];for(let Z=0,se=K.length;Z /g,">").replace(/"/g,""").replace(/'/g,"'"),`${X}`)),B.paragraph=H=>`{const oe=se.patterns;return oe?Z.concat(oe):Z},[]);const Y=function(Z,se){if(typeof Z!="string")return null;if(!se){let G;for(G=Z.length;G>0;G--){const x=Z.charCodeAt(G-1);if(x===47||x===92)break}se=Z.substr(G)}const oe=K.indexOf(se);return oe!==-1?H[oe]:null};Y.basenames=K,Y.patterns=H,Y.allBasenames=K;const X=L.filter(Z=>!Z.basenames);return X.push(Y),X}}),define(J[107],ee([0,1,27,68,8]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.matchesFuzzyIconAware=e.parseLabelWithIcons=e.stripIcons=e.markdownEscapeEscapedIcons=e.escapeIcons=e.iconStartMarker=void 0,e.iconStartMarker="$(";const D=new RegExp(`\\$\\(${w.CSSIcon.iconNameExpression}(?:${w.CSSIcon.iconModifierExpression})?\\)`,"g"),S=new RegExp(`(\\\\)?${D.source}`,"g");function p(d){return d.replace(S,(a,r)=>r?a:`\\${a}`)}e.escapeIcons=p;const C=new RegExp(`\\\\${D.source}`,"g");function n(d){return d.replace(C,a=>`\\${a}`)}e.markdownEscapeEscapedIcons=n;const g=new RegExp(`(\\s)?(\\\\)?${D.source}(\\s)?`,"g");function t(d){return d.indexOf(e.iconStartMarker)===-1?d:d.replace(g,(a,r,o,i)=>o?a:r||i||"")}e.stripIcons=t;function s(d){const a=d.indexOf(e.iconStartMarker);return a===-1?{text:d}:c(d,a)}e.parseLabelWithIcons=s;function c(d,a){const r=[];let o="";function i(m){if(m){o+=m;for(const E of m)r.push(f)}}let l=-1,h="",f=0,y,_,b=a;const v=d.length;for(i(d.substr(0,a));b " ".repeat(u.length)).replace(/\>/gm,"\\>").replace(/\n/g,s===1?`\\ +`:` + +`),this}appendMarkdown(t){return this.value+=t,this}appendCodeblock(t,s){return this.value+="\n```",this.value+=t,this.value+=` +`,this.value+=s,this.value+="\n```\n",this}}e.MarkdownString=T;function D(g){return S(g)?!g.value:Array.isArray(g)?g.every(D):!0}e.isEmptyMarkdownString=D;function S(g){return g instanceof T?!0:g&&typeof g=="object"?typeof g.value=="string"&&(typeof g.isTrusted=="boolean"||g.isTrusted===void 0)&&(typeof g.supportThemeIcons=="boolean"||g.supportThemeIcons===void 0):!1}e.isMarkdownString=S;function p(g){return g.replace(/[\\`*_{}[\]()#+\-!]/g,"\\$&")}e.escapeMarkdownSyntaxTokens=p;function C(g){return g&&g.replace(/\\([\\`*_{}[\]()#+\-.!])/g,"$1")}e.removeMarkdownEscapes=C;function n(g){const t=[],s=g.split("|").map(u=>u.trim());g=s[0];const c=s[1];if(c){const u=/height=(\d+)/.exec(c),d=/width=(\d+)/.exec(c),a=u?u[1]:"",r=d?d[1]:"",o=isFinite(parseInt(r)),i=isFinite(parseInt(a));o&&t.push(`width="${r}"`),i&&t.push(`height="${a}"`)}return{href:g,dimensions:t}}e.parseHrefAndDimensions=n}),define(J[306],ee([0,1,8]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.buildReplaceStringWithCasePreserved=void 0;function N(S,p){if(S&&S[0]!==""){const C=T(S,p,"-"),n=T(S,p,"_");return C&&!n?D(S,p,"-"):!C&&n?D(S,p,"_"):S[0].toUpperCase()===S[0]?p.toUpperCase():S[0].toLowerCase()===S[0]?p.toLowerCase():w.containsUppercaseCharacter(S[0][0])&&p.length>0?p[0].toUpperCase()+p.substr(1):S[0][0].toUpperCase()!==S[0][0]&&p.length>0?p[0].toLowerCase()+p.substr(1):p}else return p}e.buildReplaceStringWithCasePreserved=N;function T(S,p,C){return S[0].indexOf(C)!==-1&&p.indexOf(C)!==-1&&S[0].split(C).length===p.split(C).length}function D(S,p,C){const n=p.split(C),g=S[0].split(C);let t="";return n.forEach((s,c)=>{t+=N([g[c]],s)+C}),t.slice(0,-1)}}),define(J[76],ee([0,1,8]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var N;(function(T){T[T.Ignore=0]="Ignore",T[T.Info=1]="Info",T[T.Warning=2]="Warning",T[T.Error=3]="Error"})(N||(N={})),function(T){const D="error",S="warning",p="warn",C="info",n="ignore";function g(s){return s?w.equalsIgnoreCase(D,s)?T.Error:w.equalsIgnoreCase(S,s)||w.equalsIgnoreCase(p,s)?T.Warning:w.equalsIgnoreCase(C,s)?T.Info:T.Ignore:T.Ignore}T.fromValue=g;function t(s){switch(s){case T.Error:return D;case T.Warning:return S;case T.Info:return C;default:return n}}T.toString=t}(N||(N={})),e.default=N}),define(J[20],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assertNever=e.withNullAsUndefined=e.createProxyObject=e.getAllMethodNames=e.getAllPropertyNames=e.validateConstraint=e.validateConstraints=e.isFunction=e.assertIsDefined=e.assertType=e.isUndefinedOrNull=e.isDefined=e.isUndefined=e.isBoolean=e.isNumber=e.isObject=e.isString=e.isArray=void 0;function w(l){return Array.isArray(l)}e.isArray=w;function N(l){return typeof l=="string"}e.isString=N;function T(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)&&!(l instanceof RegExp)&&!(l instanceof Date)}e.isObject=T;function D(l){return typeof l=="number"&&!isNaN(l)}e.isNumber=D;function S(l){return l===!0||l===!1}e.isBoolean=S;function p(l){return typeof l=="undefined"}e.isUndefined=p;function C(l){return!n(l)}e.isDefined=C;function n(l){return p(l)||l===null}e.isUndefinedOrNull=n;function g(l,h){if(!l)throw new Error(h?`Unexpected type, expected '${h}'`:"Unexpected type")}e.assertType=g;function t(l){if(n(l))throw new Error("Assertion Failed: argument is undefined or null");return l}e.assertIsDefined=t;function s(l){return typeof l=="function"}e.isFunction=s;function c(l,h){const f=Math.min(l.length,h.length);for(let y=0;y function(){const b=Array.prototype.slice.call(arguments,0);return h(_,b)};let y={};for(const _ of l)y[_]=f(_);return y}e.createProxyObject=r;function o(l){return l===null?void 0:l}e.withNullAsUndefined=o;function i(l,h="Unreachable"){throw new Error(h)}e.assertNever=i}),define(J[38],ee([0,1,20]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getOrDefault=e.equals=e.mixin=e.cloneAndChange=e.deepFreeze=e.deepClone=void 0;function N(t){if(!t||typeof t!="object"||t instanceof RegExp)return t;const s=Array.isArray(t)?[]:{};return Object.keys(t).forEach(c=>{t[c]&&typeof t[c]=="object"?s[c]=N(t[c]):s[c]=t[c]}),s}e.deepClone=N;function T(t){if(!t||typeof t!="object")return t;const s=[t];for(;s.length>0;){const c=s.shift();Object.freeze(c);for(const u in c)if(D.call(c,u)){const d=c[u];typeof d=="object"&&!Object.isFrozen(d)&&s.push(d)}}return t}e.deepFreeze=T;const D=Object.prototype.hasOwnProperty;function S(t,s){return p(t,s,new Set)}e.cloneAndChange=S;function p(t,s,c){if((0,w.isUndefinedOrNull)(t))return t;const u=s(t);if(typeof u!="undefined")return u;if((0,w.isArray)(t)){const d=[];for(const a of t)d.push(p(a,s,c));return d}if((0,w.isObject)(t)){if(c.has(t))throw new Error("Cannot clone recursive data-structure");c.add(t);const d={};for(let a in t)D.call(t,a)&&(d[a]=p(t[a],s,c));return c.delete(t),d}return t}function C(t,s,c=!0){return(0,w.isObject)(t)?((0,w.isObject)(s)&&Object.keys(s).forEach(u=>{u in t?c&&((0,w.isObject)(t[u])&&(0,w.isObject)(s[u])?C(t[u],s[u],c):t[u]=s[u]):t[u]=s[u]}),t):s}e.mixin=C;function n(t,s){if(t===s)return!0;if(t==null||s===null||s===void 0||typeof t!=typeof s||typeof t!="object"||Array.isArray(t)!==Array.isArray(s))return!1;let c,u;if(Array.isArray(t)){if(t.length!==s.length)return!1;for(c=0;c 255?255:T|0}e.toUint8=w;function N(T){return T<0?0:T>4294967295?4294967295:T|0}e.toUint32=N}),define(J[24],ee([0,1,75,17]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uriToFsPath=e.URI=void 0;const T=/^\w[\w\d+.-]*$/,D=/^\//,S=/^\/\//;function p(_,b){if(!_.scheme&&b)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${_.authority}", path: "${_.path}", query: "${_.query}", fragment: "${_.fragment}"}`);if(_.scheme&&!T.test(_.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(_.path){if(_.authority){if(!D.test(_.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(S.test(_.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function C(_,b){return!_&&!b?"file":_}function n(_,b){switch(_){case"https":case"http":case"file":b?b[0]!==t&&(b=t+b):b=t;break}return b}const g="",t="/",s=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class c{constructor(b,v,m,E,I,k=!1){typeof b=="object"?(this.scheme=b.scheme||g,this.authority=b.authority||g,this.path=b.path||g,this.query=b.query||g,this.fragment=b.fragment||g):(this.scheme=C(b,k),this.authority=v||g,this.path=n(this.scheme,m||g),this.query=E||g,this.fragment=I||g,p(this,k))}static isUri(b){return b instanceof c?!0:b?typeof b.authority=="string"&&typeof b.fragment=="string"&&typeof b.path=="string"&&typeof b.query=="string"&&typeof b.scheme=="string"&&typeof b.fsPath=="string"&&typeof b.with=="function"&&typeof b.toString=="function":!1}get fsPath(){return i(this,!1)}with(b){if(!b)return this;let{scheme:v,authority:m,path:E,query:I,fragment:k}=b;return v===void 0?v=this.scheme:v===null&&(v=g),m===void 0?m=this.authority:m===null&&(m=g),E===void 0?E=this.path:E===null&&(E=g),I===void 0?I=this.query:I===null&&(I=g),k===void 0?k=this.fragment:k===null&&(k=g),v===this.scheme&&m===this.authority&&E===this.path&&I===this.query&&k===this.fragment?this:new d(v,m,E,I,k)}static parse(b,v=!1){const m=s.exec(b);return m?new d(m[2]||g,y(m[4]||g),y(m[5]||g),y(m[7]||g),y(m[9]||g),v):new d(g,g,g,g,g)}static file(b){let v=g;if(N.isWindows&&(b=b.replace(/\\/g,t)),b[0]===t&&b[1]===t){const m=b.indexOf(t,2);m===-1?(v=b.substring(2),b=t):(v=b.substring(2,m),b=b.substring(m)||t)}return new d("file",v,b,g,g)}static from(b){const v=new d(b.scheme,b.authority,b.path,b.query,b.fragment);return p(v,!0),v}static joinPath(b,...v){if(!b.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let m;return N.isWindows&&b.scheme==="file"?m=c.file(w.win32.join(i(b,!0),...v)).path:m=w.posix.join(b.path,...v),b.with({path:m})}toString(b=!1){return l(this,b)}toJSON(){return this}static revive(b){if(b){if(b instanceof c)return b;{const v=new d(b);return v._formatted=b.external,v._fsPath=b._sep===u?b.fsPath:null,v}}else return b}}e.URI=c;const u=N.isWindows?1:void 0;class d extends c{constructor(){super(...arguments);this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=i(this,!1)),this._fsPath}toString(b=!1){return b?l(this,!0):(this._formatted||(this._formatted=l(this,!1)),this._formatted)}toJSON(){const b={$mid:1};return this._fsPath&&(b.fsPath=this._fsPath,b._sep=u),this._formatted&&(b.external=this._formatted),this.path&&(b.path=this.path),this.scheme&&(b.scheme=this.scheme),this.authority&&(b.authority=this.authority),this.query&&(b.query=this.query),this.fragment&&(b.fragment=this.fragment),b}}const a={[58]:"%3A",[47]:"%2F",[63]:"%3F",[35]:"%23",[91]:"%5B",[93]:"%5D",[64]:"%40",[33]:"%21",[36]:"%24",[38]:"%26",[39]:"%27",[40]:"%28",[41]:"%29",[42]:"%2A",[43]:"%2B",[44]:"%2C",[59]:"%3B",[61]:"%3D",[32]:"%20"};function r(_,b){let v,m=-1;for(let E=0;E<_.length;E++){const I=_.charCodeAt(E);if(I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===45||I===46||I===95||I===126||b&&I===47)m!==-1&&(v+=encodeURIComponent(_.substring(m,E)),m=-1),v!==void 0&&(v+=_.charAt(E));else{v===void 0&&(v=_.substr(0,E));const k=a[I];k!==void 0?(m!==-1&&(v+=encodeURIComponent(_.substring(m,E)),m=-1),v+=k):m===-1&&(m=E)}}return m!==-1&&(v+=encodeURIComponent(_.substring(m))),v!==void 0?v:_}function o(_){let b;for(let v=0;v<_.length;v++){const m=_.charCodeAt(v);m===35||m===63?(b===void 0&&(b=_.substr(0,v)),b+=a[m]):b!==void 0&&(b+=_[v])}return b!==void 0?b:_}function i(_,b){let v;return _.authority&&_.path.length>1&&_.scheme==="file"?v=`//${_.authority}${_.path}`:_.path.charCodeAt(0)===47&&(_.path.charCodeAt(1)>=65&&_.path.charCodeAt(1)<=90||_.path.charCodeAt(1)>=97&&_.path.charCodeAt(1)<=122)&&_.path.charCodeAt(2)===58?b?v=_.path.substr(1):v=_.path[1].toLowerCase()+_.path.substr(2):v=_.path,N.isWindows&&(v=v.replace(/\//g,"\\")),v}e.uriToFsPath=i;function l(_,b){const v=b?o:r;let m="",{scheme:E,authority:I,path:k,query:M,fragment:P}=_;if(E&&(m+=E,m+=":"),(I||E==="file")&&(m+=t,m+=t),I){let F=I.indexOf("@");if(F!==-1){const R=I.substr(0,F);I=I.substr(F+1),F=R.indexOf(":"),F===-1?m+=v(R,!1):(m+=v(R.substr(0,F),!1),m+=":",m+=v(R.substr(F+1),!1)),m+="@"}I=I.toLowerCase(),F=I.indexOf(":"),F===-1?m+=v(I,!1):(m+=v(I.substr(0,F),!1),m+=I.substr(F))}if(k){if(k.length>=3&&k.charCodeAt(0)===47&&k.charCodeAt(2)===58){const F=k.charCodeAt(1);F>=65&&F<=90&&(k=`/${String.fromCharCode(F+32)}:${k.substr(3)}`)}else if(k.length>=2&&k.charCodeAt(1)===58){const F=k.charCodeAt(0);F>=65&&F<=90&&(k=`${String.fromCharCode(F+32)}:${k.substr(2)}`)}m+=v(k,!0)}return M&&(m+="?",m+=v(M,!1)),P&&(m+="#",m+=b?P:r(P,!1)),m}function h(_){try{return decodeURIComponent(_)}catch(b){return _.length>3?_.substr(0,3)+h(_.substr(3)):_}}const f=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function y(_){return _.match(f)?_.replace(f,b=>h(b)):_}}),define(J[210],ee([0,1,105,24]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.revive=e.parse=void 0;function T(S){let p=JSON.parse(S);return p=D(p),p}e.parse=T;function D(S,p=0){if(!S||p>200)return S;if(typeof S=="object"){switch(S.$mid){case 1:return N.URI.revive(S);case 2:return new RegExp(S.source,S.flags)}if(S instanceof w.VSBuffer||S instanceof Uint8Array)return S;if(Array.isArray(S))for(let C=0;C {let He=Oe.relatedTarget;for(;He&&He!==Le;)He=He.parentNode;He!==Le&&ye(Oe)})}e.addDisposableNonBubblingMouseOutListener=f;function y(Le,ye){return d(Le,"pointerout",Oe=>{let He=Oe.relatedTarget;for(;He&&He!==Le;)He=He.parentNode;He!==Le&&ye(Oe)})}e.addDisposableNonBubblingPointerOutListener=y;let _=null;function b(Le){if(!_){const ye=Oe=>setTimeout(()=>Oe(new Date().getTime()),0);_=self.requestAnimationFrame||self.msRequestAnimationFrame||self.webkitRequestAnimationFrame||self.mozRequestAnimationFrame||self.oRequestAnimationFrame||ye}return _.call(self,Le)}class v{constructor(ye,Oe=0){this._runner=ye,this.priority=Oe,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(ye){(0,p.onUnexpectedError)(ye)}}static sort(ye,Oe){return Oe.priority-ye.priority}}(function(){let Le=[],ye=null,Oe=!1,He=!1,Be=()=>{for(Oe=!1,ye=Le,Le=[],He=!0;ye.length>0;)ye.sort(v.sort),ye.shift().execute();He=!1};e.scheduleAtNextAnimationFrame=(Ke,ke=0)=>{let Ie=new v(Ke,ke);return Le.push(Ie),Oe||(Oe=!0,b(Be)),Ie},e.runAtThisOrScheduleAtNextAnimationFrame=(Ke,ke)=>{if(He){let Ie=new v(Ke,ke);return ye.push(Ie),Ie}else return(0,e.scheduleAtNextAnimationFrame)(Ke,ke)}})();const m=8,E=function(Le,ye){return ye};class I extends n.Disposable{constructor(ye,Oe,He,Be=E,Ke=m){super();let ke=null,Ie=0,Me=this._register(new S.TimeoutTimer),me=()=>{Ie=new Date().getTime(),He(ke),ke=null};this._register(d(ye,Oe,be=>{ke=Be(ke,be);let De=new Date().getTime()-Ie;De>=Ke?(Me.cancel(),me()):Me.setIfNotSet(me,Ke-De)}))}}function k(Le,ye,Oe,He,Be){return new I(Le,ye,Oe,He,Be)}e.addDisposableThrottledListener=k;function M(Le){return document.defaultView.getComputedStyle(Le,null)}e.getComputedStyle=M;function P(Le){if(Le!==document.body)return new R(Le.clientWidth,Le.clientHeight);if(t.isIOS&&window.visualViewport)return new R(window.visualViewport.width,window.visualViewport.height);if(window.innerWidth&&window.innerHeight)return new R(window.innerWidth,window.innerHeight);if(document.body&&document.body.clientWidth&&document.body.clientHeight)return new R(document.body.clientWidth,document.body.clientHeight);if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)return new R(document.documentElement.clientWidth,document.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}e.getClientArea=P;class F{static convertToPixels(ye,Oe){return parseFloat(Oe)||0}static getDimension(ye,Oe,He){let Be=M(ye),Ke="0";return Be&&(Be.getPropertyValue?Ke=Be.getPropertyValue(Oe):Ke=Be.getAttribute(He)),F.convertToPixels(ye,Ke)}static getBorderLeftWidth(ye){return F.getDimension(ye,"border-left-width","borderLeftWidth")}static getBorderRightWidth(ye){return F.getDimension(ye,"border-right-width","borderRightWidth")}static getBorderTopWidth(ye){return F.getDimension(ye,"border-top-width","borderTopWidth")}static getBorderBottomWidth(ye){return F.getDimension(ye,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(ye){return F.getDimension(ye,"padding-left","paddingLeft")}static getPaddingRight(ye){return F.getDimension(ye,"padding-right","paddingRight")}static getPaddingTop(ye){return F.getDimension(ye,"padding-top","paddingTop")}static getPaddingBottom(ye){return F.getDimension(ye,"padding-bottom","paddingBottom")}static getMarginLeft(ye){return F.getDimension(ye,"margin-left","marginLeft")}static getMarginTop(ye){return F.getDimension(ye,"margin-top","marginTop")}static getMarginRight(ye){return F.getDimension(ye,"margin-right","marginRight")}static getMarginBottom(ye){return F.getDimension(ye,"margin-bottom","marginBottom")}}class R{constructor(ye,Oe){this.width=ye,this.height=Oe}with(ye=this.width,Oe=this.height){return ye!==this.width||Oe!==this.height?new R(ye,Oe):this}static is(ye){return typeof ye=="object"&&typeof ye.height=="number"&&typeof ye.width=="number"}static lift(ye){return ye instanceof R?ye:new R(ye.width,ye.height)}static equals(ye,Oe){return ye===Oe?!0:!ye||!Oe?!1:ye.width===Oe.width&&ye.height===Oe.height}}e.Dimension=R;function A(Le){let ye=Le.offsetParent,Oe=Le.offsetTop,He=Le.offsetLeft;for(;(Le=Le.parentNode)!==null&&Le!==document.body&&Le!==document.documentElement;){Oe-=Le.scrollTop;const Be=se(Le)?null:M(Le);Be&&(He-=Be.direction!=="rtl"?Le.scrollLeft:-Le.scrollLeft),Le===ye&&(He+=F.getBorderLeftWidth(Le),Oe+=F.getBorderTopWidth(Le),Oe+=Le.offsetTop,He+=Le.offsetLeft,ye=Le.offsetParent)}return{left:He,top:Oe}}e.getTopLeftOffset=A;function O(Le,ye,Oe){typeof ye=="number"&&(Le.style.width=`${ye}px`),typeof Oe=="number"&&(Le.style.height=`${Oe}px`)}e.size=O;function L(Le){let ye=Le.getBoundingClientRect();return{left:ye.left+e.StandardWindow.scrollX,top:ye.top+e.StandardWindow.scrollY,width:ye.width,height:ye.height}}e.getDomNodePagePosition=L,e.StandardWindow=new class{get scrollX(){return typeof window.scrollX=="number"?window.scrollX:document.body.scrollLeft+document.documentElement.scrollLeft}get scrollY(){return typeof window.scrollY=="number"?window.scrollY:document.body.scrollTop+document.documentElement.scrollTop}};function B(Le){let ye=F.getMarginLeft(Le)+F.getMarginRight(Le);return Le.offsetWidth+ye}e.getTotalWidth=B;function W(Le){let ye=F.getBorderLeftWidth(Le)+F.getBorderRightWidth(Le),Oe=F.getPaddingLeft(Le)+F.getPaddingRight(Le);return Le.offsetWidth-ye-Oe}e.getContentWidth=W;function K(Le){let ye=F.getBorderTopWidth(Le)+F.getBorderBottomWidth(Le),Oe=F.getPaddingTop(Le)+F.getPaddingBottom(Le);return Le.offsetHeight-ye-Oe}e.getContentHeight=K;function H(Le){let ye=F.getMarginTop(Le)+F.getMarginBottom(Le);return Le.offsetHeight+ye}e.getTotalHeight=H;function Y(Le,ye){for(;Le;){if(Le===ye)return!0;Le=Le.parentNode}return!1}e.isAncestor=Y;function X(Le,ye,Oe){for(;Le&&Le.nodeType===Le.ELEMENT_NODE;){if(Le.classList.contains(ye))return Le;if(Oe){if(typeof Oe=="string"){if(Le.classList.contains(Oe))return null}else if(Le===Oe)return null}Le=Le.parentNode}return null}e.findParentWithClass=X;function Z(Le,ye,Oe){return!!X(Le,ye,Oe)}e.hasParentWithClass=Z;function se(Le){return Le&&!!Le.host&&!!Le.mode}e.isShadowRoot=se;function oe(Le){return!!G(Le)}e.isInShadowDOM=oe;function G(Le){for(;Le.parentNode;){if(Le===document.body)return null;Le=Le.parentNode}return se(Le)?Le:null}e.getShadowRoot=G;function x(){let Le=document.activeElement;for(;Le==null?void 0:Le.shadowRoot;)Le=Le.shadowRoot.activeElement;return Le}e.getActiveElement=x;function U(Le=document.getElementsByTagName("head")[0]){let ye=document.createElement("style");return ye.type="text/css",ye.media="screen",Le.appendChild(ye),ye}e.createStyleSheet=U;let $=null;function V(){return $||($=U()),$}function Q(Le){var ye,Oe;return((ye=Le==null?void 0:Le.sheet)===null||ye===void 0?void 0:ye.rules)?Le.sheet.rules:((Oe=Le==null?void 0:Le.sheet)===null||Oe===void 0?void 0:Oe.cssRules)?Le.sheet.cssRules:[]}function ue(Le,ye,Oe=V()){!Oe||!ye||Oe.sheet.insertRule(Le+"{"+ye+"}",0)}e.createCSSRule=ue;function pe(Le,ye=V()){if(!ye)return;let Oe=Q(ye),He=[];for(let Be=0;Be =0;Be--)ye.sheet.deleteRule(He[Be])}e.removeCSSRulesContainingSelector=pe;function fe(Le){return typeof HTMLElement=="object"?Le instanceof HTMLElement:Le&&typeof Le=="object"&&Le.nodeType===1&&typeof Le.nodeName=="string"}e.isHTMLElement=fe,e.EventType={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:w.isWebKit?"webkitAnimationStart":"animationstart",ANIMATION_END:w.isWebKit?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:w.isWebKit?"webkitAnimationIteration":"animationiteration"},e.EventHelper={stop:function(Le,ye){Le.preventDefault?Le.preventDefault():Le.returnValue=!1,ye&&(Le.stopPropagation?Le.stopPropagation():Le.cancelBubble=!0)}};function re(Le){let ye=[];for(let Oe=0;Le&&Le.nodeType===Le.ELEMENT_NODE;Oe++)ye[Oe]=Le.scrollTop,Le=Le.parentNode;return ye}e.saveParentsScrollTop=re;function ie(Le,ye){for(let Oe=0;Le&&Le.nodeType===Le.ELEMENT_NODE;Oe++)Le.scrollTop!==ye[Oe]&&(Le.scrollTop=ye[Oe]),Le=Le.parentNode}e.restoreParentsScrollTop=ie;class ae extends n.Disposable{constructor(ye){super();this._onDidFocus=this._register(new C.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new C.Emitter),this.onDidBlur=this._onDidBlur.event;let Oe=Y(document.activeElement,ye),He=!1;const Be=()=>{He=!1,Oe||(Oe=!0,this._onDidFocus.fire())},Ke=()=>{Oe&&(He=!0,window.setTimeout(()=>{He&&(He=!1,Oe=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{Y(document.activeElement,ye)!==Oe&&(Oe?Ke():Be())},this._register(d(ye,e.EventType.FOCUS,Be,!0)),this._register(d(ye,e.EventType.BLUR,Ke,!0))}}function q(Le){return new ae(Le)}e.trackFocus=q;function ne(Le,...ye){if(Le.append(...ye),ye.length===1&&typeof ye[0]!="string")return ye[0]}e.append=ne;function ce(Le,ye){return Le.insertBefore(ye,Le.firstChild),ye}e.prepend=ce;function le(Le,...ye){Le.innerText="",ne(Le,...ye)}e.reset=le;const de=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var z;(function(Le){Le.HTML="http://www.w3.org/1999/xhtml",Le.SVG="http://www.w3.org/2000/svg"})(z=e.Namespace||(e.Namespace={}));function te(Le,ye,Oe,...He){let Be=de.exec(ye);if(!Be)throw new Error("Bad use of emmet");Oe=Object.assign({},Oe||{});let Ke=Be[1]||"div",ke;return Le!==z.HTML?ke=document.createElementNS(Le,Ke):ke=document.createElement(Ke),Be[3]&&(ke.id=Be[3]),Be[4]&&(ke.className=Be[4].replace(/\./g," ").trim()),Object.keys(Oe).forEach(Ie=>{const Me=Oe[Ie];typeof Me!="undefined"&&(/^on\w+$/.test(Ie)?ke[Ie]=Me:Ie==="selected"?Me&&ke.setAttribute(Ie,"true"):ke.setAttribute(Ie,Me))}),ke.append(...He),ke}function he(Le,ye,...Oe){return te(z.HTML,Le,ye,...Oe)}e.$=he,he.SVG=function(Le,ye,...Oe){return te(z.SVG,Le,ye,...Oe)};function ge(...Le){for(let ye of Le)ye.style.display="",ye.removeAttribute("aria-hidden")}e.show=ge;function ve(...Le){for(let ye of Le)ye.style.display="none",ye.setAttribute("aria-hidden","true")}e.hide=ve;function Se(Le){return Array.prototype.slice.call(document.getElementsByTagName(Le),0)}e.getElementsByTagName=Se;function Ee(Le){const ye=window.devicePixelRatio*Le;return Math.max(1,Math.floor(ye))/window.devicePixelRatio}e.computeScreenAwareSize=Ee;function Ae(Le){window.open(Le,"_blank","noopener")}e.windowOpenNoOpener=Ae;function Ne(Le){const ye=()=>{Le(),Oe=(0,e.scheduleAtNextAnimationFrame)(ye)};let Oe=(0,e.scheduleAtNextAnimationFrame)(ye);return(0,n.toDisposable)(()=>Oe.dispose())}e.animate=Ne,g.RemoteAuthorities.setPreferredWebSchema(/^https:/.test(window.location.href)?"https":"http");function ze(Le){return Le?`url('${g.FileAccess.asBrowserUri(Le).toString(!0).replace(/'/g,"%27")}')`:"url('')"}e.asCSSUrl=ze;function xe(Le){return`'${Le.replace(/'/g,"%27")}'`}e.asCSSPropertyValue=xe;class We extends C.Emitter{constructor(){super();this._subscriptions=new n.DisposableStore,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(d(window,"keydown",ye=>{if(ye.defaultPrevented)return;const Oe=new T.StandardKeyboardEvent(ye);if(!(Oe.keyCode===6&&ye.repeat)){if(ye.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(ye.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(ye.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(ye.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(Oe.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=ye.altKey,this._keyStatus.ctrlKey=ye.ctrlKey,this._keyStatus.metaKey=ye.metaKey,this._keyStatus.shiftKey=ye.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=ye,this.fire(this._keyStatus))}},!0)),this._subscriptions.add(d(window,"keyup",ye=>{ye.defaultPrevented||(!ye.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!ye.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!ye.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!ye.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=ye.altKey,this._keyStatus.ctrlKey=ye.ctrlKey,this._keyStatus.metaKey=ye.metaKey,this._keyStatus.shiftKey=ye.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=ye,this.fire(this._keyStatus)))},!0)),this._subscriptions.add(d(document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),this._subscriptions.add(d(document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),this._subscriptions.add(d(document.body,"mousemove",ye=>{ye.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),this._subscriptions.add(d(window,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return We.instance||(We.instance=new We),We.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}e.ModifierKeyEmitter=We;function Ue(Le,ye){const Oe=window.matchMedia(Le);typeof Oe.addEventListener=="function"?Oe.addEventListener("change",ye):Oe.addListener(ye)}e.addMatchMediaChangeListener=Ue}),define(J[165],ee([0,1,7]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createElement=e.renderFormattedText=e.renderText=void 0;function N(t,s={}){const c=D(s);return c.textContent=t,c}e.renderText=N;function T(t,s={}){const c=D(s);return p(c,C(t,!!s.renderCodeSegments),s.actionHandler,s.renderCodeSegments),c}e.renderFormattedText=T;function D(t){const s=t.inline?"span":"div",c=document.createElement(s);return t.className&&(c.className=t.className),c}e.createElement=D;class S{constructor(s){this.source=s,this.index=0}eos(){return this.index>=this.source.length}next(){const s=this.peek();return this.advance(),s}peek(){return this.source[this.index]}advance(){this.index++}}function p(t,s,c,u){let d;if(s.type===2)d=document.createTextNode(s.content||"");else if(s.type===3)d=document.createElement("b");else if(s.type===4)d=document.createElement("i");else if(s.type===7&&u)d=document.createElement("code");else if(s.type===5&&c){const a=document.createElement("a");a.href="#",c.disposables.add(w.addStandardDisposableListener(a,"click",r=>{c.callback(String(s.index),r)})),d=a}else s.type===8?d=document.createElement("br"):s.type===1&&(d=t);d&&t!==d&&t.appendChild(d),d&&Array.isArray(s.children)&&s.children.forEach(a=>{p(d,a,c,u)})}function C(t,s){const c={type:1,children:[]};let u=0,d=c;const a=[],r=new S(t);for(;!r.eos();){let o=r.next();const i=o==="\\"&&g(r.peek(),s)!==0;if(i&&(o=r.next()),!i&&n(o,s)&&o===r.peek()){r.advance(),d.type===2&&(d=a.pop());const l=g(o,s);if(d.type===l||d.type===5&&l===6)d=a.pop();else{const h={type:l,children:[]};l===5&&(h.index=u,u++),d.children.push(h),a.push(d),d=h}}else if(o===` +`)d.type===2&&(d=a.pop()),d.children.push({type:8});else if(d.type!==2){const l={type:2,content:o};d.children.push(l),a.push(d),d=l}else d.content+=o}return d.type===2&&(d=a.pop()),a.length,c}function n(t,s){return g(t,s)!==0}function g(t,s){switch(t){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return s?7:0;default:return 0}}}),define(J[96],ee([0,1,7,204,56,2,17]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalMouseMoveMonitor=e.standardMouseMoveMerger=void 0;function p(n,g){let t=new T.StandardMouseEvent(g);return t.preventDefault(),{leftButton:t.leftButton,buttons:t.buttons,posx:t.posx,posy:t.posy}}e.standardMouseMoveMerger=p;class C{constructor(){this._hooks=new D.DisposableStore,this._mouseMoveEventMerger=null,this._mouseMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(g,t){if(!this.isMonitoring())return;this._hooks.clear(),this._mouseMoveEventMerger=null,this._mouseMoveCallback=null;const s=this._onStopCallback;this._onStopCallback=null,g&&s&&s(t)}isMonitoring(){return!!this._mouseMoveEventMerger}startMonitoring(g,t,s,c,u){if(this.isMonitoring())return;this._mouseMoveEventMerger=s,this._mouseMoveCallback=c,this._onStopCallback=u;const d=N.IframeUtils.getSameOriginWindowChain(),a=S.isIOS?"pointermove":"mousemove",r="mouseup",o=d.map(l=>l.window.document),i=w.getShadowRoot(g);i&&o.unshift(i);for(const l of o)this._hooks.add(w.addDisposableThrottledListener(l,a,h=>{if(h.buttons!==t){this.stopMonitoring(!0);return}this._mouseMoveCallback(h)},(h,f)=>this._mouseMoveEventMerger(h,f))),this._hooks.add(w.addDisposableListener(l,r,h=>this.stopMonitoring(!0)));if(N.IframeUtils.hasDifferentOriginAncestor()){let l=d[d.length-1];this._hooks.add(w.addDisposableListener(l.window.document,"mouseout",h=>{new T.StandardMouseEvent(h).target.tagName.toLowerCase()==="html"&&this.stopMonitoring(!0)})),this._hooks.add(w.addDisposableListener(l.window.document,"mouseover",h=>{new T.StandardMouseEvent(h).target.tagName.toLowerCase()==="html"&&this.stopMonitoring(!0)})),this._hooks.add(w.addDisposableListener(l.window.document.body,"mouseleave",h=>{this.stopMonitoring(!0)}))}}}e.GlobalMouseMoveMonitor=C});var Fe=this&&this.__decorate||function(j,e,w,N){var T=arguments.length,D=T<3?e:N===null?N=Object.getOwnPropertyDescriptor(e,w):N,S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(j,e,w,N);else for(var p=j.length-1;p>=0;p--)(S=j[p])&&(D=(T<3?S(D):T>3?S(e,w,D):S(e,w))||D);return T>3&&D&&Object.defineProperty(e,w,D),D};define(J[58],ee([0,1,7,19,92,2]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Gesture=e.EventType=void 0;var S;(function(C){C.Tap="-monaco-gesturetap",C.Change="-monaco-gesturechange",C.Start="-monaco-gesturestart",C.End="-monaco-gesturesend",C.Contextmenu="-monaco-gesturecontextmenu"})(S=e.EventType||(e.EventType={}));class p extends D.Disposable{constructor(){super();this.dispatched=!1,this.activeTouches={},this.handle=null,this.targets=[],this.ignoreTargets=[],this._lastSetTapCountTime=0,this._register(w.addDisposableListener(document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),this._register(w.addDisposableListener(document,"touchend",n=>this.onTouchEnd(n))),this._register(w.addDisposableListener(document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))}static addTarget(n){return p.isTouchDevice()?(p.INSTANCE||(p.INSTANCE=new p),p.INSTANCE.targets.push(n),{dispose:()=>{p.INSTANCE.targets=p.INSTANCE.targets.filter(g=>g!==n)}}):D.Disposable.None}static ignoreTarget(n){return p.isTouchDevice()?(p.INSTANCE||(p.INSTANCE=new p),p.INSTANCE.ignoreTargets.push(n),{dispose:()=>{p.INSTANCE.ignoreTargets=p.INSTANCE.ignoreTargets.filter(g=>g!==n)}}):D.Disposable.None}static isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(n){let g=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let t=0,s=n.targetTouches.length;t =p.HOLD_DELAY&&Math.abs(d.initialPageX-N.tail(d.rollingPageX))<30&&Math.abs(d.initialPageY-N.tail(d.rollingPageY))<30){let r=this.newGestureEvent(S.Contextmenu,d.initialTarget);r.pageX=N.tail(d.rollingPageX),r.pageY=N.tail(d.rollingPageY),this.dispatchEvent(r)}else if(t===1){let r=N.tail(d.rollingPageX),o=N.tail(d.rollingPageY),i=N.tail(d.rollingTimestamps)-d.rollingTimestamps[0],l=r-d.rollingPageX[0],h=o-d.rollingPageY[0];const f=this.targets.filter(y=>d.initialTarget instanceof Node&&y.contains(d.initialTarget));this.inertia(f,g,Math.abs(l)/i,l>0?1:-1,r,Math.abs(h)/i,h>0?1:-1,o)}this.dispatchEvent(this.newGestureEvent(S.End,d.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(n,g){let t=document.createEvent("CustomEvent");return t.initEvent(n,!1,!0),t.initialTarget=g,t.tapCount=0,t}dispatchEvent(n){if(n.type===S.Tap){const g=new Date().getTime();let t=0;g-this._lastSetTapCountTime>p.CLEAR_TAP_COUNT_TIME?t=1:t=2,this._lastSetTapCountTime=g,n.tapCount=t}else(n.type===S.Change||n.type===S.Contextmenu)&&(this._lastSetTapCountTime=0);for(let g=0;g{n.initialTarget instanceof Node&&g.contains(n.initialTarget)&&(g.dispatchEvent(n),this.dispatched=!0)})}inertia(n,g,t,s,c,u,d,a){this.handle=w.scheduleAtNextAnimationFrame(()=>{let r=Date.now(),o=r-g,i=0,l=0,h=!0;t+=p.SCROLL_FRICTION*o,u+=p.SCROLL_FRICTION*o,t>0&&(h=!1,i=s*t*o),u>0&&(h=!1,l=d*u*o);let f=this.newGestureEvent(S.Change);f.translationX=i,f.translationY=l,n.forEach(y=>y.dispatchEvent(f)),h||this.inertia(n,r,t,s,c+i,u,d,a+l)})}onTouchMove(n){let g=Date.now();for(let t=0,s=n.changedTouches.length;t 3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(c.pageX),u.rollingPageY.push(c.pageY),u.rollingTimestamps.push(g)}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}}p.SCROLL_FRICTION=-.005,p.HOLD_DELAY=700,p.CLEAR_TAP_COUNT_TIME=400,Fe([T.memoize],p,"isTouchDevice",null),e.Gesture=p}),define(J[108],ee([0,1,7,27]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.renderIcon=e.renderLabelWithIcons=void 0;const T=new RegExp(`(\\\\)?\\$\\((${N.CSSIcon.iconNameExpression}(?:${N.CSSIcon.iconModifierExpression})?)\\)`,"g");function D(p){const C=new Array;let n,g=0,t=0;for(;(n=T.exec(p))!==null;){t=n.index||0,C.push(p.substring(g,t)),g=(n.index||0)+n[0].length;const[,s,c]=n;C.push(s?`$(${c})`:S({id:c}))}return g{g=t===`\r +`?-1:0,s+=n;for(const c of C)c.end<=s||(c.start>=s&&(c.start+=g),c.end>=s&&(c.end+=g));return n+=g,"\u23CE"})}}e.HighlightedLabel=D}),define(J[307],ee([0,1,7]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RowCache=void 0;function N(D){try{D.parentElement&&D.parentElement.removeChild(D)}catch(S){}}class T{constructor(S){this.renderers=S,this.cache=new Map}alloc(S){let p=this.getTemplateCache(S).pop();if(!p){const C=(0,w.$)(".monaco-list-row"),g=this.getRenderer(S).renderTemplate(C);p={domNode:C,templateId:S,templateData:g}}return p}release(S){!S||this.releaseRow(S)}releaseRow(S){const{domNode:p,templateId:C}=S;p&&(p.classList.remove("scrolling"),N(p)),this.getTemplateCache(C).push(S)}getTemplateCache(S){let p=this.cache.get(S);return p||(p=[],this.cache.set(S,p)),p}dispose(){this.cache.forEach((S,p)=>{for(const C of S)this.getRenderer(p).disposeTemplate(C.templateData),C.templateData=null}),this.cache.clear()}getRenderer(S){const p=this.renderers.get(S);if(!p)throw new Error(`No renderer found for ${S}`);return p}}e.RowCache=T}),define(J[53],ee([0,1,7,52,56,58,2]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Widget=void 0;class p extends S.Disposable{onclick(n,g){this._register(w.addDisposableListener(n,w.EventType.CLICK,t=>g(new T.StandardMouseEvent(t))))}onmousedown(n,g){this._register(w.addDisposableListener(n,w.EventType.MOUSE_DOWN,t=>g(new T.StandardMouseEvent(t))))}onmouseover(n,g){this._register(w.addDisposableListener(n,w.EventType.MOUSE_OVER,t=>g(new T.StandardMouseEvent(t))))}onnonbubblingmouseout(n,g){this._register(w.addDisposableNonBubblingMouseOutListener(n,t=>g(new T.StandardMouseEvent(t))))}onkeydown(n,g){this._register(w.addDisposableListener(n,w.EventType.KEY_DOWN,t=>g(new N.StandardKeyboardEvent(t))))}onkeyup(n,g){this._register(w.addDisposableListener(n,w.EventType.KEY_UP,t=>g(new N.StandardKeyboardEvent(t))))}oninput(n,g){this._register(w.addDisposableListener(n,w.EventType.INPUT,g))}onblur(n,g){this._register(w.addDisposableListener(n,w.EventType.BLUR,g))}onfocus(n,g){this._register(w.addDisposableListener(n,w.EventType.FOCUS,g))}ignoreGesture(n){D.Gesture.ignoreTarget(n)}}e.Widget=p}),define(J[167],ee([0,1,96,53,14]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollbarArrow=e.ARROW_IMG_SIZE=void 0,e.ARROW_IMG_SIZE=11;class D extends N.Widget{constructor(p){super();this._onActivate=p.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=p.bgWidth+"px",this.bgDomNode.style.height=p.bgHeight+"px",typeof p.top!="undefined"&&(this.bgDomNode.style.top="0px"),typeof p.left!="undefined"&&(this.bgDomNode.style.left="0px"),typeof p.bottom!="undefined"&&(this.bgDomNode.style.bottom="0px"),typeof p.right!="undefined"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=p.className,this.domNode.classList.add(...p.icon.classNamesArray),this.domNode.style.position="absolute",this.domNode.style.width=e.ARROW_IMG_SIZE+"px",this.domNode.style.height=e.ARROW_IMG_SIZE+"px",typeof p.top!="undefined"&&(this.domNode.style.top=p.top+"px"),typeof p.left!="undefined"&&(this.domNode.style.left=p.left+"px"),typeof p.bottom!="undefined"&&(this.domNode.style.bottom=p.bottom+"px"),typeof p.right!="undefined"&&(this.domNode.style.right=p.right+"px"),this._mouseMoveMonitor=this._register(new w.GlobalMouseMoveMonitor),this.onmousedown(this.bgDomNode,C=>this._arrowMouseDown(C)),this.onmousedown(this.domNode,C=>this._arrowMouseDown(C)),this._mousedownRepeatTimer=this._register(new T.IntervalTimer),this._mousedownScheduleRepeatTimer=this._register(new T.TimeoutTimer)}_arrowMouseDown(p){const C=()=>{this._mousedownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24)};this._onActivate(),this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancelAndSet(C,200),this._mouseMoveMonitor.startMonitoring(p.target,p.buttons,w.standardMouseMoveMerger,n=>{},()=>{this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancel()}),p.preventDefault()}}e.ScrollbarArrow=D}),define(J[211],ee([0,1,7,30,96,167,302,53,17]),function(j,e,w,N,T,D,S,p,C){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractScrollbar=void 0;const n=140;class g extends p.Widget{constructor(s){super();this._lazyRender=s.lazyRender,this._host=s.host,this._scrollable=s.scrollable,this._scrollByPage=s.scrollByPage,this._scrollbarState=s.scrollbarState,this._visibilityController=this._register(new S.ScrollbarVisibilityController(s.visibility,"visible scrollbar "+s.extraScrollbarClassName,"invisible scrollbar "+s.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._mouseMoveMonitor=this._register(new T.GlobalMouseMoveMonitor),this._shouldRender=!0,this.domNode=(0,N.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,c=>this._domNodeMouseDown(c))}_createArrow(s){const c=this._register(new D.ScrollbarArrow(s));this.domNode.domNode.appendChild(c.bgDomNode),this.domNode.domNode.appendChild(c.domNode)}_createSlider(s,c,u,d){this.slider=(0,N.createFastDomNode)(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(s),this.slider.setLeft(c),typeof u=="number"&&this.slider.setWidth(u),typeof d=="number"&&this.slider.setHeight(d),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this.onmousedown(this.slider.domNode,a=>{a.leftButton&&(a.preventDefault(),this._sliderMouseDown(a,()=>{}))}),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(s){return this._scrollbarState.setVisibleSize(s)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(s){return this._scrollbarState.setScrollSize(s)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(s){return this._scrollbarState.setScrollPosition(s)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){!this._shouldRender||(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodeMouseDown(s){s.target===this.domNode.domNode&&this._onMouseDown(s)}delegateMouseDown(s){const c=this.domNode.domNode.getClientRects()[0].top,u=c+this._scrollbarState.getSliderPosition(),d=c+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderMousePosition(s);u<=a&&a<=d?s.leftButton&&(s.preventDefault(),this._sliderMouseDown(s,()=>{})):this._onMouseDown(s)}_onMouseDown(s){let c,u;if(s.target===this.domNode.domNode&&typeof s.browserEvent.offsetX=="number"&&typeof s.browserEvent.offsetY=="number")c=s.browserEvent.offsetX,u=s.browserEvent.offsetY;else{const a=w.getDomNodePagePosition(this.domNode.domNode);c=s.posx-a.left,u=s.posy-a.top}const d=this._mouseDownRelativePosition(c,u);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(d):this._scrollbarState.getDesiredScrollPositionFromOffset(d)),s.leftButton&&(s.preventDefault(),this._sliderMouseDown(s,()=>{}))}_sliderMouseDown(s,c){const u=this._sliderMousePosition(s),d=this._sliderOrthogonalMousePosition(s),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._mouseMoveMonitor.startMonitoring(s.target,s.buttons,T.standardMouseMoveMerger,r=>{const o=this._sliderOrthogonalMousePosition(r),i=Math.abs(o-d);if(C.isWindows&&i>n){this._setDesiredScrollPositionNow(a.getScrollPosition());return}const h=this._sliderMousePosition(r)-u;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd(),c()}),this._host.onDragStart()}_setDesiredScrollPositionNow(s){const c={};this.writeScrollPosition(c,s),this._scrollable.setScrollPositionNow(c)}updateScrollbarSize(s){this._updateScrollbarSize(s),this._scrollbarState.setScrollbarSize(s),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}e.AbstractScrollbar=g}),define(J[308],ee([0,1,56,211,167,205,27]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HorizontalScrollbar=void 0;const p=(0,S.registerCodicon)("scrollbar-button-left",S.Codicon.triangleLeft),C=(0,S.registerCodicon)("scrollbar-button-right",S.Codicon.triangleRight);class n extends N.AbstractScrollbar{constructor(t,s,c){const u=t.getScrollDimensions(),d=t.getCurrentScrollPosition();super({lazyRender:s.lazyRender,host:c,scrollbarState:new D.ScrollbarState(s.horizontalHasArrows?s.arrowSize:0,s.horizontal===2?0:s.horizontalScrollbarSize,s.vertical===2?0:s.verticalScrollbarSize,u.width,u.scrollWidth,d.scrollLeft),visibility:s.horizontal,extraScrollbarClassName:"horizontal",scrollable:t,scrollByPage:s.scrollByPage});if(s.horizontalHasArrows){const a=(s.arrowSize-T.ARROW_IMG_SIZE)/2,r=(s.horizontalScrollbarSize-T.ARROW_IMG_SIZE)/2;this._createArrow({className:"scra",icon:p,top:r,left:a,bottom:void 0,right:void 0,bgWidth:s.arrowSize,bgHeight:s.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new w.StandardWheelEvent(null,1,0))}),this._createArrow({className:"scra",icon:C,top:r,left:void 0,bottom:void 0,right:a,bgWidth:s.arrowSize,bgHeight:s.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new w.StandardWheelEvent(null,-1,0))})}this._createSlider(Math.floor((s.horizontalScrollbarSize-s.horizontalSliderSize)/2),0,void 0,s.horizontalSliderSize)}_updateSlider(t,s){this.slider.setWidth(t),this.slider.setLeft(s)}_renderDomNode(t,s){this.domNode.setWidth(t),this.domNode.setHeight(s),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(t.width)||this._shouldRender,this._shouldRender}_mouseDownRelativePosition(t,s){return t}_sliderMousePosition(t){return t.posx}_sliderOrthogonalMousePosition(t){return t.posy}_updateScrollbarSize(t){this.slider.setHeight(t)}writeScrollPosition(t,s){t.scrollLeft=s}updateOptions(t){this.updateScrollbarSize(t.horizontal===2?0:t.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._visibilityController.setVisibility(t.horizontal),this._scrollByPage=t.scrollByPage}}e.HorizontalScrollbar=n}),define(J[309],ee([0,1,56,211,167,205,27]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VerticalScrollbar=void 0;const p=(0,S.registerCodicon)("scrollbar-button-up",S.Codicon.triangleUp),C=(0,S.registerCodicon)("scrollbar-button-down",S.Codicon.triangleDown);class n extends N.AbstractScrollbar{constructor(t,s,c){const u=t.getScrollDimensions(),d=t.getCurrentScrollPosition();super({lazyRender:s.lazyRender,host:c,scrollbarState:new D.ScrollbarState(s.verticalHasArrows?s.arrowSize:0,s.vertical===2?0:s.verticalScrollbarSize,0,u.height,u.scrollHeight,d.scrollTop),visibility:s.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:s.scrollByPage});if(s.verticalHasArrows){const a=(s.arrowSize-T.ARROW_IMG_SIZE)/2,r=(s.verticalScrollbarSize-T.ARROW_IMG_SIZE)/2;this._createArrow({className:"scra",icon:p,top:a,left:r,bottom:void 0,right:void 0,bgWidth:s.verticalScrollbarSize,bgHeight:s.arrowSize,onActivate:()=>this._host.onMouseWheel(new w.StandardWheelEvent(null,0,1))}),this._createArrow({className:"scra",icon:C,top:void 0,left:r,bottom:a,right:void 0,bgWidth:s.verticalScrollbarSize,bgHeight:s.arrowSize,onActivate:()=>this._host.onMouseWheel(new w.StandardWheelEvent(null,0,-1))})}this._createSlider(0,Math.floor((s.verticalScrollbarSize-s.verticalSliderSize)/2),s.verticalSliderSize,void 0)}_updateSlider(t,s){this.slider.setHeight(t),this.slider.setTop(s)}_renderDomNode(t,s){this.domNode.setWidth(s),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_mouseDownRelativePosition(t,s){return s}_sliderMousePosition(t){return t.posy}_sliderOrthogonalMousePosition(t){return t.posx}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,s){t.scrollTop=s}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}}e.VerticalScrollbar=n}),define(J[44],ee([0,1,162,48,75,8,24]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DataUri=e.resolvePath=e.normalizePath=e.joinPath=e.dirname=e.basename=e.basenameOrAuthority=e.isEqual=e.extUri=e.ExtUri=e.originalFSPath=void 0;function p(g){return(0,S.uriToFsPath)(g,!0)}e.originalFSPath=p;class C{constructor(t){this._ignorePathCasing=t}compare(t,s,c=!1){return t===s?0:(0,D.compare)(this.getComparisonKey(t,c),this.getComparisonKey(s,c))}isEqual(t,s,c=!1){return t===s?!0:!t||!s?!1:this.getComparisonKey(t,c)===this.getComparisonKey(s,c)}getComparisonKey(t,s=!1){return t.with({path:this._ignorePathCasing(t)?t.path.toLowerCase():void 0,fragment:s?null:void 0}).toString()}joinPath(t,...s){return S.URI.joinPath(t,...s)}basenameOrAuthority(t){return(0,e.basename)(t)||t.authority}basename(t){return T.posix.basename(t.path)}dirname(t){if(t.path.length===0)return t;let s;return t.scheme===N.Schemas.file?s=S.URI.file(T.dirname(p(t))).path:(s=T.posix.dirname(t.path),t.authority&&s.length&&s.charCodeAt(0)!==47&&(console.error(`dirname("${t.toString})) resulted in a relative path`),s="/")),t.with({path:s})}normalizePath(t){if(!t.path.length)return t;let s;return t.scheme===N.Schemas.file?s=S.URI.file(T.normalize(p(t))).path:s=T.posix.normalize(t.path),t.with({path:s})}resolvePath(t,s){if(t.scheme===N.Schemas.file){const c=S.URI.file(T.resolve(p(t),s));return t.with({authority:c.authority,path:c.path})}return s=w.toPosixPath(s),t.with({path:T.posix.resolve(t.path,s)})}}e.ExtUri=C,e.extUri=new C(()=>!1),e.isEqual=e.extUri.isEqual.bind(e.extUri),e.basenameOrAuthority=e.extUri.basenameOrAuthority.bind(e.extUri),e.basename=e.extUri.basename.bind(e.extUri),e.dirname=e.extUri.dirname.bind(e.extUri),e.joinPath=e.extUri.joinPath.bind(e.extUri),e.normalizePath=e.extUri.normalizePath.bind(e.extUri),e.resolvePath=e.extUri.resolvePath.bind(e.extUri);var n;(function(g){g.META_DATA_LABEL="label",g.META_DATA_DESCRIPTION="description",g.META_DATA_SIZE="size",g.META_DATA_MIME="mime";function t(s){const c=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(a=>{const[r,o]=a.split(":");r&&o&&c.set(r,o)});const d=s.path.substring(0,s.path.indexOf(";"));return d&&c.set(g.META_DATA_MIME,d),c}g.parseMetaData=t})(n=e.DataUri||(e.DataUri={}))}),define(J[310],ee([0,1,7,717,94,165,56,108,14,23,11,4,69,107,131,2,718,210,48,38,44,8,24]),function(j,e,w,N,T,D,S,p,C,n,g,t,s,c,u,d,a,r,o,i,l,h,f){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.renderMarkdown=void 0;function y(v,m={},E={}){var I;const k=new d.DisposableStore;let M=!1;const P=k.add(new n.CancellationTokenSource),F=(0,D.createElement)(m),R=function(H){let Y;try{Y=(0,r.parse)(decodeURIComponent(H))}catch(X){}return Y?(Y=(0,i.cloneAndChange)(Y,X=>{if(v.uris&&v.uris[X])return f.URI.revive(v.uris[X])}),encodeURIComponent(JSON.stringify(Y))):H},A=function(H,Y){const X=v.uris&&v.uris[H];if(!X)return H;let Z=f.URI.revive(X);return Y?H.startsWith(o.Schemas.data+":")?H:o.FileAccess.asBrowserUri(Z).toString(!0):f.URI.parse(H).toString()===Z.toString()?H:(Z.query&&(Z=Z.with({query:R(Z.query)})),Z.toString())};let O;const L=new Promise(H=>O=H),B=new a.Renderer;if(B.image=(H,Y,X)=>{let Z=[],se=[];if(H){({href:H,dimensions:Z}=(0,s.parseHrefAndDimensions)(H)),H=A(H,!0);try{const oe=f.URI.parse(H);m.baseUrl&&oe.scheme===o.Schemas.file&&(H=(0,l.resolvePath)(m.baseUrl,H).toString())}catch(oe){}se.push(`src="${H}"`)}return X&&se.push(`alt="${X}"`),Y&&se.push(`title="${Y}"`),Z.length&&(se=se.concat(Z))," "},B.link=(H,Y,X)=>(H===X&&(X=(0,s.removeMarkdownEscapes)(X)),H=A(H,!1),m.baseUrl&&(/^\w[\w\d+.-]*:/.test(H)||(H=(0,l.resolvePath)(m.baseUrl,H).toString())),Y=(0,s.removeMarkdownEscapes)(Y),H=(0,s.removeMarkdownEscapes)(H),!H||H.match(/^data:|javascript:/i)||H.match(/^command:/i)&&!v.isTrusted||H.match(/^command:(\/\/\/)?_workbench\.downloadResource/i)?X:(H=H.replace(/&/g,"&").replace(/
${H}
`,m.codeBlockRenderer&&(B.code=(H,Y)=>{const X=m.codeBlockRenderer(Y,H),Z=u.defaultGenerator.nextId();return(0,C.raceCancellation)(Promise.all([X,L]),P.token).then(se=>{var oe;if(!M&&se){const G=F.querySelector(`div[data-code="${Z}"]`);G&&w.reset(G,se[0]),(oe=m.asyncRenderCallback)===null||oe===void 0||oe.call(m)}}).catch(()=>{}),`${(0,h.escape)(H)}`}),m.actionHandler){const H=m.actionHandler.disposables.add(new T.DomEmitter(F,"click")),Y=m.actionHandler.disposables.add(new T.DomEmitter(F,"auxclick"));m.actionHandler.disposables.add(t.Event.any(H.event,Y.event)(X=>{const Z=new S.StandardMouseEvent(X);if(!Z.leftButton&&!Z.middleButton)return;let se=Z.target;if(!(se.tagName!=="A"&&(se=se.parentElement,!se||se.tagName!=="A")))try{const oe=se.dataset.href;oe&&m.actionHandler.callback(oe,Z)}catch(oe){(0,g.onUnexpectedError)(oe)}finally{Z.preventDefault()}}))}v.supportHtml||(E.sanitizer=H=>(v.isTrusted?H.match(/^(]+>)|(<\/\s*span>)$/):void 0)?H:"",E.sanitize=!0,E.silent=!0),E.renderer=B;let W=(I=v.value)!==null&&I!==void 0?I:"";W.length>1e5&&(W=`${W.substr(0,1e5)}\u2026`),v.supportThemeIcons&&(W=(0,c.markdownEscapeEscapedIcons)(W));let K=a.parse(W,E);if(v.supportThemeIcons&&(K=(0,p.renderLabelWithIcons)(K).map(Y=>typeof Y=="string"?Y:Y.outerHTML).join("")),F.innerHTML=_(v,K),O(),m.asyncRenderCallback)for(const H of F.getElementsByTagName("img")){const Y=k.add(w.addDisposableListener(H,"load",()=>{Y.dispose(),m.asyncRenderCallback()}))}return{element:F,dispose:()=>{M=!0,P.cancel(),k.dispose()}}}e.renderMarkdown=y;function _(v,m){const{config:E,allowedSchemes:I}=b(v);N.addHook("uponSanitizeAttribute",(M,P)=>{if(P.attrName==="style"||P.attrName==="class"){if(M.tagName==="SPAN"){if(P.attrName==="style"){P.keepAttr=/^(color\:#[0-9a-fA-F]+;)?(background-color\:#[0-9a-fA-F]+;)?$/.test(P.attrValue);return}else if(P.attrName==="class"){P.keepAttr=/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(P.attrValue);return}}P.keepAttr=!1;return}});const k=document.createElement("a");N.addHook("afterSanitizeAttributes",M=>{for(const P of["href","src"])M.hasAttribute(P)&&(k.href=M.getAttribute(P),I.includes(k.protocol.replace(/:$/,""))||M.removeAttribute(P))});try{return N.sanitize(m,Object.assign(Object.assign({},E),{RETURN_TRUSTED_TYPE:!0}))}finally{N.removeHook("uponSanitizeAttribute"),N.removeHook("afterSanitizeAttributes")}}function b(v){const m=[o.Schemas.http,o.Schemas.https,o.Schemas.mailto,o.Schemas.data,o.Schemas.file,o.Schemas.vscodeFileResource,o.Schemas.vscodeRemote,o.Schemas.vscodeRemoteResource];return v.isTrusted&&m.push(o.Schemas.command),{config:{ALLOWED_TAGS:["ul","li","p","b","i","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"],ALLOWED_ATTR:["href","data-href","target","title","src","alt","class","style","data-code","width","height","align"],ALLOW_UNKNOWN_PROTOCOLS:!0},allowedSchemes:m}}}),define(J[168],ee([0,1,162,48,17,44,24]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.normalizeDriveLetter=e.getBaseLabel=void 0;function p(n){if(!n)return;typeof n=="string"&&(n=S.URI.file(n));const g=(0,D.basename)(n)||(n.scheme===N.Schemas.file?n.fsPath:n.path);return T.isWindows&&(0,w.isRootOrDriveLetter)(g)?C(g):g}e.getBaseLabel=p;function C(n){return(0,w.hasDriveLetter)(n)?n.charAt(0).toUpperCase()+n.slice(1):n}e.normalizeDriveLetter=C}),define(J[109],ee([0,1,209,48,75,44,8]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.guessMimeTypes=e.clearTextMimes=e.registerTextMime=e.Mimes=void 0;var p;(function(r){r.text="text/plain",r.binary="application/octet-stream",r.unknown="application/unknown",r.markdown="text/markdown",r.latex="text/latex"})(p=e.Mimes||(e.Mimes={}));let C=[],n=[],g=[];function t(r,o=!1){const i=s(r);C.push(i),i.userConfigured?g.push(i):n.push(i),o&&!i.userConfigured&&C.forEach(l=>{l.mime===i.mime||l.userConfigured||(i.extension&&l.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&l.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&l.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&l.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}e.registerTextMime=t;function s(r){return{id:r.id,mime:r.mime,filename:r.filename,extension:r.extension,filepattern:r.filepattern,firstline:r.firstline,userConfigured:r.userConfigured,filenameLowercase:r.filename?r.filename.toLowerCase():void 0,extensionLowercase:r.extension?r.extension.toLowerCase():void 0,filepatternLowercase:r.filepattern?(0,w.parse)(r.filepattern.toLowerCase()):void 0,filepatternOnPath:r.filepattern?r.filepattern.indexOf(T.posix.sep)>=0:!1}}function c(r){r?(C=C.filter(o=>!o.userConfigured),g=[]):(C=[],n=[],g=[])}e.clearTextMimes=c;function u(r,o){let i;if(r)switch(r.scheme){case N.Schemas.file:i=r.fsPath;break;case N.Schemas.data:i=D.DataUri.parseMetaData(r).get(D.DataUri.META_DATA_LABEL);break;default:i=r.path}if(!i)return[p.unknown];i=i.toLowerCase();const l=(0,T.basename)(i),h=d(i,l,g);if(h)return[h,p.text];const f=d(i,l,n);if(f)return[f,p.text];if(o){const y=a(o);if(y)return[y,p.text]}return[p.unknown]}e.guessMimeTypes=u;function d(r,o,i){var l;let h=null,f=null,y=null;for(let _=i.length-1;_>=0;_--){const b=i[_];if(o===b.filenameLowercase){h=b;break}if(b.filepattern&&(!f||b.filepattern.length>f.filepattern.length)){const v=b.filepatternOnPath?r:o;((l=b.filepatternLowercase)===null||l===void 0?void 0:l.call(b,v))&&(f=b)}b.extension&&(!y||b.extension.length>y.extension.length)&&o.endsWith(b.extensionLowercase)&&(y=b)}return h?h.mime:f?f.mime:y?y.mime:null}function a(r){if((0,S.startsWithUTF8BOM)(r)&&(r=r.substr(1)),r.length>0)for(let o=C.length-1;o>=0;o--){const i=C[o];if(!i.firstline)continue;const l=r.match(i.firstline);if(l&&l.length>0)return i.mime}return null}}),define(J[169],ee([0,1,109]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StaticDND=e.DragAndDropData=e.DataTransfers=void 0,e.DataTransfers={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:w.Mimes.text,TERMINALS:"Terminals"};class N{constructor(D){this.data=D}update(){}getData(){return this.data}}e.DragAndDropData=N,e.StaticDND={CurrentDragAndDropData:void 0}}),define(J[311],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.generateUuid=void 0;const w=new Uint8Array(16),N=[];for(let S=0;S<256;S++)N.push(S.toString(16).padStart(2,"0"));let T;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?T=crypto.getRandomValues.bind(crypto):T=function(S){for(let p=0;p{this._pendingReplies[v]={resolve:m,reject:E},this._send(new t(this._workerId,v,_,b))})}listen(_,b){let v=null;const m=new N.Emitter({onFirstListenerAdd:()=>{v=String(++this._lastSentReq),this._pendingEmitters.set(v,m),this._send(new c(this._workerId,v,_,b))},onLastListenerRemove:()=>{this._pendingEmitters.delete(v),this._send(new d(this._workerId,v)),v=null}});return m.event}handleMessage(_){!_||!_.vsWorker||this._workerId!==-1&&_.vsWorker!==this._workerId||this._handleMessage(_)}_handleMessage(_){switch(_.type){case 1:return this._handleReplyMessage(_);case 0:return this._handleRequestMessage(_);case 2:return this._handleSubscribeEventMessage(_);case 3:return this._handleEventMessage(_);case 4:return this._handleUnsubscribeEventMessage(_)}}_handleReplyMessage(_){if(!this._pendingReplies[_.seq]){console.warn("Got reply to unknown seq");return}let b=this._pendingReplies[_.seq];if(delete this._pendingReplies[_.seq],_.err){let v=_.err;_.err.$isError&&(v=new Error,v.name=_.err.name,v.message=_.err.message,v.stack=_.err.stack),b.reject(v);return}b.resolve(_.res)}_handleRequestMessage(_){let b=_.req;this._handler.handleMessage(_.method,_.args).then(m=>{this._send(new s(this._workerId,b,m,void 0))},m=>{m.detail instanceof Error&&(m.detail=(0,w.transformErrorForSerialization)(m.detail)),this._send(new s(this._workerId,b,void 0,(0,w.transformErrorForSerialization)(m)))})}_handleSubscribeEventMessage(_){const b=_.req,v=this._handler.handleEvent(_.eventName,_.arg)(m=>{this._send(new u(this._workerId,b,m))});this._pendingEvents.set(b,v)}_handleEventMessage(_){if(!this._pendingEmitters.has(_.req)){console.warn("Got event for unknown req");return}this._pendingEmitters.get(_.req).fire(_.event)}_handleUnsubscribeEventMessage(_){if(!this._pendingEvents.has(_.req)){console.warn("Got unsubscribe for unknown req");return}this._pendingEvents.get(_.req).dispose(),this._pendingEvents.delete(_.req)}_send(_){let b=[];if(_.type===0)for(let v=0;v<_.args.length;v++)_.args[v]instanceof ArrayBuffer&&b.push(_.args[v]);else _.type===1&&_.res instanceof ArrayBuffer&&b.push(_.res);this._handler.sendMessage(_,b)}}class r extends T.Disposable{constructor(_,b,v){super();let m=null;this._worker=this._register(_.create("vs/base/common/worker/simpleWorker",P=>{this._protocol.handleMessage(P)},P=>{m&&m(P)})),this._protocol=new a({sendMessage:(P,F)=>{this._worker.postMessage(P,F)},handleMessage:(P,F)=>{if(typeof v[P]!="function")return Promise.reject(new Error("Missing method "+P+" on main thread host."));try{return Promise.resolve(v[P].apply(v,F))}catch(R){return Promise.reject(R)}},handleEvent:(P,F)=>{if(i(P)){const R=v[P].call(v,F);if(typeof R!="function")throw new Error(`Missing dynamic event ${P} on main thread host.`);return R}if(o(P)){const R=v[P];if(typeof R!="function")throw new Error(`Missing event ${P} on main thread host.`);return R}throw new Error(`Malformed event name ${P}`)}}),this._protocol.setWorkerId(this._worker.getId());let E=null;typeof D.globals.require!="undefined"&&typeof D.globals.require.getConfig=="function"?E=D.globals.require.getConfig():typeof D.globals.requirejs!="undefined"&&(E=D.globals.requirejs.s.contexts._.config);const I=S.getAllMethodNames(v);this._onModuleLoaded=this._protocol.sendMessage(C,[this._worker.getId(),JSON.parse(JSON.stringify(E)),b,I]);const k=(P,F)=>this._request(P,F),M=(P,F)=>this._protocol.listen(P,F);this._lazyProxy=new Promise((P,F)=>{m=F,this._onModuleLoaded.then(R=>{P(l(R,k,M))},R=>{F(R),this._onError("Worker failed to load "+b,R)})})}getProxyObject(){return this._lazyProxy}_request(_,b){return new Promise((v,m)=>{this._onModuleLoaded.then(()=>{this._protocol.sendMessage(_,b).then(v,m)},m)})}_onError(_,b){console.error(_),console.info(b)}}e.SimpleWorkerClient=r;function o(y){return y[0]==="o"&&y[1]==="n"&&p.isUpperAsciiLetter(y.charCodeAt(2))}function i(y){return/^onDynamic/.test(y)&&p.isUpperAsciiLetter(y.charCodeAt(9))}function l(y,_,b){const v=I=>function(){const k=Array.prototype.slice.call(arguments,0);return _(I,k)},m=I=>function(k){return b(I,k)};let E={};for(const I of y){if(i(I)){E[I]=m(I);continue}if(o(I)){E[I]=b(I,void 0);continue}E[I]=v(I)}return E}class h{constructor(_,b){this._requestHandlerFactory=b,this._requestHandler=null,this._protocol=new a({sendMessage:(v,m)=>{_(v,m)},handleMessage:(v,m)=>this._handleMessage(v,m),handleEvent:(v,m)=>this._handleEvent(v,m)})}onmessage(_){this._protocol.handleMessage(_)}_handleMessage(_,b){if(_===C)return this.initialize(b[0],b[1],b[2],b[3]);if(!this._requestHandler||typeof this._requestHandler[_]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+_));try{return Promise.resolve(this._requestHandler[_].apply(this._requestHandler,b))}catch(v){return Promise.reject(v)}}_handleEvent(_,b){if(!this._requestHandler)throw new Error("Missing requestHandler");if(i(_)){const v=this._requestHandler[_].call(this._requestHandler,b);if(typeof v!="function")throw new Error(`Missing dynamic event ${_} on request handler.`);return v}if(o(_)){const v=this._requestHandler[_];if(typeof v!="function")throw new Error(`Missing event ${_} on request handler.`);return v}throw new Error(`Malformed event name ${_}`)}initialize(_,b,v,m){this._protocol.setWorkerId(_);const k=l(m,(M,P)=>this._protocol.sendMessage(M,P),(M,P)=>this._protocol.listen(M,P));return this._requestHandlerFactory?(this._requestHandler=this._requestHandlerFactory(k),Promise.resolve(S.getAllMethodNames(this._requestHandler))):(b&&(typeof b.baseUrl!="undefined"&&delete b.baseUrl,typeof b.paths!="undefined"&&typeof b.paths.vs!="undefined"&&delete b.paths.vs,typeof b.trustedTypesPolicy!==void 0&&delete b.trustedTypesPolicy,b.catchError=!0,D.globals.require.config(b)),new Promise((M,P)=>{(D.globals.require||j)([v],R=>{if(this._requestHandler=R.create(k),!this._requestHandler){P(new Error("No RequestHandler!"));return}M(S.getAllMethodNames(this._requestHandler))},P)}))}}e.SimpleWorkerServer=h;function f(y){return new h(y,null)}e.create=f}),define(J[213],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ItemActivation=e.QuickInputHideReason=e.NO_KEY_MODS=void 0,e.NO_KEY_MODS={ctrlCmd:!1,alt:!1};var w;(function(T){T[T.Blur=1]="Blur",T[T.Gesture=2]="Gesture",T[T.Other=3]="Other"})(w=e.QuickInputHideReason||(e.QuickInputHideReason={}));var N;(function(T){T[T.NONE=0]="NONE",T[T.FIRST=1]="FIRST",T[T.SECOND=2]="SECOND",T[T.LAST=3]="LAST"})(N=e.ItemActivation||(e.ItemActivation={}))}),define(J[312],ee([0,1,14,4,2,20]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryStorageDatabase=e.Storage=void 0;var S;(function(n){n[n.None=0]="None",n[n.Initialized=1]="Initialized",n[n.Closed=2]="Closed"})(S||(S={}));class p extends T.Disposable{constructor(g,t=Object.create(null)){super();this.database=g,this.options=t,this._onDidChangeStorage=this._register(new N.Emitter),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=S.None,this.cache=new Map,this.flushDelayer=new w.ThrottledDelayer(p.DEFAULT_FLUSH_DELAY),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(g=>this.onDidChangeItemsExternal(g)))}onDidChangeItemsExternal(g){var t,s;(t=g.changed)===null||t===void 0||t.forEach((c,u)=>this.accept(u,c)),(s=g.deleted)===null||s===void 0||s.forEach(c=>this.accept(c,void 0))}accept(g,t){if(this.state===S.Closed)return;let s=!1;(0,D.isUndefinedOrNull)(t)?s=this.cache.delete(g):this.cache.get(g)!==t&&(this.cache.set(g,t),s=!0),s&&this._onDidChangeStorage.fire(g)}get(g,t){const s=this.cache.get(g);return(0,D.isUndefinedOrNull)(s)?t:s}getBoolean(g,t){const s=this.get(g);return(0,D.isUndefinedOrNull)(s)?t:s==="true"}getNumber(g,t){const s=this.get(g);return(0,D.isUndefinedOrNull)(s)?t:parseInt(s,10)}set(g,t){return Re(this,void 0,void 0,function*(){if(this.state===S.Closed)return;if((0,D.isUndefinedOrNull)(t))return this.delete(g);const s=String(t);if(this.cache.get(g)!==s)return this.cache.set(g,s),this.pendingInserts.set(g,s),this.pendingDeletes.delete(g),this._onDidChangeStorage.fire(g),this.flushDelayer.trigger(()=>this.flushPending())})}delete(g){return Re(this,void 0,void 0,function*(){if(!(this.state===S.Closed||!this.cache.delete(g)))return this.pendingDeletes.has(g)||this.pendingDeletes.add(g),this.pendingInserts.delete(g),this._onDidChangeStorage.fire(g),this.flushDelayer.trigger(()=>this.flushPending())})}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}flushPending(){return Re(this,void 0,void 0,function*(){if(!this.hasPending)return;const g={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(g).finally(()=>{var t;if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)(t=this.whenFlushedCallbacks.pop())===null||t===void 0||t()})})}dispose(){this.flushDelayer.dispose(),super.dispose()}}e.Storage=p,p.DEFAULT_FLUSH_DELAY=100;class C{constructor(){this.onDidChangeItemsExternal=N.Event.None,this.items=new Map}updateItems(g){return Re(this,void 0,void 0,function*(){g.insert&&g.insert.forEach((t,s)=>this.items.set(s,t)),g.delete&&g.delete.forEach(t=>this.items.delete(t))})}}e.InMemoryStorageDatabase=C}),define(J[313],ee([0,1,17,212]),function(j,e,w,N){"use strict";var T;Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultWorkerFactory=e.getWorkerBootstrapUrl=void 0;const D=(T=window.trustedTypes)===null||T===void 0?void 0:T.createPolicy("defaultWorkerFactory",{createScriptURL:t=>t});function S(t,s){if(w.globals.MonacoEnvironment){if(typeof w.globals.MonacoEnvironment.getWorker=="function")return w.globals.MonacoEnvironment.getWorker(t,s);if(typeof w.globals.MonacoEnvironment.getWorkerUrl=="function"){const c=w.globals.MonacoEnvironment.getWorkerUrl(t,s);return new Worker(D?D.createScriptURL(c):c,{name:s})}}if(typeof j=="function"){const c=j.toUrl("./"+t),u=p(c,s);return new Worker(D?D.createScriptURL(u):u,{name:s})}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function p(t,s){if(/^((http:)|(https:)|(file:))/.test(t)&&t.substring(0,self.origin.length)!==self.origin){const c="vs/base/worker/defaultWorkerFactory.js",u=j.toUrl(c).slice(0,-c.length),d=`/*${s}*/self.MonacoEnvironment={baseUrl: '${u}'};const ttPolicy = self.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });importScripts(ttPolicy?.createScriptURL('${t}') ?? '${t}');/*${s}*/`,a=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(a)}return t+"#"+s}e.getWorkerBootstrapUrl=p;function C(t){return typeof t.then=="function"}class n{constructor(s,c,u,d,a){this.id=c;const r=S("workerMain.js",u);C(r)?this.worker=r:this.worker=Promise.resolve(r),this.postMessage(s,[]),this.worker.then(o=>{o.onmessage=function(i){d(i.data)},o.onmessageerror=a,typeof o.addEventListener=="function"&&o.addEventListener("error",a)})}getId(){return this.id}postMessage(s,c){this.worker&&this.worker.then(u=>u.postMessage(s,c))}dispose(){this.worker&&this.worker.then(s=>s.terminate()),this.worker=null}}class g{constructor(s){this._label=s,this._webWorkerFailedBeforeError=!1}create(s,c,u){let d=++g.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new n(s,d,this._label||"anonymous"+d,c,a=>{(0,N.logOnceWebWorkerWarning)(a),this._webWorkerFailedBeforeError=a,u(a)})}}e.DefaultWorkerFactory=g,g.LAST_WORKER_ID=0}),define(J[214],ee([12]),{}),define(J[314],ee([12]),{}),define(J[45],ee([0,1,7,17,314]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.status=e.alert=e.setARIAContainer=void 0;const T=2e4;let D,S,p,C,n;function g(u){D=document.createElement("div"),D.className="monaco-aria-container";const d=()=>{const r=document.createElement("div");return r.className="monaco-alert",r.setAttribute("role","alert"),r.setAttribute("aria-atomic","true"),D.appendChild(r),r};S=d(),p=d();const a=()=>{const r=document.createElement("div");return r.className="monaco-status",r.setAttribute("role","complementary"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),D.appendChild(r),r};C=a(),n=a(),u.appendChild(D)}e.setARIAContainer=g;function t(u){!D||(S.textContent!==u?(w.clearNode(p),c(S,u)):(w.clearNode(S),c(p,u)))}e.alert=t;function s(u){!D||(N.isMacintosh?t(u):C.textContent!==u?(w.clearNode(n),c(C,u)):(w.clearNode(C),c(n,u)))}e.status=s;function c(u,d){w.clearNode(u),d.length>T&&(d=d.substr(0,T)),u.textContent=d,u.style.visibility="hidden",u.style.visibility="visible"}}),define(J[315],ee([12]),{}),define(J[316],ee([0,1,7,52,58,108,29,4,2,38,315]),function(j,e,w,N,T,D,S,p,C,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Button=void 0;const g={buttonBackground:S.Color.fromHex("#0E639C"),buttonHoverBackground:S.Color.fromHex("#006BB3"),buttonForeground:S.Color.white};class t extends C.Disposable{constructor(c,u){super();this._onDidClick=this._register(new p.Emitter),this.options=u||Object.create(null),(0,n.mixin)(this.options,g,!1),this.buttonForeground=this.options.buttonForeground,this.buttonBackground=this.options.buttonBackground,this.buttonHoverBackground=this.options.buttonHoverBackground,this.buttonSecondaryForeground=this.options.buttonSecondaryForeground,this.buttonSecondaryBackground=this.options.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=this.options.buttonSecondaryHoverBackground,this.buttonBorder=this.options.buttonBorder,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),c.appendChild(this._element),this._register(T.Gesture.addTarget(this._element)),[w.EventType.CLICK,T.EventType.Tap].forEach(d=>{this._register((0,w.addDisposableListener)(this._element,d,a=>{if(!this.enabled){w.EventHelper.stop(a);return}this._onDidClick.fire(a)}))}),this._register((0,w.addDisposableListener)(this._element,w.EventType.KEY_DOWN,d=>{const a=new N.StandardKeyboardEvent(d);let r=!1;this.enabled&&(a.equals(3)||a.equals(10))?(this._onDidClick.fire(d),r=!0):a.equals(9)&&(this._element.blur(),r=!0),r&&w.EventHelper.stop(a,!0)})),this._register((0,w.addDisposableListener)(this._element,w.EventType.MOUSE_OVER,d=>{this._element.classList.contains("disabled")||this.setHoverBackground()})),this._register((0,w.addDisposableListener)(this._element,w.EventType.MOUSE_OUT,d=>{this.applyStyles()})),this.focusTracker=this._register((0,w.trackFocus)(this._element)),this._register(this.focusTracker.onDidFocus(()=>this.setHoverBackground())),this._register(this.focusTracker.onDidBlur(()=>this.applyStyles())),this.applyStyles()}get onDidClick(){return this._onDidClick.event}setHoverBackground(){let c;this.options.secondary?c=this.buttonSecondaryHoverBackground?this.buttonSecondaryHoverBackground.toString():null:c=this.buttonHoverBackground?this.buttonHoverBackground.toString():null,c&&(this._element.style.backgroundColor=c)}style(c){this.buttonForeground=c.buttonForeground,this.buttonBackground=c.buttonBackground,this.buttonHoverBackground=c.buttonHoverBackground,this.buttonSecondaryForeground=c.buttonSecondaryForeground,this.buttonSecondaryBackground=c.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=c.buttonSecondaryHoverBackground,this.buttonBorder=c.buttonBorder,this.applyStyles()}applyStyles(){if(this._element){let c,u;this.options.secondary?(u=this.buttonSecondaryForeground?this.buttonSecondaryForeground.toString():"",c=this.buttonSecondaryBackground?this.buttonSecondaryBackground.toString():""):(u=this.buttonForeground?this.buttonForeground.toString():"",c=this.buttonBackground?this.buttonBackground.toString():"");const d=this.buttonBorder?this.buttonBorder.toString():"";this._element.style.color=u,this._element.style.backgroundColor=c,this._element.style.borderWidth=d?"1px":"",this._element.style.borderStyle=d?"solid":"",this._element.style.borderColor=d}}get element(){return this._element}set label(c){this._element.classList.add("monaco-text-button"),this.options.supportIcons?(0,w.reset)(this._element,...(0,D.renderLabelWithIcons)(c)):this._element.textContent=c,typeof this.options.title=="string"?this._element.title=this.options.title:this.options.title&&(this._element.title=c)}set enabled(c){c?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}}e.Button=t}),define(J[317],ee([12]),{}),define(J[170],ee([0,1,53,27,29,4,317]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Checkbox=void 0;const S={inputActiveOptionBorder:T.Color.fromHex("#007ACC00"),inputActiveOptionForeground:T.Color.fromHex("#FFFFFF"),inputActiveOptionBackground:T.Color.fromHex("#0E639C50")};class p extends w.Widget{constructor(n){super();this._onChange=this._register(new D.Emitter),this.onChange=this._onChange.event,this._onKeyDown=this._register(new D.Emitter),this.onKeyDown=this._onKeyDown.event,this._opts=Object.assign(Object.assign({},S),n),this._checked=this._opts.isChecked;const g=["monaco-custom-checkbox"];this._opts.icon&&g.push(...N.CSSIcon.asClassNameArray(this._opts.icon)),this._opts.actionClassName&&g.push(...this._opts.actionClassName.split(" ")),this._checked&&g.push("checked"),this.domNode=document.createElement("div"),this.domNode.title=this._opts.title,this.domNode.classList.add(...g),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,t=>{this.checked=!this._checked,this._onChange.fire(!1),t.preventDefault()}),this.ignoreGesture(this.domNode),this.onkeydown(this.domNode,t=>{if(t.keyCode===10||t.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),t.preventDefault();return}this._onKeyDown.fire(t)})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(n){this._checked=n,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}width(){return 2+2+2+16}style(n){n.inputActiveOptionBorder&&(this._opts.inputActiveOptionBorder=n.inputActiveOptionBorder),n.inputActiveOptionForeground&&(this._opts.inputActiveOptionForeground=n.inputActiveOptionForeground),n.inputActiveOptionBackground&&(this._opts.inputActiveOptionBackground=n.inputActiveOptionBackground),this.applyStyles()}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder?this._opts.inputActiveOptionBorder.toString():"transparent",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground?this._opts.inputActiveOptionForeground.toString():"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground?this._opts.inputActiveOptionBackground.toString():"transparent")}enable(){this.domNode.setAttribute("aria-disabled",String(!1))}disable(){this.domNode.setAttribute("aria-disabled",String(!0))}}e.Checkbox=p}),define(J[318],ee([12]),{}),define(J[319],ee([12]),{}),define(J[136],ee([0,1,27,318,319]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formatRule=void 0;function N(T){let D=T.definition;for(;D instanceof w.Codicon;)D=D.definition;return`.codicon-${T.id}:before { content: '${D.fontCharacter}'; }`}e.formatRule=N}),define(J[320],ee([12]),{}),define(J[215],ee([0,1,161,7,2,17,132,320]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContextView=e.layout=e.LayoutAnchorMode=void 0;var p;(function(t){t[t.AVOID=0]="AVOID",t[t.ALIGN=1]="ALIGN"})(p=e.LayoutAnchorMode||(e.LayoutAnchorMode={}));function C(t,s,c){const u=c.mode===p.ALIGN?c.offset:c.offset+c.size,d=c.mode===p.ALIGN?c.offset+c.size:c.offset;return c.position===0?s<=t-u?u:s<=d?d-s:Math.max(t-s,0):s<=d?d-s:s<=t-u?u:0}e.layout=C;class n extends T.Disposable{constructor(s,c){super();this.container=null,this.delegate=null,this.toDisposeOnClean=T.Disposable.None,this.toDisposeOnSetContainer=T.Disposable.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=N.$(".context-view"),this.useFixedPosition=!1,this.useShadowDOM=!1,N.hide(this.view),this.setContainer(s,c),this._register((0,T.toDisposable)(()=>this.setContainer(null,1)))}setContainer(s,c){var u;if(this.container&&(this.toDisposeOnSetContainer.dispose(),this.shadowRoot?(this.shadowRoot.removeChild(this.view),this.shadowRoot=null,(u=this.shadowRootHostElement)===null||u===void 0||u.remove(),this.shadowRootHostElement=null):this.container.removeChild(this.view),this.container=null),s){if(this.container=s,this.useFixedPosition=c!==1,this.useShadowDOM=c===3,this.useShadowDOM){this.shadowRootHostElement=N.$(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const a=document.createElement("style");a.textContent=g,this.shadowRoot.appendChild(a),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(N.$("slot"))}else this.container.appendChild(this.view);const d=new T.DisposableStore;n.BUBBLE_UP_EVENTS.forEach(a=>{d.add(N.addStandardDisposableListener(this.container,a,r=>{this.onDOMEvent(r,!1)}))}),n.BUBBLE_DOWN_EVENTS.forEach(a=>{d.add(N.addStandardDisposableListener(this.container,a,r=>{this.onDOMEvent(r,!0)},!0))}),this.toDisposeOnSetContainer=d}}show(s){this.isVisible()&&this.hide(),N.clearNode(this.view),this.view.className="context-view",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex="2500",this.view.style.position=this.useFixedPosition?"fixed":"absolute",N.show(this.view),this.toDisposeOnClean=s.render(this.view)||T.Disposable.None,this.delegate=s,this.doLayout(),this.delegate.focus&&this.delegate.focus()}getViewElement(){return this.view}layout(){if(!!this.isVisible()){if(this.delegate.canRelayout===!1&&!(D.isIOS&&w.BrowserFeatures.pointerEvents)){this.hide();return}this.delegate.layout&&this.delegate.layout(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let s=this.delegate.getAnchor(),c;if(N.isHTMLElement(s)){let f=N.getDomNodePagePosition(s);c={top:f.top,left:f.left,width:f.width,height:f.height}}else c={top:s.y,left:s.x,width:s.width||1,height:s.height||2};const u=N.getTotalWidth(this.view),d=N.getTotalHeight(this.view),a=this.delegate.anchorPosition||0,r=this.delegate.anchorAlignment||0,o=this.delegate.anchorAxisAlignment||0;let i,l;if(o===0){const f={offset:c.top-window.pageYOffset,size:c.height,position:a===0?0:1},y={offset:c.left,size:c.width,position:r===0?0:1,mode:p.ALIGN};i=C(window.innerHeight,d,f)+window.pageYOffset,S.Range.intersects({start:i,end:i+d},{start:f.offset,end:f.offset+f.size})&&(y.mode=p.AVOID),l=C(window.innerWidth,u,y)}else{const f={offset:c.left,size:c.width,position:r===0?0:1},y={offset:c.top,size:c.height,position:a===0?0:1,mode:p.ALIGN};l=C(window.innerWidth,u,f),S.Range.intersects({start:l,end:l+u},{start:f.offset,end:f.offset+f.size})&&(y.mode=p.AVOID),i=C(window.innerHeight,d,y)+window.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(a===0?"bottom":"top"),this.view.classList.add(r===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const h=N.getDomNodePagePosition(this.container);this.view.style.top=`${i-(this.useFixedPosition?N.getDomNodePagePosition(this.view).top:h.top)}px`,this.view.style.left=`${l-(this.useFixedPosition?N.getDomNodePagePosition(this.view).left:h.left)}px`,this.view.style.width="initial"}hide(s){const c=this.delegate;this.delegate=null,(c==null?void 0:c.onHide)&&c.onHide(s),this.toDisposeOnClean.dispose(),N.hide(this.view)}isVisible(){return!!this.delegate}onDOMEvent(s,c){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(s,document.activeElement):c&&!N.isAncestor(s.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}}e.ContextView=n,n.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"],n.BUBBLE_DOWN_EVENTS=["click"];let g=` + :host { + all: initial; /* 1st rule so subsequent properties are reset. */ + } + + @font-face { + font-family: "codicon"; + font-display: block; + src: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype"); + } + + .codicon[class*='codicon-'] { + font: normal normal normal 16px/1 codicon; + display: inline-block; + text-decoration: none; + text-rendering: auto; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + } + + :host { + font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif; + } + + :host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; } + :host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; } + :host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; } + :host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; } + :host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; } + + :host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; } + :host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; } + :host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; } + :host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; } + :host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; } + + :host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; } + :host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; } + :host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; } +`}),define(J[321],ee([12]),{}),define(J[216],ee([0,1,7,29,38,8,321]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CountBadge=void 0;const S={badgeBackground:N.Color.fromHex("#4D4D4D"),badgeForeground:N.Color.fromHex("#FFFFFF")};class p{constructor(n,g){this.count=0,this.options=g||Object.create(null),(0,T.mixin)(this.options,S,!1),this.badgeBackground=this.options.badgeBackground,this.badgeForeground=this.options.badgeForeground,this.badgeBorder=this.options.badgeBorder,this.element=(0,w.append)(n,(0,w.$)(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(n){this.count=n,this.render()}setTitleFormat(n){this.titleFormat=n,this.render()}render(){this.element.textContent=(0,D.format)(this.countFormat,this.count),this.element.title=(0,D.format)(this.titleFormat,this.count),this.applyStyles()}style(n){this.badgeBackground=n.badgeBackground,this.badgeForeground=n.badgeForeground,this.badgeBorder=n.badgeBorder,this.applyStyles()}applyStyles(){if(this.element){const n=this.badgeBackground?this.badgeBackground.toString():"",g=this.badgeForeground?this.badgeForeground.toString():"",t=this.badgeBorder?this.badgeBorder.toString():"";this.element.style.backgroundColor=n,this.element.style.color=g,this.element.style.borderWidth=t?"1px":"",this.element.style.borderStyle=t?"solid":"",this.element.style.borderColor=t}}}e.CountBadge=p}),define(J[217],ee([12]),{}),define(J[218],ee([12]),{}),define(J[322],ee([12]),{}),define(J[323],ee([12]),{}),define(J[324],ee([12]),{}),define(J[325],ee([12]),{}),define(J[219],ee([12]),{}),define(J[326],ee([12]),{}),define(J[137],ee([0,1,326]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MOUSE_CURSOR_TEXT_CSS_CLASS_NAME=void 0,e.MOUSE_CURSOR_TEXT_CSS_CLASS_NAME="monaco-mouse-cursor-text"}),define(J[327],ee([12]),{}),define(J[328],ee([0,1,7,14,29,2,38,327]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressBar=void 0;const p="done",C="active",n="infinite",g="discrete",t={progressBarBackground:T.Color.fromHex("#0E70C0")};class s extends D.Disposable{constructor(u,d){super();this.options=d||Object.create(null),(0,S.mixin)(this.options,t,!1),this.workedVal=0,this.progressBarBackground=this.options.progressBarBackground,this._register(this.showDelayedScheduler=new N.RunOnceScheduler(()=>(0,w.show)(this.element),0)),this.create(u)}create(u){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),u.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.element.appendChild(this.bit),this.applyStyles()}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(C,n,g),this.workedVal=0,this.totalWork=void 0}stop(){return this.doDone(!1)}doDone(u){return this.element.classList.add(p),this.element.classList.contains(n)?(this.bit.style.opacity="0",u?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",u?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(g,p),this.element.classList.add(C,n),this}getContainer(){return this.element}style(u){this.progressBarBackground=u.progressBarBackground,this.applyStyles()}applyStyles(){if(this.bit){const u=this.progressBarBackground?this.progressBarBackground.toString():"";this.bit.style.backgroundColor=u}}}e.ProgressBar=s}),define(J[329],ee([12]),{}),define(J[110],ee([0,1,7,94,58,14,92,4,2,17,329]),function(j,e,w,N,T,D,S,p,C,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Sash=e.OrthogonalEdge=void 0;let g=!1;var t;(function(l){l.North="north",l.South="south",l.East="east",l.West="west"})(t=e.OrthogonalEdge||(e.OrthogonalEdge={}));let s=4;const c=new p.Emitter;let u=300;const d=new p.Emitter;class a{constructor(){this.disposables=new C.DisposableStore}get onPointerMove(){return this.disposables.add(new N.DomEmitter(window,"mousemove")).event}get onPointerUp(){return this.disposables.add(new N.DomEmitter(window,"mouseup")).event}dispose(){this.disposables.dispose()}}Fe([S.memoize],a.prototype,"onPointerMove",null),Fe([S.memoize],a.prototype,"onPointerUp",null);class r{constructor(h){this.el=h,this.disposables=new C.DisposableStore}get onPointerMove(){return this.disposables.add(new N.DomEmitter(this.el,T.EventType.Change)).event}get onPointerUp(){return this.disposables.add(new N.DomEmitter(this.el,T.EventType.End)).event}dispose(){this.disposables.dispose()}}Fe([S.memoize],r.prototype,"onPointerMove",null),Fe([S.memoize],r.prototype,"onPointerUp",null);class o{constructor(h){this.factory=h}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}}Fe([S.memoize],o.prototype,"onPointerMove",null),Fe([S.memoize],o.prototype,"onPointerUp",null);class i extends C.Disposable{constructor(h,f,y){super();this.hoverDelay=u,this.hoverDelayer=this._register(new D.Delayer(this.hoverDelay)),this._state=3,this._onDidEnablementChange=this._register(new p.Emitter),this.onDidEnablementChange=this._onDidEnablementChange.event,this._onDidStart=this._register(new p.Emitter),this.onDidStart=this._onDidStart.event,this._onDidChange=this._register(new p.Emitter),this.onDidChange=this._onDidChange.event,this._onDidReset=this._register(new p.Emitter),this.onDidReset=this._onDidReset.event,this._onDidEnd=this._register(new p.Emitter),this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.orthogonalStartSashDisposables=this._register(new C.DisposableStore),this.orthogonalStartDragHandleDisposables=this._register(new C.DisposableStore),this.orthogonalEndSashDisposables=this._register(new C.DisposableStore),this.orthogonalEndDragHandleDisposables=this._register(new C.DisposableStore),this.el=(0,w.append)(h,(0,w.$)(".monaco-sash")),y.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${y.orthogonalEdge}`),n.isMacintosh&&this.el.classList.add("mac");const _=this._register(new N.DomEmitter(this.el,"mousedown")).event;this._register(_(M=>this.onPointerStart(M,new a),this));const b=this._register(new N.DomEmitter(this.el,"dblclick")).event;this._register(b(this.onPointerDoublePress,this));const v=this._register(new N.DomEmitter(this.el,"mouseenter")).event;this._register(v(()=>i.onMouseEnter(this)));const m=this._register(new N.DomEmitter(this.el,"mouseleave")).event;this._register(m(()=>i.onMouseLeave(this))),this._register(T.Gesture.addTarget(this.el));const E=p.Event.map(this._register(new N.DomEmitter(this.el,T.EventType.Start)).event,M=>{var P;return Object.assign(Object.assign({},M),{target:(P=M.initialTarget)!==null&&P!==void 0?P:null})});this._register(E(M=>this.onPointerStart(M,new r(this.el)),this));const I=this._register(new N.DomEmitter(this.el,T.EventType.Tap)).event,k=p.Event.map(p.Event.filter(p.Event.debounce(I,(M,P)=>{var F;return{event:P,count:((F=M==null?void 0:M.count)!==null&&F!==void 0?F:0)+1}},250),({count:M})=>M===2),({event:M})=>{var P;return Object.assign(Object.assign({},M),{target:(P=M.initialTarget)!==null&&P!==void 0?P:null})});this._register(k(this.onPointerDoublePress,this)),typeof y.size=="number"?(this.size=y.size,y.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=s,this._register(c.event(M=>{this.size=M,this.layout()}))),this._register(d.event(M=>this.hoverDelay=M)),this.hidden=!1,this.layoutProvider=f,this.orthogonalStartSash=y.orthogonalStartSash,this.orthogonalEndSash=y.orthogonalEndSash,this.orientation=y.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",g),this.layout()}get state(){return this._state}set state(h){this._state!==h&&(this.el.classList.toggle("disabled",h===0),this.el.classList.toggle("minimum",h===1),this.el.classList.toggle("maximum",h===2),this._state=h,this._onDidEnablementChange.fire(h))}get orthogonalStartSash(){return this._orthogonalStartSash}set orthogonalStartSash(h){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),h){const f=y=>{this.orthogonalStartDragHandleDisposables.clear(),y!==0&&(this._orthogonalStartDragHandle=(0,w.append)(this.el,(0,w.$)(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add((0,C.toDisposable)(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(new N.DomEmitter(this._orthogonalStartDragHandle,"mouseenter")).event(()=>i.onMouseEnter(h),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new N.DomEmitter(this._orthogonalStartDragHandle,"mouseleave")).event(()=>i.onMouseLeave(h),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(h.onDidEnablementChange(f,this)),f(h.state)}this._orthogonalStartSash=h}get orthogonalEndSash(){return this._orthogonalEndSash}set orthogonalEndSash(h){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),h){const f=y=>{this.orthogonalEndDragHandleDisposables.clear(),y!==0&&(this._orthogonalEndDragHandle=(0,w.append)(this.el,(0,w.$)(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add((0,C.toDisposable)(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(new N.DomEmitter(this._orthogonalEndDragHandle,"mouseenter")).event(()=>i.onMouseEnter(h),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new N.DomEmitter(this._orthogonalEndDragHandle,"mouseleave")).event(()=>i.onMouseLeave(h),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(h.onDidEnablementChange(f,this)),f(h.state)}this._orthogonalEndSash=h}onPointerStart(h,f){w.EventHelper.stop(h);let y=!1;if(!h.__orthogonalSashEvent){const R=this.getOrthogonalSash(h);R&&(y=!0,h.__orthogonalSashEvent=!0,R.onPointerStart(h,new o(f)))}if(this.linkedSash&&!h.__linkedSashEvent&&(h.__linkedSashEvent=!0,this.linkedSash.onPointerStart(h,new o(f))),!this.state)return;const _=(0,w.getElementsByTagName)("iframe");for(const R of _)R.style.pointerEvents="none";const b=h.pageX,v=h.pageY,m=h.altKey,E={startX:b,currentX:b,startY:v,currentY:v,altKey:m};this.el.classList.add("active"),this._onDidStart.fire(E);const I=(0,w.createStyleSheet)(this.el),k=()=>{let R="";y?R="all-scroll":this.orientation===1?this.state===1?R="s-resize":this.state===2?R="n-resize":R=n.isMacintosh?"row-resize":"ns-resize":this.state===1?R="e-resize":this.state===2?R="w-resize":R=n.isMacintosh?"col-resize":"ew-resize",I.textContent=`* { cursor: ${R} !important; }`},M=new C.DisposableStore;k(),y||this.onDidEnablementChange(k,null,M);const P=R=>{w.EventHelper.stop(R,!1);const A={startX:b,currentX:R.pageX,startY:v,currentY:R.pageY,altKey:m};this._onDidChange.fire(A)},F=R=>{w.EventHelper.stop(R,!1),this.el.removeChild(I),this.el.classList.remove("active"),this._onDidEnd.fire(),M.dispose();for(const A of _)A.style.pointerEvents="auto"};f.onPointerMove(P,null,M),f.onPointerUp(F,null,M),M.add(f)}onPointerDoublePress(h){const f=this.getOrthogonalSash(h);f&&f._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(h,f=!1){h.el.classList.contains("active")?(h.hoverDelayer.cancel(),h.el.classList.add("hover")):h.hoverDelayer.trigger(()=>h.el.classList.add("hover"),h.hoverDelay).then(void 0,()=>{}),!f&&h.linkedSash&&i.onMouseEnter(h.linkedSash,!0)}static onMouseLeave(h,f=!1){h.hoverDelayer.cancel(),h.el.classList.remove("hover"),!f&&h.linkedSash&&i.onMouseLeave(h.linkedSash,!0)}clearSashHoverState(){i.onMouseLeave(this)}layout(){if(this.orientation===0){const h=this.layoutProvider;this.el.style.left=h.getVerticalSashLeft(this)-this.size/2+"px",h.getVerticalSashTop&&(this.el.style.top=h.getVerticalSashTop(this)+"px"),h.getVerticalSashHeight&&(this.el.style.height=h.getVerticalSashHeight(this)+"px")}else{const h=this.layoutProvider;this.el.style.top=h.getHorizontalSashTop(this)-this.size/2+"px",h.getHorizontalSashLeft&&(this.el.style.left=h.getHorizontalSashLeft(this)+"px"),h.getHorizontalSashWidth&&(this.el.style.width=h.getHorizontalSashWidth(this)+"px")}}hide(){this.hidden=!0,this.el.style.display="none",this.el.setAttribute("aria-hidden","true")}getOrthogonalSash(h){if(!(!h.target||!(h.target instanceof HTMLElement))&&h.target.classList.contains("orthogonal-drag-handle"))return h.target.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}}e.Sash=i}),define(J[330],ee([12]),{}),define(J[64],ee([0,1,34,7,30,56,308,309,53,14,4,2,17,133,330]),function(j,e,w,N,T,D,S,p,C,n,g,t,s,c){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DomScrollableElement=e.SmoothScrollableElement=e.ScrollableElement=e.AbstractScrollableElement=e.MouseWheelClassifier=void 0;const u=500,d=50,a=!0;class r{constructor(b,v,m){this.timestamp=b,this.deltaX=v,this.deltaY=m,this.score=0}}class o{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let b=1,v=0,m=1,E=this._rear;do{const I=E===this._front?b:Math.pow(2,-m);if(b-=I,v+=this._memory[E].score*I,E===this._front)break;E=(this._capacity+E-1)%this._capacity,m++}while(!0);return v<=.5}accept(b,v,m){const E=new r(b,v,m);E.score=this._computeScore(E),this._front===-1&&this._rear===-1?(this._memory[0]=E,this._front=0,this._rear=0):(this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=E)}_computeScore(b){if(Math.abs(b.deltaX)>0&&Math.abs(b.deltaY)>0)return 1;let v=.5;const m=this._front===-1&&this._rear===-1?null:this._memory[this._rear];return(!this._isAlmostInt(b.deltaX)||!this._isAlmostInt(b.deltaY))&&(v+=.25),Math.min(Math.max(v,0),1)}_isAlmostInt(b){return Math.abs(Math.round(b)-b)<.01}}e.MouseWheelClassifier=o,o.INSTANCE=new o;class i extends C.Widget{constructor(b,v,m){super();this._onScroll=this._register(new g.Emitter),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new g.Emitter),b.style.overflow="hidden",this._options=y(v),this._scrollable=m,this._register(this._scrollable.onScroll(I=>{this._onWillScroll.fire(I),this._onDidScroll(I),this._onScroll.fire(I)}));const E={onMouseWheel:I=>this._onMouseWheel(I),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new p.VerticalScrollbar(this._scrollable,this._options,E)),this._horizontalScrollbar=this._register(new S.HorizontalScrollbar(this._scrollable,this._options,E)),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(b),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=(0,T.createFastDomNode)(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=(0,T.createFastDomNode)(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=(0,T.createFastDomNode)(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,I=>this._onMouseOver(I)),this.onnonbubblingmouseout(this._listenOnDomNode,I=>this._onMouseOut(I)),this._hideTimeout=this._register(new n.TimeoutTimer),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=(0,t.dispose)(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarMouseDown(b){this._verticalScrollbar.delegateMouseDown(b)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(b){this._scrollable.setScrollDimensions(b,!1)}updateClassName(b){this._options.className=b,s.isMacintosh&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(b){typeof b.handleMouseWheel!="undefined"&&(this._options.handleMouseWheel=b.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof b.mouseWheelScrollSensitivity!="undefined"&&(this._options.mouseWheelScrollSensitivity=b.mouseWheelScrollSensitivity),typeof b.fastScrollSensitivity!="undefined"&&(this._options.fastScrollSensitivity=b.fastScrollSensitivity),typeof b.scrollPredominantAxis!="undefined"&&(this._options.scrollPredominantAxis=b.scrollPredominantAxis),typeof b.horizontal!="undefined"&&(this._options.horizontal=b.horizontal),typeof b.vertical!="undefined"&&(this._options.vertical=b.vertical),typeof b.horizontalScrollbarSize!="undefined"&&(this._options.horizontalScrollbarSize=b.horizontalScrollbarSize),typeof b.verticalScrollbarSize!="undefined"&&(this._options.verticalScrollbarSize=b.verticalScrollbarSize),typeof b.scrollByPage!="undefined"&&(this._options.scrollByPage=b.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}_setListeningToMouseWheel(b){if(this._mouseWheelToDispose.length>0!==b&&(this._mouseWheelToDispose=(0,t.dispose)(this._mouseWheelToDispose),b)){const m=E=>{this._onMouseWheel(new D.StandardWheelEvent(E))};this._mouseWheelToDispose.push(N.addDisposableListener(this._listenOnDomNode,N.EventType.MOUSE_WHEEL,m,{passive:!1}))}}_onMouseWheel(b){const v=o.INSTANCE;if(a){const I=window.devicePixelRatio/(0,w.getZoomFactor)();s.isWindows||s.isLinux?v.accept(Date.now(),b.deltaX/I,b.deltaY/I):v.accept(Date.now(),b.deltaX,b.deltaY)}let m=!1;if(b.deltaY||b.deltaX){let I=b.deltaY*this._options.mouseWheelScrollSensitivity,k=b.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(Math.abs(I)>=Math.abs(k)?k=0:I=0),this._options.flipAxes&&([I,k]=[k,I]);const M=!s.isMacintosh&&b.browserEvent&&b.browserEvent.shiftKey;(this._options.scrollYToX||M)&&!k&&(k=I,I=0),b.browserEvent&&b.browserEvent.altKey&&(k=k*this._options.fastScrollSensitivity,I=I*this._options.fastScrollSensitivity);const P=this._scrollable.getFutureScrollPosition();let F={};if(I){const R=d*I,A=P.scrollTop-(R<0?Math.floor(R):Math.ceil(R));this._verticalScrollbar.writeScrollPosition(F,A)}if(k){const R=d*k,A=P.scrollLeft-(R<0?Math.floor(R):Math.ceil(R));this._horizontalScrollbar.writeScrollPosition(F,A)}F=this._scrollable.validateScrollPosition(F),(P.scrollLeft!==F.scrollLeft||P.scrollTop!==F.scrollTop)&&(a&&this._options.mouseWheelSmoothScroll&&v.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(F):this._scrollable.setScrollPositionNow(F),m=!0)}let E=m;!E&&this._options.alwaysConsumeMouseWheel&&(E=!0),!E&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(E=!0),E&&(b.preventDefault(),b.stopPropagation())}_onDidScroll(b){this._shouldRender=this._horizontalScrollbar.onDidScroll(b)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(b)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(!!this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const b=this._scrollable.getCurrentScrollPosition(),v=b.scrollTop>0,m=b.scrollLeft>0,E=m?" left":"",I=v?" top":"",k=m||v?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${E}`),this._topShadowDomNode.setClassName(`shadow${I}`),this._topLeftShadowDomNode.setClassName(`shadow${k}${I}${E}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseOut(b){this._mouseIsOver=!1,this._hide()}_onMouseOver(b){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),u)}}e.AbstractScrollableElement=i;class l extends i{constructor(b,v){v=v||{},v.mouseWheelSmoothScroll=!1;const m=new c.Scrollable(0,E=>N.scheduleAtNextAnimationFrame(E));super(b,v,m);this._register(m)}setScrollPosition(b){this._scrollable.setScrollPositionNow(b)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}e.ScrollableElement=l;class h extends i{constructor(b,v,m){super(b,v,m)}setScrollPosition(b){b.reuseAnimation?this._scrollable.setScrollPositionSmooth(b,b.reuseAnimation):this._scrollable.setScrollPositionNow(b)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}e.SmoothScrollableElement=h;class f extends l{constructor(b,v){super(b,v);this._element=b,this.onScroll(m=>{m.scrollTopChanged&&(this._element.scrollTop=m.scrollTop),m.scrollLeftChanged&&(this._element.scrollLeft=m.scrollLeft)}),this.scanDomNode()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}e.DomScrollableElement=f;function y(_){const b={lazyRender:typeof _.lazyRender!="undefined"?_.lazyRender:!1,className:typeof _.className!="undefined"?_.className:"",useShadows:typeof _.useShadows!="undefined"?_.useShadows:!0,handleMouseWheel:typeof _.handleMouseWheel!="undefined"?_.handleMouseWheel:!0,flipAxes:typeof _.flipAxes!="undefined"?_.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof _.consumeMouseWheelIfScrollbarIsNeeded!="undefined"?_.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof _.alwaysConsumeMouseWheel!="undefined"?_.alwaysConsumeMouseWheel:!1,scrollYToX:typeof _.scrollYToX!="undefined"?_.scrollYToX:!1,mouseWheelScrollSensitivity:typeof _.mouseWheelScrollSensitivity!="undefined"?_.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof _.fastScrollSensitivity!="undefined"?_.fastScrollSensitivity:5,scrollPredominantAxis:typeof _.scrollPredominantAxis!="undefined"?_.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof _.mouseWheelSmoothScroll!="undefined"?_.mouseWheelSmoothScroll:!0,arrowSize:typeof _.arrowSize!="undefined"?_.arrowSize:11,listenOnDomNode:typeof _.listenOnDomNode!="undefined"?_.listenOnDomNode:null,horizontal:typeof _.horizontal!="undefined"?_.horizontal:1,horizontalScrollbarSize:typeof _.horizontalScrollbarSize!="undefined"?_.horizontalScrollbarSize:10,horizontalSliderSize:typeof _.horizontalSliderSize!="undefined"?_.horizontalSliderSize:0,horizontalHasArrows:typeof _.horizontalHasArrows!="undefined"?_.horizontalHasArrows:!1,vertical:typeof _.vertical!="undefined"?_.vertical:1,verticalScrollbarSize:typeof _.verticalScrollbarSize!="undefined"?_.verticalScrollbarSize:10,verticalHasArrows:typeof _.verticalHasArrows!="undefined"?_.verticalHasArrows:!1,verticalSliderSize:typeof _.verticalSliderSize!="undefined"?_.verticalSliderSize:0,scrollByPage:typeof _.scrollByPage!="undefined"?_.scrollByPage:!1};return b.horizontalSliderSize=typeof _.horizontalSliderSize!="undefined"?_.horizontalSliderSize:b.horizontalScrollbarSize,b.verticalSliderSize=typeof _.verticalSliderSize!="undefined"?_.verticalSliderSize:b.verticalScrollbarSize,s.isMacintosh&&(b.className+=" mac"),b}}),define(J[220],ee([0,1,7,64,2,322]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HoverAction=e.HoverWidget=void 0;const D=w.$;class S extends T.Disposable{constructor(){super();this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this._scrollbar=this._register(new N.DomScrollableElement(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this._scrollbar.getDomNode())}onContentsChanged(){this._scrollbar.scanDomNode()}}e.HoverWidget=S;class p extends T.Disposable{constructor(n,g,t){super();this.actionContainer=w.append(n,D("div.action-container")),this.action=w.append(this.actionContainer,D("a.action")),this.action.setAttribute("href","#"),this.action.setAttribute("role","button"),g.iconClass&&w.append(this.action,D(`span.icon.${g.iconClass}`));const s=w.append(this.action,D("span"));s.textContent=t?`${g.label} (${t})`:g.label,this._register(w.addDisposableListener(this.actionContainer,w.EventType.MOUSE_DOWN,c=>{c.stopPropagation(),c.preventDefault(),g.run(this.actionContainer)})),this.setEnabled(!0)}static render(n,g,t){return new p(n,g,t)}setEnabled(n){n?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}e.HoverAction=p}),define(J[171],ee([0,1,34,169,7,94,58,64,19,14,92,4,2,38,132,133,301,307]),function(j,e,w,N,T,D,S,p,C,n,g,t,s,c,u,d,a,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ListView=e.NativeDragAndDropData=e.ExternalElementsDragAndDropData=e.ElementsDragAndDropData=void 0;const o={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(b){return[b]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class i{constructor(v){this.elements=v}update(){}getData(){return this.elements}}e.ElementsDragAndDropData=i;class l{constructor(v){this.elements=v}update(){}getData(){return this.elements}}e.ExternalElementsDragAndDropData=l;class h{constructor(){this.types=[],this.files=[]}update(v){if(v.types&&this.types.splice(0,this.types.length,...v.types),v.files){this.files.splice(0,this.files.length);for(let m=0;m I,(v==null?void 0:v.getPosInSet)?this.getPosInSet=v.getPosInSet.bind(v):this.getPosInSet=(m,E)=>E+1,(v==null?void 0:v.getRole)?this.getRole=v.getRole.bind(v):this.getRole=m=>"listitem",(v==null?void 0:v.isChecked)?this.isChecked=v.isChecked.bind(v):this.isChecked=m=>{}}}class _{constructor(v,m,E,I=o){if(this.virtualDelegate=m,this.domId=`list_id_${++_.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new n.Delayer(50),this.splicing=!1,this.dragOverAnimationStopDisposable=s.Disposable.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=s.Disposable.None,this.onDragLeaveTimeout=s.Disposable.None,this.disposables=new s.DisposableStore,this._onDidChangeContentHeight=new t.Emitter,this._horizontalScrolling=!1,I.horizontalScrolling&&I.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=new a.RangeMap;for(const M of E)this.renderers.set(M.templateId,M);this.cache=this.disposables.add(new r.RowCache(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof I.mouseSupport=="boolean"?I.mouseSupport:!0),this._horizontalScrolling=(0,c.getOrDefault)(I,M=>M.horizontalScrolling,o.horizontalScrolling),this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.additionalScrollHeight=typeof I.additionalScrollHeight=="undefined"?0:I.additionalScrollHeight,this.accessibilityProvider=new y(I.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(0,c.getOrDefault)(I,M=>M.transformOptimization,o.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)"),this.disposables.add(S.Gesture.addTarget(this.rowsContainer)),this.scrollable=new d.Scrollable((0,c.getOrDefault)(I,M=>M.smoothScrolling,!1)?125:0,M=>(0,T.scheduleAtNextAnimationFrame)(M)),this.scrollableElement=this.disposables.add(new p.SmoothScrollableElement(this.rowsContainer,{alwaysConsumeMouseWheel:(0,c.getOrDefault)(I,M=>M.alwaysConsumeMouseWheel,o.alwaysConsumeMouseWheel),horizontal:1,vertical:(0,c.getOrDefault)(I,M=>M.verticalScrollMode,o.verticalScrollMode),useShadows:(0,c.getOrDefault)(I,M=>M.useShadows,o.useShadows),mouseWheelScrollSensitivity:I.mouseWheelScrollSensitivity,fastScrollSensitivity:I.fastScrollSensitivity},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),v.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add((0,T.addDisposableListener)(this.rowsContainer,S.EventType.Change,M=>this.onTouchChange(M))),this.disposables.add((0,T.addDisposableListener)(this.scrollableElement.getDomNode(),"scroll",M=>M.target.scrollTop=0)),this.disposables.add((0,T.addDisposableListener)(this.domNode,"dragover",M=>this.onDragOver(this.toDragEvent(M)))),this.disposables.add((0,T.addDisposableListener)(this.domNode,"drop",M=>this.onDrop(this.toDragEvent(M)))),this.disposables.add((0,T.addDisposableListener)(this.domNode,"dragleave",M=>this.onDragLeave(this.toDragEvent(M)))),this.disposables.add((0,T.addDisposableListener)(this.domNode,"dragend",M=>this.onDragEnd(M))),this.setRowLineHeight=(0,c.getOrDefault)(I,M=>M.setRowLineHeight,o.setRowLineHeight),this.setRowHeight=(0,c.getOrDefault)(I,M=>M.setRowHeight,o.setRowHeight),this.supportDynamicHeights=(0,c.getOrDefault)(I,M=>M.supportDynamicHeights,o.supportDynamicHeights),this.dnd=(0,c.getOrDefault)(I,M=>M.dnd,o.dnd),this.layout()}get contentHeight(){return this.rangeMap.size}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(v){if(v!==this._horizontalScrolling){if(v&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=v,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const m of this.items)this.measureItemWidth(m);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:(0,T.getContentWidth)(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}updateOptions(v){v.additionalScrollHeight!==void 0&&(this.additionalScrollHeight=v.additionalScrollHeight,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),v.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(v.smoothScrolling?125:0),v.horizontalScrolling!==void 0&&(this.horizontalScrolling=v.horizontalScrolling),v.mouseWheelScrollSensitivity!==void 0&&this.scrollableElement.updateOptions({mouseWheelScrollSensitivity:v.mouseWheelScrollSensitivity}),v.fastScrollSensitivity!==void 0&&this.scrollableElement.updateOptions({fastScrollSensitivity:v.fastScrollSensitivity})}splice(v,m,E=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(v,m,E)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(v,m,E=[]){const I=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),k={start:v,end:v+m},M=u.Range.intersect(I,k),P=new Map;for(let G=M.start;G ({id:String(this.itemId++),element:G,templateId:this.virtualDelegate.getTemplateId(G),size:this.virtualDelegate.getHeight(G),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(G),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:s.Disposable.None}));let L;v===0&&m>=this.items.length?(this.rangeMap=new a.RangeMap,this.rangeMap.splice(0,0,O),L=this.items,this.items=O):(this.rangeMap.splice(v,m,O),L=this.items.splice(v,m,...O));const B=E.length-m,W=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),K=(0,a.shift)(R,B),H=u.Range.intersect(W,K);for(let G=H.start;G (0,a.shift)(G,B)),se=[{start:v,end:v+E.length},...X].map(G=>u.Range.intersect(W,G)),oe=this.getNextToLastElement(se);for(const G of se)for(let x=G.start;x G.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=(0,T.scheduleAtNextAnimationFrame)(()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let v=0;for(const m of this.items)typeof m.width!="undefined"&&(v=Math.max(v,m.width));this.scrollWidth=v,this.scrollableElement.setScrollDimensions({scrollWidth:v===0?0:v+10})}rerender(){if(!!this.supportDynamicHeights){for(const v of this.items)v.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}element(v){return this.items[v].element}domElement(v){const m=this.items[v].row;return m&&m.domNode}elementHeight(v){return this.items[v].size}elementTop(v){return this.rangeMap.positionAt(v)}indexAt(v){return this.rangeMap.indexAt(v)}indexAfter(v){return this.rangeMap.indexAfter(v)}layout(v,m){let E={height:typeof v=="number"?v:(0,T.getContentHeight)(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,E.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(E),typeof m!="undefined"&&(this.renderWidth=m,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof m=="number"?m:(0,T.getContentWidth)(this.domNode)})}render(v,m,E,I,k,M=!1){const P=this.getRenderRange(m,E),F=u.Range.relativeComplement(P,v),R=u.Range.relativeComplement(v,P),A=this.getNextToLastElement(F);if(M){const O=u.Range.intersect(v,P);for(let L=O.start;L this.onDragStart(I.element,F,R))),this.horizontalScrolling&&(this.measureItemWidth(I),this.eventuallyUpdateScrollWidth())}measureItemWidth(v){if(!v.row||!v.row.domNode)return;v.row.domNode.style.width=w.isFirefox?"-moz-fit-content":"fit-content",v.width=(0,T.getContentWidth)(v.row.domNode);const m=window.getComputedStyle(v.row.domNode);m.paddingLeft&&(v.width+=parseFloat(m.paddingLeft)),m.paddingRight&&(v.width+=parseFloat(m.paddingRight)),v.row.domNode.style.width=""}updateItemInDOM(v,m){v.row.domNode.style.top=`${this.elementTop(m)}px`,this.setRowHeight&&(v.row.domNode.style.height=`${v.size}px`),this.setRowLineHeight&&(v.row.domNode.style.lineHeight=`${v.size}px`),v.row.domNode.setAttribute("data-index",`${m}`),v.row.domNode.setAttribute("data-last-element",m===this.length-1?"true":"false"),v.row.domNode.setAttribute("data-parity",m%2==0?"even":"odd"),v.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(v.element,m,this.length))),v.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(v.element,m))),v.row.domNode.setAttribute("id",this.getElementDomId(m)),v.row.domNode.classList.toggle("drop-target",v.dropTarget)}removeItemFromDOM(v){const m=this.items[v];if(m.dragStartDisposable.dispose(),m.row){const E=this.renderers.get(m.templateId);E&&E.disposeElement&&E.disposeElement(m.element,v,m.row.templateData,m.size),this.cache.release(m.row),m.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(v,m){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:v,reuseAnimation:m})}get scrollTop(){return this.getScrollTop()}set scrollTop(v){this.setScrollTop(v)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.additionalScrollHeight}get onMouseClick(){return t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"click")).event,v=>this.toMouseEvent(v))}get onMouseDblClick(){return t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"dblclick")).event,v=>this.toMouseEvent(v))}get onMouseMiddleClick(){return t.Event.filter(t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"auxclick")).event,v=>this.toMouseEvent(v)),v=>v.browserEvent.button===1)}get onMouseDown(){return t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"mousedown")).event,v=>this.toMouseEvent(v))}get onContextMenu(){return t.Event.any(t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"contextmenu")).event,v=>this.toMouseEvent(v)),t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,S.EventType.Contextmenu)).event,v=>this.toGestureEvent(v)))}get onTouchStart(){return t.Event.map(this.disposables.add(new D.DomEmitter(this.domNode,"touchstart")).event,v=>this.toTouchEvent(v))}get onTap(){return t.Event.map(this.disposables.add(new D.DomEmitter(this.rowsContainer,S.EventType.Tap)).event,v=>this.toGestureEvent(v))}toMouseEvent(v){const m=this.getItemIndexFromEventTarget(v.target||null),E=typeof m=="undefined"?void 0:this.items[m],I=E&&E.element;return{browserEvent:v,index:m,element:I}}toTouchEvent(v){const m=this.getItemIndexFromEventTarget(v.target||null),E=typeof m=="undefined"?void 0:this.items[m],I=E&&E.element;return{browserEvent:v,index:m,element:I}}toGestureEvent(v){const m=this.getItemIndexFromEventTarget(v.initialTarget||null),E=typeof m=="undefined"?void 0:this.items[m],I=E&&E.element;return{browserEvent:v,index:m,element:I}}toDragEvent(v){const m=this.getItemIndexFromEventTarget(v.target||null),E=typeof m=="undefined"?void 0:this.items[m],I=E&&E.element;return{browserEvent:v,index:m,element:I}}onScroll(v){try{const m=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(m,v.scrollTop,v.height,v.scrollLeft,v.scrollWidth),this.supportDynamicHeights&&this._rerender(v.scrollTop,v.height,v.inSmoothScrolling)}catch(m){throw console.error("Got bad scroll event:",v),m}}onTouchChange(v){v.preventDefault(),v.stopPropagation(),this.scrollTop-=v.translationY}onDragStart(v,m,E){if(!E.dataTransfer)return;const I=this.dnd.getDragElements(v);if(E.dataTransfer.effectAllowed="copyMove",E.dataTransfer.setData(N.DataTransfers.TEXT,m),E.dataTransfer.setDragImage){let k;this.dnd.getDragLabel&&(k=this.dnd.getDragLabel(I,E)),typeof k=="undefined"&&(k=String(I.length));const M=(0,T.$)(".monaco-drag-image");M.textContent=k,document.body.appendChild(M),E.dataTransfer.setDragImage(M,-10,-10),setTimeout(()=>document.body.removeChild(M),0)}this.currentDragData=new i(I),N.StaticDND.CurrentDragAndDropData=new l(I),this.dnd.onDragStart&&this.dnd.onDragStart(this.currentDragData,E)}onDragOver(v){if(v.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),N.StaticDND.CurrentDragAndDropData&&N.StaticDND.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(v.browserEvent),!v.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(N.StaticDND.CurrentDragAndDropData)this.currentDragData=N.StaticDND.CurrentDragAndDropData;else{if(!v.browserEvent.dataTransfer.types)return!1;this.currentDragData=new h}const m=this.dnd.onDragOver(this.currentDragData,v.element,v.index,v.browserEvent);if(this.canDrop=typeof m=="boolean"?m:m.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;v.browserEvent.dataTransfer.dropEffect=typeof m!="boolean"&&m.effect===0?"copy":"move";let E;if(typeof m!="boolean"&&m.feedback?E=m.feedback:typeof v.index=="undefined"?E=[-1]:E=[v.index],E=(0,C.distinct)(E).filter(I=>I>=-1&&I I-k),E=E[0]===-1?[-1]:E,f(this.currentDragFeedback,E))return!0;if(this.currentDragFeedback=E,this.currentDragFeedbackDisposable.dispose(),E[0]===-1)this.domNode.classList.add("drop-target"),this.rowsContainer.classList.add("drop-target"),this.currentDragFeedbackDisposable=(0,s.toDisposable)(()=>{this.domNode.classList.remove("drop-target"),this.rowsContainer.classList.remove("drop-target")});else{for(const I of E){const k=this.items[I];k.dropTarget=!0,k.row&&k.row.domNode.classList.add("drop-target")}this.currentDragFeedbackDisposable=(0,s.toDisposable)(()=>{for(const I of E){const k=this.items[I];k.dropTarget=!1,k.row&&k.row.domNode.classList.remove("drop-target")}})}return!0}onDragLeave(v){var m,E;this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=(0,n.disposableTimeout)(()=>this.clearDragOverFeedback(),100),this.currentDragData&&((E=(m=this.dnd).onDragLeave)===null||E===void 0||E.call(m,this.currentDragData,v.element,v.index,v.browserEvent))}onDrop(v){if(!this.canDrop)return;const m=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,N.StaticDND.CurrentDragAndDropData=void 0,!(!m||!v.browserEvent.dataTransfer)&&(v.browserEvent.preventDefault(),m.update(v.browserEvent.dataTransfer),this.dnd.drop(m,v.element,v.index,v.browserEvent))}onDragEnd(v){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,N.StaticDND.CurrentDragAndDropData=void 0,this.dnd.onDragEnd&&this.dnd.onDragEnd(v)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=s.Disposable.None}setupDragAndDropScrollTopAnimation(v){if(!this.dragOverAnimationDisposable){const m=(0,T.getTopLeftOffset)(this.domNode).top;this.dragOverAnimationDisposable=(0,T.animate)(this.animateDragAndDropScrollTop.bind(this,m))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=(0,n.disposableTimeout)(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3),this.dragOverMouseY=v.pageY}animateDragAndDropScrollTop(v){if(this.dragOverMouseY===void 0)return;const m=this.dragOverMouseY-v,E=this.renderHeight-35;m<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(m-35))):m>E&&(this.scrollTop+=Math.min(14,Math.floor(.3*(m-E))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getItemIndexFromEventTarget(v){const m=this.scrollableElement.getDomNode();let E=v;for(;E instanceof HTMLElement&&E!==this.rowsContainer&&m.contains(E);){const I=E.getAttribute("data-index");if(I){const k=Number(I);if(!isNaN(k))return k}E=E.parentElement}}getRenderRange(v,m){return{start:this.rangeMap.indexAt(v),end:this.rangeMap.indexAfter(v+m-1)}}_rerender(v,m,E){const I=this.getRenderRange(v,m);let k,M;v===this.elementTop(I.start)?(k=I.start,M=0):I.end-I.start>1&&(k=I.start+1,M=this.elementTop(k)-v);let P=0;for(;;){const F=this.getRenderRange(v,m);let R=!1;for(let A=F.start;A Q.templateData===$);if(V>=0){const Q=this.renderedElements[V];this.trait.unrender($),Q.index=U}else{const Q={index:U,templateData:$};this.renderedElements.push(Q)}this.trait.renderIndex(U,$)}splice(x,U,$){const V=[];for(const Q of this.renderedElements)Q.index =x+U&&V.push({index:Q.index+$-U,templateData:Q.templateData});this.renderedElements=V}renderIndexes(x){for(const{index:U,templateData:$}of this.renderedElements)x.indexOf(U)>-1&&this.trait.renderIndex(U,$)}disposeTemplate(x){const U=this.renderedElements.findIndex($=>$.templateData===x);U<0||this.renderedElements.splice(U,1)}}class f{constructor(x){this._trait=x,this.length=0,this.indexes=[],this.sortedIndexes=[],this._onChange=new s.Emitter,this.onChange=this._onChange.event}get trait(){return this._trait}get renderer(){return new h(this)}splice(x,U,$){var V;U=Math.max(0,Math.min(U,this.length-x));const Q=$.length-U,ue=x+U,pe=[...this.sortedIndexes.filter(re=>re re?ie+x:-1).filter(re=>re!==-1),...this.sortedIndexes.filter(re=>re>=ue).map(re=>re+Q)],fe=this.length+Q;if(this.sortedIndexes.length>0&&pe.length===0&&fe>0){const re=(V=this.sortedIndexes.find(ie=>ie>=x))!==null&&V!==void 0?V:fe-1;pe.push(Math.min(re,fe-1))}this.renderer.splice(x,U,$.length),this._set(pe,pe),this.length=fe}renderIndex(x,U){U.classList.toggle(this._trait,this.contains(x))}unrender(x){x.classList.remove(this._trait)}set(x,U){return this._set(x,[...x].sort(Y),U)}_set(x,U,$){const V=this.indexes,Q=this.sortedIndexes;this.indexes=x,this.sortedIndexes=U;const ue=K(Q,x);return this.renderer.renderIndexes(ue),this._onChange.fire({indexes:x,browserEvent:$}),V}get(){return this.indexes}contains(x){return(0,C.binarySearch)(this.sortedIndexes,x,Y)>=0}dispose(){(0,u.dispose)(this._onChange)}}Fe([t.memoize],f.prototype,"renderer",null);class y extends f{constructor(x){super("selected");this.setAriaSelected=x}renderIndex(x,U){super.renderIndex(x,U),this.setAriaSelected&&(this.contains(x)?U.setAttribute("aria-selected","true"):U.setAttribute("aria-selected","false"))}}class _{constructor(x,U,$){this.trait=x,this.view=U,this.identityProvider=$}splice(x,U,$){if(!this.identityProvider)return this.trait.splice(x,U,$.map(()=>!1));const V=this.trait.get().map(ue=>this.identityProvider.getId(this.view.element(ue)).toString()),Q=$.map(ue=>V.indexOf(this.identityProvider.getId(ue).toString())>-1);this.trait.splice(x,U,Q)}}function b(G){return G.tagName==="INPUT"||G.tagName==="TEXTAREA"}e.isInputElement=b;function v(G){return G.classList.contains("monaco-editor")?!0:G.classList.contains("monaco-list")||!G.parentElement?!1:v(G.parentElement)}e.isMonacoEditor=v;class m{constructor(x,U,$){this.list=x,this.view=U,this.disposables=new u.DisposableStore,this.multipleSelectionDisposables=new u.DisposableStore,this.onKeyDown.filter(V=>V.keyCode===3).on(this.onEnter,this,this.disposables),this.onKeyDown.filter(V=>V.keyCode===16).on(this.onUpArrow,this,this.disposables),this.onKeyDown.filter(V=>V.keyCode===18).on(this.onDownArrow,this,this.disposables),this.onKeyDown.filter(V=>V.keyCode===11).on(this.onPageUpArrow,this,this.disposables),this.onKeyDown.filter(V=>V.keyCode===12).on(this.onPageDownArrow,this,this.disposables),this.onKeyDown.filter(V=>V.keyCode===9).on(this.onEscape,this,this.disposables),$.multipleSelectionSupport!==!1&&this.onKeyDown.filter(V=>(r.isMacintosh?V.metaKey:V.ctrlKey)&&V.keyCode===31).on(this.onCtrlA,this,this.multipleSelectionDisposables)}get onKeyDown(){return s.Event.chain(this.disposables.add(new N.DomEmitter(this.view.domNode,"keydown")).event).filter(x=>!b(x.target)).map(x=>new T.StandardKeyboardEvent(x))}updateOptions(x){x.multipleSelectionSupport!==void 0&&(this.multipleSelectionDisposables.clear(),x.multipleSelectionSupport&&this.onKeyDown.filter(U=>(r.isMacintosh?U.metaKey:U.ctrlKey)&&U.keyCode===31).on(this.onCtrlA,this,this.multipleSelectionDisposables))}onEnter(x){x.preventDefault(),x.stopPropagation(),this.list.setSelection(this.list.getFocus(),x.browserEvent)}onUpArrow(x){x.preventDefault(),x.stopPropagation(),this.list.focusPrevious(1,!1,x.browserEvent);const U=this.list.getFocus()[0];this.list.setAnchor(U),this.list.reveal(U),this.view.domNode.focus()}onDownArrow(x){x.preventDefault(),x.stopPropagation(),this.list.focusNext(1,!1,x.browserEvent);const U=this.list.getFocus()[0];this.list.setAnchor(U),this.list.reveal(U),this.view.domNode.focus()}onPageUpArrow(x){x.preventDefault(),x.stopPropagation(),this.list.focusPreviousPage(x.browserEvent);const U=this.list.getFocus()[0];this.list.setAnchor(U),this.list.reveal(U),this.view.domNode.focus()}onPageDownArrow(x){x.preventDefault(),x.stopPropagation(),this.list.focusNextPage(x.browserEvent);const U=this.list.getFocus()[0];this.list.setAnchor(U),this.list.reveal(U),this.view.domNode.focus()}onCtrlA(x){x.preventDefault(),x.stopPropagation(),this.list.setSelection((0,C.range)(this.list.length),x.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(x){this.list.getSelection().length&&(x.preventDefault(),x.stopPropagation(),this.list.setSelection([],x.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}Fe([t.memoize],m.prototype,"onKeyDown",null);var E;(function(G){G[G.Idle=0]="Idle",G[G.Typing=1]="Typing"})(E||(E={})),e.DefaultKeyboardNavigationDelegate=new class{mightProducePrintableCharacter(G){return G.ctrlKey||G.metaKey||G.altKey?!1:G.keyCode>=31&&G.keyCode<=56||G.keyCode>=21&&G.keyCode<=30||G.keyCode>=93&&G.keyCode<=102||G.keyCode>=80&&G.keyCode<=90}};class I{constructor(x,U,$,V){this.list=x,this.view=U,this.keyboardNavigationLabelProvider=$,this.delegate=V,this.enabled=!1,this.state=E.Idle,this.automaticKeyboardNavigation=!0,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new u.DisposableStore,this.disposables=new u.DisposableStore,this.updateOptions(x.options)}updateOptions(x){(typeof x.enableKeyboardNavigation=="undefined"?!0:!!x.enableKeyboardNavigation)?this.enable():this.disable(),typeof x.automaticKeyboardNavigation!="undefined"&&(this.automaticKeyboardNavigation=x.automaticKeyboardNavigation)}enable(){if(this.enabled)return;const x=s.Event.chain(this.enabledDisposables.add(new N.DomEmitter(this.view.domNode,"keydown")).event).filter(V=>!b(V.target)).filter(()=>this.automaticKeyboardNavigation||this.triggered).map(V=>new T.StandardKeyboardEvent(V)).filter(V=>this.delegate.mightProducePrintableCharacter(V)).forEach(V=>{V.stopPropagation(),V.preventDefault()}).map(V=>V.browserEvent.key).event,U=s.Event.debounce(x,()=>null,800);s.Event.reduce(s.Event.any(x,U),(V,Q)=>Q===null?null:(V||"")+Q)(this.onInput,this,this.enabledDisposables),U(this.onClear,this,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){!this.enabled||(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){var x;const U=this.list.getFocus();if(U.length>0&&U[0]===this.previouslyFocused){const $=(x=this.list.options.accessibilityProvider)===null||x===void 0?void 0:x.getAriaLabel(this.list.element(U[0]));$&&(0,S.alert)($)}this.previouslyFocused=-1}onInput(x){if(!x){this.state=E.Idle,this.triggered=!1;return}const U=this.list.getFocus(),$=U.length>0?U[0]:0,V=this.state===E.Idle?1:0;this.state=E.Typing;for(let Q=0;Q !b(V.target)).map(V=>new T.StandardKeyboardEvent(V)).filter(V=>V.keyCode===2&&!V.ctrlKey&&!V.metaKey&&!V.shiftKey&&!V.altKey).on(this.onTab,this,this.disposables)}onTab(x){if(x.target!==this.view.domNode)return;const U=this.list.getFocus();if(U.length===0)return;const $=this.view.domElement(U[0]);if(!$)return;const V=$.querySelector("[tabIndex]");if(!V||!(V instanceof HTMLElement)||V.tabIndex===-1)return;const Q=window.getComputedStyle(V);Q.visibility==="hidden"||Q.display==="none"||(x.preventDefault(),x.stopPropagation(),V.focus())}dispose(){this.disposables.dispose()}}function M(G){return r.isMacintosh?G.browserEvent.metaKey:G.browserEvent.ctrlKey}e.isSelectionSingleChangeEvent=M;function P(G){return G.browserEvent.shiftKey}e.isSelectionRangeChangeEvent=P;function F(G){return G instanceof MouseEvent&&G.button===2}const R={isSelectionSingleChangeEvent:M,isSelectionRangeChangeEvent:P};class A{constructor(x){this.list=x,this.disposables=new u.DisposableStore,this._onPointer=new s.Emitter,this.onPointer=this._onPointer.event,x.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||R),this.mouseSupport=typeof x.options.mouseSupport=="undefined"||!!x.options.mouseSupport,this.mouseSupport&&(x.onMouseDown(this.onMouseDown,this,this.disposables),x.onContextMenu(this.onContextMenu,this,this.disposables),x.onMouseDblClick(this.onDoubleClick,this,this.disposables),x.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(D.Gesture.addTarget(x.getHTMLElement()))),s.Event.any(x.onMouseClick,x.onMouseMiddleClick,x.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(x){x.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,x.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||R))}isSelectionSingleChangeEvent(x){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(x):!1}isSelectionRangeChangeEvent(x){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(x):!1}isSelectionChangeEvent(x){return this.isSelectionSingleChangeEvent(x)||this.isSelectionRangeChangeEvent(x)}onMouseDown(x){v(x.browserEvent.target)||document.activeElement!==x.browserEvent.target&&this.list.domFocus()}onContextMenu(x){if(v(x.browserEvent.target))return;const U=typeof x.index=="undefined"?[]:[x.index];this.list.setFocus(U,x.browserEvent)}onViewPointer(x){if(!this.mouseSupport||b(x.browserEvent.target)||v(x.browserEvent.target))return;const U=x.index;if(typeof U=="undefined"){this.list.setFocus([],x.browserEvent),this.list.setSelection([],x.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionRangeChangeEvent(x))return this.changeSelection(x);if(this.isSelectionChangeEvent(x))return this.changeSelection(x);this.list.setFocus([U],x.browserEvent),this.list.setAnchor(U),F(x.browserEvent)||this.list.setSelection([U],x.browserEvent),this._onPointer.fire(x)}onDoubleClick(x){if(b(x.browserEvent.target)||v(x.browserEvent.target)||this.isSelectionChangeEvent(x))return;const U=this.list.getFocus();this.list.setSelection(U,x.browserEvent)}changeSelection(x){const U=x.index;let $=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(x)){if(typeof $=="undefined"){const ie=this.list.getFocus()[0];$=ie??U,this.list.setAnchor($)}const V=Math.min($,U),Q=Math.max($,U),ue=(0,C.range)(V,Q+1),pe=this.list.getSelection(),fe=W(K(pe,[$]),$);if(fe.length===0)return;const re=K(ue,H(pe,fe));this.list.setSelection(re,x.browserEvent),this.list.setFocus([U],x.browserEvent)}else if(this.isSelectionSingleChangeEvent(x)){const V=this.list.getSelection(),Q=V.filter(ue=>ue!==U);this.list.setFocus([U]),this.list.setAnchor(U),V.length===Q.length?this.list.setSelection([...Q,U],x.browserEvent):this.list.setSelection(Q,x.browserEvent)}}dispose(){this.disposables.dispose()}}e.MouseController=A;class O{constructor(x,U){this.styleElement=x,this.selectorSuffix=U}style(x){const U=this.selectorSuffix&&`.${this.selectorSuffix}`,$=[];x.listBackground&&(x.listBackground.isOpaque()?$.push(`.monaco-list${U} .monaco-list-rows { background: ${x.listBackground}; }`):r.isMacintosh||console.warn(`List with id '${this.selectorSuffix}' was styled with a non-opaque background color. This will break sub-pixel antialiasing.`)),x.listFocusBackground&&($.push(`.monaco-list${U}:focus .monaco-list-row.focused { background-color: ${x.listFocusBackground}; }`),$.push(`.monaco-list${U}:focus .monaco-list-row.focused:hover { background-color: ${x.listFocusBackground}; }`)),x.listFocusForeground&&$.push(`.monaco-list${U}:focus .monaco-list-row.focused { color: ${x.listFocusForeground}; }`),x.listActiveSelectionBackground&&($.push(`.monaco-list${U}:focus .monaco-list-row.selected { background-color: ${x.listActiveSelectionBackground}; }`),$.push(`.monaco-list${U}:focus .monaco-list-row.selected:hover { background-color: ${x.listActiveSelectionBackground}; }`)),x.listActiveSelectionForeground&&$.push(`.monaco-list${U}:focus .monaco-list-row.selected { color: ${x.listActiveSelectionForeground}; }`),x.listActiveSelectionIconForeground&&$.push(`.monaco-list${U}:focus .monaco-list-row.selected .codicon { color: ${x.listActiveSelectionIconForeground}; }`),x.listFocusAndSelectionBackground&&$.push(` + .monaco-drag-image, + .monaco-list${U}:focus .monaco-list-row.selected.focused { background-color: ${x.listFocusAndSelectionBackground}; } + `),x.listFocusAndSelectionForeground&&$.push(` + .monaco-drag-image, + .monaco-list${U}:focus .monaco-list-row.selected.focused { color: ${x.listFocusAndSelectionForeground}; } + `),x.listInactiveFocusForeground&&($.push(`.monaco-list${U} .monaco-list-row.focused { color: ${x.listInactiveFocusForeground}; }`),$.push(`.monaco-list${U} .monaco-list-row.focused:hover { color: ${x.listInactiveFocusForeground}; }`)),x.listInactiveSelectionIconForeground&&$.push(`.monaco-list${U} .monaco-list-row.focused .codicon { color: ${x.listInactiveSelectionIconForeground}; }`),x.listInactiveFocusBackground&&($.push(`.monaco-list${U} .monaco-list-row.focused { background-color: ${x.listInactiveFocusBackground}; }`),$.push(`.monaco-list${U} .monaco-list-row.focused:hover { background-color: ${x.listInactiveFocusBackground}; }`)),x.listInactiveSelectionBackground&&($.push(`.monaco-list${U} .monaco-list-row.selected { background-color: ${x.listInactiveSelectionBackground}; }`),$.push(`.monaco-list${U} .monaco-list-row.selected:hover { background-color: ${x.listInactiveSelectionBackground}; }`)),x.listInactiveSelectionForeground&&$.push(`.monaco-list${U} .monaco-list-row.selected { color: ${x.listInactiveSelectionForeground}; }`),x.listHoverBackground&&$.push(`.monaco-list${U}:not(.drop-target) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${x.listHoverBackground}; }`),x.listHoverForeground&&$.push(`.monaco-list${U} .monaco-list-row:hover:not(.selected):not(.focused) { color: ${x.listHoverForeground}; }`),x.listSelectionOutline&&$.push(`.monaco-list${U} .monaco-list-row.selected { outline: 1px dotted ${x.listSelectionOutline}; outline-offset: -1px; }`),x.listFocusOutline&&$.push(` + .monaco-drag-image, + .monaco-list${U}:focus .monaco-list-row.focused { outline: 1px solid ${x.listFocusOutline}; outline-offset: -1px; } + `),x.listInactiveFocusOutline&&$.push(`.monaco-list${U} .monaco-list-row.focused { outline: 1px dotted ${x.listInactiveFocusOutline}; outline-offset: -1px; }`),x.listHoverOutline&&$.push(`.monaco-list${U} .monaco-list-row:hover { outline: 1px dashed ${x.listHoverOutline}; outline-offset: -1px; }`),x.listDropBackground&&$.push(` + .monaco-list${U}.drop-target, + .monaco-list${U} .monaco-list-rows.drop-target, + .monaco-list${U} .monaco-list-row.drop-target { background-color: ${x.listDropBackground} !important; color: inherit !important; } + `),x.listFilterWidgetBackground&&$.push(`.monaco-list-type-filter { background-color: ${x.listFilterWidgetBackground} }`),x.listFilterWidgetOutline&&$.push(`.monaco-list-type-filter { border: 1px solid ${x.listFilterWidgetOutline}; }`),x.listFilterWidgetNoMatchesOutline&&$.push(`.monaco-list-type-filter.no-matches { border: 1px solid ${x.listFilterWidgetNoMatchesOutline}; }`),x.listMatchesShadow&&$.push(`.monaco-list-type-filter { box-shadow: 1px 1px 1px ${x.listMatchesShadow}; }`),x.tableColumnsBorder&&$.push(` + .monaco-table:hover > .monaco-split-view2, + .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before { + border-color: ${x.tableColumnsBorder}; + }`),this.styleElement.textContent=$.join(` +`)}}e.DefaultStyleController=O;const L={listFocusBackground:g.Color.fromHex("#7FB0D0"),listActiveSelectionBackground:g.Color.fromHex("#0E639C"),listActiveSelectionForeground:g.Color.fromHex("#FFFFFF"),listActiveSelectionIconForeground:g.Color.fromHex("#FFFFFF"),listFocusAndSelectionBackground:g.Color.fromHex("#094771"),listFocusAndSelectionForeground:g.Color.fromHex("#FFFFFF"),listInactiveSelectionBackground:g.Color.fromHex("#3F3F46"),listInactiveSelectionIconForeground:g.Color.fromHex("#FFFFFF"),listHoverBackground:g.Color.fromHex("#2A2D2E"),listDropBackground:g.Color.fromHex("#383B3D"),treeIndentGuidesStroke:g.Color.fromHex("#a9a9a9"),tableColumnsBorder:g.Color.fromHex("#cccccc").transparent(.2)},B={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){}}};function W(G,x){const U=G.indexOf(x);if(U===-1)return[];const $=[];let V=U-1;for(;V>=0&&G[V]===x-(U-V);)$.push(G[V--]);for($.reverse(),V=U;V =G.length)U.push(x[V++]);else if(V>=x.length)U.push(G[$++]);else if(G[$]===x[V]){U.push(G[$]),$++,V++;continue}else G[$] =G.length)U.push(x[V++]);else if(V>=x.length)U.push(G[$++]);else if(G[$]===x[V]){$++,V++;continue}else G[$] G-x;class X{constructor(x,U){this._templateId=x,this.renderers=U}get templateId(){return this._templateId}renderTemplate(x){return this.renderers.map(U=>U.renderTemplate(x))}renderElement(x,U,$,V){let Q=0;for(const ue of this.renderers)ue.renderElement(x,U,$[Q++],V)}disposeElement(x,U,$,V){let Q=0;for(const ue of this.renderers)ue.disposeElement&&ue.disposeElement(x,U,$[Q],V),Q+=1}disposeTemplate(x){let U=0;for(const $ of this.renderers)$.disposeTemplate(x[U++])}}class Z{constructor(x){this.accessibilityProvider=x,this.templateId="a18n"}renderTemplate(x){return x}renderElement(x,U,$){const V=this.accessibilityProvider.getAriaLabel(x);V?$.setAttribute("aria-label",V):$.removeAttribute("aria-label");const Q=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(x);typeof Q=="number"?$.setAttribute("aria-level",`${Q}`):$.removeAttribute("aria-level")}disposeTemplate(x){}}class se{constructor(x,U){this.list=x,this.dnd=U}getDragElements(x){const U=this.list.getSelectedElements();return U.indexOf(x)>-1?U:[x]}getDragURI(x){return this.dnd.getDragURI(x)}getDragLabel(x,U){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(x,U)}onDragStart(x,U){this.dnd.onDragStart&&this.dnd.onDragStart(x,U)}onDragOver(x,U,$,V){return this.dnd.onDragOver(x,U,$,V)}onDragLeave(x,U,$,V){var Q,ue;(ue=(Q=this.dnd).onDragLeave)===null||ue===void 0||ue.call(Q,x,U,$,V)}onDragEnd(x){this.dnd.onDragEnd&&this.dnd.onDragEnd(x)}drop(x,U,$,V){this.dnd.drop(x,U,$,V)}}class oe{constructor(x,U,$,V,Q=B){var ue;this.user=x,this._options=Q,this.focus=new f("focused"),this.anchor=new f("anchor"),this.eventBufferer=new s.EventBufferer,this._ariaLabel="",this.disposables=new u.DisposableStore,this._onDidDispose=new s.Emitter,this.onDidDispose=this._onDidDispose.event;const pe=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?(ue=this._options.accessibilityProvider)===null||ue===void 0?void 0:ue.getWidgetRole():"list";this.selection=new y(pe!=="listbox"),(0,a.mixin)(Q,L,!1);const fe=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=Q.accessibilityProvider,this.accessibilityProvider&&(fe.push(new Z(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant&&this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant,this,this.disposables)),V=V.map(ie=>new X(ie.templateId,[...fe,ie]));const re=Object.assign(Object.assign({},Q),{dnd:Q.dnd&&new se(this,Q.dnd)});if(this.view=new l.ListView(U,$,V,re),this.view.domNode.setAttribute("role",pe),Q.styleController)this.styleController=Q.styleController(this.view.domId);else{const ie=(0,w.createStyleSheet)(this.view.domNode);this.styleController=new O(ie,this.view.domId)}if(this.spliceable=new p.CombinedSpliceable([new _(this.focus,this.view,Q.identityProvider),new _(this.selection,this.view,Q.identityProvider),new _(this.anchor,this.view,Q.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new k(this,this.view)),(typeof Q.keyboardSupport!="boolean"||Q.keyboardSupport)&&(this.keyboardController=new m(this,this.view,Q),this.disposables.add(this.keyboardController)),Q.keyboardNavigationLabelProvider){const ie=Q.keyboardNavigationDelegate||e.DefaultKeyboardNavigationDelegate;this.typeLabelController=new I(this,this.view,Q.keyboardNavigationLabelProvider,ie),this.disposables.add(this.typeLabelController)}this.mouseController=this.createMouseController(Q),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return s.Event.map(this.eventBufferer.wrapEvent(this.focus.onChange),x=>this.toListEvent(x))}get onDidChangeSelection(){return s.Event.map(this.eventBufferer.wrapEvent(this.selection.onChange),x=>this.toListEvent(x))}get domId(){return this.view.domId}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let x=!1;const U=s.Event.chain(this.disposables.add(new N.DomEmitter(this.view.domNode,"keydown")).event).map(Q=>new T.StandardKeyboardEvent(Q)).filter(Q=>x=Q.keyCode===58||Q.shiftKey&&Q.keyCode===68).map(N.stopEvent).filter(()=>!1).event,$=s.Event.chain(this.disposables.add(new N.DomEmitter(this.view.domNode,"keyup")).event).forEach(()=>x=!1).map(Q=>new T.StandardKeyboardEvent(Q)).filter(Q=>Q.keyCode===58||Q.shiftKey&&Q.keyCode===68).map(N.stopEvent).map(({browserEvent:Q})=>{const ue=this.getFocus(),pe=ue.length?ue[0]:void 0,fe=typeof pe!="undefined"?this.view.element(pe):void 0,re=typeof pe!="undefined"?this.view.domElement(pe):this.view.domNode;return{index:pe,element:fe,anchor:re,browserEvent:Q}}).event,V=s.Event.chain(this.view.onContextMenu).filter(Q=>!x).map(({element:Q,index:ue,browserEvent:pe})=>({element:Q,index:ue,anchor:{x:pe.pageX+1,y:pe.pageY},browserEvent:pe})).event;return s.Event.any(U,$,V)}get onKeyDown(){return this.disposables.add(new N.DomEmitter(this.view.domNode,"keydown")).event}get onDidFocus(){return s.Event.signal(this.disposables.add(new N.DomEmitter(this.view.domNode,"focus",!0)).event)}createMouseController(x){return new A(this)}updateOptions(x={}){var U;this._options=Object.assign(Object.assign({},this._options),x),this.typeLabelController&&this.typeLabelController.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(x),(U=this.keyboardController)===null||U===void 0||U.updateOptions(x),this.view.updateOptions(x)}get options(){return this._options}splice(x,U,$=[]){if(x<0||x>this.view.length)throw new i.ListError(this.user,`Invalid start index: ${x}`);if(U<0)throw new i.ListError(this.user,`Invalid delete count: ${U}`);U===0&&$.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(x,U,$))}rerender(){this.view.rerender()}element(x){return this.view.element(x)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(x){this.view.setScrollTop(x)}get ariaLabel(){return this._ariaLabel}set ariaLabel(x){this._ariaLabel=x,this.view.domNode.setAttribute("aria-label",x)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(x,U){this.view.layout(x,U)}setSelection(x,U){for(const $ of x)if($<0||$>=this.length)throw new i.ListError(this.user,`Invalid index ${$}`);this.selection.set(x,U)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(x=>this.view.element(x))}setAnchor(x){if(typeof x=="undefined"){this.anchor.set([]);return}if(x<0||x>=this.length)throw new i.ListError(this.user,`Invalid index ${x}`);this.anchor.set([x])}getAnchor(){return(0,C.firstOrDefault)(this.anchor.get(),void 0)}getAnchorElement(){const x=this.getAnchor();return typeof x=="undefined"?void 0:this.element(x)}setFocus(x,U){for(const $ of x)if($<0||$>=this.length)throw new i.ListError(this.user,`Invalid index ${$}`);this.focus.set(x,U)}focusNext(x=1,U=!1,$,V){if(this.length===0)return;const Q=this.focus.get(),ue=this.findNextIndex(Q.length>0?Q[0]+x:0,U,V);ue>-1&&this.setFocus([ue],$)}focusPrevious(x=1,U=!1,$,V){if(this.length===0)return;const Q=this.focus.get(),ue=this.findPreviousIndex(Q.length>0?Q[0]-x:0,U,V);ue>-1&&this.setFocus([ue],$)}focusNextPage(x,U){return Re(this,void 0,void 0,function*(){let $=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);$=$===0?0:$-1;const V=this.view.element($),Q=this.getFocusedElements()[0];if(Q!==V){const ue=this.findPreviousIndex($,!1,U);ue>-1&&Q!==this.view.element(ue)?this.setFocus([ue],x):this.setFocus([$],x)}else{const ue=this.view.getScrollTop();this.view.setScrollTop(ue+this.view.renderHeight-this.view.elementHeight($)),this.view.getScrollTop()!==ue&&(this.setFocus([]),yield(0,n.timeout)(0),yield this.focusNextPage(x,U))}})}focusPreviousPage(x,U){return Re(this,void 0,void 0,function*(){let $;const V=this.view.getScrollTop();V===0?$=this.view.indexAt(V):$=this.view.indexAfter(V-1);const Q=this.view.element($),ue=this.getFocusedElements()[0];if(ue!==Q){const pe=this.findNextIndex($,!1,U);pe>-1&&ue!==this.view.element(pe)?this.setFocus([pe],x):this.setFocus([$],x)}else{const pe=V;this.view.setScrollTop(V-this.view.renderHeight),this.view.getScrollTop()!==pe&&(this.setFocus([]),yield(0,n.timeout)(0),yield this.focusPreviousPage(x,U))}})}focusLast(x,U){if(this.length===0)return;const $=this.findPreviousIndex(this.length-1,!1,U);$>-1&&this.setFocus([$],x)}focusFirst(x,U){this.focusNth(0,x,U)}focusNth(x,U,$){if(this.length===0)return;const V=this.findNextIndex(x,!1,$);V>-1&&this.setFocus([V],U)}findNextIndex(x,U=!1,$){for(let V=0;V =this.length&&!U)return-1;if(x=x%this.length,!$||$(this.element(x)))return x;x++}return-1}findPreviousIndex(x,U=!1,$){for(let V=0;V this.view.element(x))}reveal(x,U){if(x<0||x>=this.length)throw new i.ListError(this.user,`Invalid index ${x}`);const $=this.view.getScrollTop(),V=this.view.elementTop(x),Q=this.view.elementHeight(x);if((0,o.isNumber)(U)){const ue=Q-this.view.renderHeight;this.view.setScrollTop(ue*(0,d.clamp)(U,0,1)+V)}else{const ue=V+Q,pe=$+this.view.renderHeight;V<$&&ue>=pe||(V<$||ue>=pe&&Q>=this.view.renderHeight?this.view.setScrollTop(V):ue>=pe&&this.view.setScrollTop(ue-this.view.renderHeight))}}getRelativeTop(x){if(x<0||x>=this.length)throw new i.ListError(this.user,`Invalid index ${x}`);const U=this.view.getScrollTop(),$=this.view.elementTop(x),V=this.view.elementHeight(x);if($U+this.view.renderHeight)return null;const Q=V-this.view.renderHeight;return Math.abs((U-$)/Q)}getHTMLElement(){return this.view.domNode}style(x){this.styleController.style(x)}toListEvent({indexes:x,browserEvent:U}){return{indexes:x,elements:x.map($=>this.view.element($)),browserEvent:U}}_onFocusChange(){const x=this.focus.get();this.view.domNode.classList.toggle("element-focused",x.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){var x;const U=this.focus.get();if(U.length>0){let $;((x=this.accessibilityProvider)===null||x===void 0?void 0:x.getActiveDescendantId)&&($=this.accessibilityProvider.getActiveDescendantId(this.view.element(U[0]))),this.view.domNode.setAttribute("aria-activedescendant",$||this.view.getElementDomId(U[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const x=this.selection.get();this.view.domNode.classList.toggle("selection-none",x.length===0),this.view.domNode.classList.toggle("selection-single",x.length===1),this.view.domNode.classList.toggle("selection-multiple",x.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}Fe([t.memoize],oe.prototype,"onDidChangeFocus",null),Fe([t.memoize],oe.prototype,"onDidChangeSelection",null),Fe([t.memoize],oe.prototype,"onContextMenu",null),Fe([t.memoize],oe.prototype,"onKeyDown",null),Fe([t.memoize],oe.prototype,"onDidFocus",null),e.List=oe}),define(J[331],ee([0,1,19,23,4,2,111,219]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PagedList=void 0;class p{constructor(s,c){this.renderer=s,this.modelProvider=c}get templateId(){return this.renderer.templateId}renderTemplate(s){return{data:this.renderer.renderTemplate(s),disposable:D.Disposable.None}}renderElement(s,c,u,d){if(u.disposable&&u.disposable.dispose(),!u.data)return;const a=this.modelProvider();if(a.isResolved(s))return this.renderer.renderElement(a.get(s),s,u.data,d);const r=new N.CancellationTokenSource,o=a.resolve(s,r.token);u.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(s,u.data),o.then(i=>this.renderer.renderElement(i,s,u.data,d))}disposeTemplate(s){s.disposable&&(s.disposable.dispose(),s.disposable=void 0),s.data&&(this.renderer.disposeTemplate(s.data),s.data=void 0)}}class C{constructor(s,c){this.modelProvider=s,this.accessibilityProvider=c}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(s){const c=this.modelProvider();return c.isResolved(s)?this.accessibilityProvider.getAriaLabel(c.get(s)):null}}function n(t,s){return Object.assign(Object.assign({},s),{accessibilityProvider:s.accessibilityProvider&&new C(t,s.accessibilityProvider)})}class g{constructor(s,c,u,d,a={}){const r=()=>this.model,o=d.map(i=>new p(i,r));this.list=new S.List(s,c,u,o,n(r,a))}updateOptions(s){this.list.updateOptions(s)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return T.Event.map(this.list.onMouseDblClick,({element:s,index:c,browserEvent:u})=>({element:s===void 0?void 0:this._model.get(s),index:c,browserEvent:u}))}get onPointer(){return T.Event.map(this.list.onPointer,({element:s,index:c,browserEvent:u})=>({element:s===void 0?void 0:this._model.get(s),index:c,browserEvent:u}))}get onDidChangeSelection(){return T.Event.map(this.list.onDidChangeSelection,({elements:s,indexes:c,browserEvent:u})=>({elements:s.map(d=>this._model.get(d)),indexes:c,browserEvent:u}))}get model(){return this._model}set model(s){this._model=s,this.list.splice(0,this.list.length,(0,w.range)(s.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(s=>this.model.get(s))}style(s){this.list.style(s)}dispose(){this.list.dispose()}}e.PagedList=g}),define(J[332],ee([12]),{}),define(J[221],ee([0,1,7,110,64,19,29,4,2,106,133,20,332]),function(j,e,w,N,T,D,S,p,C,n,g,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SplitView=e.Sizing=void 0;const s={separatorBorder:S.Color.transparent};class c{constructor(l,h,f,y){this.container=l,this.view=h,this.disposable=y,this._cachedVisibleSize=void 0,typeof f=="number"?(this._size=f,this._cachedVisibleSize=void 0,l.classList.add("visible")):(this._size=0,this._cachedVisibleSize=f.cachedVisibleSize)}set size(l){this._size=l}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize=="undefined"}setVisible(l,h){l!==this.visible&&(l?(this.size=(0,n.clamp)(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof h=="number"?h:this.size,this.size=0),this.container.classList.toggle("visible",l),this.view.setVisible&&this.view.setVisible(l))}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(l){this.container.style.pointerEvents=l?"":"none"}layout(l,h){this.layoutContainer(l),this.view.layout(this.size,l,h)}dispose(){return this.disposable.dispose(),this.view}}class u extends c{layoutContainer(l){this.container.style.top=`${l}px`,this.container.style.height=`${this.size}px`}}class d extends c{layoutContainer(l){this.container.style.left=`${l}px`,this.container.style.width=`${this.size}px`}}var a;(function(i){i[i.Idle=0]="Idle",i[i.Busy=1]="Busy"})(a||(a={}));var r;(function(i){i.Distribute={type:"distribute"};function l(f){return{type:"split",index:f}}i.Split=l;function h(f){return{type:"invisible",cachedVisibleSize:f}}i.Invisible=h})(r=e.Sizing||(e.Sizing={}));class o extends C.Disposable{constructor(l,h={}){var f,y;super();this.size=0,this.contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=a.Idle,this._onDidSashChange=this._register(new p.Emitter),this.onDidSashChange=this._onDidSashChange.event,this._onDidSashReset=this._register(new p.Emitter),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.orientation=t.isUndefined(h.orientation)?0:h.orientation,this.inverseAltBehavior=!!h.inverseAltBehavior,this.proportionalLayout=t.isUndefined(h.proportionalLayout)?!0:!!h.proportionalLayout,this.getSashOrthogonalSize=h.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),l.appendChild(this.el),this.sashContainer=(0,w.append)(this.el,(0,w.$)(".sash-container")),this.viewContainer=(0,w.$)(".split-view-container"),this.scrollable=new g.Scrollable(125,w.scheduleAtNextAnimationFrame),this.scrollableElement=this._register(new T.SmoothScrollableElement(this.viewContainer,{vertical:this.orientation===0?(f=h.scrollbarVisibility)!==null&&f!==void 0?f:1:2,horizontal:this.orientation===1?(y=h.scrollbarVisibility)!==null&&y!==void 0?y:1:2},this.scrollable)),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(_=>{this.viewContainer.scrollTop=_.scrollTop,this.viewContainer.scrollLeft=_.scrollLeft})),(0,w.append)(this.el,this.scrollableElement.getDomNode()),this.style(h.styles||s),h.descriptor&&(this.size=h.descriptor.size,h.descriptor.views.forEach((_,b)=>{const v=t.isUndefined(_.visible)||_.visible?_.size:{type:"invisible",cachedVisibleSize:_.size},m=_.view;this.doAddView(m,v,b,!0)}),this.contentSize=this.viewItems.reduce((_,b)=>_+b.size,0),this.saveProportions())}get orthogonalStartSash(){return this._orthogonalStartSash}set orthogonalStartSash(l){for(const h of this.sashItems)h.sash.orthogonalStartSash=l;this._orthogonalStartSash=l}get orthogonalEndSash(){return this._orthogonalEndSash}set orthogonalEndSash(l){for(const h of this.sashItems)h.sash.orthogonalEndSash=l;this._orthogonalEndSash=l}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(l){this._startSnappingEnabled!==l&&(this._startSnappingEnabled=l,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(l){this._endSnappingEnabled!==l&&(this._endSnappingEnabled=l,this.updateSashEnablement())}style(l){l.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",l.separatorBorder.toString()))}addView(l,h,f=this.viewItems.length,y){this.doAddView(l,h,f,y)}layout(l,h){const f=Math.max(this.size,this.contentSize);if(this.size=l,this.layoutContext=h,this.proportions)for(let y=0;y this.viewItems[v].priority===1),b=y.filter(v=>this.viewItems[v].priority===2);this.resize(this.viewItems.length-1,l-f,void 0,_,b)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this.contentSize>0&&(this.proportions=this.viewItems.map(l=>l.size/this.contentSize))}onSashStart({sash:l,start:h,alt:f}){for(const v of this.viewItems)v.enabled=!1;const y=this.sashItems.findIndex(v=>v.sash===l),_=(0,C.combinedDisposable)((0,w.addDisposableListener)(document.body,"keydown",v=>b(this.sashDragState.current,v.altKey)),(0,w.addDisposableListener)(document.body,"keyup",()=>b(this.sashDragState.current,!1))),b=(v,m)=>{const E=this.viewItems.map(F=>F.size);let I=Number.NEGATIVE_INFINITY,k=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(m=!m),m)if(y===this.sashItems.length-1){const R=this.viewItems[y];I=(R.minimumSize-R.size)/2,k=(R.maximumSize-R.size)/2}else{const R=this.viewItems[y+1];I=(R.size-R.maximumSize)/2,k=(R.size-R.minimumSize)/2}let M,P;if(!m){const F=(0,D.range)(y,-1),R=(0,D.range)(y+1,this.viewItems.length),A=F.reduce((X,Z)=>X+(this.viewItems[Z].minimumSize-E[Z]),0),O=F.reduce((X,Z)=>X+(this.viewItems[Z].viewMaximumSize-E[Z]),0),L=R.length===0?Number.POSITIVE_INFINITY:R.reduce((X,Z)=>X+(E[Z]-this.viewItems[Z].minimumSize),0),B=R.length===0?Number.NEGATIVE_INFINITY:R.reduce((X,Z)=>X+(E[Z]-this.viewItems[Z].viewMaximumSize),0),W=Math.max(A,B),K=Math.min(L,O),H=this.findFirstSnapIndex(F),Y=this.findFirstSnapIndex(R);if(typeof H=="number"){const X=this.viewItems[H],Z=Math.floor(X.viewMinimumSize/2);M={index:H,limitDelta:X.visible?W-Z:W+Z,size:X.size}}if(typeof Y=="number"){const X=this.viewItems[Y],Z=Math.floor(X.viewMinimumSize/2);P={index:Y,limitDelta:X.visible?K+Z:K-Z,size:X.size}}}this.sashDragState={start:v,current:v,index:y,sizes:E,minDelta:I,maxDelta:k,alt:m,snapBefore:M,snapAfter:P,disposable:_}};b(h,f)}onSashChange({current:l}){const{index:h,start:f,sizes:y,alt:_,minDelta:b,maxDelta:v,snapBefore:m,snapAfter:E}=this.sashDragState;this.sashDragState.current=l;const I=l-f,k=this.resize(h,I,y,void 0,void 0,b,v,m,E);if(_){const M=h===this.sashItems.length-1,P=this.viewItems.map(B=>B.size),F=M?h:h+1,R=this.viewItems[F],A=R.size-R.maximumSize,O=R.size-R.minimumSize,L=M?h-1:h+1;this.resize(L,-k,P,void 0,void 0,A,O)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(l){this._onDidSashChange.fire(l),this.sashDragState.disposable.dispose(),this.saveProportions();for(const h of this.viewItems)h.enabled=!0}onViewChange(l,h){const f=this.viewItems.indexOf(l);f<0||f>=this.viewItems.length||(h=typeof h=="number"?h:l.size,h=(0,n.clamp)(h,l.minimumSize,l.maximumSize),this.inverseAltBehavior&&f>0?(this.resize(f-1,Math.floor((l.size-h)/2)),this.distributeEmptySpace(),this.layoutViews()):(l.size=h,this.relayout([f],void 0)))}resizeView(l,h){if(this.state!==a.Idle)throw new Error("Cant modify splitview");if(this.state=a.Busy,l<0||l>=this.viewItems.length)return;const f=(0,D.range)(this.viewItems.length).filter(v=>v!==l),y=[...f.filter(v=>this.viewItems[v].priority===1),l],_=f.filter(v=>this.viewItems[v].priority===2),b=this.viewItems[l];h=Math.round(h),h=(0,n.clamp)(h,b.minimumSize,Math.min(b.maximumSize,this.size)),b.size=h,this.relayout(y,_),this.state=a.Idle}distributeViewSizes(){const l=[];let h=0;for(const v of this.viewItems)v.maximumSize-v.minimumSize>0&&(l.push(v),h+=v.size);const f=Math.floor(h/l.length);for(const v of l)v.size=(0,n.clamp)(f,v.minimumSize,v.maximumSize);const y=(0,D.range)(this.viewItems.length),_=y.filter(v=>this.viewItems[v].priority===1),b=y.filter(v=>this.viewItems[v].priority===2);this.relayout(_,b)}getViewSize(l){return l<0||l>=this.viewItems.length?-1:this.viewItems[l].size}doAddView(l,h,f=this.viewItems.length,y){if(this.state!==a.Idle)throw new Error("Cant modify splitview");this.state=a.Busy;const _=(0,w.$)(".split-view-view");f===this.viewItems.length?this.viewContainer.appendChild(_):this.viewContainer.insertBefore(_,this.viewContainer.children.item(f));const b=l.onDidChange(M=>this.onViewChange(I,M)),v=(0,C.toDisposable)(()=>this.viewContainer.removeChild(_)),m=(0,C.combinedDisposable)(b,v);let E;typeof h=="number"?E=h:h.type==="split"?E=this.getViewSize(h.index)/2:h.type==="invisible"?E={cachedVisibleSize:h.cachedVisibleSize}:E=l.minimumSize;const I=this.orientation===0?new u(_,l,E,m):new d(_,l,E,m);if(this.viewItems.splice(f,0,I),this.viewItems.length>1){let M={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash};const P=this.orientation===0?new N.Sash(this.sashContainer,{getHorizontalSashTop:X=>this.getSashPosition(X),getHorizontalSashWidth:this.getSashOrthogonalSize},Object.assign(Object.assign({},M),{orientation:1})):new N.Sash(this.sashContainer,{getVerticalSashLeft:X=>this.getSashPosition(X),getVerticalSashHeight:this.getSashOrthogonalSize},Object.assign(Object.assign({},M),{orientation:0})),F=this.orientation===0?X=>({sash:P,start:X.startY,current:X.currentY,alt:X.altKey}):X=>({sash:P,start:X.startX,current:X.currentX,alt:X.altKey}),A=p.Event.map(P.onDidStart,F)(this.onSashStart,this),L=p.Event.map(P.onDidChange,F)(this.onSashChange,this),W=p.Event.map(P.onDidEnd,()=>this.sashItems.findIndex(X=>X.sash===P))(this.onSashEnd,this),K=P.onDidReset(()=>{const X=this.sashItems.findIndex(x=>x.sash===P),Z=(0,D.range)(X,-1),se=(0,D.range)(X+1,this.viewItems.length),oe=this.findFirstSnapIndex(Z),G=this.findFirstSnapIndex(se);typeof oe=="number"&&!this.viewItems[oe].visible||typeof G=="number"&&!this.viewItems[G].visible||this._onDidSashReset.fire(X)}),H=(0,C.combinedDisposable)(A,L,W,K,P),Y={sash:P,disposable:H};this.sashItems.splice(f-1,0,Y)}_.appendChild(l.element);let k;typeof h!="number"&&h.type==="split"&&(k=[h.index]),y||this.relayout([f],k),this.state=a.Idle,!y&&typeof h!="number"&&h.type==="distribute"&&this.distributeViewSizes()}relayout(l,h){const f=this.viewItems.reduce((y,_)=>y+_.size,0);this.resize(this.viewItems.length-1,this.size-f,void 0,l,h),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(l,h,f=this.viewItems.map(I=>I.size),y,_,b=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,m,E){if(l<0||l>=this.viewItems.length)return 0;const I=(0,D.range)(l,-1),k=(0,D.range)(l+1,this.viewItems.length);if(_)for(const Y of _)(0,D.pushToStart)(I,Y),(0,D.pushToStart)(k,Y);if(y)for(const Y of y)(0,D.pushToEnd)(I,Y),(0,D.pushToEnd)(k,Y);const M=I.map(Y=>this.viewItems[Y]),P=I.map(Y=>f[Y]),F=k.map(Y=>this.viewItems[Y]),R=k.map(Y=>f[Y]),A=I.reduce((Y,X)=>Y+(this.viewItems[X].minimumSize-f[X]),0),O=I.reduce((Y,X)=>Y+(this.viewItems[X].maximumSize-f[X]),0),L=k.length===0?Number.POSITIVE_INFINITY:k.reduce((Y,X)=>Y+(f[X]-this.viewItems[X].minimumSize),0),B=k.length===0?Number.NEGATIVE_INFINITY:k.reduce((Y,X)=>Y+(f[X]-this.viewItems[X].maximumSize),0),W=Math.max(A,B,b),K=Math.min(L,O,v);let H=!1;if(m){const Y=this.viewItems[m.index],X=h>=m.limitDelta;H=X!==Y.visible,Y.setVisible(X,m.size)}if(!H&&E){const Y=this.viewItems[E.index],X=h v+m.size,0);let f=this.size-h;const y=(0,D.range)(this.viewItems.length-1,-1),_=y.filter(v=>this.viewItems[v].priority===1),b=y.filter(v=>this.viewItems[v].priority===2);for(const v of b)(0,D.pushToStart)(y,v);for(const v of _)(0,D.pushToEnd)(y,v);typeof l=="number"&&(0,D.pushToEnd)(y,l);for(let v=0;f!==0&&v h+f.size,0);let l=0;for(const h of this.viewItems)h.layout(l,this.layoutContext),l+=h.size;this.sashItems.forEach(h=>h.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this.contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this.contentSize})}updateSashEnablement(){let l=!1;const h=this.viewItems.map(m=>l=m.size-m.minimumSize>0||l);l=!1;const f=this.viewItems.map(m=>l=m.maximumSize-m.size>0||l),y=[...this.viewItems].reverse();l=!1;const _=y.map(m=>l=m.size-m.minimumSize>0||l).reverse();l=!1;const b=y.map(m=>l=m.maximumSize-m.size>0||l).reverse();let v=0;for(let m=0;m 0||this.startSnappingEnabled)?E.state=1:L&&h[m]&&(v 0)return;if(!f.visible&&f.snap)return h}}dispose(){super.dispose(),this.viewItems.forEach(l=>l.dispose()),this.viewItems=[],this.sashItems.forEach(l=>l.disposable.dispose()),this.sashItems=[]}}e.SplitView=o}),define(J[333],ee([12]),{}),define(J[334],ee([0,1,7,111,221,4,333]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Table=void 0;class S{constructor(t,s,c){this.columns=t,this.getColumnSize=c,this.templateId=S.TemplateId,this.renderedTemplates=new Set;const u=new Map(s.map(d=>[d.templateId,d]));this.renderers=[];for(const d of t){const a=u.get(d.templateId);if(!a)throw new Error(`Table cell renderer for template id ${d.templateId} not found.`);this.renderers.push(a)}}renderTemplate(t){const s=(0,w.append)(t,(0,w.$)(".monaco-table-tr")),c=[],u=[];for(let a=0;a new C(l,h)),o={size:r.reduce((l,h)=>l+h.column.weight,0),views:r.map(l=>({size:l.column.weight,view:l}))};this.splitview=new T.SplitView(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:o}),this.splitview.el.style.height=`${c.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${c.headerRowHeight}px`;const i=new S(u,d,l=>this.splitview.getViewSize(l));this.list=new N.List(t,this.domNode,p(c),[i],a),this.columnLayoutDisposable=D.Event.any(...r.map(l=>l.onDidLayout))(([l,h])=>i.layoutColumn(l,h)),this.styleElement=(0,w.createStyleSheet)(this.domNode),this.style({})}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onMouseDblClick(){return this.list.onMouseDblClick}get onPointer(){return this.list.onPointer}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}updateOptions(t){this.list.updateOptions(t)}splice(t,s,c=[]){this.list.splice(t,s,c)}getHTMLElement(){return this.domNode}style(t){const s=[];s.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before { + top: ${this.virtualDelegate.headerRowHeight+1}px; + height: calc(100% - ${this.virtualDelegate.headerRowHeight}px); + }`),this.styleElement.textContent=s.join(` +`),this.list.style(t)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.splitview.dispose(),this.list.dispose(),this.columnLayoutDisposable.dispose()}}e.Table=n,n.InstanceCount=0}),define(J[335],ee([12]),{}),define(J[138],ee([12]),{}),define(J[222],ee([0,1,7,131,138]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getIconClass=void 0;const T={},D=new N.IdGenerator("quick-input-button-icon-");function S(p){if(!p)return;let C;const n=p.dark.toString();return T[n]?C=T[n]:(C=D.nextId(),w.createCSSRule(`.${C}`,`background-image: ${w.asCSSUrl(p.light||p.dark)}`),w.createCSSRule(`.vs-dark .${C}, .hc-black .${C}`,`background-image: ${w.asCSSUrl(p.dark)}`),T[n]=C),C}e.getIconClass=S}),define(J[336],ee([12]),{}),define(J[337],ee([12]),{}),define(J[338],ee([12]),{}),define(J[339],ee([12]),{}),define(J[340],ee([12]),{}),define(J[341],ee([12]),{}),define(J[342],ee([12]),{}),define(J[343],ee([12]),{}),define(J[344],ee([12]),{}),define(J[345],ee([12]),{}),define(J[346],ee([12]),{}),define(J[347],ee([12]),{}),define(J[348],ee([12]),{}),define(J[349],ee([12]),{}),define(J[350],ee([12]),{}),define(J[351],ee([12]),{}),define(J[352],ee([12]),{}),define(J[353],ee([12]),{}),define(J[354],ee([12]),{}),define(J[355],ee([12]),{}),define(J[356],ee([12]),{}),define(J[357],ee([12]),{}),define(J[358],ee([12]),{}),define(J[359],ee([12]),{}),define(J[360],ee([12]),{}),define(J[361],ee([12]),{}),define(J[362],ee([12]),{}),define(J[363],ee([12]),{}),define(J[364],ee([12]),{}),define(J[365],ee([12]),{}),define(J[366],ee([12]),{}),define(J[367],ee([12]),{}),define(J[368],ee([12]),{}),define(J[369],ee([12]),{}),define(J[370],ee([12]),{}),define(J[371],ee([12]),{}),define(J[372],ee([12]),{}),define(J[373],ee([12]),{}),define(J[374],ee([12]),{}),define(J[375],ee([12]),{}),define(J[376],ee([12]),{}),define(J[377],ee([12]),{}),define(J[378],ee([12]),{}),define(J[379],ee([12]),{}),define(J[380],ee([12]),{}),define(J[223],ee([0,1,2]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ElementSizeObserver=void 0;class N extends w.Disposable{constructor(D,S,p){super();this.referenceDomElement=D,this.changeCallback=p,this.width=-1,this.height=-1,this.resizeObserver=null,this.measureReferenceDomElementToken=-1,this.measureReferenceDomElement(!1,S)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this.width}getHeight(){return this.height}startObserving(){typeof ResizeObserver!="undefined"?!this.resizeObserver&&this.referenceDomElement&&(this.resizeObserver=new ResizeObserver(D=>{D&&D[0]&&D[0].contentRect?this.observe({width:D[0].contentRect.width,height:D[0].contentRect.height}):this.observe()}),this.resizeObserver.observe(this.referenceDomElement)):this.measureReferenceDomElementToken===-1&&(this.measureReferenceDomElementToken=setInterval(()=>this.observe(),100))}stopObserving(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.measureReferenceDomElementToken!==-1&&(clearInterval(this.measureReferenceDomElementToken),this.measureReferenceDomElementToken=-1)}observe(D){this.measureReferenceDomElement(!0,D)}measureReferenceDomElement(D,S){let p=0,C=0;S?(p=S.width,C=S.height):this.referenceDomElement&&(p=this.referenceDomElement.clientWidth,C=this.referenceDomElement.clientHeight),p=Math.max(5,p),C=Math.max(5,C),(this.width!==p||this.height!==C)&&(this.width=p,this.height=C,D&&this.changeCallback())}}e.ElementSizeObserver=N}),define(J[172],ee([0,1,7,96,56,2]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalEditorMouseMoveMonitor=e.EditorPointerEventFactory=e.EditorMouseEventFactory=e.EditorMouseEvent=e.createEditorPagePosition=e.EditorPagePosition=e.ClientCoordinates=e.PageCoordinates=void 0;class S{constructor(d,a){this.x=d,this.y=a,this._pageCoordinatesBrand=void 0}toClientCoordinates(){return new p(this.x-w.StandardWindow.scrollX,this.y-w.StandardWindow.scrollY)}}e.PageCoordinates=S;class p{constructor(d,a){this.clientX=d,this.clientY=a,this._clientCoordinatesBrand=void 0}toPageCoordinates(){return new S(this.clientX+w.StandardWindow.scrollX,this.clientY+w.StandardWindow.scrollY)}}e.ClientCoordinates=p;class C{constructor(d,a,r,o){this.x=d,this.y=a,this.width=r,this.height=o,this._editorPagePositionBrand=void 0}}e.EditorPagePosition=C;function n(u){const d=w.getDomNodePagePosition(u);return new C(d.left,d.top,d.width,d.height)}e.createEditorPagePosition=n;class g extends T.StandardMouseEvent{constructor(d,a){super(d);this._editorMouseEventBrand=void 0,this.pos=new S(this.posx,this.posy),this.editorPos=n(a)}}e.EditorMouseEvent=g;class t{constructor(d){this._editorViewDomNode=d}_create(d){return new g(d,this._editorViewDomNode)}onContextMenu(d,a){return w.addDisposableListener(d,"contextmenu",r=>{a(this._create(r))})}onMouseUp(d,a){return w.addDisposableListener(d,"mouseup",r=>{a(this._create(r))})}onMouseDown(d,a){return w.addDisposableListener(d,"mousedown",r=>{a(this._create(r))})}onMouseLeave(d,a){return w.addDisposableNonBubblingMouseOutListener(d,r=>{a(this._create(r))})}onMouseMoveThrottled(d,a,r,o){const i=(l,h)=>r(l,this._create(h));return w.addDisposableThrottledListener(d,"mousemove",a,i,o)}}e.EditorMouseEventFactory=t;class s{constructor(d){this._editorViewDomNode=d}_create(d){return new g(d,this._editorViewDomNode)}onPointerUp(d,a){return w.addDisposableListener(d,"pointerup",r=>{a(this._create(r))})}onPointerDown(d,a){return w.addDisposableListener(d,"pointerdown",r=>{a(this._create(r))})}onPointerLeave(d,a){return w.addDisposableNonBubblingPointerOutListener(d,r=>{a(this._create(r))})}onPointerMoveThrottled(d,a,r,o){const i=(l,h)=>r(l,this._create(h));return w.addDisposableThrottledListener(d,"pointermove",a,i,o)}}e.EditorPointerEventFactory=s;class c extends D.Disposable{constructor(d){super();this._editorViewDomNode=d,this._globalMouseMoveMonitor=this._register(new N.GlobalMouseMoveMonitor),this._keydownListener=null}startMonitoring(d,a,r,o,i){this._keydownListener=w.addStandardDisposableListener(document,"keydown",h=>{h.toKeybinding().isModifierKey()||this._globalMouseMoveMonitor.stopMonitoring(!0,h.browserEvent)},!0);const l=(h,f)=>r(h,new g(f,this._editorViewDomNode));this._globalMouseMoveMonitor.startMonitoring(d,a,l,o,h=>{this._keydownListener.dispose(),i(h)})}stopMonitoring(){this._globalMouseMoveMonitor.stopMonitoring(!0)}}e.GlobalEditorMouseMoveMonitor=c}),define(J[381],ee([0,1,4,2]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractCodeEditorService=void 0;class T extends N.Disposable{constructor(){super();this._onCodeEditorAdd=this._register(new w.Emitter),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new w.Emitter),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onDiffEditorAdd=this._register(new w.Emitter),this._onDiffEditorRemove=this._register(new w.Emitter),this._onDecorationTypeRegistered=this._register(new w.Emitter),this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null)}addCodeEditor(S){this._codeEditors[S.getId()]=S,this._onCodeEditorAdd.fire(S)}removeCodeEditor(S){delete this._codeEditors[S.getId()]&&this._onCodeEditorRemove.fire(S)}listCodeEditors(){return Object.keys(this._codeEditors).map(S=>this._codeEditors[S])}addDiffEditor(S){this._diffEditors[S.getId()]=S,this._onDiffEditorAdd.fire(S)}removeDiffEditor(S){delete this._diffEditors[S.getId()]&&this._onDiffEditorRemove.fire(S)}listDiffEditors(){return Object.keys(this._diffEditors).map(S=>this._diffEditors[S])}getFocusedCodeEditor(){let S=null;const p=this.listCodeEditors();for(const C of p){if(C.hasTextFocus())return C;C.hasWidgetFocus()&&(S=C)}return S}setModelProperty(S,p,C){const n=S.toString();let g;this._modelProperties.has(n)?g=this._modelProperties.get(n):(g=new Map,this._modelProperties.set(n,g)),g.set(p,C)}getModelProperty(S,p){const C=S.toString();if(this._modelProperties.has(C))return this._modelProperties.get(C).get(p)}}e.AbstractCodeEditorService=T}),define(J[224],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCharIndex=e.allCharCodes=void 0,e.allCharCodes=(()=>{const N=[];for(let T=32;T<=126;T++)N.push(T);return N.push(65533),N})();const w=(N,T)=>(N-=32,N<0||N>96?T<=2?(N+96)%96:96-1:N);e.getCharIndex=w}),define(J[382],ee([0,1,224,135]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MinimapCharRenderer=void 0;class T{constructor(S,p){this.scale=p,this._minimapCharRendererBrand=void 0,this.charDataNormal=T.soften(S,12/15),this.charDataLight=T.soften(S,50/60)}static soften(S,p){let C=new Uint8ClampedArray(S.length);for(let n=0,g=S.length;n S.width||C+i>S.height){console.warn("bad render request outside image data");return}const l=d?this.charDataLight:this.charDataNormal,h=(0,w.getCharIndex)(n,u),f=S.width*4,y=s.r,_=s.g,b=s.b,v=g.r-y,m=g.g-_,E=g.b-b,I=Math.max(t,c),k=S.data;let M=h*r*o,P=C*f+p*4;for(let F=0;FS.width||C+a>S.height){console.warn("bad render request outside image data");return}const r=S.width*4,o=.5*(g/255),i=t.r,l=t.g,h=t.b,f=n.r-i,y=n.g-l,_=n.b-h,b=i+f*o,v=l+y*o,m=h+_*o,E=Math.max(g,s),I=S.data;let k=C*r+p*4;for(let M=0;M{const S=new Uint8ClampedArray(D.length/2);for(let p=0;p >1]=N[D[p]]<<4|N[D[p+1]]&15;return S};e.prebakedMiniMaps={1:(0,w.once)(()=>T("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:(0,w.once)(()=>T("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))}}),define(J[384],ee([0,1,382,224,383,135]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MinimapCharRendererFactory=void 0;class S{static create(C,n){if(this.lastCreated&&C===this.lastCreated.scale&&n===this.lastFontFamily)return this.lastCreated;let g;return T.prebakedMiniMaps[C]?g=new w.MinimapCharRenderer(T.prebakedMiniMaps[C](),C):g=S.createFromSampleData(S.createSampleData(n).data,C),this.lastFontFamily=n,this.lastCreated=g,g}static createSampleData(C){const n=document.createElement("canvas"),g=n.getContext("2d");n.style.height=`${16}px`,n.height=16,n.width=96*10,n.style.width=96*10+"px",g.fillStyle="#ffffff",g.font=`bold ${16}px ${C}`,g.textBaseline="middle";let t=0;for(const s of N.allCharCodes)g.fillText(String.fromCharCode(s),t,16/2),t+=10;return g.getImageData(0,0,96*10,16)}static createFromSampleData(C,n){const g=16*10*4*96;if(C.length!==g)throw new Error("Unexpected source in MinimapCharRenderer");let t=S._downsample(C,n);return new w.MinimapCharRenderer(t,n)}static _downsampleChar(C,n,g,t,s){const c=1*s,u=2*s;let d=t,a=0;for(let r=0;r0){const a=255/d;for(let r=0;r =65536?2:1,s===9)g=N.nextRenderTabStop(g,p);else{let c=w.getGraphemeBreakType(s);for(;t =65536?2:1,c=d}w.isFullWidthCharacter(s)||w.isEmojiImprecise(s)?g=g+2:g=g+1}}return g}static visibleColumnsByColumns(D,S){const p=D.length;let C=new Array;C.push(-1);let n=0,g=0;for(;g =65536?2:1,C.push(n),t>=65536&&C.push(n),t===9)n=N.nextRenderTabStop(n,S);else{let s=w.getGraphemeBreakType(t);for(;g
=65536?2:1,C.push(n),t>=65536&&C.push(n),s=u}w.isFullWidthCharacter(t)||w.isEmojiImprecise(t)?n=n+2:n=n+1}}return C.push(n),C}static visibleColumnFromColumn2(D,S,p){return this.visibleColumnFromColumn(S.getLineContent(p.lineNumber),p.column,D.tabSize)}static columnFromVisibleColumn(D,S,p){if(S<=0)return 1;const C=D.length;let n=0,g=1,t=0;for(;t
=65536?2:1;let c;if(s===9)c=N.nextRenderTabStop(n,p);else{let d=w.getGraphemeBreakType(s);for(;t =65536?2:1,d=r}w.isFullWidthCharacter(s)||w.isEmojiImprecise(s)?c=n+2:c=n+1}const u=t+1;if(c>=S){const d=S-n;return c-S t?t:n}static nextRenderTabStop(D,S){return D+S-D%S}static nextIndentTabStop(D,S){return D+S-D%S}static prevRenderTabStop(D,S){return Math.max(0,D-1-(D-1)%S)}static prevIndentTabStop(D,S){return Math.max(0,D-1-(D-1)%S)}}e.CursorColumns=N}),define(J[97],ee([0,1,135]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CharacterSet=e.CharacterClassifier=void 0;class N{constructor(S){let p=(0,w.toUint8)(S);this._defaultValue=p,this._asciiMap=N._createAsciiMap(p),this._map=new Map}static _createAsciiMap(S){let p=new Uint8Array(256);for(let C=0;C<256;C++)p[C]=S;return p}set(S,p){let C=(0,w.toUint8)(p);S>=0&&S<256?this._asciiMap[S]=C:this._map.set(S,C)}get(S){return S>=0&&S<256?this._asciiMap[S]:this._map.get(S)||this._defaultValue}}e.CharacterClassifier=N;class T{constructor(){this._actual=new N(0)}add(S){this._actual.set(S,1)}has(S){return this._actual.get(S)===1}}e.CharacterSet=T}),define(J[112],ee([0,1,97]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getMapForWordSeparators=e.WordCharacterClassifier=void 0;class N extends w.CharacterClassifier{constructor(S){super(0);for(let p=0,C=S.length;p (S.hasOwnProperty(p)||(S[p]=D(p)),S[p])}e.getMapForWordSeparators=T(D=>new N(D))}),define(J[13],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Position=void 0;class w{constructor(T,D){this.lineNumber=T,this.column=D}with(T=this.lineNumber,D=this.column){return T===this.lineNumber&&D===this.column?this:new w(T,D)}delta(T=0,D=0){return this.with(this.lineNumber+T,this.column+D)}equals(T){return w.equals(this,T)}static equals(T,D){return!T&&!D?!0:!!T&&!!D&&T.lineNumber===D.lineNumber&&T.column===D.column}isBefore(T){return w.isBefore(this,T)}static isBefore(T,D){return T.lineNumber p||D===p&&S>C?(this.startLineNumber=p,this.startColumn=C,this.endLineNumber=D,this.endColumn=S):(this.startLineNumber=D,this.startColumn=S,this.endLineNumber=p,this.endColumn=C)}isEmpty(){return N.isEmpty(this)}static isEmpty(D){return D.startLineNumber===D.endLineNumber&&D.startColumn===D.endColumn}containsPosition(D){return N.containsPosition(this,D)}static containsPosition(D,S){return!(S.lineNumber D.endLineNumber||S.lineNumber===D.startLineNumber&&S.column D.endColumn)}containsRange(D){return N.containsRange(this,D)}static containsRange(D,S){return!(S.startLineNumber D.endLineNumber||S.endLineNumber>D.endLineNumber||S.startLineNumber===D.startLineNumber&&S.startColumn D.endColumn)}strictContainsRange(D){return N.strictContainsRange(this,D)}static strictContainsRange(D,S){return!(S.startLineNumber D.endLineNumber||S.endLineNumber>D.endLineNumber||S.startLineNumber===D.startLineNumber&&S.startColumn<=D.startColumn||S.endLineNumber===D.endLineNumber&&S.endColumn>=D.endColumn)}plusRange(D){return N.plusRange(this,D)}static plusRange(D,S){let p,C,n,g;return S.startLineNumber D.endLineNumber?(n=S.endLineNumber,g=S.endColumn):S.endLineNumber===D.endLineNumber?(n=S.endLineNumber,g=Math.max(S.endColumn,D.endColumn)):(n=D.endLineNumber,g=D.endColumn),new N(p,C,n,g)}intersectRanges(D){return N.intersectRanges(this,D)}static intersectRanges(D,S){let p=D.startLineNumber,C=D.startColumn,n=D.endLineNumber,g=D.endColumn,t=S.startLineNumber,s=S.startColumn,c=S.endLineNumber,u=S.endColumn;return p c?(n=c,g=u):n===c&&(g=Math.min(g,u)),p>n||p===n&&C>g?null:new N(p,C,n,g)}equalsRange(D){return N.equalsRange(this,D)}static equalsRange(D,S){return!!D&&!!S&&D.startLineNumber===S.startLineNumber&&D.startColumn===S.startColumn&&D.endLineNumber===S.endLineNumber&&D.endColumn===S.endColumn}getEndPosition(){return N.getEndPosition(this)}static getEndPosition(D){return new w.Position(D.endLineNumber,D.endColumn)}getStartPosition(){return N.getStartPosition(this)}static getStartPosition(D){return new w.Position(D.startLineNumber,D.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(D,S){return new N(this.startLineNumber,this.startColumn,D,S)}setStartPosition(D,S){return new N(D,S,this.endLineNumber,this.endColumn)}collapseToStart(){return N.collapseToStart(this)}static collapseToStart(D){return new N(D.startLineNumber,D.startColumn,D.startLineNumber,D.startColumn)}static fromPositions(D,S=D){return new N(D.lineNumber,D.column,S.lineNumber,S.column)}static lift(D){return D?new N(D.startLineNumber,D.startColumn,D.endLineNumber,D.endColumn):null}static isIRange(D){return D&&typeof D.startLineNumber=="number"&&typeof D.startColumn=="number"&&typeof D.endLineNumber=="number"&&typeof D.endColumn=="number"}static areIntersectingOrTouching(D,S){return!(D.endLineNumber D.startLineNumber}}e.Range=N}),define(J[225],ee([0,1,8,13,3]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PagedScreenReaderStrategy=e.TextAreaState=e._debugComposition=void 0,e._debugComposition=!1;class D{constructor(C,n,g,t,s){this.value=C,this.selectionStart=n,this.selectionEnd=g,this.selectionStartPosition=t,this.selectionEndPosition=s}toString(){return"[ <"+this.value+">, selectionStart: "+this.selectionStart+", selectionEnd: "+this.selectionEnd+"]"}static readFromTextArea(C){return new D(C.getValue(),C.getSelectionStart(),C.getSelectionEnd(),null,null)}collapseSelection(){return new D(this.value,this.value.length,this.value.length,null,null)}writeToTextArea(C,n,g){e._debugComposition&&console.log("writeToTextArea "+C+": "+this.toString()),n.setValue(C,this.value),g&&n.setSelectionRange(C,this.selectionStart,this.selectionEnd)}deduceEditorPosition(C){if(C<=this.selectionStart){const t=this.value.substring(C,this.selectionStart);return this._finishDeduceEditorPosition(this.selectionStartPosition,t,-1)}if(C>=this.selectionEnd){const t=this.value.substring(this.selectionEnd,C);return this._finishDeduceEditorPosition(this.selectionEndPosition,t,1)}const n=this.value.substring(this.selectionStart,C);if(n.indexOf(String.fromCharCode(8230))===-1)return this._finishDeduceEditorPosition(this.selectionStartPosition,n,1);const g=this.value.substring(C,this.selectionEnd);return this._finishDeduceEditorPosition(this.selectionEndPosition,g,-1)}_finishDeduceEditorPosition(C,n,g){let t=0,s=-1;for(;(s=n.indexOf(` +`,s+1))!==-1;)t++;return[C,g*n.length,t]}static selectedText(C){return new D(C,0,C.length,null,null)}static deduceInput(C,n,g){if(!C)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};e._debugComposition&&(console.log("------------------------deduceInput"),console.log("PREVIOUS STATE: "+C.toString()),console.log("CURRENT STATE: "+n.toString()));let t=C.value,s=C.selectionStart,c=C.selectionEnd,u=n.value,d=n.selectionStart,a=n.selectionEnd;const r=t.substring(c),o=u.substring(a),i=w.commonSuffixLength(r,o);u=u.substring(0,u.length-i),t=t.substring(0,t.length-i);const l=t.substring(0,s),h=u.substring(0,d),f=w.commonPrefixLength(l,h);if(u=u.substring(f),t=t.substring(f),d-=f,s-=f,a-=f,c-=f,e._debugComposition&&(console.log("AFTER DIFFING PREVIOUS STATE: <"+t+">, selectionStart: "+s+", selectionEnd: "+c),console.log("AFTER DIFFING CURRENT STATE: <"+u+">, selectionStart: "+d+", selectionEnd: "+a)),g&&d===a&&t.length>0){let _=null;if(d===u.length?u.startsWith(t)&&(_=u.substring(t.length)):u.endsWith(t)&&(_=u.substring(0,u.length-t.length)),_!==null&&_.length>0&&(/\uFE0F/.test(_)||w.containsEmoji(_)))return{text:_,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0}}if(d===a){if(t===u&&s===0&&c===t.length&&d===u.length&&u.indexOf(` +`)===-1&&w.containsFullWidthCharacter(u))return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};const _=l.length-f;return e._debugComposition&&console.log("REMOVE PREVIOUS: "+(l.length-f)+" chars"),{text:u,replacePrevCharCnt:_,replaceNextCharCnt:0,positionDelta:0}}const y=c-s;return{text:u,replacePrevCharCnt:y,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(C,n){if(!C)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(e._debugComposition&&(console.log("------------------------deduceAndroidCompositionInput"),console.log("PREVIOUS STATE: "+C.toString()),console.log("CURRENT STATE: "+n.toString())),C.value===n.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:n.selectionEnd-C.selectionEnd};const g=Math.min(w.commonPrefixLength(C.value,n.value),C.selectionEnd),t=Math.min(w.commonSuffixLength(C.value,n.value),C.value.length-C.selectionEnd),s=C.value.substring(g,C.value.length-t),c=n.value.substring(g,n.value.length-t),u=C.selectionStart-g,d=C.selectionEnd-g,a=n.selectionStart-g,r=n.selectionEnd-g;return e._debugComposition&&(console.log("AFTER DIFFING PREVIOUS STATE: <"+s+">, selectionStart: "+u+", selectionEnd: "+d),console.log("AFTER DIFFING CURRENT STATE: <"+c+">, selectionStart: "+a+", selectionEnd: "+r)),{text:c,replacePrevCharCnt:d,replaceNextCharCnt:s.length-d,positionDelta:r-c.length}}}e.TextAreaState=D,D.EMPTY=new D("",0,0,null,null);class S{static _getPageOfLine(C,n){return Math.floor((C-1)/n)}static _getRangeForPage(C,n){const g=C*n,t=g+1,s=g+n;return new T.Range(t,1,s+1,1)}static fromEditorSelection(C,n,g,t,s){const c=S._getPageOfLine(g.startLineNumber,t),u=S._getRangeForPage(c,t),d=S._getPageOfLine(g.endLineNumber,t),a=S._getRangeForPage(d,t),r=u.intersectRanges(new T.Range(1,1,g.startLineNumber,g.startColumn));let o=n.getValueInRange(r,1);const i=n.getLineCount(),l=n.getLineMaxColumn(i),h=a.intersectRanges(new T.Range(g.endLineNumber,g.endColumn,i,l));let f=n.getValueInRange(h,1),y;if(c===d||c+1===d)y=n.getValueInRange(g,1);else{const _=u.intersectRanges(g),b=a.intersectRanges(g);y=n.getValueInRange(_,1)+String.fromCharCode(8230)+n.getValueInRange(b,1)}if(s){const _=500;o.length>_&&(o=o.substring(o.length-_,o.length)),f.length>_&&(f=f.substring(0,_)),y.length>2*_&&(y=y.substring(0,_)+String.fromCharCode(8230)+y.substring(y.length-_,y.length))}return new D(o+y+f,o.length,o.length+y.length,new N.Position(g.startLineNumber,g.startColumn),new N.Position(g.endLineNumber,g.endColumn))}}e.PagedScreenReaderStrategy=S}),define(J[226],ee([0,1,206,4,2,38,3]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiffNavigator=void 0;const p={followsCaret:!0,ignoreCharChanges:!0,alwaysRevealFirst:!0};class C extends T.Disposable{constructor(g,t={}){super();this._onDidUpdate=this._register(new N.Emitter),this._editor=g,this._options=D.mixin(t,p,!1),this.disposed=!1,this.nextIdx=-1,this.ranges=[],this.ignoreSelectionChange=!1,this.revealFirst=Boolean(this._options.alwaysRevealFirst),this._register(this._editor.onDidDispose(()=>this.dispose())),this._register(this._editor.onDidUpdateDiff(()=>this._onDiffUpdated())),this._options.followsCaret&&this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition(s=>{this.ignoreSelectionChange||(this.nextIdx=-1)})),this._options.alwaysRevealFirst&&this._register(this._editor.getModifiedEditor().onDidChangeModel(s=>{this.revealFirst=!0})),this._init()}_init(){!!this._editor.getLineChanges()}_onDiffUpdated(){this._init(),this._compute(this._editor.getLineChanges()),this.revealFirst&&this._editor.getLineChanges()!==null&&(this.revealFirst=!1,this.nextIdx=-1,this.next(1))}_compute(g){this.ranges=[],g&&g.forEach(t=>{!this._options.ignoreCharChanges&&t.charChanges?t.charChanges.forEach(s=>{this.ranges.push({rhs:!0,range:new S.Range(s.modifiedStartLineNumber,s.modifiedStartColumn,s.modifiedEndLineNumber,s.modifiedEndColumn)})}):t.modifiedEndLineNumber===0?this.ranges.push({rhs:!0,range:new S.Range(t.modifiedStartLineNumber,1,t.modifiedStartLineNumber+1,1)}):this.ranges.push({rhs:!0,range:new S.Range(t.modifiedStartLineNumber,1,t.modifiedEndLineNumber+1,1)})}),this.ranges.sort((t,s)=>S.Range.compareRangesUsingStarts(t.range,s.range)),this._onDidUpdate.fire(this)}_initIdx(g){let t=!1,s=this._editor.getPosition();if(!s){this.nextIdx=0;return}for(let c=0,u=this.ranges.length;c=this.ranges.length&&(this.nextIdx=0)):(this.nextIdx-=1,this.nextIdx<0&&(this.nextIdx=this.ranges.length-1));let s=this.ranges[this.nextIdx];this.ignoreSelectionChange=!0;try{let c=s.range.getStartPosition();this._editor.setPosition(c),this._editor.revealRangeInCenter(s.range,t)}finally{this.ignoreSelectionChange=!1}}canNavigate(){return this.ranges&&this.ranges.length>0}next(g=0){this._move(!0,g)}previous(g=0){this._move(!1,g)}dispose(){super.dispose(),this.ranges=[],this.disposed=!0}}e.DiffNavigator=C}),define(J[59],ee([0,1,3]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EditOperation=void 0;class N{static insert(D,S){return{range:new w.Range(D.lineNumber,D.column,D.lineNumber,D.column),text:S,forceMoveMarkers:!0}}static delete(D){return{range:D,text:null}}static replace(D,S){return{range:D,text:S}}static replaceMove(D,S){return{range:D,text:S,forceMoveMarkers:!0}}}e.EditOperation=N}),define(J[385],ee([0,1,8,59,3]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.trimTrailingWhitespace=e.TrimTrailingWhitespaceCommand=void 0;class D{constructor(C,n){this._selection=C,this._cursors=n,this._selectionId=null}getEditOperations(C,n){let g=S(C,this._cursors);for(let t=0,s=g.length;t c.lineNumber===u.lineNumber?c.column-u.column:c.lineNumber-u.lineNumber);for(let c=C.length-2;c>=0;c--)C[c].lineNumber===C[c+1].lineNumber&&C.splice(c,1);let n=[],g=0,t=0,s=C.length;for(let c=1,u=p.getLineCount();c<=u;c++){let d=p.getLineContent(c),a=d.length+1,r=0;if(t255?255:T|0}}e.RGBA8=w,w.Empty=new w(0,0,0,0)}),define(J[22],ee([0,1,13,3]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Selection=void 0;class T extends N.Range{constructor(S,p,C,n){super(S,p,C,n);this.selectionStartLineNumber=S,this.selectionStartColumn=p,this.positionLineNumber=C,this.positionColumn=n}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(S){return T.selectionsEqual(this,S)}static selectionsEqual(S,p){return S.selectionStartLineNumber===p.selectionStartLineNumber&&S.selectionStartColumn===p.selectionStartColumn&&S.positionLineNumber===p.positionLineNumber&&S.positionColumn===p.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(S,p){return this.getDirection()===0?new T(this.startLineNumber,this.startColumn,S,p):new T(S,p,this.startLineNumber,this.startColumn)}getPosition(){return new w.Position(this.positionLineNumber,this.positionColumn)}setStartPosition(S,p){return this.getDirection()===0?new T(S,p,this.endLineNumber,this.endColumn):new T(this.endLineNumber,this.endColumn,S,p)}static fromPositions(S,p=S){return new T(S.lineNumber,S.column,p.lineNumber,p.column)}static liftSelection(S){return new T(S.selectionStartLineNumber,S.selectionStartColumn,S.positionLineNumber,S.positionColumn)}static selectionsArrEqual(S,p){if(S&&!p||!S&&p)return!1;if(!S&&!p)return!0;if(S.length!==p.length)return!1;for(let C=0,n=S.length;Cthis._onCut.fire(),0)),this._asyncFocusGainWriteScreenReaderContent=this._register(new T.RunOnceScheduler(()=>this.writeScreenReaderContent("asyncFocusGain"),0)),this._textAreaState=g.TextAreaState.EMPTY,this._selectionChangeListener=null,this.writeScreenReaderContent("ctor"),this._hasFocus=!1,this._isDoingComposition=!1,this._nextCommand=0;let h=null;this._register(N.addStandardDisposableListener(l.domNode,"keydown",b=>{(b.keyCode===109||this._isDoingComposition&&b.keyCode===1)&&b.stopPropagation(),b.equals(9)&&b.preventDefault(),h=b,this._onKeyDown.fire(b)})),this._register(N.addStandardDisposableListener(l.domNode,"keyup",b=>{this._onKeyUp.fire(b)})),this._register(N.addDisposableListener(l.domNode,"compositionstart",b=>{if(g._debugComposition&&console.log("[compositionstart]",b),!this._isDoingComposition){if(this._isDoingComposition=!0,C.isMacintosh&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===b.data&&(h&&h.equals(109)&&(h.code==="ArrowRight"||h.code==="ArrowLeft")||w.isFirefox)){g._debugComposition&&console.log("[compositionstart] Handling long press case on macOS + arrow key or Firefox",b),this._textAreaState=new g.TextAreaState(this._textAreaState.value,this._textAreaState.selectionStart-1,this._textAreaState.selectionEnd,this._textAreaState.selectionStartPosition?new t.Position(this._textAreaState.selectionStartPosition.lineNumber,this._textAreaState.selectionStartPosition.column-1):null,this._textAreaState.selectionEndPosition),this._onCompositionStart.fire({revealDeltaColumns:-1});return}if(w.isAndroid){this._onCompositionStart.fire({revealDeltaColumns:-this._textAreaState.selectionStart});return}this._setAndWriteTextAreaState("compositionstart",g.TextAreaState.EMPTY),this._onCompositionStart.fire({revealDeltaColumns:0})}}));const f=b=>{const v=this._textAreaState,m=g.TextAreaState.readFromTextArea(this._textArea);return[m,g.TextAreaState.deduceInput(v,m,b)]},y=()=>{const b=this._textAreaState,v=g.TextAreaState.readFromTextArea(this._textArea);return[v,g.TextAreaState.deduceAndroidCompositionInput(b,v)]},_=b=>{const v=this._textAreaState,m=g.TextAreaState.selectedText(b),E={text:m.value,replacePrevCharCnt:v.selectionEnd-v.selectionStart,replaceNextCharCnt:0,positionDelta:0};return[m,E]};this._register(N.addDisposableListener(l.domNode,"compositionupdate",b=>{if(g._debugComposition&&console.log("[compositionupdate]",b),w.isAndroid){const[E,I]=y();this._textAreaState=E,this._onType.fire(I),this._onCompositionUpdate.fire(b);return}const[v,m]=_(b.data||"");this._textAreaState=v,this._onType.fire(m),this._onCompositionUpdate.fire(b)})),this._register(N.addDisposableListener(l.domNode,"compositionend",b=>{if(g._debugComposition&&console.log("[compositionend]",b),!this._isDoingComposition)return;if(this._isDoingComposition=!1,w.isAndroid){const[E,I]=y();this._textAreaState=E,this._onType.fire(I),this._onCompositionEnd.fire();return}const[v,m]=_(b.data||"");this._textAreaState=v,this._onType.fire(m),(w.isChrome||w.isFirefox)&&(this._textAreaState=g.TextAreaState.readFromTextArea(this._textArea)),this._onCompositionEnd.fire()})),this._register(N.addDisposableListener(l.domNode,"input",()=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._isDoingComposition)return;const[b,v]=f(C.isMacintosh);v.replacePrevCharCnt===0&&v.text.length===1&&n.isHighSurrogate(v.text.charCodeAt(0))||(this._textAreaState=b,this._nextCommand===0?(v.text!==""||v.replacePrevCharCnt!==0)&&this._onType.fire(v):((v.text!==""||v.replacePrevCharCnt!==0)&&this._firePaste(v.text,null),this._nextCommand=0))})),this._register(N.addDisposableListener(l.domNode,"cut",b=>{this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(b),this._asyncTriggerCut.schedule()})),this._register(N.addDisposableListener(l.domNode,"copy",b=>{this._ensureClipboardGetsEditorSelection(b)})),this._register(N.addDisposableListener(l.domNode,"paste",b=>{if(this._textArea.setIgnoreSelectionChangeTime("received paste event"),a.canUseTextData(b)){const[v,m]=a.getTextData(b);v!==""&&this._firePaste(v,m)}else this._textArea.getSelectionStart()!==this._textArea.getSelectionEnd()&&this._setAndWriteTextAreaState("paste",g.TextAreaState.EMPTY),this._nextCommand=1})),this._register(N.addDisposableListener(l.domNode,"focus",()=>{const b=this._hasFocus;this._setHasFocus(!0),w.isSafari&&!b&&this._hasFocus&&this._asyncFocusGainWriteScreenReaderContent.schedule()})),this._register(N.addDisposableListener(l.domNode,"blur",()=>{this._isDoingComposition&&(this._isDoingComposition=!1,this.writeScreenReaderContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(N.addDisposableListener(l.domNode,c.Tap,()=>{w.isAndroid&&this._isDoingComposition&&(this._isDoingComposition=!1,this.writeScreenReaderContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let i=0;return N.addDisposableListener(document,"selectionchange",l=>{if(!this._hasFocus||this._isDoingComposition||!w.isChrome)return;const h=Date.now(),f=h-i;if(i=h,f<5)return;const y=h-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),y<100||!this._textAreaState.selectionStartPosition||!this._textAreaState.selectionEndPosition)return;const _=this._textArea.getValue();if(this._textAreaState.value!==_)return;const b=this._textArea.getSelectionStart(),v=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===b&&this._textAreaState.selectionEnd===v)return;const m=this._textAreaState.deduceEditorPosition(b),E=this._host.deduceModelPosition(m[0],m[1],m[2]),I=this._textAreaState.deduceEditorPosition(v),k=this._host.deduceModelPosition(I[0],I[1],I[2]),M=new s.Selection(E.lineNumber,E.column,k.lineNumber,k.column);this._onSelectionChangeRequest.fire(M)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){const i=N.getShadowRoot(this.textArea.domNode);i?this._setHasFocus(i.activeElement===this.textArea.domNode):N.isInDOM(this.textArea.domNode)?this._setHasFocus(document.activeElement===this.textArea.domNode):this._setHasFocus(!1)}_setHasFocus(i){this._hasFocus!==i&&(this._hasFocus=i,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeScreenReaderContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(i,l){this._hasFocus||(l=l.collapseSelection()),l.writeToTextArea(i,this._textArea,this._hasFocus),this._textAreaState=l}writeScreenReaderContent(i){this._isDoingComposition||this._setAndWriteTextAreaState(i,this._host.getScreenReaderContent(this._textAreaState))}_ensureClipboardGetsEditorSelection(i){const l=this._host.getDataToCopy(a.canUseTextData(i)),h={version:1,isFromEmptySelection:l.isFromEmptySelection,multicursorText:l.multicursorText,mode:l.mode};if(u.INSTANCE.set(w.isFirefox?l.text.replace(/\r\n/g,` +`):l.text,h),!a.canUseTextData(i)){this._setAndWriteTextAreaState("copy or cut",g.TextAreaState.selectedText(l.text));return}a.setTextData(i,l.text,l.html,h)}_firePaste(i,l){l||(l=u.INSTANCE.get(i)),this._onPaste.fire({text:i,metadata:l})}}e.TextAreaInput=d;class a{static canUseTextData(i){return!!i.clipboardData}static getTextData(i){if(i.clipboardData){i.preventDefault();const l=i.clipboardData.getData(p.Mimes.text);let h=null;const f=i.clipboardData.getData("vscode-editor-data");if(typeof f=="string")try{h=JSON.parse(f),h.version!==1&&(h=null)}catch(y){}return[l,h]}throw new Error("ClipboardEventUtils.getTextData: Cannot use text data!")}static setTextData(i,l,h,f){if(i.clipboardData){i.clipboardData.setData(p.Mimes.text,l),typeof h=="string"&&i.clipboardData.setData("text/html",h),i.clipboardData.setData("vscode-editor-data",JSON.stringify(f)),i.preventDefault();return}throw new Error("ClipboardEventUtils.setTextData: Cannot use text data!")}}class r extends S.Disposable{constructor(i){super();this._actual=i,this._ignoreSelectionChangeTime=0}setIgnoreSelectionChangeTime(i){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.domNode.value}setValue(i,l){const h=this._actual.domNode;h.value!==l&&(this.setIgnoreSelectionChangeTime("setValue"),h.value=l)}getSelectionStart(){return this._actual.domNode.selectionDirection==="backward"?this._actual.domNode.selectionEnd:this._actual.domNode.selectionStart}getSelectionEnd(){return this._actual.domNode.selectionDirection==="backward"?this._actual.domNode.selectionStart:this._actual.domNode.selectionEnd}setSelectionRange(i,l,h){const f=this._actual.domNode;let y=null;const _=N.getShadowRoot(f);_?y=_.activeElement:y=document.activeElement;const b=y===f,v=f.selectionStart,m=f.selectionEnd;if(b&&v===l&&m===h){w.isFirefox&&window.parent!==window&&f.focus();return}if(b){this.setIgnoreSelectionChangeTime("setSelectionRange"),f.setSelectionRange(l,h),w.isFirefox&&window.parent!==window&&f.focus();return}try{const E=N.saveParentsScrollTop(f);this.setIgnoreSelectionChangeTime("setSelectionRange"),f.focus(),f.setSelectionRange(l,h),N.restoreParentsScrollTop(f,E)}catch(E){}}}}),define(J[98],ee([0,1,22]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReplaceCommandThatPreservesSelection=e.ReplaceCommandWithOffsetCursorState=e.ReplaceCommandWithoutChangingPosition=e.ReplaceCommandThatSelectsText=e.ReplaceCommand=void 0;class N{constructor(n,g,t=!1){this._range=n,this._text=g,this.insertsAutoWhitespace=t}getEditOperations(n,g){g.addTrackedEditOperation(this._range,this._text)}computeCursorState(n,g){let s=g.getInverseEditOperations()[0].range;return new w.Selection(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn)}}e.ReplaceCommand=N;class T{constructor(n,g){this._range=n,this._text=g}getEditOperations(n,g){g.addTrackedEditOperation(this._range,this._text)}computeCursorState(n,g){const s=g.getInverseEditOperations()[0].range;return new w.Selection(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn)}}e.ReplaceCommandThatSelectsText=T;class D{constructor(n,g,t=!1){this._range=n,this._text=g,this.insertsAutoWhitespace=t}getEditOperations(n,g){g.addTrackedEditOperation(this._range,this._text)}computeCursorState(n,g){let s=g.getInverseEditOperations()[0].range;return new w.Selection(s.startLineNumber,s.startColumn,s.startLineNumber,s.startColumn)}}e.ReplaceCommandWithoutChangingPosition=D;class S{constructor(n,g,t,s,c=!1){this._range=n,this._text=g,this._columnDeltaOffset=s,this._lineNumberDeltaOffset=t,this.insertsAutoWhitespace=c}getEditOperations(n,g){g.addTrackedEditOperation(this._range,this._text)}computeCursorState(n,g){let s=g.getInverseEditOperations()[0].range;return new w.Selection(s.endLineNumber+this._lineNumberDeltaOffset,s.endColumn+this._columnDeltaOffset,s.endLineNumber+this._lineNumberDeltaOffset,s.endColumn+this._columnDeltaOffset)}}e.ReplaceCommandWithOffsetCursorState=S;class p{constructor(n,g,t,s=!1){this._range=n,this._text=g,this._initialSelection=t,this._forceMoveMarkers=s,this._selectionId=null}getEditOperations(n,g){g.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=g.trackSelection(this._initialSelection)}computeCursorState(n,g){return g.getTrackedSelection(this._selectionId)}}e.ReplaceCommandThatPreservesSelection=p}),define(J[386],ee([0,1,3,22]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SurroundSelectionCommand=void 0;class T{constructor(S,p,C){this._range=S,this._charBeforeSelection=p,this._charAfterSelection=C}getEditOperations(S,p){p.addTrackedEditOperation(new w.Range(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),p.addTrackedEditOperation(new w.Range(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection)}computeCursorState(S,p){let C=p.getInverseEditOperations(),n=C[0].range,g=C[1].range;return new N.Selection(n.endLineNumber,n.endColumn,g.endLineNumber,g.endColumn-this._charAfterSelection.length)}}e.SurroundSelectionCommand=T}),define(J[84],ee([0,1,8,17,105]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decodeUTF16LE=e.createStringBuilder=e.hasTextDecoder=e.getPlatformTextDecoder=void 0;let D;function S(){return D||(D=new TextDecoder("UTF-16LE")),D}let p;function C(){return p||(p=new TextDecoder("UTF-16BE")),p}let n;function g(){return n||(n=N.isLittleEndian()?S():C()),n}e.getPlatformTextDecoder=g,e.hasTextDecoder=typeof TextDecoder!="undefined",e.hasTextDecoder?(e.createStringBuilder=d=>new c(d),e.decodeUTF16LE=t):(e.createStringBuilder=d=>new u,e.decodeUTF16LE=s);function t(d,a,r){const o=new Uint16Array(d.buffer,a,r);return r>0&&(o[0]===65279||o[0]===65534)?s(d,a,r):S().decode(o)}function s(d,a,r){let o=[],i=0;for(let l=0;l =this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=a;return}for(let o=0;o =this._lines.length)throw new Error("Illegal value for lineNumber");return this._lines[g]}onLinesDeleted(n,g){if(this.getCount()===0)return null;const t=this.getStartLineNumber(),s=this.getEndLineNumber();if(g s)return null;let c=0,u=0;for(let a=t;a<=s;a++){const r=a-this._rendLineNumberStart;n<=a&&a<=g&&(u===0?(c=r,u=1):u++)}if(n =t&&u<=s&&(this._lines[u-this._rendLineNumberStart].onContentChanged(),c=!0);return c}onLinesInserted(n,g){if(this.getCount()===0)return null;const t=g-n+1,s=this.getStartLineNumber(),c=this.getEndLineNumber();if(n<=s)return this._rendLineNumberStart+=t,null;if(n>c)return null;if(t+n>c)return this._lines.splice(n-this._rendLineNumberStart,c-n+1);const u=[];for(let i=0;i t)continue;const a=Math.max(g,d.fromLineNumber),r=Math.min(t,d.toLineNumber);for(let o=a;o<=r;o++){const i=o-this._rendLineNumberStart;this._lines[i].onTokensChanged(),s=!0}}return s}}e.RenderedLinesCollection=D;class S{constructor(n){this._host=n,this.domNode=this._createDomNode(),this._linesCollection=new D(()=>this._host.createVisibleLine())}_createDomNode(){const n=(0,w.createFastDomNode)(document.createElement("div"));return n.setClassName("view-layer"),n.setPosition("absolute"),n.domNode.setAttribute("role","presentation"),n.domNode.setAttribute("aria-hidden","true"),n}onConfigurationChanged(n){return!!n.hasChanged(129)}onFlushed(n){return this._linesCollection.flush(),!0}onLinesChanged(n){return this._linesCollection.onLinesChanged(n.fromLineNumber,n.toLineNumber)}onLinesDeleted(n){const g=this._linesCollection.onLinesDeleted(n.fromLineNumber,n.toLineNumber);if(g)for(let t=0,s=g.length;t g){const u=g,d=Math.min(t,c.rendLineNumberStart-1);u<=d&&(this._insertLinesBefore(c,u,d,s,g),c.linesLength+=d-u+1)}else if(c.rendLineNumberStart0&&(this._removeLinesBefore(c,u),c.linesLength-=u)}if(c.rendLineNumberStart=g,c.rendLineNumberStart+c.linesLength-1 t){const u=Math.max(0,t-c.rendLineNumberStart+1),a=c.linesLength-1-u+1;a>0&&(this._removeLinesAfter(c,a),c.linesLength-=a)}return this._finishRendering(c,!1,s),c}_renderUntouchedLines(n,g,t,s,c){const u=n.rendLineNumberStart,d=n.lines;for(let a=g;a<=t;a++){const r=u+a;d[a].layoutLine(r,s[r-c])}}_insertLinesBefore(n,g,t,s,c){const u=[];let d=0;for(let a=g;a<=t;a++)u[d++]=this.host.createVisibleLine();n.lines=u.concat(n.lines)}_removeLinesBefore(n,g){for(let t=0;t =0;d--){const a=n.lines[d];s[d]&&(a.setDomNode(u),u=u.previousSibling)}}_finishRenderingInvalidLines(n,g,t){const s=document.createElement("div");p._ttPolicy&&(g=p._ttPolicy.createHTML(g)),s.innerHTML=g;for(let c=0;c C}),p._sb=(0,N.createStringBuilder)(1e5)}),define(J[141],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenizationResult2=e.TokenizationResult=e.Token=void 0;class w{constructor(S,p,C){this._tokenBrand=void 0,this.offset=S|0,this.type=p,this.language=C}toString(){return"("+this.offset+", "+this.type+")"}}e.Token=w;class N{constructor(S,p){this._tokenizationResultBrand=void 0,this.tokens=S,this.endState=p}}e.TokenizationResult=N;class T{constructor(S,p){this._tokenizationResult2Brand=void 0,this.tokens=S,this.endState=p}}e.TokenizationResult2=T}),define(J[387],ee([0,1,134,8]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiffComputer=void 0;const T=3;function D(d,a,r,o){return new w.LcsDiff(d,a,r).ComputeDiff(o)}class S{constructor(a){const r=[],o=[];for(let i=0,l=a.length;i 0&&r.originalLength<20&&r.modifiedLength>0&&r.modifiedLength<20&&l()){const E=o.createCharSequence(a,r.originalStart,r.originalStart+r.originalLength-1),I=i.createCharSequence(a,r.modifiedStart,r.modifiedStart+r.modifiedLength-1);let k=D(E,I,l,!0).changes;f&&(k=n(k)),m=[];for(let M=0,P=k.length;M 1&&k>1;){const M=m.charCodeAt(I-2),P=E.charCodeAt(k-2);if(M!==P)break;I--,k--}(I>1||k>1)&&this._pushTrimWhitespaceCharChange(i,l+1,1,I,h+1,1,k)}{let I=c(m,1),k=c(E,1);const M=m.length+1,P=E.length+1;for(;I
!0;const a=Date.now();return()=>Date.now()-a =f}e.lengthGreaterThanEqual=a;function r(h){return C(h.lineNumber-1,h.column-1)}e.positionToLength=r;function o(h,f){const y=h,_=Math.floor(y/p),b=y-_*p,v=f,m=Math.floor(v/p),E=v-m*p;return new N.Range(_+1,b+1,m+1,E+1)}e.lengthsToRange=o;function i(h){const f=(0,w.splitLines)(h);return C(f.length-1,f[f.length-1].length)}e.lengthOfString=i;function l(h){return h}e.lengthHash=l}),define(J[229],ee([0,1,85]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BeforeEditPositionMapper=e.TextEditInfo=void 0;class N{constructor(p,C,n){this.startOffset=p,this.endOffset=C,this.newLength=n}}e.TextEditInfo=N;class T{constructor(p,C){this.documentLength=C,this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=p.map(n=>D.from(n))}getOffsetBeforeChange(p){return this.adjustNextEdit(p),this.translateCurToOld(p)}getDistanceToNextChange(p){this.adjustNextEdit(p);const C=this.edits[this.nextEditIdx],n=C?this.translateOldToCur(C.offsetObj):this.documentLength;return(0,w.lengthDiffNonNegative)(p,n)}translateOldToCur(p){return p.lineCount===this.deltaLineIdxInOld?(0,w.toLength)(p.lineCount+this.deltaOldToNewLineCount,p.columnCount+this.deltaOldToNewColumnCount):(0,w.toLength)(p.lineCount+this.deltaOldToNewLineCount,p.columnCount)}translateCurToOld(p){const C=(0,w.lengthToObj)(p);return C.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?(0,w.toLength)(C.lineCount-this.deltaOldToNewLineCount,C.columnCount-this.deltaOldToNewColumnCount):(0,w.toLength)(C.lineCount-this.deltaOldToNewLineCount,C.columnCount)}adjustNextEdit(p){for(;this.nextEditIdx =S.childrenLength)return-1;if(S.getChild(p))return p}}function D(S){return S.length>0?S[S.length-1]:void 0}}),define(J[115],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DenseKeyProvider=e.identityKeyProvider=e.SmallImmutableSet=void 0;const w=new Array;class N{constructor(S,p){this.items=S,this.additionalItems=p}static create(S,p){if(S<=128&&p.length===0){let C=N.cache[S];return C||(C=new N(S,p),N.cache[S]=C),C}return new N(S,p)}static getEmpty(){return this.empty}add(S,p){const C=p.getKey(S);let n=C>>5;if(n===0){const t=1< 0;)i=i.getChild(l-1);return i.canBeReused(o)}handleChildrenChanged(){this.throwIfImmutable();const o=this.childrenLength;let i=this.getChild(0).length,l=this.getChild(0).missingOpeningBracketIds;for(let h=1;h =n.length)return null;const d=g,a=n[d].listHeight;for(g++;g =2?T(d===0&&g===n.length?n:n.slice(d,g),!1):n[d]}let s=t(),c=t();if(!c)return s;for(let d=t();d;d=t())D(s,c)<=D(c,d)?(s=S(s,c),c=d):c=S(c,d);return S(s,c)}e.concat23Trees=N;function T(n,g=!1){if(n.length===0)return null;if(n.length===1)return n[0];let t=n.length;for(;t>3;){const s=t>>1;for(let c=0;c =3?n[2]:null,g)}e.concat23TreesOfSameHeight=T;function D(n,g){return Math.abs(n.listHeight-g.listHeight)}function S(n,g){return n.listHeight===g.listHeight?w.ListAstNode.create23(n,g,null,!1):n.listHeight>g.listHeight?p(n,g):C(g,n)}function p(n,g){n=n.toMutable();let t=n;const s=new Array;let c;for(;;){if(g.listHeight===t.listHeight){c=g;break}if(t.kind!==4)throw new Error("unexpected");s.push(t),t=t.makeLastElementMutable()}for(let u=s.length-1;u>=0;u--){const d=s[u];c?d.childrenLength>=3?c=w.ListAstNode.create23(d.unappendChild(),c,null,!1):(d.appendChildOfSameHeight(c),c=void 0):d.handleChildrenChanged()}return c?w.ListAstNode.create23(n,c,null,!1):n}function C(n,g){n=n.toMutable();let t=n;const s=new Array;for(;g.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");s.push(t),t=t.makeFirstElementMutable()}let c=g;for(let u=s.length-1;u>=0;u--){const d=s[u];c?d.childrenLength>=3?c=w.ListAstNode.create23(c,d.unprependChild(),null,!1):(d.prependChildOfSameHeight(c),c=void 0):d.handleChildrenChanged()}return c?w.ListAstNode.create23(c,n,null,!1):n}}),define(J[391],ee([0,1,142,229,115,85,390,389]),function(j,e,w,N,T,D,S,p){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseDocument=void 0;function C(g,t,s,c){return new n(g,t,s,c).parseDocument()}e.parseDocument=C;class n{constructor(t,s,c,u){if(this.tokenizer=t,this.createImmutableLists=u,this._itemsConstructed=0,this._itemsFromCache=0,c&&u)throw new Error("Not supported");this.oldNodeReader=c?new p.NodeReader(c):void 0,this.positionMapper=new N.BeforeEditPositionMapper(s,t.length)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let t=this.parseList(T.SmallImmutableSet.getEmpty());return t||(t=w.ListAstNode.getEmpty()),t}parseList(t){const s=new Array;for(;;){const u=this.tokenizer.peek();if(!u||u.kind===2&&u.bracketIds.intersects(t))break;const d=this.parseChild(t);d.kind===4&&d.childrenLength===0||s.push(d)}return this.oldNodeReader?(0,S.concat23Trees)(s):(0,S.concat23TreesOfSameHeight)(s,this.createImmutableLists)}parseChild(t){if(this.oldNodeReader){const c=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(!(0,D.lengthIsZero)(c)){const u=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),d=>(0,D.lengthLessThan)(d.length,c)?d.canBeReused(t):!1);if(u)return this._itemsFromCache++,this.tokenizer.skip(u.length),u}}this._itemsConstructed++;const s=this.tokenizer.read();switch(s.kind){case 2:return new w.InvalidBracketAstNode(s.bracketIds,s.length);case 0:return s.astNode;case 1:const c=t.merge(s.bracketIds),u=this.parseList(c),d=this.tokenizer.peek();return d&&d.kind===2&&(d.bracketId===s.bracketId||d.bracketIds.intersects(s.bracketIds))?(this.tokenizer.read(),w.PairAstNode.create(s.astNode,u,d.astNode)):w.PairAstNode.create(s.astNode,u,null);default:throw new Error("unexpected")}}}}),define(J[392],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.guessIndentation=void 0;class w{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}function N(D,S,p,C,n){n.spacesDiff=0,n.looksLikeAlignment=!1;let g;for(g=0;g0&&s>0||c>0&&u>0)return;let d=Math.abs(s-u),a=Math.abs(t-c);if(d===0){n.spacesDiff=a,a>0&&0<=c-1&&c-10?n++:b>1&&g++,N(t,s,h,_,a),a.looksLikeAlignment&&!(p&&S===a.spacesDiff)))continue;let m=a.spacesDiff;m<=u&&d[m]++,t=h,s=_}let r=p;n!==g&&(r=n {let h=d[l];h>i&&(i=h,o=l)}),o===4&&d[4]>0&&d[2]>0&&d[2]>=d[4]/2&&(o=2)}return{insertSpaces:r,tabSize:o}}e.guessIndentation=T}),define(J[393],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.intervalCompare=e.recomputeMaxEnd=e.nodeAcceptEdit=e.IntervalTree=e.SENTINEL=e.IntervalNode=e.getNodeColor=void 0;function w(R){return(R.metadata&1)>>>0}e.getNodeColor=w;function N(R,A){R.metadata=R.metadata&254|A<<0}function T(R){return(R.metadata&2)>>>1==1}function D(R,A){R.metadata=R.metadata&253|(A?1:0)<<1}function S(R){return(R.metadata&4)>>>2==1}function p(R,A){R.metadata=R.metadata&251|(A?1:0)<<2}function C(R){return(R.metadata&24)>>>3}function n(R,A){R.metadata=R.metadata&231|A<<3}function g(R){return(R.metadata&32)>>>5==1}function t(R,A){R.metadata=R.metadata&223|(A?1:0)<<5}class s{constructor(A,O,L){this.metadata=0,this.parent=this,this.left=this,this.right=this,N(this,1),this.start=O,this.end=L,this.delta=0,this.maxEnd=L,this.id=A,this.ownerId=0,this.options=null,p(this,!1),n(this,1),t(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=O,this.cachedAbsoluteEnd=L,this.range=null,D(this,!1)}reset(A,O,L,B){this.start=O,this.end=L,this.maxEnd=L,this.cachedVersionId=A,this.cachedAbsoluteStart=O,this.cachedAbsoluteEnd=L,this.range=B}setOptions(A){this.options=A;let O=this.options.className;p(this,O==="squiggly-error"||O==="squiggly-warning"||O==="squiggly-info"),n(this,this.options.stickiness),t(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(A,O,L){this.cachedVersionId!==L&&(this.range=null),this.cachedVersionId=L,this.cachedAbsoluteStart=A,this.cachedAbsoluteEnd=O}detach(){this.parent=null,this.left=null,this.right=null}}e.IntervalNode=s,e.SENTINEL=new s(null,0,0),e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.left=e.SENTINEL,e.SENTINEL.right=e.SENTINEL,N(e.SENTINEL,0);class c{constructor(){this.root=e.SENTINEL,this.requestNormalizeDelta=!1}intervalSearch(A,O,L,B,W){return this.root===e.SENTINEL?[]:f(this,A,O,L,B,W)}search(A,O,L){return this.root===e.SENTINEL?[]:h(this,A,O,L)}collectNodesFromOwner(A){return i(this,A)}collectNodesPostOrder(){return l(this)}insert(A){y(this,A),this._normalizeDeltaIfNecessary()}delete(A){b(this,A),this._normalizeDeltaIfNecessary()}resolveNode(A,O){const L=A;let B=0;for(;A!==this.root;)A===A.parent.right&&(B+=A.parent.delta),A=A.parent;const W=L.start+B,K=L.end+B;L.setCachedOffsets(W,K,O)}acceptReplace(A,O,L,B){const W=r(this,A,A+O);for(let K=0,H=W.length;K O||L===1?!1:L===2?!0:A}function a(R,A,O,L,B){const W=C(R),K=W===0||W===2,H=W===1||W===2,Y=O-A,X=L,Z=Math.min(Y,X),se=R.start;let oe=!1;const G=R.end;let x=!1;A<=se&&G<=O&&g(R)&&(R.start=A,oe=!0,R.end=A,x=!0);{const $=B?1:Y>0?2:0;!oe&&d(se,K,A,$)&&(oe=!0),!x&&d(G,H,A,$)&&(x=!0)}if(Z>0&&!B){const $=Y>X?2:0;!oe&&d(se,K,A+Z,$)&&(oe=!0),!x&&d(G,H,A+Z,$)&&(x=!0)}{const $=B?1:0;!oe&&d(se,K,O,$)&&(R.start=A+X,oe=!0),!x&&d(G,H,O,$)&&(R.end=A+X,x=!0)}const U=X-Y;oe||(R.start=Math.max(0,se+U)),x||(R.end=Math.max(0,G+U)),R.start>R.end&&(R.end=R.start)}e.nodeAcceptEdit=a;function r(R,A,O){let L=R.root,B=0,W=0,K=0,H=0,Y=[],X=0;for(;L!==e.SENTINEL;){if(T(L)){D(L.left,!1),D(L.right,!1),L===L.parent.right&&(B-=L.parent.delta),L=L.parent;continue}if(!T(L.left)){if(W=B+L.maxEnd,WO){D(L,!0);continue}if(H=B+L.end,H>=A&&(L.setCachedOffsets(K,H,0),Y[X++]=L),D(L,!0),L.right!==e.SENTINEL&&!T(L.right)){B+=L.delta,L=L.right;continue}}return D(R.root,!1),Y}function o(R,A,O,L){let B=R.root,W=0,K=0,H=0;const Y=L-(O-A);for(;B!==e.SENTINEL;){if(T(B)){D(B.left,!1),D(B.right,!1),B===B.parent.right&&(W-=B.parent.delta),M(B),B=B.parent;continue}if(!T(B.left)){if(K=W+B.maxEnd,KO){B.start+=Y,B.end+=Y,B.delta+=Y,(B.delta<-1073741824||B.delta>1073741824)&&(R.requestNormalizeDelta=!0),D(B,!0);continue}if(D(B,!0),B.right!==e.SENTINEL&&!T(B.right)){W+=B.delta,B=B.right;continue}}D(R.root,!1)}function i(R,A){let O=R.root,L=[],B=0;for(;O!==e.SENTINEL;){if(T(O)){D(O.left,!1),D(O.right,!1),O=O.parent;continue}if(O.left!==e.SENTINEL&&!T(O.left)){O=O.left;continue}if(O.ownerId===A&&(L[B++]=O),D(O,!0),O.right!==e.SENTINEL&&!T(O.right)){O=O.right;continue}}return D(R.root,!1),L}function l(R){let A=R.root,O=[],L=0;for(;A!==e.SENTINEL;){if(T(A)){D(A.left,!1),D(A.right,!1),A=A.parent;continue}if(A.left!==e.SENTINEL&&!T(A.left)){A=A.left;continue}if(A.right!==e.SENTINEL&&!T(A.right)){A=A.right;continue}O[L++]=A,D(A,!0)}return D(R.root,!1),O}function h(R,A,O,L){let B=R.root,W=0,K=0,H=0,Y=[],X=0;for(;B!==e.SENTINEL;){if(T(B)){D(B.left,!1),D(B.right,!1),B===B.parent.right&&(W-=B.parent.delta),B=B.parent;continue}if(B.left!==e.SENTINEL&&!T(B.left)){B=B.left;continue}K=W+B.start,H=W+B.end,B.setCachedOffsets(K,H,L);let Z=!0;if(A&&B.ownerId&&B.ownerId!==A&&(Z=!1),O&&S(B)&&(Z=!1),Z&&(Y[X++]=B),D(B,!0),B.right!==e.SENTINEL&&!T(B.right)){W+=B.delta,B=B.right;continue}}return D(R.root,!1),Y}function f(R,A,O,L,B,W){let K=R.root,H=0,Y=0,X=0,Z=0,se=[],oe=0;for(;K!==e.SENTINEL;){if(T(K)){D(K.left,!1),D(K.right,!1),K===K.parent.right&&(H-=K.parent.delta),K=K.parent;continue}if(!T(K.left)){if(Y=H+K.maxEnd,YO){D(K,!0);continue}if(Z=H+K.end,Z>=A){K.setCachedOffsets(X,Z,W);let G=!0;L&&K.ownerId&&K.ownerId!==L&&(G=!1),B&&S(K)&&(G=!1),G&&(se[oe++]=K)}if(D(K,!0),K.right!==e.SENTINEL&&!T(K.right)){H+=K.delta,K=K.right;continue}}return D(R.root,!1),se}function y(R,A){if(R.root===e.SENTINEL)return A.parent=e.SENTINEL,A.left=e.SENTINEL,A.right=e.SENTINEL,N(A,0),R.root=A,R.root;_(R,A),P(A.parent);let O=A;for(;O!==R.root&&w(O.parent)===1;)if(O.parent===O.parent.parent.left){const L=O.parent.parent.right;w(L)===1?(N(O.parent,0),N(L,0),N(O.parent.parent,1),O=O.parent.parent):(O===O.parent.right&&(O=O.parent,E(R,O)),N(O.parent,0),N(O.parent.parent,1),I(R,O.parent.parent))}else{const L=O.parent.parent.left;w(L)===1?(N(O.parent,0),N(L,0),N(O.parent.parent,1),O=O.parent.parent):(O===O.parent.left&&(O=O.parent,I(R,O)),N(O.parent,0),N(O.parent.parent,1),E(R,O.parent.parent))}return N(R.root,0),A}function _(R,A){let O=0,L=R.root;const B=A.start,W=A.end;for(;;)if(F(B,W,L.start+O,L.end+O)<0)if(L.left===e.SENTINEL){A.start-=O,A.end-=O,A.maxEnd-=O,L.left=A;break}else L=L.left;else if(L.right===e.SENTINEL){A.start-=O+L.delta,A.end-=O+L.delta,A.maxEnd-=O+L.delta,L.right=A;break}else O+=L.delta,L=L.right;A.parent=L,A.left=e.SENTINEL,A.right=e.SENTINEL,N(A,1)}function b(R,A){let O,L;if(A.left===e.SENTINEL?(O=A.right,L=A,O.delta+=A.delta,(O.delta<-1073741824||O.delta>1073741824)&&(R.requestNormalizeDelta=!0),O.start+=A.delta,O.end+=A.delta):A.right===e.SENTINEL?(O=A.left,L=A):(L=v(A.right),O=L.right,O.start+=L.delta,O.end+=L.delta,O.delta+=L.delta,(O.delta<-1073741824||O.delta>1073741824)&&(R.requestNormalizeDelta=!0),L.start+=A.delta,L.end+=A.delta,L.delta=A.delta,(L.delta<-1073741824||L.delta>1073741824)&&(R.requestNormalizeDelta=!0)),L===R.root){R.root=O,N(O,0),A.detach(),m(),M(O),R.root.parent=e.SENTINEL;return}let B=w(L)===1;if(L===L.parent.left?L.parent.left=O:L.parent.right=O,L===A?O.parent=L.parent:(L.parent===A?O.parent=L:O.parent=L.parent,L.left=A.left,L.right=A.right,L.parent=A.parent,N(L,w(A)),A===R.root?R.root=L:A===A.parent.left?A.parent.left=L:A.parent.right=L,L.left!==e.SENTINEL&&(L.left.parent=L),L.right!==e.SENTINEL&&(L.right.parent=L)),A.detach(),B){P(O.parent),L!==A&&(P(L),P(L.parent)),m();return}P(O),P(O.parent),L!==A&&(P(L),P(L.parent));let W;for(;O!==R.root&&w(O)===0;)O===O.parent.left?(W=O.parent.right,w(W)===1&&(N(W,0),N(O.parent,1),E(R,O.parent),W=O.parent.right),w(W.left)===0&&w(W.right)===0?(N(W,1),O=O.parent):(w(W.right)===0&&(N(W.left,0),N(W,1),I(R,W),W=O.parent.right),N(W,w(O.parent)),N(O.parent,0),N(W.right,0),E(R,O.parent),O=R.root)):(W=O.parent.left,w(W)===1&&(N(W,0),N(O.parent,1),I(R,O.parent),W=O.parent.left),w(W.left)===0&&w(W.right)===0?(N(W,1),O=O.parent):(w(W.left)===0&&(N(W.right,0),N(W,1),E(R,W),W=O.parent.left),N(W,w(O.parent)),N(O.parent,0),N(W.left,0),I(R,O.parent),O=R.root));N(O,0),m()}function v(R){for(;R.left!==e.SENTINEL;)R=R.left;return R}function m(){e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.delta=0,e.SENTINEL.start=0,e.SENTINEL.end=0}function E(R,A){const O=A.right;O.delta+=A.delta,(O.delta<-1073741824||O.delta>1073741824)&&(R.requestNormalizeDelta=!0),O.start+=A.delta,O.end+=A.delta,A.right=O.left,O.left!==e.SENTINEL&&(O.left.parent=A),O.parent=A.parent,A.parent===e.SENTINEL?R.root=O:A===A.parent.left?A.parent.left=O:A.parent.right=O,O.left=A,A.parent=O,M(A),M(O)}function I(R,A){const O=A.left;A.delta-=O.delta,(A.delta<-1073741824||A.delta>1073741824)&&(R.requestNormalizeDelta=!0),A.start-=O.delta,A.end-=O.delta,A.left=O.right,O.right!==e.SENTINEL&&(O.right.parent=A),O.parent=A.parent,A.parent===e.SENTINEL?R.root=O:A===A.parent.right?A.parent.right=O:A.parent.left=O,O.right=A,A.parent=O,M(A),M(O)}function k(R){let A=R.end;if(R.left!==e.SENTINEL){const O=R.left.maxEnd;O>A&&(A=O)}if(R.right!==e.SENTINEL){const O=R.right.maxEnd+R.delta;O>A&&(A=O)}return A}function M(R){R.maxEnd=k(R)}e.recomputeMaxEnd=M;function P(R){for(;R!==e.SENTINEL;){const A=k(R);if(R.maxEnd===A)return;R.maxEnd=A,R=R.parent}}function F(R,A,O,L){return R===O?A-L:R-O}e.intervalCompare=F}),define(J[394],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.recomputeTreeMetadata=e.updateTreeMetadata=e.fixInsert=e.rbDelete=e.rightRotate=e.leftRotate=e.resetSentinel=e.calculateLF=e.calculateSize=e.righttest=e.leftest=e.SENTINEL=e.TreeNode=void 0;class w{constructor(d,a){this.piece=d,this.color=a,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==e.SENTINEL)return N(this.right);let d=this;for(;d.parent!==e.SENTINEL&&d.parent.left!==d;)d=d.parent;return d.parent===e.SENTINEL?e.SENTINEL:d.parent}prev(){if(this.left!==e.SENTINEL)return T(this.left);let d=this;for(;d.parent!==e.SENTINEL&&d.parent.right!==d;)d=d.parent;return d.parent===e.SENTINEL?e.SENTINEL:d.parent}detach(){this.parent=null,this.left=null,this.right=null}}e.TreeNode=w,e.SENTINEL=new w(null,0),e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.left=e.SENTINEL,e.SENTINEL.right=e.SENTINEL,e.SENTINEL.color=0;function N(u){for(;u.left!==e.SENTINEL;)u=u.left;return u}e.leftest=N;function T(u){for(;u.right!==e.SENTINEL;)u=u.right;return u}e.righttest=T;function D(u){return u===e.SENTINEL?0:u.size_left+u.piece.length+D(u.right)}e.calculateSize=D;function S(u){return u===e.SENTINEL?0:u.lf_left+u.piece.lineFeedCnt+S(u.right)}e.calculateLF=S;function p(){e.SENTINEL.parent=e.SENTINEL}e.resetSentinel=p;function C(u,d){let a=d.right;a.size_left+=d.size_left+(d.piece?d.piece.length:0),a.lf_left+=d.lf_left+(d.piece?d.piece.lineFeedCnt:0),d.right=a.left,a.left!==e.SENTINEL&&(a.left.parent=d),a.parent=d.parent,d.parent===e.SENTINEL?u.root=a:d.parent.left===d?d.parent.left=a:d.parent.right=a,a.left=d,d.parent=a}e.leftRotate=C;function n(u,d){let a=d.left;d.left=a.right,a.right!==e.SENTINEL&&(a.right.parent=d),a.parent=d.parent,d.size_left-=a.size_left+(a.piece?a.piece.length:0),d.lf_left-=a.lf_left+(a.piece?a.piece.lineFeedCnt:0),d.parent===e.SENTINEL?u.root=a:d===d.parent.right?d.parent.right=a:d.parent.left=a,a.right=d,d.parent=a}e.rightRotate=n;function g(u,d){let a,r;if(d.left===e.SENTINEL?(r=d,a=r.right):d.right===e.SENTINEL?(r=d,a=r.left):(r=N(d.right),a=r.right),r===u.root){u.root=a,a.color=0,d.detach(),p(),u.root.parent=e.SENTINEL;return}let o=r.color===1;if(r===r.parent.left?r.parent.left=a:r.parent.right=a,r===d?(a.parent=r.parent,c(u,a)):(r.parent===d?a.parent=r:a.parent=r.parent,c(u,a),r.left=d.left,r.right=d.right,r.parent=d.parent,r.color=d.color,d===u.root?u.root=r:d===d.parent.left?d.parent.left=r:d.parent.right=r,r.left!==e.SENTINEL&&(r.left.parent=r),r.right!==e.SENTINEL&&(r.right.parent=r),r.size_left=d.size_left,r.lf_left=d.lf_left,c(u,r)),d.detach(),a.parent.left===a){let l=D(a),h=S(a);if(l!==a.parent.size_left||h!==a.parent.lf_left){let f=l-a.parent.size_left,y=h-a.parent.lf_left;a.parent.size_left=l,a.parent.lf_left=h,s(u,a.parent,f,y)}}if(c(u,a.parent),o){p();return}let i;for(;a!==u.root&&a.color===0;)a===a.parent.left?(i=a.parent.right,i.color===1&&(i.color=0,a.parent.color=1,C(u,a.parent),i=a.parent.right),i.left.color===0&&i.right.color===0?(i.color=1,a=a.parent):(i.right.color===0&&(i.left.color=0,i.color=1,n(u,i),i=a.parent.right),i.color=a.parent.color,a.parent.color=0,i.right.color=0,C(u,a.parent),a=u.root)):(i=a.parent.left,i.color===1&&(i.color=0,a.parent.color=1,n(u,a.parent),i=a.parent.left),i.left.color===0&&i.right.color===0?(i.color=1,a=a.parent):(i.left.color===0&&(i.right.color=0,i.color=1,C(u,i),i=a.parent.left),i.color=a.parent.color,a.parent.color=0,i.left.color=0,n(u,a.parent),a=u.root));a.color=0,p()}e.rbDelete=g;function t(u,d){for(c(u,d);d!==u.root&&d.parent.color===1;)if(d.parent===d.parent.parent.left){const a=d.parent.parent.right;a.color===1?(d.parent.color=0,a.color=0,d.parent.parent.color=1,d=d.parent.parent):(d===d.parent.right&&(d=d.parent,C(u,d)),d.parent.color=0,d.parent.parent.color=1,n(u,d.parent.parent))}else{const a=d.parent.parent.left;a.color===1?(d.parent.color=0,a.color=0,d.parent.parent.color=1,d=d.parent.parent):(d===d.parent.left&&(d=d.parent,n(u,d)),d.parent.color=0,d.parent.parent.color=1,C(u,d.parent.parent))}u.root.color=0}e.fixInsert=t;function s(u,d,a,r){for(;d!==u.root&&d!==e.SENTINEL;)d.parent.left===d&&(d.parent.size_left+=a,d.parent.lf_left+=r),d=d.parent}e.updateTreeMetadata=s;function c(u,d){let a=0,r=0;if(d!==u.root){for(;d!==u.root&&d===d.parent.right;)d=d.parent;if(d!==u.root)for(d=d.parent,a=D(d.left)-d.size_left,r=S(d.left)-d.lf_left,d.size_left+=a,d.lf_left+=r;d!==u.root&&(a!==0||r!==0);)d.parent.left===d&&(d.parent.size_left+=a,d.parent.lf_left+=r),d=d.parent}}e.recomputeTreeMetadata=c}),define(J[230],ee([0,1,105,84]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compressConsecutiveTextChanges=e.TextChange=void 0;function T(C){return C.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class D{constructor(n,g,t,s){this.oldPosition=n,this.oldText=g,this.newPosition=t,this.newText=s}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${T(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${T(this.oldText)}")`:`(replace@${this.oldPosition} "${T(this.oldText)}" with "${T(this.newText)}")`}static _writeStringSize(n){return 4+2*n.length}static _writeString(n,g,t){const s=g.length;w.writeUInt32BE(n,s,t),t+=4;for(let c=0;c 0&&c.push(new N(u.ownerId,u.range.startLineNumber,u.range.startColumn,u.options.before,0)),u.options.after&&u.options.after.content.length>0&&c.push(new N(u.ownerId,u.range.endLineNumber,u.range.endColumn,u.options.after,1));return c.sort((u,d)=>u.lineNumber===d.lineNumber?u.column===d.column?u.order-d.order:u.column-d.column:u.lineNumber-d.lineNumber),c}}e.LineInjectedText=N;class T{constructor(s,c,u){this.changeType=2,this.lineNumber=s,this.detail=c,this.injectedText=u}}e.ModelRawLineChanged=T;class D{constructor(s,c){this.changeType=3,this.fromLineNumber=s,this.toLineNumber=c}}e.ModelRawLinesDeleted=D;class S{constructor(s,c,u,d){this.changeType=4,this.injectedTexts=d,this.fromLineNumber=s,this.toLineNumber=c,this.detail=u}}e.ModelRawLinesInserted=S;class p{constructor(){this.changeType=5}}e.ModelRawEOLChanged=p;class C{constructor(s,c,u,d){this.changes=s,this.versionId=c,this.isUndoing=u,this.isRedoing=d,this.resultingSelection=null}containsEvent(s){for(let c=0,u=this.changes.length;c=0;let l=null;try{l=w.createRegExp(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:i,global:!0,unicode:!0})}catch(f){return null}if(!l)return null;let h=!this.isRegex&&!i;return h&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(h=this.matchCase),new g(l,this.wordSeparators?(0,N.getMapForWordSeparators)(this.wordSeparators):null,h?this.searchString:null)}}e.SearchParams=C;function n(o){if(!o||o.length===0)return!1;for(let i=0,l=o.length;i=l)break;const f=o.charCodeAt(i);if(f===110||f===114||f===87)return!0}return!1}e.isMultilineRegexSource=n;class g{constructor(i,l,h){this.regex=i,this.wordSeparators=l,this.simpleSearch=h}}e.SearchData=g;function t(o,i,l){if(!l)return new S.FindMatch(o,null);let h=[];for(let f=0,y=i.length;f >0);l[y]>=i?f=y-1:l[y+1]>=i?(h=y,f=y):h=y+1}return h+1}}class c{static findMatches(i,l,h,f,y){const _=l.parseSearchRequest();return _?_.regex.multiline?this._doFindMatchesMultiline(i,h,new r(_.wordSeparators,_.regex),f,y):this._doFindMatchesLineByLine(i,h,_,f,y):[]}static _getMultilineMatchRange(i,l,h,f,y,_){let b,v=0;f?(v=f.findLineFeedCountBeforeOffset(y),b=l+y+v):b=l+y;let m;if(f){let M=f.findLineFeedCountBeforeOffset(y+_.length)-v;m=b+_.length+M}else m=b+_.length;const E=i.getPositionAt(b),I=i.getPositionAt(m);return new D.Range(E.lineNumber,E.column,I.lineNumber,I.column)}static _doFindMatchesMultiline(i,l,h,f,y){const _=i.getOffsetAt(l.getStartPosition()),b=i.getValueInRange(l,1),v=i.getEOL()===`\r +`?new s(b):null,m=[];let E=0,I;for(h.reset(0);I=h.next(b);)if(m[E++]=t(this._getMultilineMatchRange(i,_,b,v,I.index,I[0]),I,f),E>=y)return m;return m}static _doFindMatchesLineByLine(i,l,h,f,y){const _=[];let b=0;if(l.startLineNumber===l.endLineNumber){const m=i.getLineContent(l.startLineNumber).substring(l.startColumn-1,l.endColumn-1);return b=this._findMatchesInLine(h,m,l.startLineNumber,l.startColumn-1,b,_,f,y),_}const v=i.getLineContent(l.startLineNumber).substring(l.startColumn-1);b=this._findMatchesInLine(h,v,l.startLineNumber,l.startColumn-1,b,_,f,y);for(let m=l.startLineNumber+1;m =v))return y;return y}const E=new r(i.wordSeparators,i.regex);let I;E.reset(0);do if(I=E.next(l),I&&(_[y++]=t(new D.Range(h,I.index+1+f,h,I.index+1+I[0].length+f),I,b),y>=v))return y;while(I);return y}static findNextMatch(i,l,h,f){const y=l.parseSearchRequest();if(!y)return null;const _=new r(y.wordSeparators,y.regex);return y.regex.multiline?this._doFindNextMatchMultiline(i,h,_,f):this._doFindNextMatchLineByLine(i,h,_,f)}static _doFindNextMatchMultiline(i,l,h,f){const y=new T.Position(l.lineNumber,1),_=i.getOffsetAt(y),b=i.getLineCount(),v=i.getValueInRange(new D.Range(y.lineNumber,y.column,b,i.getLineMaxColumn(b)),1),m=i.getEOL()===`\r +`?new s(v):null;h.reset(l.column-1);let E=h.next(v);return E?t(this._getMultilineMatchRange(i,_,v,m,E.index,E[0]),E,f):l.lineNumber!==1||l.column!==1?this._doFindNextMatchMultiline(i,new T.Position(1,1),h,f):null}static _doFindNextMatchLineByLine(i,l,h,f){const y=i.getLineCount(),_=l.lineNumber,b=i.getLineContent(_),v=this._findFirstMatchInLine(h,b,_,l.column,f);if(v)return v;for(let m=1;m<=y;m++){const E=(_+m-1)%y,I=i.getLineContent(E+1),k=this._findFirstMatchInLine(h,I,E+1,1,f);if(k)return k}return null}static _findFirstMatchInLine(i,l,h,f,y){i.reset(f-1);const _=i.next(l);return _?t(new D.Range(h,_.index+1,h,_.index+1+_[0].length),_,y):null}static findPreviousMatch(i,l,h,f){const y=l.parseSearchRequest();if(!y)return null;const _=new r(y.wordSeparators,y.regex);return y.regex.multiline?this._doFindPreviousMatchMultiline(i,h,_,f):this._doFindPreviousMatchLineByLine(i,h,_,f)}static _doFindPreviousMatchMultiline(i,l,h,f){const y=this._doFindMatchesMultiline(i,new D.Range(1,1,l.lineNumber,l.column),h,f,10*p);if(y.length>0)return y[y.length-1];const _=i.getLineCount();return l.lineNumber!==_||l.column!==i.getLineMaxColumn(_)?this._doFindPreviousMatchMultiline(i,new T.Position(_,i.getLineMaxColumn(_)),h,f):null}static _doFindPreviousMatchLineByLine(i,l,h,f){const y=i.getLineCount(),_=l.lineNumber,b=i.getLineContent(_).substring(0,l.column-1),v=this._findLastMatchInLine(h,b,_,f);if(v)return v;for(let m=1;m<=y;m++){const E=(y+_-m-1)%y,I=i.getLineContent(E+1),k=this._findLastMatchInLine(h,I,E+1,f);if(k)return k}return null}static _findLastMatchInLine(i,l,h,f){let y=null,_;for(i.reset(0);_=i.next(l);)y=t(new D.Range(h,_.index+1,h,_.index+1+_[0].length),_,f);return y}}e.TextModelSearch=c;function u(o,i,l,h,f){if(h===0)return!0;const y=i.charCodeAt(h-1);if(o.get(y)!==0||y===13||y===10)return!0;if(f>0){const _=i.charCodeAt(h);if(o.get(_)!==0)return!0}return!1}function d(o,i,l,h,f){if(h+f===l)return!0;const y=i.charCodeAt(h+f);if(o.get(y)!==0||y===13||y===10)return!0;if(f>0){const _=i.charCodeAt(h+f-1);if(o.get(_)!==0)return!0}return!1}function a(o,i,l,h,f){return u(o,i,l,h,f)&&d(o,i,l,h,f)}e.isValidMatch=a;class r{constructor(i,l){this._wordSeparators=i,this._searchRegex=l,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(i){this._searchRegex.lastIndex=i,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(i){const l=i.length;let h;do{if(this._prevMatchStartIndex+this._prevMatchLength===l||(h=this._searchRegex.exec(i),!h))return null;const f=h.index,y=h[0].length;if(f===this._prevMatchStartIndex&&y===this._prevMatchLength){if(y===0){w.getNextCodePoint(i,l,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=f,this._prevMatchLength=y,!this._wordSeparators||a(this._wordSeparators,i,l,f,y))return h}while(h);return null}}e.Searcher=r}),define(J[231],ee([0,1,13,3,49,394,176]),function(j,e,w,N,T,D,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PieceTreeBase=e.StringBuffer=e.Piece=e.createLineStarts=e.createLineStartsFast=e.LineStarts=e.createUintArray=e.AverageBufferSize=void 0,e.AverageBufferSize=65535;function p(a){let r;return a[a.length-1]<65536?r=new Uint16Array(a.length):r=new Uint32Array(a.length),r.set(a,0),r}e.createUintArray=p;class C{constructor(r,o,i,l,h){this.lineStarts=r,this.cr=o,this.lf=i,this.crlf=l,this.isBasicASCII=h}}e.LineStarts=C;function n(a,r=!0){let o=[0],i=1;for(let l=0,h=a.length;l 126)&&(f=!1)}const y=new C(p(a),i,l,h,f);return a.length=0,y}e.createLineStarts=g;class t{constructor(r,o,i,l,h){this.bufferIndex=r,this.start=o,this.end=i,this.lineFeedCnt=l,this.length=h}}e.Piece=t;class s{constructor(r,o){this.buffer=r,this.lineStarts=o}}e.StringBuffer=s;class c{constructor(r,o){this._pieces=[],this._tree=r,this._BOM=o,this._index=0,r.root!==D.SENTINEL&&r.iterate(r.root,i=>(i!==D.SENTINEL&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class u{constructor(r){this._limit=r,this._cache=[]}get(r){for(let o=this._cache.length-1;o>=0;o--){let i=this._cache[o];if(i.nodeStartOffset<=r&&i.nodeStartOffset+i.node.piece.length>=r)return i}return null}get2(r){for(let o=this._cache.length-1;o>=0;o--){let i=this._cache[o];if(i.nodeStartLineNumber&&i.nodeStartLineNumber =r)return i}return null}set(r){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(r)}validate(r){let o=!1,i=this._cache;for(let l=0;l =r){i[l]=null,o=!0;continue}}if(o){let l=[];for(const h of i)h!==null&&l.push(h);this._cache=l}}}class d{constructor(r,o,i){this.create(r,o,i)}create(r,o,i){this._buffers=[new s("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=D.SENTINEL,this._lineCnt=1,this._length=0,this._EOL=o,this._EOLLength=o.length,this._EOLNormalized=i;let l=null;for(let h=0,f=r.length;h 0){r[h].lineStarts||(r[h].lineStarts=n(r[h].buffer));let y=new t(h+1,{line:0,column:0},{line:r[h].lineStarts.length-1,column:r[h].buffer.length-r[h].lineStarts[r[h].lineStarts.length-1]},r[h].lineStarts.length-1,r[h].buffer.length);this._buffers.push(r[h]),l=this.rbInsertRight(l,y)}this._searchCache=new u(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(r){let o=e.AverageBufferSize,i=o-Math.floor(o/3),l=i*2,h="",f=0,y=[];if(this.iterate(this.root,_=>{let b=this.getNodeContent(_),v=b.length;if(f<=i||f+v 0){let _=h.replace(/\r\n|\r|\n/g,r);y.push(new s(_,n(_)))}this.create(y,r,!0)}getEOL(){return this._EOL}setEOL(r){this._EOL=r,this._EOLLength=this._EOL.length,this.normalizeEOL(r)}createSnapshot(r){return new c(this,r)}getOffsetAt(r,o){let i=0,l=this.root;for(;l!==D.SENTINEL;)if(l.left!==D.SENTINEL&&l.lf_left+1>=r)l=l.left;else{if(l.lf_left+l.piece.lineFeedCnt+1>=r)return i+=l.size_left,i+=this.getAccumulatedValue(l,r-l.lf_left-2)+o-1;r-=l.lf_left+l.piece.lineFeedCnt,i+=l.size_left+l.piece.length,l=l.right}return i}getPositionAt(r){r=Math.floor(r),r=Math.max(0,r);let o=this.root,i=0,l=r;for(;o!==D.SENTINEL;)if(o.size_left!==0&&o.size_left>=r)o=o.left;else if(o.size_left+o.piece.length>=r){let h=this.getIndexOf(o,r-o.size_left);if(i+=o.lf_left+h.index,h.index===0){let f=this.getOffsetAt(i+1,1),y=l-f;return new w.Position(i+1,y+1)}return new w.Position(i+1,h.remainder+1)}else if(r-=o.size_left+o.piece.length,i+=o.lf_left+o.piece.lineFeedCnt,o.right===D.SENTINEL){let h=this.getOffsetAt(i+1,1),f=l-r-h;return new w.Position(i+1,f+1)}else o=o.right;return new w.Position(1,1)}getValueInRange(r,o){if(r.startLineNumber===r.endLineNumber&&r.startColumn===r.endColumn)return"";let i=this.nodeAt2(r.startLineNumber,r.startColumn),l=this.nodeAt2(r.endLineNumber,r.endColumn),h=this.getValueInRange2(i,l);return o?o!==this._EOL||!this._EOLNormalized?h.replace(/\r\n|\r|\n/g,o):o===this.getEOL()&&this._EOLNormalized?h:h.replace(/\r\n|\r|\n/g,o):h}getValueInRange2(r,o){if(r.node===o.node){let y=r.node,_=this._buffers[y.piece.bufferIndex].buffer,b=this.offsetInBuffer(y.piece.bufferIndex,y.piece.start);return _.substring(b+r.remainder,b+o.remainder)}let i=r.node,l=this._buffers[i.piece.bufferIndex].buffer,h=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),f=l.substring(h+r.remainder,h+i.piece.length);for(i=i.next();i!==D.SENTINEL;){let y=this._buffers[i.piece.bufferIndex].buffer,_=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===o.node){f+=y.substring(_,_+o.remainder);break}else f+=y.substr(_,i.piece.length);i=i.next()}return f}getLinesContent(){let r=[],o=0,i="",l=!1;return this.iterate(this.root,h=>{if(h===D.SENTINEL)return!0;const f=h.piece;let y=f.length;if(y===0)return!0;const _=this._buffers[f.bufferIndex].buffer,b=this._buffers[f.bufferIndex].lineStarts,v=f.start.line,m=f.end.line;let E=b[v]+f.start.column;if(l&&(_.charCodeAt(E)===10&&(E++,y--),r[o++]=i,i="",l=!1,y===0))return!0;if(v===m)return!this._EOLNormalized&&_.charCodeAt(E+y-1)===13?(l=!0,i+=_.substr(E,y-1)):i+=_.substr(E,y),!0;i+=this._EOLNormalized?_.substring(E,Math.max(E,b[v+1]-this._EOLLength)):_.substring(E,b[v+1]).replace(/(\r\n|\r|\n)$/,""),r[o++]=i;for(let I=v+1;I O+k,o.reset(0)):(R=E.buffer,A=O=>O,o.reset(k));do if(P=o.next(R),P){if(A(P.index)>=M)return v;this.positionInBuffer(r,A(P.index)-I,F);let O=this.getLineFeedCnt(r.piece.bufferIndex,h,F),L=F.line===h.line?F.column-h.column+l:F.column+1,B=L+P[0].length;if(m[v++]=(0,S.createFindMatch)(new N.Range(i+O,L,i+O,B),P,_),A(P.index)+P[0].length>=M||v>=b)return v}while(P);return v}findMatchesLineByLine(r,o,i,l){const h=[];let f=0;const y=new S.Searcher(o.wordSeparators,o.regex);let _=this.nodeAt2(r.startLineNumber,r.startColumn);if(_===null)return[];let b=this.nodeAt2(r.endLineNumber,r.endColumn);if(b===null)return[];let v=this.positionInBuffer(_.node,_.remainder),m=this.positionInBuffer(b.node,b.remainder);if(_.node===b.node)return this.findMatchesInNode(_.node,y,r.startLineNumber,r.startColumn,v,m,o,i,l,f,h),h;let E=r.startLineNumber,I=_.node;for(;I!==b.node;){let M=this.getLineFeedCnt(I.piece.bufferIndex,v,I.piece.end);if(M>=1){let F=this._buffers[I.piece.bufferIndex].lineStarts,R=this.offsetInBuffer(I.piece.bufferIndex,I.piece.start),A=F[v.line+M],O=E===r.startLineNumber?r.startColumn:1;if(f=this.findMatchesInNode(I,y,E,O,v,this.positionInBuffer(I,A-R),o,i,l,f,h),f>=l)return h;E+=M}let P=E===r.startLineNumber?r.startColumn-1:0;if(E===r.endLineNumber){const F=this.getLineContent(E).substring(P,r.endColumn-1);return f=this._findMatchesInLine(o,y,F,r.endLineNumber,P,f,h,i,l),h}if(f=this._findMatchesInLine(o,y,this.getLineContent(E).substr(P),E,P,f,h,i,l),f>=l)return h;E++,_=this.nodeAt2(E,1),I=_.node,v=this.positionInBuffer(_.node,_.remainder)}if(E===r.endLineNumber){let M=E===r.startLineNumber?r.startColumn-1:0;const P=this.getLineContent(E).substring(M,r.endColumn-1);return f=this._findMatchesInLine(o,y,P,r.endLineNumber,M,f,h,i,l),h}let k=E===r.startLineNumber?r.startColumn:1;return f=this.findMatchesInNode(b.node,y,E,k,v,m,o,i,l,f,h),h}_findMatchesInLine(r,o,i,l,h,f,y,_,b){const v=r.wordSeparators;if(!_&&r.simpleSearch){const E=r.simpleSearch,I=E.length,k=i.length;let M=-I;for(;(M=i.indexOf(E,M+I))!==-1;)if((!v||(0,S.isValidMatch)(v,i,k,M,I))&&(y[f++]=new T.FindMatch(new N.Range(l,M+1+h,l,M+1+I+h),null),f>=b))return f;return f}let m;o.reset(0);do if(m=o.next(i),m&&(y[f++]=(0,S.createFindMatch)(new N.Range(l,m.index+1+h,l,m.index+1+m[0].length+h),m,_),f>=b))return f;while(m);return f}insert(r,o,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==D.SENTINEL){let{node:l,remainder:h,nodeStartOffset:f}=this.nodeAt(r),y=l.piece,_=y.bufferIndex,b=this.positionInBuffer(l,h);if(l.piece.bufferIndex===0&&y.end.line===this._lastChangeBufferPos.line&&y.end.column===this._lastChangeBufferPos.column&&f+y.length===r&&o.length r){let v=[],m=new t(y.bufferIndex,b,y.end,this.getLineFeedCnt(y.bufferIndex,b,y.end),this.offsetInBuffer(_,y.end)-this.offsetInBuffer(_,b));if(this.shouldCheckCRLF()&&this.endWithCR(o)&&this.nodeCharCodeAt(l,h)===10){let M={line:m.start.line+1,column:0};m=new t(m.bufferIndex,M,m.end,this.getLineFeedCnt(m.bufferIndex,M,m.end),m.length-1),o+=` +`}if(this.shouldCheckCRLF()&&this.startWithLF(o))if(this.nodeCharCodeAt(l,h-1)===13){let M=this.positionInBuffer(l,h-1);this.deleteNodeTail(l,M),o="\r"+o,l.piece.length===0&&v.push(l)}else this.deleteNodeTail(l,b);else this.deleteNodeTail(l,b);let E=this.createNewPieces(o);m.length>0&&this.rbInsertRight(l,m);let I=l;for(let k=0;k =0;f--)h=this.rbInsertLeft(h,l[f]);this.validateCRLFWithPrevNode(h),this.deleteNodes(i)}insertContentToNodeRight(r,o){this.adjustCarriageReturnFromNext(r,o)&&(r+=` +`);let i=this.createNewPieces(r),l=this.rbInsertRight(o,i[0]),h=l;for(let f=1;f =E)b=m+1;else break;return i?(i.line=m,i.column=_-I,null):{line:m,column:_-I}}getLineFeedCnt(r,o,i){if(i.column===0)return i.line-o.line;let l=this._buffers[r].lineStarts;if(i.line===l.length-1)return i.line-o.line;let h=l[i.line+1],f=l[i.line]+i.column;if(h>f+1)return i.line-o.line;let y=f-1;return this._buffers[r].buffer.charCodeAt(y)===13?i.line-o.line+1:i.line-o.line}offsetInBuffer(r,o){return this._buffers[r].lineStarts[o.line]+o.column}deleteNodes(r){for(let o=0;o e.AverageBufferSize){let v=[];for(;r.length>e.AverageBufferSize;){const E=r.charCodeAt(e.AverageBufferSize-1);let I;E===13||E>=55296&&E<=56319?(I=r.substring(0,e.AverageBufferSize-1),r=r.substring(e.AverageBufferSize-1)):(I=r.substring(0,e.AverageBufferSize),r=r.substring(e.AverageBufferSize));let k=n(I);v.push(new t(this._buffers.length,{line:0,column:0},{line:k.length-1,column:I.length-k[k.length-1]},k.length-1,I.length)),this._buffers.push(new s(I,k))}let m=n(r);return v.push(new t(this._buffers.length,{line:0,column:0},{line:m.length-1,column:r.length-m[m.length-1]},m.length-1,r.length)),this._buffers.push(new s(r,m)),v}let o=this._buffers[0].buffer.length;const i=n(r,!1);let l=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===o&&o!==0&&this.startWithLF(r)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},l=this._lastChangeBufferPos;for(let v=0;v =r-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>r-1){let _=this.getAccumulatedValue(i,r-i.lf_left-2),b=this.getAccumulatedValue(i,r-i.lf_left-1),v=this._buffers[i.piece.bufferIndex].buffer,m=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return f+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:f,nodeStartLineNumber:y-(r-1-i.lf_left)}),v.substring(m+_,m+b-o)}else if(i.lf_left+i.piece.lineFeedCnt===r-1){let _=this.getAccumulatedValue(i,r-i.lf_left-2),b=this._buffers[i.piece.bufferIndex].buffer,v=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);l=b.substring(v+_,v+i.piece.length);break}else r-=i.lf_left+i.piece.lineFeedCnt,f+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==D.SENTINEL;){let f=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){let y=this.getAccumulatedValue(i,0),_=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return l+=f.substring(_,_+y-o),l}else{let y=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);l+=f.substr(y,i.piece.length)}i=i.next()}return l}computeBufferMetadata(){let r=this.root,o=1,i=0;for(;r!==D.SENTINEL;)o+=r.lf_left+r.piece.lineFeedCnt,i+=r.size_left+r.piece.length,r=r.right;this._lineCnt=o,this._length=i,this._searchCache.validate(this._length)}getIndexOf(r,o){let i=r.piece,l=this.positionInBuffer(r,o),h=l.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===o){let f=this.getLineFeedCnt(r.piece.bufferIndex,i.start,l);if(f!==h)return{index:f,remainder:0}}return{index:h,remainder:l.column}}getAccumulatedValue(r,o){if(o<0)return 0;let i=r.piece,l=this._buffers[i.bufferIndex].lineStarts,h=i.start.line+o+1;return h>i.end.line?l[i.end.line]+i.end.column-l[i.start.line]-i.start.column:l[h]-l[i.start.line]-i.start.column}deleteNodeTail(r,o){const i=r.piece,l=i.lineFeedCnt,h=this.offsetInBuffer(i.bufferIndex,i.end),f=o,y=this.offsetInBuffer(i.bufferIndex,f),_=this.getLineFeedCnt(i.bufferIndex,i.start,f),b=_-l,v=y-h,m=i.length+v;r.piece=new t(i.bufferIndex,i.start,f,_,m),(0,D.updateTreeMetadata)(this,r,v,b)}deleteNodeHead(r,o){const i=r.piece,l=i.lineFeedCnt,h=this.offsetInBuffer(i.bufferIndex,i.start),f=o,y=this.getLineFeedCnt(i.bufferIndex,f,i.end),_=this.offsetInBuffer(i.bufferIndex,f),b=y-l,v=h-_,m=i.length+v;r.piece=new t(i.bufferIndex,f,i.end,y,m),(0,D.updateTreeMetadata)(this,r,v,b)}shrinkNode(r,o,i){const l=r.piece,h=l.start,f=l.end,y=l.length,_=l.lineFeedCnt,b=o,v=this.getLineFeedCnt(l.bufferIndex,l.start,b),m=this.offsetInBuffer(l.bufferIndex,o)-this.offsetInBuffer(l.bufferIndex,h);r.piece=new t(l.bufferIndex,l.start,b,v,m),(0,D.updateTreeMetadata)(this,r,m-y,v-_);let E=new t(l.bufferIndex,i,f,this.getLineFeedCnt(l.bufferIndex,i,f),this.offsetInBuffer(l.bufferIndex,f)-this.offsetInBuffer(l.bufferIndex,i)),I=this.rbInsertRight(r,E);this.validateCRLFWithPrevNode(I)}appendToNode(r,o){this.adjustCarriageReturnFromNext(o,r)&&(o+=` +`);const i=this.shouldCheckCRLF()&&this.startWithLF(o)&&this.endWithCR(r),l=this._buffers[0].buffer.length;this._buffers[0].buffer+=o;const h=n(o,!1);for(let I=0;I r)o=o.left;else if(o.size_left+o.piece.length>=r){l+=o.size_left;let h={node:o,remainder:r-o.size_left,nodeStartOffset:l};return this._searchCache.set(h),h}else r-=o.size_left+o.piece.length,l+=o.size_left+o.piece.length,o=o.right;return null}nodeAt2(r,o){let i=this.root,l=0;for(;i!==D.SENTINEL;)if(i.left!==D.SENTINEL&&i.lf_left>=r-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>r-1){let h=this.getAccumulatedValue(i,r-i.lf_left-2),f=this.getAccumulatedValue(i,r-i.lf_left-1);return l+=i.size_left,{node:i,remainder:Math.min(h+o-1,f),nodeStartOffset:l}}else if(i.lf_left+i.piece.lineFeedCnt===r-1){let h=this.getAccumulatedValue(i,r-i.lf_left-2);if(h+o-1<=i.piece.length)return{node:i,remainder:h+o-1,nodeStartOffset:l};o-=i.piece.length-h;break}else r-=i.lf_left+i.piece.lineFeedCnt,l+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==D.SENTINEL;){if(i.piece.lineFeedCnt>0){let h=this.getAccumulatedValue(i,0),f=this.offsetOfNode(i);return{node:i,remainder:Math.min(o-1,h),nodeStartOffset:f}}else if(i.piece.length>=o-1){let h=this.offsetOfNode(i);return{node:i,remainder:o-1,nodeStartOffset:h}}else o-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(r,o){if(r.piece.lineFeedCnt<1)return-1;let i=this._buffers[r.piece.bufferIndex],l=this.offsetInBuffer(r.piece.bufferIndex,r.piece.start)+o;return i.buffer.charCodeAt(l)}offsetOfNode(r){if(!r)return 0;let o=r.size_left;for(;r!==this.root;)r.parent.right===r&&(o+=r.parent.size_left+r.parent.piece.length),r=r.parent;return o}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===` +`)}startWithLF(r){if(typeof r=="string")return r.charCodeAt(0)===10;if(r===D.SENTINEL||r.piece.lineFeedCnt===0)return!1;let o=r.piece,i=this._buffers[o.bufferIndex].lineStarts,l=o.start.line,h=i[l]+o.start.column;return l===i.length-1||i[l+1]>h+1?!1:this._buffers[o.bufferIndex].buffer.charCodeAt(h)===10}endWithCR(r){return typeof r=="string"?r.charCodeAt(r.length-1)===13:r===D.SENTINEL||r.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(r,r.piece.length-1)===13}validateCRLFWithPrevNode(r){if(this.shouldCheckCRLF()&&this.startWithLF(r)){let o=r.prev();this.endWithCR(o)&&this.fixCRLF(o,r)}}validateCRLFWithNextNode(r){if(this.shouldCheckCRLF()&&this.endWithCR(r)){let o=r.next();this.startWithLF(o)&&this.fixCRLF(r,o)}}fixCRLF(r,o){let i=[],l=this._buffers[r.piece.bufferIndex].lineStarts,h;r.piece.end.column===0?h={line:r.piece.end.line-1,column:l[r.piece.end.line]-l[r.piece.end.line-1]-1}:h={line:r.piece.end.line,column:r.piece.end.column-1};const f=r.piece.length-1,y=r.piece.lineFeedCnt-1;r.piece=new t(r.piece.bufferIndex,r.piece.start,h,y,f),(0,D.updateTreeMetadata)(this,r,-1,-1),r.piece.length===0&&i.push(r);let _={line:o.piece.start.line+1,column:0};const b=o.piece.length-1,v=this.getLineFeedCnt(o.piece.bufferIndex,_,o.piece.end);o.piece=new t(o.piece.bufferIndex,_,o.piece.end,v,b),(0,D.updateTreeMetadata)(this,o,-1,-1),o.piece.length===0&&i.push(o);let m=this.createNewPieces(`\r +`);this.rbInsertRight(r,m[0]);for(let E=0;E /?";function w(p=""){let C="(-?\\d*\\.\\d\\w*)|([^";for(const n of e.USUAL_WORD_SEPARATORS)p.indexOf(n)>=0||(C+="\\"+n);return C+="\\s]+)",new RegExp(C,"g")}e.DEFAULT_WORD_REGEXP=w();function N(p){let C=e.DEFAULT_WORD_REGEXP;if(p&&p instanceof RegExp)if(p.global)C=p;else{let n="g";p.ignoreCase&&(n+="i"),p.multiline&&(n+="m"),p.unicode&&(n+="u"),C=new RegExp(p.source,n)}return C.lastIndex=0,C}e.ensureValidWordDefinition=N;const T={maxLen:1e3,windowSize:15,timeBudget:150};function D(p,C,n,g,t=T){if(n.length>t.maxLen){let a=p-t.maxLen/2;return a<0?a=0:g+=a,n=n.substring(a,p+t.maxLen/2),D(p,C,n,g,t)}const s=Date.now(),c=p-1-g;let u=-1,d=null;for(let a=1;!(Date.now()-s>=t.timeBudget);a++){const r=c-t.windowSize*a;C.lastIndex=Math.max(0,r);const o=S(C,n,c,u);if(!o&&d||(d=o,r<=0))break;u=r}if(d){let a={word:d[0],startColumn:g+1+d.index,endColumn:g+1+d.index+d[0].length};return C.lastIndex=0,a}return null}e.getWordAtText=D;function S(p,C,n,g){let t;for(;t=p.exec(C);){const s=t.index||0;if(s<=n&&p.lastIndex>=n)return t;if(g>0&&s>g)return null}return null}}),define(J[116],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AutoClosingPairs=e.StandardAutoClosingPairConditional=e.IndentAction=void 0;var w;(function(S){S[S.None=0]="None",S[S.Indent=1]="Indent",S[S.IndentOutdent=2]="IndentOutdent",S[S.Outdent=3]="Outdent"})(w=e.IndentAction||(e.IndentAction={}));class N{constructor(p){if(this._standardAutoClosingPairConditionalBrand=void 0,this.open=p.open,this.close=p.close,this._standardTokenMask=0,Array.isArray(p.notIn))for(let C=0,n=p.notIn.length;C n&&(n=t)}return n}else{if(typeof D=="string")return C?D==="*"?5:D===p?10:0:0;if(D){const{language:n,pattern:g,scheme:t,hasAccessToAllModels:s}=D;if(!C&&!s)return 0;let c=0;if(t)if(t===S.scheme)c=10;else if(t==="*")c=5;else return 0;if(n)if(n===p)c=10;else if(n==="*")c=Math.max(c,5);else return 0;if(g){let u;if(typeof g=="string"?u=g:u=Object.assign(Object.assign({},g),{base:(0,N.normalize)(g.base)}),u===S.fsPath||(0,w.match)(u,S.fsPath))c=10;else return 0}return c}else return 0}}e.score=T}),define(J[396],ee([0,1,97]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.computeLinks=e.LinkComputer=e.StateMachine=e.Uint8Matrix=void 0;class N{constructor(s,c,u){const d=new Uint8Array(s*c);for(let a=0,r=s*c;a c&&(c=i),o>u&&(u=o),l>u&&(u=l)}c++,u++;let d=new N(u,c,0);for(let a=0,r=s.length;a =this._maxCharCode?0:this._states.get(s,c)}}e.StateMachine=T;let D=null;function S(){return D===null&&(D=new T([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),D}let p=null;function C(){if(p===null){p=new w.CharacterClassifier(0);const t=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u3008\u300C\u300E\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u300F\u300D\u3009\u2019\uFF40\uFF5E\u2026`;for(let c=0;c d);if(d>0){const o=c.charCodeAt(d-1),i=c.charCodeAt(r);(o===40&&i===41||o===91&&i===93||o===123&&i===125)&&r--}return{range:{startLineNumber:u,startColumn:d+1,endLineNumber:u,endColumn:r+2},url:c.substring(d,r+1)}}static computeLinks(s,c=S()){const u=C();let d=[];for(let a=1,r=s.getLineCount();a<=r;a++){const o=s.getLineContent(a),i=o.length;let l=0,h=0,f=0,y=1,_=!1,b=!1,v=!1,m=!1;for(;l>>0,new w.TokenizationResult2(g,C===null?e.NULL_STATE:C)}e.nullTokenize2=D}),define(J[177],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ignoreBracketsInToken=e.ScopedLineTokens=e.createScopedLineTokens=void 0;function w(D,S){let p=D.getCount(),C=D.findTokenIndexAtOffset(S),n=D.getLanguageId(C),g=C;for(;g+1 0&&D.getLanguageId(t-1)===n;)t--;return new N(D,n,t,g+1,D.getStartOffset(t),D.getEndOffset(g))}e.createScopedLineTokens=w;class N{constructor(S,p,C,n,g,t){this._scopedLineTokensBrand=void 0,this._actual=S,this.languageId=p,this._firstTokenIndex=C,this._lastTokenIndex=n,this.firstCharOffset=g,this._lastCharOffset=t}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getActualLineContentBefore(S){return this._actual.getLineContent().substring(0,this.firstCharOffset+S)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(S){return this._actual.findTokenIndexAtOffset(S+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(S){return this._actual.getStandardTokenType(S+this._firstTokenIndex)}}e.ScopedLineTokens=N;function T(D){return(D&7)!=0}e.ignoreBracketsInToken=T}),define(J[397],ee([0,1,116]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CharacterPairSupport=void 0;class N{constructor(S){if(S.autoClosingPairs?this._autoClosingPairs=S.autoClosingPairs.map(p=>new w.StandardAutoClosingPairConditional(p)):S.brackets?this._autoClosingPairs=S.brackets.map(p=>new w.StandardAutoClosingPairConditional({open:p[0],close:p[1]})):this._autoClosingPairs=[],S.colorizedBracketPairs?this._colorizedBracketPairs=T(S.colorizedBracketPairs.map(p=>[p[0],p[1]])):S.brackets?this._colorizedBracketPairs=T(S.brackets.map(p=>[p[0],p[1]]).filter(p=>!(p[0]==="<"&&p[1]===">"))):this._colorizedBracketPairs=[],S.__electricCharacterSupport&&S.__electricCharacterSupport.docComment){const p=S.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new w.StandardAutoClosingPairConditional({open:p.open,close:p.close||""}))}this._autoCloseBefore=typeof S.autoCloseBefore=="string"?S.autoCloseBefore:N.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED,this._surroundingPairs=S.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(){return this._autoCloseBefore}static shouldAutoClosePair(S,p,C){if(p.getTokenCount()===0)return!0;const n=p.findTokenIndexAtOffset(C-2),g=p.getStandardTokenType(n);return S.isOK(g)}getSurroundingPairs(){return this._surroundingPairs}getColorizedBrackets(){return this._colorizedBracketPairs}}e.CharacterPairSupport=N,N.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED=`;:.,=}])> + `;function T(D){return D.filter(([S,p])=>S!==""&&p!=="")}}),define(J[398],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IndentRulesSupport=void 0;function w(T){return T.global&&(T.lastIndex=0),!0}class N{constructor(D){this._indentationRules=D}shouldIncrease(D){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&w(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(D))}shouldDecrease(D){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&w(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(D))}shouldIndentNextLine(D){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&w(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(D))}shouldIgnore(D){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&w(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(D))}getIndentMetadata(D){let S=0;return this.shouldIncrease(D)&&(S+=1),this.shouldDecrease(D)&&(S+=2),this.shouldIndentNextLine(D)&&(S+=4),this.shouldIgnore(D)&&(S+=8),S}}e.IndentRulesSupport=N}),define(J[399],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BasicInplaceReplace=void 0;class w{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}navigateValueSet(T,D,S,p,C){if(T&&D){let n=this.doNavigateValueSet(D,C);if(n)return{range:T,value:n}}if(S&&p){let n=this.doNavigateValueSet(p,C);if(n)return{range:S,value:n}}return null}doNavigateValueSet(T,D){let S=this.numberReplace(T,D);return S!==null?S:this.textReplace(T,D)}numberReplace(T,D){let S=Math.pow(10,T.length-(T.lastIndexOf(".")+1)),p=Number(T),C=parseFloat(T);return!isNaN(p)&&!isNaN(C)&&p===C?p===0&&!D?null:(p=Math.floor(p*S),p+=D?S:-S,String(p/S)):null}textReplace(T,D){return this.valueSetsReplace(this._defaultValueSet,T,D)}valueSetsReplace(T,D,S){let p=null;for(let C=0,n=T.length;p===null&&C
=0?(p+=S?1:-1,p<0?p=T.length-1:p%=T.length,T[p]):null}}e.BasicInplaceReplace=w,w.INSTANCE=new w}),define(J[400],ee([0,1,11,8,116]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnEnterSupport=void 0;class D{constructor(p){p=p||{},p.brackets=p.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],p.brackets.forEach(C=>{const n=D._createOpenBracketRegExp(C[0]),g=D._createCloseBracketRegExp(C[1]);n&&g&&this._brackets.push({open:C[0],openRegExp:n,close:C[1],closeRegExp:g})}),this._regExpRules=p.onEnterRules||[]}onEnter(p,C,n,g){if(p>=3)for(let t=0,s=this._regExpRules.length;t d.reg?(d.reg.lastIndex=0,d.reg.test(d.text)):!0))return c.action}if(p>=2&&n.length>0&&g.length>0)for(let t=0,s=this._brackets.length;t=2&&n.length>0){for(let t=0,s=this._brackets.length;t[b[0].toLowerCase(),b[1].toLowerCase()]);const h=[];for(let b=0;b{const[m,E]=b,[I,k]=v;return m===I||m===k||E===I||E===k},y=(b,v)=>{const m=Math.min(b,v),E=Math.max(b,v);for(let I=0;I 0&&_.push({open:v,close:m})}return _}class p{constructor(l,h){this._richEditBracketsBrand=void 0;const f=S(h);this.brackets=f.map((y,_)=>new D(l,_,y.open,y.close,t(y.open,y.close,f,_),s(y.open,y.close,f,_))),this.forwardRegex=c(this.brackets),this.reversedRegex=u(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const y of this.brackets){for(const _ of y.open)this.textIsBracket[_]=y,this.textIsOpenBracket[_]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,_.length);for(const _ of y.close)this.textIsBracket[_]=y,this.textIsOpenBracket[_]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,_.length)}}}e.RichEditBrackets=p;function C(i,l,h,f){for(let y=0,_=l.length;y<_;y++){if(y===h)continue;const b=l[y];for(const v of b.open)v.indexOf(i)>=0&&f.push(v);for(const v of b.close)v.indexOf(i)>=0&&f.push(v)}}function n(i,l){return i.length-l.length}function g(i){if(i.length<=1)return i;const l=[],h=new Set;for(const f of i)h.has(f)||(l.push(f),h.add(f));return l}function t(i,l,h,f){let y=[];y=y.concat(i),y=y.concat(l);for(let _=0,b=y.length;_=0;b--)y[_++]=f.charCodeAt(b);return N.getPlatformTextDecoder().decode(y)}else{let y=[],_=0;for(let b=f.length-1;b>=0;b--)y[_++]=f.charAt(b);return y.join("")}}let l=null,h=null;return function(y){return l!==y&&(l=y,h=i(l)),h}}();class o{static _findPrevBracketInText(l,h,f,y){let _=f.match(l);if(!_)return null;let b=f.length-(_.index||0),v=_[0].length,m=y+b;return new T.Range(h,m-v+1,h,m+1)}static findPrevBracketInRange(l,h,f,y,_){const v=r(f).substring(f.length-_,f.length-y);return this._findPrevBracketInText(l,h,v,y)}static findNextBracketInText(l,h,f,y){let _=f.match(l);if(!_)return null;let b=_.index||0,v=_[0].length;if(v===0)return null;let m=y+b;return new T.Range(h,m+1,h,m+1+v)}static findNextBracketInRange(l,h,f,y,_){const b=f.substring(y,_);return this.findNextBracketInText(l,h,b,y)}}e.BracketsUtils=o}),define(J[401],ee([0,1,177,178]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BracketElectricCharacterSupport=void 0;class T{constructor(S){this._richEditBrackets=S}getElectricCharacters(){let S=[];if(this._richEditBrackets)for(const p of this._richEditBrackets.brackets)for(const C of p.close){const n=C.charAt(C.length-1);S.push(n)}return S=S.filter((p,C,n)=>n.indexOf(p)===C),S}onElectricCharacter(S,p,C){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const n=p.findTokenIndexAtOffset(C-1);if((0,w.ignoreBracketsInToken)(p.getStandardTokenType(n)))return null;const g=this._richEditBrackets.reversedRegex,t=p.getLineContent().substring(0,C-1)+S,s=N.BracketsUtils.findPrevBracketInRange(g,1,t,0,t.length);if(!s)return null;const c=t.substring(s.startColumn-1,s.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[c])return null;const d=p.getActualLineContentBefore(s.startColumn-1);return/^\s*$/.test(d)?{matchOpenBracket:c}:null}}e.BracketElectricCharacterSupport=T}),define(J[402],ee([0,1,29]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.generateTokensCSSForColorMap=e.ThemeTrieElement=e.ThemeTrieElementRule=e.strcmp=e.toStandardTokenType=e.TokenTheme=e.ColorMap=e.parseTokenTheme=e.ParsedTokenThemeRule=void 0;class N{constructor(a,r,o,i,l){this._parsedThemeRuleBrand=void 0,this.token=a,this.index=r,this.fontStyle=o,this.foreground=i,this.background=l}}e.ParsedTokenThemeRule=N;function T(d){if(!d||!Array.isArray(d))return[];let a=[],r=0;for(let o=0,i=d.length;o{let m=t(b.token,v.token);return m!==0?m:b.index-v.index});let r=0,o="000000",i="ffffff";for(;d.length>=1&&d[0].token==="";){let b=d.shift();b.fontStyle!==-1&&(r=b.fontStyle),b.foreground!==null&&(o=b.foreground),b.background!==null&&(i=b.background)}let l=new p;for(let b of a)l.getId(b);let h=l.getId(o),f=l.getId(i),y=new s(r,h,f),_=new c(y);for(let b=0,v=d.length;b >>0,this._cache.set(r,o)}return(o|a<<0)>>>0}}e.TokenTheme=C;const n=/\b(comment|string|regex|regexp)\b/;function g(d){let a=d.match(n);if(!a)return 0;switch(a[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"regexp":return 4}throw new Error("Unexpected match for standard token type!")}e.toStandardTokenType=g;function t(d,a){return da?1:0}e.strcmp=t;class s{constructor(a,r,o){this._themeTrieElementRuleBrand=void 0,this._fontStyle=a,this._foreground=r,this._background=o,this.metadata=(this._fontStyle<<11|this._foreground<<14|this._background<<23)>>>0}clone(){return new s(this._fontStyle,this._foreground,this._background)}acceptOverwrite(a,r,o){a!==-1&&(this._fontStyle=a),r!==0&&(this._foreground=r),o!==0&&(this._background=o),this.metadata=(this._fontStyle<<11|this._foreground<<14|this._background<<23)>>>0}}e.ThemeTrieElementRule=s;class c{constructor(a){this._themeTrieElementBrand=void 0,this._mainRule=a,this._children=new Map}match(a){if(a==="")return this._mainRule;let r=a.indexOf("."),o,i;r===-1?(o=a,i=""):(o=a.substring(0,r),i=a.substring(r+1));let l=this._children.get(o);return typeof l!="undefined"?l.match(i):this._mainRule}insert(a,r,o,i){if(a===""){this._mainRule.acceptOverwrite(r,o,i);return}let l=a.indexOf("."),h,f;l===-1?(h=a,f=""):(h=a.substring(0,l),f=a.substring(l+1));let y=this._children.get(h);typeof y=="undefined"&&(y=new c(this._mainRule.clone()),this._children.set(h,y)),y.insert(f,r,o,i)}}e.ThemeTrieElement=c;function u(d){let a=[];for(let r=1,o=d.length;r {this._map.get(S)===p&&(this._map.delete(S),this.fire([S]))})}registerPromise(S,p){let C=null,n=!1;return this._promises.set(S,p.then(g=>{this._promises.delete(S),!(n||!g)&&(C=this.register(S,g))})),(0,N.toDisposable)(()=>{n=!0,C&&C.dispose()})}getPromise(S){const p=this.get(S);if(p)return Promise.resolve(p);const C=this._promises.get(S);return C?C.then(n=>this.get(S)):null}get(S){return this._map.get(S)||null}setColorMap(S){this._colorMap=S,this._onDidChange.fire({changedLanguages:Array.from(this._map.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}}e.TokenizationRegistryImpl=T}),define(J[404],ee([0,1,105,17]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeSemanticTokensDto=void 0;function T(C){for(let n=0,g=C.length;n C&&(o=C-i);const l=d.color;let h=this._color2Id[l];h||(h=++this._lastAssignedId,this._color2Id[l]=h,this._id2Color[h]=l);const f=new w(o-i,o+i,h);d.setColorZone(f),s.push(f)}return this._colorZonesInvalid=!1,s.sort(w.compare),s}}e.OverviewZoneManager=T}),define(J[117],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VisibleRanges=e.HorizontalPosition=e.FloatHorizontalRange=e.HorizontalRange=e.LineVisibleRanges=e.RenderingContext=e.RestrictedRenderingContext=void 0;class w{constructor(g,t){this._restrictedRenderingContextBrand=void 0,this._viewLayout=g,this.viewportData=t,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;const s=this._viewLayout.getCurrentViewport();this.scrollTop=s.top,this.scrollLeft=s.left,this.viewportWidth=s.width,this.viewportHeight=s.height}getScrolledTopFromAbsoluteTop(g){return g-this.scrollTop}getVerticalOffsetForLineNumber(g){return this._viewLayout.getVerticalOffsetForLineNumber(g)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}}e.RestrictedRenderingContext=w;class N extends w{constructor(g,t,s){super(g,t);this._renderingContextBrand=void 0,this._viewLines=s}linesVisibleRangesForRange(g,t){return this._viewLines.linesVisibleRangesForRange(g,t)}visibleRangeForPosition(g){return this._viewLines.visibleRangeForPosition(g)}}e.RenderingContext=N;class T{constructor(g,t,s){this.outsideRenderedLine=g,this.lineNumber=t,this.ranges=s}}e.LineVisibleRanges=T;class D{constructor(g,t){this._horizontalRangeBrand=void 0,this.left=Math.round(g),this.width=Math.round(t)}static from(g){const t=new Array(g.length);for(let s=0,c=g.length;s =t.left?C.width=Math.max(C.width,t.left+t.width-C.left):(S[p++]=C,C=t)}return S[p++]=C,S}static _createHorizontalRangesFromClientRects(D,S){if(!D||D.length===0)return null;const p=[];for(let C=0,n=D.length;C c)return null;if(S=Math.min(c,Math.max(s,S)),C=Math.min(c,Math.max(s,C)),S===C&&p===n&&p===0&&!D.children[S].firstChild){const r=D.children[S].getClientRects();return this._createHorizontalRangesFromClientRects(r,g)}S!==C&&C>0&&n===0&&(C--,n=1073741824);let u=D.children[S].firstChild,d=D.children[C].firstChild;if((!u||!d)&&(!u&&p===0&&S>0&&(u=D.children[S-1].firstChild,p=1073741824),!d&&n===0&&C>0&&(d=D.children[C-1].firstChild,n=1073741824)),!u||!d)return null;p=Math.min(u.textContent.length,Math.max(0,p)),n=Math.min(d.textContent.length,Math.max(0,n));const a=this._readClientRects(u,p,d,n,t);return this._createHorizontalRangesFromClientRects(a,g)}}e.RangeUtil=N}),define(J[406],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewContext=e.EditorTheme=void 0;class w{constructor(D){this._theme=D}get type(){return this._theme.type}update(D){this._theme=D}getColor(D){return this._theme.getColor(D)}}e.EditorTheme=w;class N{constructor(D,S,p){this.configuration=D,this.theme=new w(S),this.model=p,this.viewLayout=p.viewLayout}addEventHandler(D){this.model.addViewEventHandler(D)}removeEventHandler(D){this.model.removeViewEventHandler(D)}}e.ViewContext=N}),define(J[180],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewZonesChangedEvent=e.ViewTokensColorsChangedEvent=e.ViewTokensChangedEvent=e.ViewThemeChangedEvent=e.ViewScrollChangedEvent=e.ViewRevealRangeRequestEvent=e.ViewLinesInsertedEvent=e.ViewLinesDeletedEvent=e.ViewLinesChangedEvent=e.ViewLineMappingChangedEvent=e.ViewLanguageConfigurationEvent=e.ViewFocusChangedEvent=e.ViewFlushedEvent=e.ViewDecorationsChangedEvent=e.ViewCursorStateChangedEvent=e.ViewConfigurationChangedEvent=e.ViewCompositionEndEvent=e.ViewCompositionStartEvent=void 0;class w{constructor(){this.type=0}}e.ViewCompositionStartEvent=w;class N{constructor(){this.type=1}}e.ViewCompositionEndEvent=N;class T{constructor(h){this.type=2,this._source=h}hasChanged(h){return this._source.hasChanged(h)}}e.ViewConfigurationChangedEvent=T;class D{constructor(h,f){this.type=3,this.selections=h,this.modelSelections=f}}e.ViewCursorStateChangedEvent=D;class S{constructor(h){this.type=4,h?(this.affectsMinimap=h.affectsMinimap,this.affectsOverviewRuler=h.affectsOverviewRuler):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0)}}e.ViewDecorationsChangedEvent=S;class p{constructor(){this.type=5}}e.ViewFlushedEvent=p;class C{constructor(h){this.type=6,this.isFocused=h}}e.ViewFocusChangedEvent=C;class n{constructor(){this.type=7}}e.ViewLanguageConfigurationEvent=n;class g{constructor(){this.type=8}}e.ViewLineMappingChangedEvent=g;class t{constructor(h,f){this.type=9,this.fromLineNumber=h,this.toLineNumber=f}}e.ViewLinesChangedEvent=t;class s{constructor(h,f){this.type=10,this.fromLineNumber=h,this.toLineNumber=f}}e.ViewLinesDeletedEvent=s;class c{constructor(h,f){this.type=11,this.fromLineNumber=h,this.toLineNumber=f}}e.ViewLinesInsertedEvent=c;class u{constructor(h,f,y,_,b,v){this.type=12,this.source=h,this.range=f,this.selections=y,this.verticalType=_,this.revealHorizontal=b,this.scrollType=v}}e.ViewRevealRangeRequestEvent=u;class d{constructor(h){this.type=13,this.scrollWidth=h.scrollWidth,this.scrollLeft=h.scrollLeft,this.scrollHeight=h.scrollHeight,this.scrollTop=h.scrollTop,this.scrollWidthChanged=h.scrollWidthChanged,this.scrollLeftChanged=h.scrollLeftChanged,this.scrollHeightChanged=h.scrollHeightChanged,this.scrollTopChanged=h.scrollTopChanged}}e.ViewScrollChangedEvent=d;class a{constructor(){this.type=14}}e.ViewThemeChangedEvent=a;class r{constructor(h){this.type=15,this.ranges=h}}e.ViewTokensChangedEvent=r;class o{constructor(){this.type=16}}e.ViewTokensColorsChangedEvent=o;class i{constructor(){this.type=17}}e.ViewZonesChangedEvent=i}),define(J[144],ee([0,1,8]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LineDecorationsNormalizer=e.DecorationSegment=e.LineDecoration=void 0;class N{constructor(C,n,g,t){this.startColumn=C,this.endColumn=n,this.className=g,this.type=t,this._lineDecorationBrand=void 0}static _equals(C,n){return C.startColumn===n.startColumn&&C.endColumn===n.endColumn&&C.className===n.className&&C.type===n.type}static equalsArr(C,n){const g=C.length,t=n.length;if(g!==t)return!1;for(let s=0;s =s||(u[d++]=new N(Math.max(1,a.startColumn-t+1),Math.min(c+1,a.endColumn-t+1),a.className,a.type));return u}static filter(C,n,g,t){if(C.length===0)return[];let s=[],c=0;for(let u=0,d=C.length;u n||r.isEmpty()&&(a.type===0||a.type===3))continue;const o=r.startLineNumber===n?r.startColumn:g,i=r.endLineNumber===n?r.endColumn:t;s[c++]=new N(o,i,a.inlineClassName,a.type)}return s}static _typeCompare(C,n){const g=[2,0,1,3];return g[C]-g[n]}static compare(C,n){if(C.startColumn!==n.startColumn)return C.startColumn-n.startColumn;if(C.endColumn!==n.endColumn)return C.endColumn-n.endColumn;const g=N._typeCompare(C.type,n.type);return g!==0?g:C.className!==n.className?C.className 0&&this.stopOffsets[0] 0&&n =C){this.stopOffsets.splice(t,0,C),this.classNames.splice(t,0,n),this.metadata.splice(t,0,g);break}this.count++}}class S{static normalize(C,n){if(n.length===0)return[];let g=[];const t=new D;let s=0;for(let c=0,u=n.length;c1){const f=C.charCodeAt(a-2);w.isHighSurrogate(f)&&a--}if(r>1){const f=C.charCodeAt(r-2);w.isHighSurrogate(f)&&r--}const l=a-1,h=r-2;s=t.consumeLowerThan(l,s,g),t.count===0&&(s=l),t.insert(h,o,i)}return t.consumeLowerThan(1073741824,s,g),g}}e.LineDecorationsNormalizer=S}),define(J[407],ee([0,1,8]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinesLayout=e.EditorWhitespace=void 0;class N{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(p){this._hasPending=!0,this._inserts.push(p)}change(p){this._hasPending=!0,this._changes.push(p)}remove(p){this._hasPending=!0,this._removes.push(p)}mustCommit(){return this._hasPending}commit(p){if(!this._hasPending)return;const C=this._inserts,n=this._changes,g=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],p._commitPendingChanges(C,n,g)}}class T{constructor(p,C,n,g,t){this.id=p,this.afterLineNumber=C,this.ordinal=n,this.height=g,this.minWidth=t,this.prefixSum=0}}e.EditorWhitespace=T;class D{constructor(p,C,n,g){this._instanceId=w.singleLetterHash(++D.INSTANCE_COUNT),this._pendingChanges=new N,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=p,this._lineHeight=C,this._paddingTop=n,this._paddingBottom=g}static findInsertionIndex(p,C,n){let g=0,t=p.length;for(;g >>1;C===p[s].afterLineNumber?n {C=!0,g=g|0,t=t|0,s=s|0,c=c|0;const u=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new T(u,g,t,s,c)),u},changeOneWhitespace:(g,t,s)=>{C=!0,t=t|0,s=s|0,this._pendingChanges.change({id:g,newAfterLineNumber:t,newHeight:s})},removeWhitespace:g=>{C=!0,this._pendingChanges.remove({id:g})}})}finally{this._pendingChanges.commit(this)}return C}_commitPendingChanges(p,C,n){if((p.length>0||n.length>0)&&(this._minWidth=-1),p.length+C.length+n.length<=1){for(const u of p)this._insertWhitespace(u);for(const u of C)this._changeOneWhitespace(u.id,u.newAfterLineNumber,u.newHeight);for(const u of n){const d=this._findWhitespaceIndex(u.id);d!==-1&&this._removeWhitespace(d)}return}const g=new Set;for(const u of n)g.add(u.id);const t=new Map;for(const u of C)t.set(u.id,u);const s=u=>{let d=[];for(const a of u)if(!g.has(a.id)){if(t.has(a.id)){const r=t.get(a.id);a.afterLineNumber=r.newAfterLineNumber,a.height=r.newHeight}d.push(a)}return d},c=s(this._arr).concat(s(p));c.sort((u,d)=>u.afterLineNumber===d.afterLineNumber?u.ordinal-d.ordinal:u.afterLineNumber-d.afterLineNumber),this._arr=c,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(p){const C=D.findInsertionIndex(this._arr,p.afterLineNumber,p.ordinal);this._arr.splice(C,0,p),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,C-1)}_findWhitespaceIndex(p){const C=this._arr;for(let n=0,g=C.length;n
C&&(this._arr[n].afterLineNumber-=C-p+1)}}onLinesInserted(p,C){this._checkPendingChanges(),p=p|0,C=C|0,this._lineCount+=C-p+1;for(let n=0,g=this._arr.length;n =C.length||C[c+1].afterLineNumber>=p)return c;n=c+1|0}else g=c-1|0}return-1}_findFirstWhitespaceAfterLineNumber(p){p=p|0;const n=this._findLastWhitespaceBeforeLineNumber(p)+1;return n 1?C=this._lineHeight*(p-1):C=0;const n=this.getWhitespaceAccumulatedHeightBeforeLineNumber(p);return C+n+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),this._minWidth===-1){let p=0;for(let C=0,n=this._arr.length;C C}isInTopPadding(p){return this._paddingTop===0?!1:(this._checkPendingChanges(),p =C-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(p){if(this._checkPendingChanges(),p=p|0,p<0)return 1;const C=this._lineCount|0,n=this._lineHeight;let g=1,t=C;for(;g =c+n)g=s+1;else{if(p>=c)return s;t=s}}return g>C?C:g}getLinesViewportData(p,C){this._checkPendingChanges(),p=p|0,C=C|0;const n=this._lineHeight,g=this.getLineNumberAtOrAfterVerticalOffset(p)|0,t=this.getVerticalOffsetForLineNumber(g)|0;let s=this._lineCount|0,c=this.getFirstWhitespaceIndexAfterLineNumber(g)|0;const u=this.getWhitespacesCount()|0;let d,a;c===-1?(c=u,a=s+1,d=0):(a=this.getAfterLineNumberForWhitespaceIndex(c)|0,d=this.getHeightForWhitespaceIndex(c)|0);let r=t,o=r;const i=5e5;let l=0;t>=i&&(l=Math.floor(t/i)*i,l=Math.floor(l/n)*n,o-=l);const h=[],f=p+(C-p)/2;let y=-1;for(let m=g;m<=s;m++){if(y===-1){const E=r,I=r+n;(E<=f&&ff)&&(y=m)}for(r+=n,h[m-g]=o,o+=n;a===m;)o+=d,r+=d,c++,c>=u?a=s+1:(a=this.getAfterLineNumberForWhitespaceIndex(c)|0,d=this.getHeightForWhitespaceIndex(c)|0);if(r>=C){s=m;break}}y===-1&&(y=s);const _=this.getVerticalOffsetForLineNumber(s)|0;let b=g,v=s;return b C&&v--,{bigNumbersDelta:l,startLineNumber:g,endLineNumber:s,relativeVerticalOffset:h,centeredLineNumber:y,completelyVisibleStartLineNumber:b,completelyVisibleEndLineNumber:v}}getVerticalOffsetForWhitespaceIndex(p){this._checkPendingChanges(),p=p|0;const C=this.getAfterLineNumberForWhitespaceIndex(p);let n;C>=1?n=this._lineHeight*C:n=0;let g;return p>0?g=this.getWhitespacesAccumulatedHeight(p-1):g=0,n+g+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(p){this._checkPendingChanges(),p=p|0;let C=0,n=this.getWhitespacesCount()-1;if(n<0)return-1;const g=this.getVerticalOffsetForWhitespaceIndex(n),t=this.getHeightForWhitespaceIndex(n);if(p>=g+t)return-1;for(;C =c+u)C=s+1;else{if(p>=c)return s;n=s}}return C}getWhitespaceAtVerticalOffset(p){this._checkPendingChanges(),p=p|0;const C=this.getWhitespaceIndexAtOrAfterVerticallOffset(p);if(C<0||C>=this.getWhitespacesCount())return null;const n=this.getVerticalOffsetForWhitespaceIndex(C);if(n>p)return null;const g=this.getHeightForWhitespaceIndex(C),t=this.getIdForWhitespaceIndex(C),s=this.getAfterLineNumberForWhitespaceIndex(C);return{id:t,afterLineNumber:s,verticalOffset:n,height:g}}getWhitespaceViewportData(p,C){this._checkPendingChanges(),p=p|0,C=C|0;const n=this.getWhitespaceIndexAtOrAfterVerticallOffset(p),g=this.getWhitespacesCount()-1;if(n<0)return[];let t=[];for(let s=n;s<=g;s++){const c=this.getVerticalOffsetForWhitespaceIndex(s),u=this.getHeightForWhitespaceIndex(s);if(c>=C)break;t.push({id:this.getIdForWhitespaceIndex(s),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(s),verticalOffset:c,height:u})}return t}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(p){return this._checkPendingChanges(),p=p|0,this._arr[p].id}getAfterLineNumberForWhitespaceIndex(p){return this._checkPendingChanges(),p=p|0,this._arr[p].afterLineNumber}getHeightForWhitespaceIndex(p){return this._checkPendingChanges(),p=p|0,this._arr[p].height}}e.LinesLayout=D,D.INSTANCE_COUNT=0}),define(J[118],ee([0,1,8,84,144]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.renderViewLine2=e.RenderLineOutput2=e.renderViewLine=e.RenderLineOutput=e.CharacterMapping=e.DomPosition=e.RenderLineInput=e.LineRange=void 0;class D{constructor(b,v,m){this._linePartBrand=void 0,this.endIndex=b,this.type=v,this.metadata=m}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}}class S{constructor(b,v){this.startOffset=b,this.endOffset=v}equals(b){return this.startOffset===b.startOffset&&this.endOffset===b.endOffset}}e.LineRange=S;class p{constructor(b,v,m,E,I,k,M,P,F,R,A,O,L,B,W,K,H,Y,X){this.useMonospaceOptimizations=b,this.canUseHalfwidthRightwardsArrow=v,this.lineContent=m,this.continuesWithWrappedLine=E,this.isBasicASCII=I,this.containsRTL=k,this.fauxIndentLength=M,this.lineTokens=P,this.lineDecorations=F.sort(T.LineDecoration.compare),this.tabSize=R,this.startVisibleColumn=A,this.spaceWidth=O,this.stopRenderingLineAfter=W,this.renderWhitespace=K==="all"?4:K==="boundary"?1:K==="selection"?2:K==="trailing"?3:0,this.renderControlCharacters=H,this.fontLigatures=Y,this.selectionsOnLine=X&&X.sort((oe,G)=>oe.startOffset >>16}static getCharIndex(b){return(b&65535)>>>0}setColumnInfo(b,v,m,E){const I=(v<<16|m<<0)>>>0;this._data[b-1]=I,this._absoluteOffsets[b-1]=E+m}getAbsoluteOffset(b){return this._absoluteOffsets.length===0?0:this._absoluteOffsets[b-1]}charOffsetToPartData(b){return this.length===0?0:b<0?this._data[0]:b>=this.length?this._data[this.length-1]:this._data[b]}getDomPosition(b){const v=this.charOffsetToPartData(b-1),m=n.getPartIndex(v),E=n.getCharIndex(v);return new C(m,E)}getColumn(b,v){return this.partDataToCharOffset(b.partIndex,v,b.charIndex)+1}partDataToCharOffset(b,v,m){if(this.length===0)return 0;let E=(b<<16|m<<0)>>>0,I=0,k=this.length-1;for(;I+1 >>1,K=this._data[W];if(K===E)return W;K>E?k=W:I=W}if(I===k)return I;let M=this._data[I],P=this._data[k];if(M===E)return I;if(P===E)return k;let F=n.getPartIndex(M),R=n.getCharIndex(M),A=n.getPartIndex(P),O;F!==A?O=v:O=n.getCharIndex(P);let L=m-R,B=O-m;return L<=B?I:k}}e.CharacterMapping=n;class g{constructor(b,v,m){this._renderLineOutputBrand=void 0,this.characterMapping=b,this.containsRTL=v,this.containsForeignElements=m}}e.RenderLineOutput=g;function t(_,b){if(_.lineContent.length===0){if(_.lineDecorations.length>0){b.appendASCIIString("");let v=0,m=0,E=0;for(const k of _.lineDecorations)(k.type===1||k.type===2)&&(b.appendASCIIString(''),k.type===1&&(E|=1,v++),k.type===2&&(E|=2,m++));b.appendASCIIString("");const I=new n(1,v+m);return I.setColumnInfo(1,v,0,0),new g(I,!1,E)}return b.appendASCIIString(""),new g(new n(0,0),!1,0)}return f(d(_),b)}e.renderViewLine=t;class s{constructor(b,v,m,E){this.characterMapping=b,this.html=v,this.containsRTL=m,this.containsForeignElements=E}}e.RenderLineOutput2=s;function c(_){let b=(0,N.createStringBuilder)(1e4),v=t(_,b);return new s(v.characterMapping,b.build(),v.containsRTL,v.containsForeignElements)}e.renderViewLine2=c;class u{constructor(b,v,m,E,I,k,M,P,F,R,A,O,L,B,W){this.fontIsMonospace=b,this.canUseHalfwidthRightwardsArrow=v,this.lineContent=m,this.len=E,this.isOverflowing=I,this.parts=k,this.containsForeignElements=M,this.fauxIndentLength=P,this.tabSize=F,this.startVisibleColumn=R,this.containsRTL=A,this.spaceWidth=O,this.renderSpaceCharCode=L,this.renderWhitespace=B,this.renderControlCharacters=W}}function d(_){const b=_.lineContent;let v,m;_.stopRenderingLineAfter!==-1&&_.stopRenderingLineAfter 0){for(let k=0,M=_.lineDecorations.length;k 0&&(m[E++]=new D(b,"",0));for(let I=0,k=_.getCount();I =v){m[E++]=new D(v,P,0);break}m[E++]=new D(M,P,0)}return m}function r(_,b,v){let m=0,E=[],I=0;if(v)for(let k=0,M=b.length;k =50&&(E[I++]=new D(O+1,R,A),L=O+1,O=-1);L!==F&&(E[I++]=new D(F,R,A))}else E[I++]=P;m=F}else for(let k=0,M=b.length;k 50){const A=P.type,O=P.metadata,L=Math.ceil(R/50);for(let B=1;B =8234&&_<=8238||_>=8294&&_<=8297||_>=8206&&_<=8207||_===1564}function i(_,b){let v=[],m=new D(0,"",0),E=0;for(const I of b){const k=I.endIndex;for(;E m.endIndex&&(m=new D(E,I.type,I.metadata),v.push(m)),m=new D(E+1,"mtkcontrol",I.metadata),v.push(m))}E>m.endIndex&&(m=new D(k,I.type,I.metadata),v.push(m))}return v}function l(_,b,v,m){const E=_.continuesWithWrappedLine,I=_.fauxIndentLength,k=_.tabSize,M=_.startVisibleColumn,P=_.useMonospaceOptimizations,F=_.selectionsOnLine,R=_.renderWhitespace===1,A=_.renderWhitespace===3,O=_.renderSpaceWidth!==_.spaceWidth;let L=[],B=0,W=0,K=m[W].type,H=m[W].endIndex;const Y=m.length;let X=!1,Z=w.firstNonWhitespaceIndex(b),se;Z===-1?(X=!0,Z=v,se=v):se=w.lastNonWhitespaceIndex(b);let oe=!1,G=0,x=F&&F[G],U=M%k;for(let V=I;V =x.endOffset&&(G++,x=F&&F[G]);let ue;if(V se)ue=!0;else if(Q===9)ue=!0;else if(Q===32)if(R)if(oe)ue=!0;else{const pe=V+1 V),ue&&A&&(ue=X||V>se),oe){if(!ue||!P&&U>=k){if(O){const pe=B>0?L[B-1].endIndex:I;for(let fe=pe+1;fe<=V;fe++)L[B++]=new D(fe,"mtkw",1)}else L[B++]=new D(V,"mtkw",1);U=U%k}}else(V===H||ue&&V>I)&&(L[B++]=new D(V,K,0),U=U%k);for(Q===9?U=k:w.isFullWidthCharacter(Q)?U+=2:U++,oe=ue;V===H&&(W++,W 0?b.charCodeAt(v-1):0,Q=v>1?b.charCodeAt(v-2):0;V===32&&Q!==32&&Q!==9||($=!0)}else $=!0;if($)if(O){const V=B>0?L[B-1].endIndex:I;for(let Q=V+1;Q<=v;Q++)L[B++]=new D(Q,"mtkw",1)}else L[B++]=new D(v,"mtkw",1);else L[B++]=new D(v,K,0);return L}function h(_,b,v,m){m.sort(T.LineDecoration.compare);const E=T.LineDecorationsNormalizer.normalize(_,m),I=E.length;let k=0,M=[],P=0,F=0;for(let A=0,O=v.length;A F&&(F=H.startOffset,M[P++]=new D(F,W,K)),H.endOffset+1<=B)F=H.endOffset+1,M[P++]=new D(F,W+" "+H.className,K|H.metadata),k++;else{F=B,M[P++]=new D(F,W+" "+H.className,K|H.metadata);break}}B>F&&(F=B,M[P++]=new D(F,W,K))}const R=v[v.length-1].endIndex;if(k'):b.appendASCIIString("");for(let U=0,$=P.length;U<$;U++){x+=G;const V=P[U],Q=V.endIndex,ue=V.type,pe=W!==0&&V.isWhitespace(),fe=pe&&!v&&(ue==="mtkw"||!E),re=X===Q&&V.isPseudoAfter();if(se=0,b.appendASCIIString('=F&&(q+=ce)}}for(fe&&(b.appendASCIIString(' style="width:'),b.appendASCIIString(String(L*ie)),b.appendASCIIString('px"')),b.appendASCII(62);X 1?b.write1(8594):b.write1(65515);for(let ne=2;ne<=q;ne++)b.write1(160)}else q=1,b.write1(B);se+=q,X>=F&&(Z+=q)}G=ie}else{let ie=0;for(b.appendASCII(62);X")}return Y||H.setColumnInfo(k+1,P.length-1,se,x),M&&b.appendASCIIString("…"),b.appendASCIIString(""),new g(H,O,E)}function y(_){return _.toString(16).toUpperCase().padStart(4,"0")}}),define(J[408],ee([0,1,3]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewportData=void 0;class N{constructor(D,S,p,C){this.selections=D,this.startLineNumber=S.startLineNumber|0,this.endLineNumber=S.endLineNumber|0,this.relativeVerticalOffset=S.relativeVerticalOffset,this.bigNumbersDelta=S.bigNumbersDelta|0,this.whitespaceViewportData=p,this._model=C,this.visibleRange=new w.Range(S.startLineNumber,this._model.getLineMinColumn(S.startLineNumber),S.endLineNumber,this._model.getLineMaxColumn(S.endLineNumber))}getViewLineRenderingData(D){return this._model.getViewLineRenderingData(this.visibleRange,D)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}e.ViewportData=N}),define(J[234],ee([0,1,135]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PrefixSumComputer=e.PrefixSumIndexOfResult=void 0;class N{constructor(S,p){this._prefixSumIndexOfResultBrand=void 0,this.index=S,this.remainder=p}}e.PrefixSumIndexOfResult=N;class T{constructor(S){this.values=S,this.prefixSum=new Uint32Array(S.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}insertValues(S,p){S=(0,w.toUint32)(S);const C=this.values,n=this.prefixSum,g=p.length;return g===0?!1:(this.values=new Uint32Array(C.length+g),this.values.set(C.subarray(0,S),0),this.values.set(C.subarray(S),S+g),this.values.set(p,S),S-1=F&&(Z+=ne)}G=ie}re?oe++:oe=0,X>=k&&!Y&&V.isPseudoAfter()&&(Y=!0,H.setColumnInfo(X+1,U,se,x)),b.appendASCIIString("=0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}changeValue(S,p){return S=(0,w.toUint32)(S),p=(0,w.toUint32)(p),this.values[S]===p?!1:(this.values[S]=p,S-1 =C.length)return!1;let g=C.length-S;return p>=g&&(p=g),p===0?!1:(this.values=new Uint32Array(C.length-p),this.values.set(C.subarray(0,S),0),this.values.set(C.subarray(S+p),S),this.prefixSum=new Uint32Array(this.values.length),S-1 =0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(S){return S<0?0:(S=(0,w.toUint32)(S),this._getPrefixSum(S))}_getPrefixSum(S){if(S<=this.prefixSumValidIndex[0])return this.prefixSum[S];let p=this.prefixSumValidIndex[0]+1;p===0&&(this.prefixSum[0]=this.values[0],p++),S>=this.values.length&&(S=this.values.length-1);for(let C=p;C<=S;C++)this.prefixSum[C]=this.prefixSum[C-1]+this.values[C];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],S),this.prefixSum[S]}getIndexOf(S){S=Math.floor(S),this.getTotalSum();let p=0,C=this.values.length-1,n=0,g=0,t=0;for(;p<=C;)if(n=p+(C-p)/2|0,g=this.prefixSum[n],t=g-this.values[n],S =g)p=n+1;else break;return new N(n,S-t)}}e.PrefixSumComputer=T}),define(J[409],ee([0,1,8,13,234]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MirrorTextModel=void 0;class D{constructor(p,C,n,g){this._uri=p,this._lines=C,this._eol=n,this._versionId=g,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(p){p.eol&&p.eol!==this._eol&&(this._eol=p.eol,this._lineStarts=null);const C=p.changes;for(const n of C)this._acceptDeleteRange(n.range),this._acceptInsertText(new N.Position(n.range.startLineNumber,n.range.startColumn),n.text);this._versionId=p.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){const p=this._eol.length,C=this._lines.length,n=new Uint32Array(C);for(let g=0;g this._lines.length)l=this._lines.length,h=this._lines[l-1].length+1,f=!0;else{let y=this._lines[l-1].length+1;h<1?(h=1,f=!0):h>y&&(h=y,f=!0)}return f?{lineNumber:l,column:h}:i}}e.MirrorModel=d;class a{constructor(i,l){this._host=i,this._models=Object.create(null),this._foreignModuleFactory=l,this._foreignModule=null}dispose(){this._models=Object.create(null)}_getModel(i){return this._models[i]}_getModels(){let i=[];return Object.keys(this._models).forEach(l=>i.push(this._models[l])),i}acceptNewModel(i){this._models[i.url]=new d(T.URI.parse(i.url),i.lines,i.EOL,i.versionId)}acceptModelChanged(i,l){if(!this._models[i])return;this._models[i].onEvents(l)}acceptRemovedModel(i){!this._models[i]||delete this._models[i]}computeDiff(i,l,h,f){return Re(this,void 0,void 0,function*(){const y=this._getModel(i),_=this._getModel(l);if(!y||!_)return null;const b=y.getLinesContent(),v=_.getLinesContent(),E=new p.DiffComputer(b,v,{shouldComputeCharChanges:!0,shouldPostProcessCharChanges:!0,shouldIgnoreTrimWhitespace:h,shouldMakePrettyDiff:!0,maxComputationTime:f}).computeDiff(),I=E.changes.length>0?!1:this._modelsAreIdentical(y,_);return{quitEarly:E.quitEarly,identical:I,changes:E.changes}})}_modelsAreIdentical(i,l){const h=i.getLineCount(),f=l.getLineCount();if(h!==f)return!1;for(let y=1;y<=h;y++){const _=i.getLineContent(y),b=l.getLineContent(y);if(_!==b)return!1}return!0}computeMoreMinimalEdits(i,l){return Re(this,void 0,void 0,function*(){const h=this._getModel(i);if(!h)return l;const f=[];let y;l=l.slice(0).sort((_,b)=>{if(_.range&&b.range)return S.Range.compareRangesUsingStarts(_.range,b.range);let v=_.range?0:1,m=b.range?0:1;return v-m});for(let{range:_,text:b,eol:v}of l){if(typeof v=="number"&&(y=v),S.Range.isEmpty(_)&&!b)continue;const m=h.getValueInRange(_);if(b=b.replace(/\r\n|\n|\r/g,h.eol),m===b)continue;if(Math.max(b.length,m.length)>a._diffLimit){f.push({range:_,text:b});continue}const E=(0,w.stringDiff)(m,b,!1),I=h.offsetAt(S.Range.lift(_).getStartPosition());for(const k of E){const M=h.positionAt(I+k.originalStart),P=h.positionAt(I+k.originalStart+k.originalLength),F={text:b.substr(k.modifiedStart,k.modifiedLength),range:{startLineNumber:M.lineNumber,startColumn:M.column,endLineNumber:P.lineNumber,endColumn:P.column}};h.getValueInRange(F.range)!==F.text&&f.push(F)}}return typeof y=="number"&&f.push({eol:y,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),f})}computeLinks(i){return Re(this,void 0,void 0,function*(){let l=this._getModel(i);return l?(0,g.computeLinks)(l):null})}textualSuggest(i,l,h,f){return Re(this,void 0,void 0,function*(){const y=new u.StopWatch(!0),_=new RegExp(h,f),b=new Set;e:for(let v of i){const m=this._getModel(v);if(!!m){for(let E of m.words(_))if(!(E===l||!isNaN(Number(E)))&&(b.add(E),b.size>a._suggestionsLimit))break e}}return{words:Array.from(b),duration:y.elapsed()}})}computeWordRanges(i,l,h,f){return Re(this,void 0,void 0,function*(){let y=this._getModel(i);if(!y)return Object.create(null);const _=new RegExp(h,f),b=Object.create(null);for(let v=l.startLineNumber;v this._host.fhr(b,v);let _={host:c.createProxyObject(h,f),getMirrorModels:()=>this._getModels()};return this._foreignModuleFactory?(this._foreignModule=this._foreignModuleFactory(_,l),Promise.resolve(c.getAllMethodNames(this._foreignModule))):new Promise((b,v)=>{j([i],m=>{this._foreignModule=m.create(_,l),b(c.getAllMethodNames(this._foreignModule))},v)})}fmr(i,l){if(!this._foreignModule||typeof this._foreignModule[i]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+i));try{return Promise.resolve(this._foreignModule[i].apply(this._foreignModule,l))}catch(h){return Promise.reject(h)}}}e.EditorSimpleWorker=a,a._diffLimit=1e5,a._suggestionsLimit=1e4;function r(o){return new a(o,null)}e.create=r,typeof importScripts=="function"&&(N.globals.monaco=(0,s.createMonacoBaseAPI)())}),define(J[119],ee([0,1,2]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewEventHandler=void 0;class N extends w.Disposable{constructor(){super();this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(D){return!1}onCompositionEnd(D){return!1}onConfigurationChanged(D){return!1}onCursorStateChanged(D){return!1}onDecorationsChanged(D){return!1}onFlushed(D){return!1}onFocusChanged(D){return!1}onLanguageConfigurationChanged(D){return!1}onLineMappingChanged(D){return!1}onLinesChanged(D){return!1}onLinesDeleted(D){return!1}onLinesInserted(D){return!1}onRevealRangeRequest(D){return!1}onScrollChanged(D){return!1}onThemeChanged(D){return!1}onTokensChanged(D){return!1}onTokensColorsChanged(D){return!1}onZonesChanged(D){return!1}handleEvents(D){let S=!1;for(let p=0,C=D.length;p =c,h=r,f=o>=c;let y=g.left,_=t.left;return y+s>u.scrollLeft+u.viewportWidth&&(y=u.scrollLeft+u.viewportWidth-s),_+s>u.scrollLeft+u.viewportWidth&&(_=u.scrollLeft+u.viewportWidth-s),y d){const r=a-(d-c);a-=r,s-=r}if(a=b,E=i+c<=l.height-v;return this._fixedOverflowWidgets?{fitsAbove:m,aboveTop:Math.max(o,b),aboveLeft:f,fitsBelow:E,belowTop:i,belowLeft:_}:{fitsAbove:m,aboveTop:d,aboveLeft:h,fitsBelow:E,belowTop:a,belowLeft:y}}_prepareRenderWidgetAtExactPositionOverflowing(g){return new D(g.top,g.left+this._contentLeft)}_getTopAndBottomLeft(g){if(!this._viewRange)return[null,null];const t=g.linesVisibleRangesForRange(this._viewRange,!1);if(!t||t.length===0)return[null,null];let s=t[0],c=t[0];for(const l of t)l.lineNumber c.lineNumber&&(c=l);let u=1073741824;for(const l of s.ranges)l.leftg.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(g){this._renderData=this._prepareRenderWidget(g)}render(g){if(!this._renderData){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&C(this._actual.afterRender,this._actual,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+g.scrollTop-g.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&C(this._actual.afterRender,this._actual,this._renderData.position)}}function C(n,g,...t){try{return n.call(g,...t)}catch(s){return null}}}),define(J[412],ee([0,1,100,3,117,338]),function(j,e,w,N,T){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DecorationsOverlay=void 0;class D extends w.DynamicViewOverlay{constructor(p){super();this._context=p;const C=this._context.configuration.options;this._lineHeight=C.get(58),this._typicalHalfwidthCharacterWidth=C.get(43).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(p){const C=this._context.configuration.options;return this._lineHeight=C.get(58),this._typicalHalfwidthCharacterWidth=C.get(43).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(p){return!0}onFlushed(p){return!0}onLinesChanged(p){return!0}onLinesDeleted(p){return!0}onLinesInserted(p){return!0}onScrollChanged(p){return p.scrollTopChanged||p.scrollWidthChanged}onZonesChanged(p){return!0}prepareRender(p){const C=p.getDecorationsInViewport();let n=[],g=0;for(let u=0,d=C.length;u {if(u.options.zIndex d.options.zIndex)return 1;const a=u.options.className,r=d.options.className;return a r?1:N.Range.compareRangesUsingStarts(u.range,d.range)});const t=p.visibleRange.startLineNumber,s=p.visibleRange.endLineNumber,c=[];for(let u=t;u<=s;u++){const d=u-t;c[d]=""}this._renderWholeLineDecorations(p,n,c),this._renderNormalDecorations(p,n,c),this._renderResult=c}_renderWholeLineDecorations(p,C,n){const g=String(this._lineHeight),t=p.visibleRange.startLineNumber,s=p.visibleRange.endLineNumber;for(let c=0,u=C.length;c',r=Math.max(d.range.startLineNumber,t),o=Math.min(d.range.endLineNumber,s);for(let i=r;i<=o;i++){const l=i-t;n[l]+=a}}}_renderNormalDecorations(p,C,n){const g=String(this._lineHeight),t=p.visibleRange.startLineNumber;let s=null,c=!1,u=null;for(let d=0,a=C.length;d';c[o]+=f}}}render(p,C){if(!this._renderResult)return"";const n=C-p;return n<0||n>=this._renderResult.length?"":this._renderResult[n]}}e.DecorationsOverlay=D}),define(J[181],ee([0,1,100,339]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlyphMarginOverlay=e.DedupOverlay=e.DecorationToRender=void 0;class N{constructor(p,C,n){this._decorationToRenderBrand=void 0,this.startLineNumber=+p,this.endLineNumber=+C,this.className=String(n)}}e.DecorationToRender=N;class T extends w.DynamicViewOverlay{_render(p,C,n){const g=[];for(let c=p;c<=C;c++){const u=c-p;g[u]=[]}if(n.length===0)return g;n.sort((c,u)=>c.className===u.className?c.startLineNumber===u.startLineNumber?c.endLineNumber-u.endLineNumber:c.startLineNumber-u.startLineNumber:c.className ',d=[];for(let a=C;a<=n;a++){const r=a-C,o=g[r];o.length===0?d[r]="":d[r]=' =this._renderResult.length?"":this._renderResult[n]}}e.GlyphMarginOverlay=D}),define(J[413],ee([0,1,181,343]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinesDecorationsOverlay=void 0;class N extends w.DedupOverlay{constructor(D){super();this._context=D;const p=this._context.configuration.options.get(129);this._decorationsLeft=p.decorationsLeft,this._decorationsWidth=p.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(D){const p=this._context.configuration.options.get(129);return this._decorationsLeft=p.decorationsLeft,this._decorationsWidth=p.decorationsWidth,!0}onDecorationsChanged(D){return!0}onFlushed(D){return!0}onLinesChanged(D){return!0}onLinesDeleted(D){return!0}onLinesInserted(D){return!0}onScrollChanged(D){return D.scrollTopChanged}onZonesChanged(D){return!0}_getDecorations(D){const S=D.getDecorationsInViewport();let p=[],C=0;for(let n=0,g=S.length;n',s=[];for(let c=S;c<=p;c++){const u=c-S,d=C[u];let a="";for(let r=0,o=d.length;r';n[t]=c}this._renderResult=n}render(D,S){return this._renderResult?this._renderResult[S-D]:""}}e.MarginViewLineDecorationsOverlay=N}),define(J[415],ee([0,1,30,50,346]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewOverlayWidgets=void 0;class T extends N.ViewPart{constructor(S){super(S);const C=this._context.configuration.options.get(129);this._widgets={},this._verticalScrollbarWidth=C.verticalScrollbarWidth,this._minimapWidth=C.minimap.minimapWidth,this._horizontalScrollbarHeight=C.horizontalScrollbarHeight,this._editorHeight=C.height,this._editorWidth=C.width,this._domNode=(0,w.createFastDomNode)(document.createElement("div")),N.PartFingerprints.write(this._domNode,4),this._domNode.setClassName("overlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(S){const C=this._context.configuration.options.get(129);return this._verticalScrollbarWidth=C.verticalScrollbarWidth,this._minimapWidth=C.minimap.minimapWidth,this._horizontalScrollbarHeight=C.horizontalScrollbarHeight,this._editorHeight=C.height,this._editorWidth=C.width,!0}addWidget(S){const p=(0,w.createFastDomNode)(S.getDomNode());this._widgets[S.getId()]={widget:S,preference:null,domNode:p},p.setPosition("absolute"),p.setAttribute("widgetId",S.getId()),this._domNode.appendChild(p),this.setShouldRender()}setWidgetPosition(S,p){const C=this._widgets[S.getId()];return C.preference===p?!1:(C.preference=p,this.setShouldRender(),!0)}removeWidget(S){const p=S.getId();if(this._widgets.hasOwnProperty(p)){const n=this._widgets[p].domNode.domNode;delete this._widgets[p],n.parentNode.removeChild(n),this.setShouldRender()}}_renderWidget(S){const p=S.domNode;if(S.preference===null){p.unsetTop();return}if(S.preference===0)p.setTop(0),p.setRight(2*this._verticalScrollbarWidth+this._minimapWidth);else if(S.preference===1){const C=p.domNode.clientHeight;p.setTop(this._editorHeight-C-2*this._horizontalScrollbarHeight),p.setRight(2*this._verticalScrollbarWidth+this._minimapWidth)}else S.preference===2&&(p.setTop(0),p.domNode.style.right="50%")}prepareRender(S){}render(S){this._domNode.setWidth(this._editorWidth);const p=Object.keys(this._widgets);for(let C=0,n=p.length;C this._context.viewLayout.getVerticalOffsetForLineNumber(g)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(n.get(58)),this._zoneManager.setPixelRatio(n.get(127)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(p){const C=this._context.configuration.options;return p.hasChanged(58)&&(this._zoneManager.setLineHeight(C.get(58)),this._render()),p.hasChanged(127)&&(this._zoneManager.setPixelRatio(C.get(127)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(p){return this._render(),!0}onScrollChanged(p){return p.scrollHeightChanged&&(this._zoneManager.setOuterHeight(p.scrollHeight),this._render()),!0}onZonesChanged(p){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(p){this._domNode.setTop(p.top),this._domNode.setRight(p.right);let C=!1;C=this._zoneManager.setDOMWidth(p.width)||C,C=this._zoneManager.setDOMHeight(p.height)||C,C&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(p){this._zoneManager.setZones(p),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;const p=this._zoneManager.getCanvasWidth(),C=this._zoneManager.getCanvasHeight(),n=this._zoneManager.resolveColorZones(),g=this._zoneManager.getId2Color(),t=this._domNode.domNode.getContext("2d");return t.clearRect(0,0,p,C),n.length>0&&this._renderOneLane(t,n,g,p),!0}_renderOneLane(p,C,n,g){let t=0,s=0,c=0;for(const u of C){const d=u.colorId,a=u.from,r=u.to;d!==t?(p.fillRect(0,s,g,c-s),t=d,p.fillStyle=n[t],s=a,c=r):c>=a?c=Math.max(c,r):(p.fillRect(0,s,g,c-s),s=a,c=r)}p.fillRect(0,s,g,c-s)}}e.OverviewRuler=D}),define(J[417],ee([0,1,30,11,50,13]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewZones=void 0;const S=()=>{throw new Error("Invalid change accessor")};class p extends T.ViewPart{constructor(g){super(g);const t=this._context.configuration.options,s=t.get(129);this._lineHeight=t.get(58),this._contentWidth=s.contentWidth,this._contentLeft=s.contentLeft,this.domNode=(0,w.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=(0,w.createFastDomNode)(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const g=this._context.viewLayout.getWhitespaces(),t=new Map;for(const c of g)t.set(c.id,c);let s=!1;return this._context.model.changeWhitespace(c=>{const u=Object.keys(this._zones);for(let d=0,a=u.length;d{const c={addZone:u=>(t=!0,this._addZone(s,u)),removeZone:u=>{!u||(t=this._removeZone(s,u)||t)},layoutZone:u=>{!u||(t=this._layoutZone(s,u)||t)}};C(g,c),c.addZone=S,c.removeZone=S,c.layoutZone=S}),t}_addZone(g,t){const s=this._computeWhitespaceProps(t),u={whitespaceId:g.insertWhitespace(s.afterViewLineNumber,this._getZoneOrdinal(t),s.heightInPx,s.minWidthInPx),delegate:t,isInHiddenArea:s.isInHiddenArea,isVisible:!1,domNode:(0,w.createFastDomNode)(t.domNode),marginDomNode:t.marginDomNode?(0,w.createFastDomNode)(t.marginDomNode):null};return this._safeCallOnComputedHeight(u.delegate,s.heightInPx),u.domNode.setPosition("absolute"),u.domNode.domNode.style.width="100%",u.domNode.setDisplay("none"),u.domNode.setAttribute("monaco-view-zone",u.whitespaceId),this.domNode.appendChild(u.domNode),u.marginDomNode&&(u.marginDomNode.setPosition("absolute"),u.marginDomNode.domNode.style.width="100%",u.marginDomNode.setDisplay("none"),u.marginDomNode.setAttribute("monaco-view-zone",u.whitespaceId),this.marginDomNode.appendChild(u.marginDomNode)),this._zones[u.whitespaceId]=u,this.setShouldRender(),u.whitespaceId}_removeZone(g,t){if(this._zones.hasOwnProperty(t)){const s=this._zones[t];return delete this._zones[t],g.removeWhitespace(s.whitespaceId),s.domNode.removeAttribute("monaco-visible-view-zone"),s.domNode.removeAttribute("monaco-view-zone"),s.domNode.domNode.parentNode.removeChild(s.domNode.domNode),s.marginDomNode&&(s.marginDomNode.removeAttribute("monaco-visible-view-zone"),s.marginDomNode.removeAttribute("monaco-view-zone"),s.marginDomNode.domNode.parentNode.removeChild(s.marginDomNode.domNode)),this.setShouldRender(),!0}return!1}_layoutZone(g,t){if(this._zones.hasOwnProperty(t)){const s=this._zones[t],c=this._computeWhitespaceProps(s.delegate);return s.isInHiddenArea=c.isInHiddenArea,g.changeOneWhitespace(s.whitespaceId,c.afterViewLineNumber,c.heightInPx),this._safeCallOnComputedHeight(s.delegate,c.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(g){if(this._zones.hasOwnProperty(g)){const t=this._zones[g];return Boolean(t.delegate.suppressMouseDown)}return!1}_heightInPixels(g){return typeof g.heightInPx=="number"?g.heightInPx:typeof g.heightInLines=="number"?this._lineHeight*g.heightInLines:this._lineHeight}_minWidthInPixels(g){return typeof g.minWidthInPx=="number"?g.minWidthInPx:0}_safeCallOnComputedHeight(g,t){if(typeof g.onComputedHeight=="function")try{g.onComputedHeight(t)}catch(s){(0,N.onUnexpectedError)(s)}}_safeCallOnDomNodeTop(g,t){if(typeof g.onDomNodeTop=="function")try{g.onDomNodeTop(t)}catch(s){(0,N.onUnexpectedError)(s)}}prepareRender(g){}render(g){const t=g.viewportData.whitespaceViewportData,s={};let c=!1;for(const d of t)this._zones[d.id].isInHiddenArea||(s[d.id]=d,c=!0);const u=Object.keys(this._zones);for(let d=0,a=u.length;d0?o:0;return new N.Position(r+this.outputLineIndex,i+this.outputOffset+1)}}e.OutputPosition=S;class p{constructor(r,o,i,l,h){this.breakOffsets=r,this.breakOffsetsVisibleColumn=o,this.wrappedTextIndentLength=i,this.injectionOffsets=l,this.injectionOptions=h}getInputOffsetOfOutputPosition(r,o){let i=0;if(r===0?i=o:i=this.breakOffsets[r-1]+o,this.injectionOffsets!==null)for(let l=0;l this.injectionOffsets[l];l++)i 0?this.breakOffsets[h-1]:0,o===0)if(r<=f)l=h-1;else if(r>y)i=h+1;else break;else if(r =y)i=h+1;else break}return new S(h,r-f)}outputPositionToOffsetInUnwrappedLine(r,o){let i=(r>0?this.breakOffsets[r-1]:0)+o;return r>0&&(i-=this.wrappedTextIndentLength),i}normalizeOffsetAroundInjections(r,o){const i=this.getInjectedTextAtOffset(r);if(!i)return r;if(o===2)return r===i.offsetInUnwrappedLine+i.length?i.offsetInUnwrappedLine+i.length:i.offsetInUnwrappedLine;if(o===1){let f=i.offsetInUnwrappedLine+i.length,y=i.injectedTextIndex;for(;y+1 =0&&this.injectionOffsets[h-1]===this.injectionOffsets[h];)l-=this.injectionOptions[h-1].content.length,h++;return l}getInjectedText(r,o){const i=this.outputPositionToOffsetInUnwrappedLine(r,o),l=this.getInjectedTextAtOffset(i);return l?{options:this.injectionOptions[l.injectedTextIndex]}:null}getInjectedTextAtOffset(r){const o=this.injectionOffsets,i=this.injectionOptions;if(o!==null){let l=0;for(let h=0;h r)break;if(r<=_)return{injectedTextIndex:h,offsetInUnwrappedLine:y,length:f};l+=f}}}}e.LineBreakData=p;class C{constructor(r){this.options=r}}e.InjectedText=C;class n{constructor(r,o){this.tabSize=r,this.data=o}}e.MinimapLinesRenderingData=n;class g{constructor(r,o,i,l,h,f,y){this._viewLineDataBrand=void 0,this.content=r,this.continuesWithWrappedLine=o,this.minColumn=i,this.maxColumn=l,this.startVisibleColumn=h,this.tokens=f,this.inlineDecorations=y}}e.ViewLineData=g;class t{constructor(r,o,i,l,h,f,y,_,b,v){this.minColumn=r,this.maxColumn=o,this.content=i,this.continuesWithWrappedLine=l,this.isBasicASCII=t.isBasicASCII(i,f),this.containsRTL=t.containsRTL(i,this.isBasicASCII,h),this.tokens=y,this.inlineDecorations=_,this.tabSize=b,this.startVisibleColumn=v}static isBasicASCII(r,o){return o?w.isBasicASCII(r):!0}static containsRTL(r,o,i){return!o&&i?w.containsRTL(r):!1}}e.ViewLineRenderingData=t;class s{constructor(r,o,i){this.range=r,this.inlineClassName=o,this.type=i}}e.InlineDecoration=s;class c{constructor(r,o,i,l){this.startOffset=r,this.endOffset=o,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=l}toInlineDecoration(r){return new s(new T.Range(r,this.startOffset+1,r,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}e.SingleLineInlineDecoration=c;class u{constructor(r,o){this._viewModelDecorationBrand=void 0,this.range=r,this.options=o}}e.ViewModelDecoration=u;class d{constructor(r,o,i){this.color=r,this.zIndex=o,this.data=i}static cmp(r,o){return r.zIndex===o.zIndex?r.color o.color?1:0:r.zIndex-o.zIndex}}e.OverviewRulerDecorationsGroup=d}),define(J[418],ee([0,1,8,97,60,99]),function(j,e,w,N,T,D){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MonospaceLineBreaksComputerFactory=void 0;class S extends N.CharacterClassifier{constructor(r,o){super(0);for(let i=0;i =0&&r<256?this._asciiMap[r]:r>=12352&&r<=12543||r>=13312&&r<=19903||r>=19968&&r<=40959?3:this._map.get(r)||this._defaultValue}}let p=[],C=[];class n{constructor(r,o){this.classifier=new S(r,o)}static create(r){return new n(r.get(118),r.get(117))}createLineBreaksComputer(r,o,i,l){o=o|0,i=+i;const h=[],f=[],y=[];return{addRequest:(_,b,v)=>{h.push(_),f.push(b),y.push(v)},finalize:()=>{const _=r.typicalFullwidthCharacterWidth/r.typicalHalfwidthCharacterWidth;let b=[];for(let v=0,m=h.length;v =0){let O=Math.abs(b[A]-F);for(;A+1 =O)break;O=L,A++}}for(;A O&&(O=M,L=P);let B=0,W=0,K=0,H=0;if(L<=F){let X=L,Z=O===0?0:o.charCodeAt(O-1),se=O===0?0:a.get(Z),oe=!0;for(let G=O;G M&&u(Z,se,U,$)&&(B=x,W=X),X+=V,X>F){x>M?(K=x,H=X-V):(K=G+1,H=X),X-W>m&&(B=0),oe=!1;break}Z=U,se=$}if(oe){k>0&&(E[k]=_[_.length-1],I[k]=b[_.length-1],k++);break}}if(B===0){let X=L,Z=o.charCodeAt(O),se=a.get(Z),oe=!1;for(let G=O-1;G>=M;G--){const x=G+1,U=o.charCodeAt(G);if(U===9){oe=!0;break}let $,V;if(w.isLowSurrogate(U)?(G--,$=0,V=2):($=a.get(U),V=w.isFullWidthCharacter(U)?h:1),X<=F){if(K===0&&(K=x,H=X),X<=F-m)break;if(u(U,$,Z,se)){B=x,W=X;break}}X-=V,Z=U,se=$}if(B!==0){const G=m-(H-W);if(G<=i){const x=o.charCodeAt(K);let U;w.isHighSurrogate(x)?U=2:U=s(x,H,i,h),G-U<0&&(B=0)}}if(oe){A--;continue}}if(B===0&&(B=K,W=H),B<=M){const X=o.charCodeAt(M);w.isHighSurrogate(X)?(B=M+2,W=P+2):(B=M+1,W=P+s(X,P,i,h))}for(M=B,E[k]=B,P=W,I[k]=W,k++,F=W+m;A<0||A =Y)break;Y=X,A++}}return k===0?null:(E.length=k,I.length=k,p=r.breakOffsets,C=r.breakOffsetsVisibleColumn,r.breakOffsets=E,r.breakOffsetsVisibleColumn=I,r.wrappedTextIndentLength=v,r)}function t(a,r,o,i,l,h,f){const y=D.LineInjectedText.applyInjectedText(r,o);let _,b;if(o&&o.length>0?(_=o.map(W=>W.options),b=o.map(W=>W.column-1)):(_=null,b=null),l===-1)return _?new T.LineBreakData([y.length],[],0,b,_):null;const v=y.length;if(v<=1)return _?new T.LineBreakData([y.length],[],0,b,_):null;const m=d(y,i,l,h,f),E=l-m;let I=[],k=[],M=0,P=0,F=0,R=l,A=y.charCodeAt(0),O=a.get(A),L=s(A,0,i,h),B=1;w.isHighSurrogate(A)&&(L+=1,A=y.charCodeAt(1),O=a.get(A),B++);for(let W=B;W R&&((P===0||L-F>E)&&(P=K,F=L-X),I[M]=P,k[M]=F,M++,R=F+E,P=0),A=H,O=Y}return M===0&&(!o||o.length===0)?null:(I[M]=v,k[M]=L,new T.LineBreakData(I,k,m,b,_))}function s(a,r,o,i){return a===9?o-r%o:w.isFullWidthCharacter(a)||a<32?i:1}function c(a,r){return r-a%r}function u(a,r,o,i){return o!==32&&(r===2||r===3&&i!==2||i===1||i===3&&r!==1)}function d(a,r,o,i,l){let h=0;if(l!==0){const f=w.firstNonWhitespaceIndex(a);if(f!==-1){for(let _=0;_ o&&(h=0)}}return h}}),define(J[182],ee([0,1,4,2]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadOnlyEditAttemptEvent=e.CursorStateChangedEvent=e.HiddenAreasChangedEvent=e.ViewZonesChangedEvent=e.ScrollChangedEvent=e.FocusChangedEvent=e.ContentSizeChangedEvent=e.ViewModelEventsCollector=e.ViewModelEventDispatcher=void 0;class T extends N.Disposable{constructor(){super();this._onEvent=this._register(new w.Emitter),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(u){this._addOutgoingEvent(u),this._emitOutgoingEvents()}_addOutgoingEvent(u){for(let d=0,a=this._outgoingEvents.length;d0;){if(this._collector||this._isConsumingViewEventQueue)return;const u=this._outgoingEvents.shift();u.isNoOp()||this._onEvent.fire(u)}}addViewEventHandler(u){for(let d=0,a=this._eventHandlers.length;d0&&this._emitMany(d)}this._emitOutgoingEvents()}emitSingleViewEvent(u){try{this.beginEmitViewEvents().emitViewEvent(u)}finally{this.endEmitViewEvents()}}_emitMany(u){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(u):this._viewEventQueue=u,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const u=this._viewEventQueue;this._viewEventQueue=null;const d=this._eventHandlers.slice(0);for(const a of d)a.handleEvents(u)}}}e.ViewModelEventDispatcher=T;class D{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(u){this.viewEvents.push(u)}emitOutgoingEvent(u){this.outgoingEvents.push(u)}}e.ViewModelEventsCollector=D;class S{constructor(u,d,a,r){this.kind=0,this._oldContentWidth=u,this._oldContentHeight=d,this.contentWidth=a,this.contentHeight=r,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}merge(u){return u.kind!==0?this:new S(this._oldContentWidth,this._oldContentHeight,u.contentWidth,u.contentHeight)}}e.ContentSizeChangedEvent=S;class p{constructor(u,d){this.kind=1,this.oldHasFocus=u,this.hasFocus=d}isNoOp(){return this.oldHasFocus===this.hasFocus}merge(u){return u.kind!==1?this:new p(this.oldHasFocus,u.hasFocus)}}e.FocusChangedEvent=p;class C{constructor(u,d,a,r,o,i,l,h){this.kind=2,this._oldScrollWidth=u,this._oldScrollLeft=d,this._oldScrollHeight=a,this._oldScrollTop=r,this.scrollWidth=o,this.scrollLeft=i,this.scrollHeight=l,this.scrollTop=h,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}merge(u){return u.kind!==2?this:new C(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,u.scrollWidth,u.scrollLeft,u.scrollHeight,u.scrollTop)}}e.ScrollChangedEvent=C;class n{constructor(){this.kind=3}isNoOp(){return!1}merge(u){return this}}e.ViewZonesChangedEvent=n;class g{constructor(){this.kind=4}isNoOp(){return!1}merge(u){return this}}e.HiddenAreasChangedEvent=g;class t{constructor(u,d,a,r,o,i,l){this.kind=6,this.oldSelections=u,this.selections=d,this.oldModelVersionId=a,this.modelVersionId=r,this.source=o,this.reason=i,this.reachedMaxCursorCount=l}static _selectionsAreEqual(u,d){if(!u&&!d)return!0;if(!u||!d)return!1;const a=u.length,r=d.length;if(a!==r)return!1;for(let o=0;o=u?0:a.horizontalScrollbarSize}_getContentHeight(c,u,d){const a=this._configuration.options;let r=this._linesLayout.getLinesTotalHeight();return a.get(93)?r+=Math.max(0,u-a.get(58)-a.get(74).bottom):r+=this._getHorizontalScrollbarHeight(c,d),r}_updateHeight(){const c=this._scrollable.getScrollDimensions(),u=c.width,d=c.height,a=c.contentWidth;this._scrollable.setScrollDimensions(new n(u,c.contentWidth,d,this._getContentHeight(u,d,a)))}getCurrentViewport(){const c=this._scrollable.getScrollDimensions(),u=this._scrollable.getCurrentScrollPosition();return new S.Viewport(u.scrollTop,u.scrollLeft,c.width,c.height)}getFutureViewport(){const c=this._scrollable.getScrollDimensions(),u=this._scrollable.getFutureScrollPosition();return new S.Viewport(u.scrollTop,u.scrollLeft,c.width,c.height)}_computeContentWidth(c){const u=this._configuration.options,d=u.get(130),a=u.get(43);if(d.isViewportWrapping){const r=u.get(129),o=u.get(64);return c>r.contentWidth+a.typicalHalfwidthCharacterWidth&&o.enabled&&o.side==="right"?c+r.verticalScrollbarWidth:c}else{const r=u.get(92)*a.typicalHalfwidthCharacterWidth,o=this._linesLayout.getWhitespaceMinWidth();return Math.max(c+r,o)}}setMaxLineWidth(c){const u=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new n(u.width,this._computeContentWidth(c),u.height,u.contentHeight)),this._updateHeight()}saveState(){const c=this._scrollable.getFutureScrollPosition();let u=c.scrollTop,d=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(u),a=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(d);return{scrollTop:u,scrollTopWithoutViewZones:u-a,scrollLeft:c.scrollLeft}}changeWhitespace(c){const u=this._linesLayout.changeWhitespace(c);return u&&this.onHeightMaybeChanged(),u}getVerticalOffsetForLineNumber(c){return this._linesLayout.getVerticalOffsetForLineNumber(c)}isAfterLines(c){return this._linesLayout.isAfterLines(c)}isInTopPadding(c){return this._linesLayout.isInTopPadding(c)}isInBottomPadding(c){return this._linesLayout.isInBottomPadding(c)}getLineNumberAtVerticalOffset(c){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(c)}getWhitespaceAtVerticalOffset(c){return this._linesLayout.getWhitespaceAtVerticalOffset(c)}getLinesViewportData(){const c=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(c.top,c.top+c.height)}getLinesViewportDataAtScrollTop(c){const u=this._scrollable.getScrollDimensions();return c+u.height>u.scrollHeight&&(c=u.scrollHeight-u.height),c<0&&(c=0),this._linesLayout.getLinesViewportData(c,c+u.height)}getWhitespaceViewportData(){const c=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(c.top,c.top+c.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(c){return this._scrollable.validateScrollPosition(c)}setScrollPosition(c,u){u===1?this._scrollable.setScrollPositionNow(c):this._scrollable.setScrollPositionSmooth(c)}deltaScrollNow(c,u){const d=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:d.scrollLeft+c,scrollTop:d.scrollTop+u})}}e.ViewLayout=t}),define(J[420],ee([0,1,3,22]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MoveCaretCommand=void 0;class T{constructor(S,p){this._selection=S,this._isMovingLeft=p}getEditOperations(S,p){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const C=this._selection.startLineNumber,n=this._selection.startColumn,g=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&g===S.getLineMaxColumn(C)))if(this._isMovingLeft){const t=new w.Range(C,n-1,C,n),s=S.getValueInRange(t);p.addEditOperation(t,null),p.addEditOperation(new w.Range(C,g,C,g),s)}else{const t=new w.Range(C,g,C,g+1),s=S.getValueInRange(t);p.addEditOperation(t,null),p.addEditOperation(new w.Range(C,n,C,n),s)}}computeCursorState(S,p){return this._isMovingLeft?new N.Selection(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new N.Selection(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}e.MoveCaretCommand=T}),define(J[145],ee([0,1]),function(j,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CodeActionCommandArgs=e.filtersAction=e.mayIncludeActionsOfKind=e.CodeActionKind=void 0;class w{constructor(C){this.value=C}equals(C){return this.value===C.value}contains(C){return this.equals(C)||this.value===""||C.value.startsWith(this.value+w.sep)}intersects(C){return this.contains(C)||C.contains(this)}append(C){return new w(this.value+w.sep+C)}}e.CodeActionKind=w,w.sep=".",w.None=new w("@@none@@"),w.Empty=new w(""),w.QuickFix=new w("quickfix"),w.Refactor=new w("refactor"),w.Source=new w("source"),w.SourceOrganizeImports=w.Source.append("organizeImports"),w.SourceFixAll=w.Source.append("fixAll");function N(p,C){return!(p.include&&!p.include.intersects(C)||p.excludes&&p.excludes.some(n=>D(C,n,p.include))||!p.includeSourceActions&&w.Source.contains(C))}e.mayIncludeActionsOfKind=N;function T(p,C){const n=C.kind?new w(C.kind):void 0;return!(p.include&&(!n||!p.include.contains(n))||p.excludes&&n&&p.excludes.some(g=>D(n,g,p.include))||!p.includeSourceActions&&n&&w.Source.contains(n)||p.onlyIncludePreferredActions&&!C.isPreferred)}e.filtersAction=T;function D(p,C,n){return!(!C.contains(p)||n&&C.contains(n))}class S{constructor(C,n,g){this.kind=C,this.apply=n,this.preferred=g}static fromUser(C,n){return!C||typeof C!="object"?new S(n.kind,n.apply,!1):new S(S.getKindFromUser(C,n.kind),S.getApplyFromUser(C,n.apply),S.getPreferredUser(C))}static getApplyFromUser(C,n){switch(typeof C.apply=="string"?C.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return n}}static getKindFromUser(C,n){return typeof C.kind=="string"?new w(C.kind):n}static getPreferredUser(C){return typeof C.preferred=="boolean"?C.preferred:!1}}e.CodeActionCommandArgs=S}),define(J[421],ee([0,1,4]),function(j,e,w){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPickerModel=void 0;class N{constructor(D,S,p){this.presentationIndex=p,this._onColorFlushed=new w.Emitter,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new w.Emitter,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new w.Emitter,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=D,this._color=D,this._colorPresentations=S}get color(){return this._color}set color(D){this._color.equals(D)||(this._color=D,this._onDidChangeColor.fire(D))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(D){this._colorPresentations=D,this.presentationIndex>D.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(D,S){for(let p=0;p this.selection.endLineNumber){this.targetSelection=new N.Selection(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber 0){let p=[];for(let g=0;g w.Range.compareRangesUsingStarts(g.range,t.range));let C=[],n=p[0];for(let g=1;g 0){let r=[],o=d.caseOps.length,i=0;for(let l=0,h=a.length;l =o){r.push(a.slice(l));break}switch(d.caseOps[i]){case"U":r.push(a[l].toUpperCase());break;case"u":r.push(a[l].toUpperCase()),i++;break;case"L":r.push(a[l].toLowerCase());break;case"l":r.push(a[l].toLowerCase()),i++;break;default:r.push(a[l])}}a=r.join("")}s+=a}return s}static _substitute(g,t){if(t===null)return"";if(g===0)return t[0];let s="";for(;g>0;){if(g =c)break;let d=n.charCodeAt(s);switch(d){case 92:t.emitUnchanged(s-1),t.emitStatic("\\",s+1);break;case 110:t.emitUnchanged(s-1),t.emitStatic(` +`,s+1);break;case 116:t.emitUnchanged(s-1),t.emitStatic(" ",s+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(s-1),t.emitStatic("",s+1),g.push(String.fromCharCode(d));break}continue}if(u===36){if(s++,s>=c)break;let d=n.charCodeAt(s);if(d===36){t.emitUnchanged(s-1),t.emitStatic("$",s+1);continue}if(d===48||d===38){t.emitUnchanged(s-1),t.emitMatchIndex(0,s+1,g),g.length=0;continue}if(49<=d&&d<=57){let a=d-48;if(s+1 e.MAX_FOLDING_REGIONS)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=S,this._endIndexes=p,this._collapseStates=new Uint32Array(Math.ceil(S.length/32)),this._types=C,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let S=[],p=(C,n)=>{let g=S[S.length-1];return this.getStartLineNumber(g)<=C&&this.getEndLineNumber(g)>=n};for(let C=0,n=this._startIndexes.length;C e.MAX_LINE_NUMBER||t>e.MAX_LINE_NUMBER)throw new Error("startLineNumber or endLineNumber must not exceed "+e.MAX_LINE_NUMBER);for(;S.length>0&&!p(g,t);)S.pop();let s=S.length>0?S[S.length-1]:-1;S.push(C),this._startIndexes[C]=g+((s&255)<<24),this._endIndexes[C]=t+((s&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(S){return this._startIndexes[S]&e.MAX_LINE_NUMBER}getEndLineNumber(S){return this._endIndexes[S]&e.MAX_LINE_NUMBER}getType(S){return this._types?this._types[S]:void 0}hasTypes(){return!!this._types}isCollapsed(S){let p=S/32|0,C=S%32;return(this._collapseStates[p]&1< >>24)+((this._endIndexes[S]&w)>>>16);return p===e.MAX_FOLDING_REGIONS?-1:p}contains(S,p){return this.getStartLineNumber(S)<=p&&this.getEndLineNumber(S)>=p}findIndex(S){let p=0,C=this._startIndexes.length;if(C===0)return-1;for(;p =0){if(this.getEndLineNumber(p)>=S)return p;for(p=this.getParentIndex(p);p!==-1;){if(this.contains(p,S))return p;p=this.getParentIndex(p)}}return-1}toString(){let S=[];for(let p=0;p =this.endLineNumber}containsLine(S){return this.startLineNumber<=S&&S<=this.endLineNumber}}e.FoldingRegion=T}),define(J[425],ee([0,1,4,183]),function(j,e,w,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNextFoldLine=e.getPreviousFoldLine=e.getParentFoldLine=e.setCollapseStateForType=e.setCollapseStateForMatchingLines=e.setCollapseStateForRest=e.setCollapseStateAtLevel=e.setCollapseStateUp=e.setCollapseStateLevelsUp=e.setCollapseStateLevelsDown=e.toggleCollapseState=e.FoldingModel=void 0;class T{constructor(r,o){this._updateEventEmitter=new w.Emitter,this.onDidChange=this._updateEventEmitter.event,this._textModel=r,this._decorationProvider=o,this._regions=new N.FoldingRegions(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[],this._isInitialized=!1}get regions(){return this._regions}get textModel(){return this._textModel}get isInitialized(){return this._isInitialized}toggleCollapseState(r){if(!r.length)return;r=r.sort((i,l)=>i.regionIndex-l.regionIndex);const o={};this._decorationProvider.changeDecorations(i=>{let l=0,h=-1,f=-1;const y=_=>{for(;l<_;){const b=this._regions.getEndLineNumber(l),v=this._regions.isCollapsed(l);b<=h&&i.changeDecorationOptions(this._editorDecorationIds[l],this._decorationProvider.getDecorationOption(v,b<=f)),v&&b>f&&(f=b),l++}};for(let _ of r){let b=_.regionIndex,v=this._editorDecorationIds[b];if(v&&!o[v]){o[v]=!0,y(b);let m=!this._regions.isCollapsed(b);this._regions.setCollapsed(b,m),h=Math.max(h,this._regions.getEndLineNumber(b))}}y(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:r})}update(r,o=[]){let i=[],l=(m,E)=>{for(let I of o)if(m{const I=r.getStartLineNumber(m),k=r.getEndLineNumber(m);E||(E=r.isCollapsed(m)),E&&l(I,k)&&(E=!1),r.setCollapsed(m,E);const M=this._textModel.getLineMaxColumn(I),P={startLineNumber:I,startColumn:Math.max(M-1,1),endLineNumber:I,endColumn:M};i.push({range:P,options:this._decorationProvider.getDecorationOption(E,k<=h)}),E&&k>h&&(h=k)},y=0,_=()=>{for(;y =I)f(b,E===I),b++;else break}}v=_()}for(;b