@digipair/skill-web-jsoneditor 0.63.1 → 0.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +471 -221
  2. package/index.esm.js +471 -221
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -449,7 +449,7 @@ var _Symbol, _a$2, _a1;
449
449
  * @license
450
450
  * Copyright 2017 Google LLC
451
451
  * SPDX-License-Identifier: BSD-3-Clause
452
- */ var i$5 = Object.is, e$2 = Object.defineProperty, r$5 = Object.getOwnPropertyDescriptor, h$2 = Object.getOwnPropertyNames, o$3 = Object.getOwnPropertySymbols, n$3 = Object.getPrototypeOf, a$2 = globalThis, c$2 = a$2.trustedTypes, l$3 = c$2 ? c$2.emptyScript : "", p$3 = a$2.reactiveElementPolyfillSupport, d$2 = function(t, s) {
452
+ */ var i$4 = Object.is, e$2 = Object.defineProperty, r$5 = Object.getOwnPropertyDescriptor, h$2 = Object.getOwnPropertyNames, o$3 = Object.getOwnPropertySymbols, n$3 = Object.getPrototypeOf, a$2 = globalThis, c$2 = a$2.trustedTypes, l$3 = c$2 ? c$2.emptyScript : "", p$3 = a$2.reactiveElementPolyfillSupport, d$2 = function(t, s) {
453
453
  return t;
454
454
  }, u$2 = {
455
455
  toAttribute: function toAttribute(t, s) {
@@ -483,7 +483,7 @@ var _Symbol, _a$2, _a1;
483
483
  return i;
484
484
  }
485
485
  }, f$2 = function(t, s) {
486
- return !i$5(t, s);
486
+ return !i$4(t, s);
487
487
  }, y$2 = {
488
488
  attribute: !0,
489
489
  type: String,
@@ -1158,7 +1158,7 @@ function _create_super$c(Derived) {
1158
1158
  };
1159
1159
  }
1160
1160
  var _t$1;
1161
- var t$3 = globalThis, i$4 = t$3.trustedTypes, s$1 = i$4 ? i$4.createPolicy("lit-html", {
1161
+ var t$3 = globalThis, i$3 = t$3.trustedTypes, s$1 = i$3 ? i$3.createPolicy("lit-html", {
1162
1162
  createHTML: function(t) {
1163
1163
  return t;
1164
1164
  }
@@ -1249,7 +1249,7 @@ var N = /*#__PURE__*/ function() {
1249
1249
  if ($$1.test(r.tagName)) {
1250
1250
  var t3 = r.textContent.split(h$1), s2 = t3.length - 1;
1251
1251
  if (s2 > 0) {
1252
- r.textContent = i$4 ? i$4.emptyScript : "";
1252
+ r.textContent = i$3 ? i$3.emptyScript : "";
1253
1253
  for(var i2 = 0; i2 < s2; i2++)r.append(t3[i2], l$2()), C$2.nextNode(), d.push({
1254
1254
  type: 2,
1255
1255
  index: ++c
@@ -1806,8 +1806,8 @@ var _globalThis1;
1806
1806
  r$3._$litElement$ = !0, r$3["finalized"] = !0, (_globalThis_litElementHydrateSupport = (_globalThis = globalThis).litElementHydrateSupport) === null || _globalThis_litElementHydrateSupport === void 0 ? void 0 : _globalThis_litElementHydrateSupport.call(_globalThis, {
1807
1807
  LitElement: r$3
1808
1808
  });
1809
- var i$3 = globalThis.litElementPolyfillSupport;
1810
- i$3 === null || i$3 === void 0 ? void 0 : i$3({
1809
+ var i$2 = globalThis.litElementPolyfillSupport;
1810
+ i$2 === null || i$2 === void 0 ? void 0 : i$2({
1811
1811
  LitElement: r$3
1812
1812
  });
1813
1813
  var _litElementVersions;
@@ -3221,6 +3221,12 @@ function isControlCharacter(code) {
3221
3221
  */ function isWhitespace(code) {
3222
3222
  return code === codeSpace || code === codeNewline || code === codeTab || code === codeReturn;
3223
3223
  }
3224
+ /**
3225
+ * Check if the given character is a whitespace character like space or tab,
3226
+ * but NOT a newline
3227
+ */ function isWhitespaceExceptNewline(code) {
3228
+ return code === codeSpace || code === codeTab || code === codeReturn;
3229
+ }
3224
3230
  /**
3225
3231
  * Check if the given character is a special whitespace character, some
3226
3232
  * unicode variant
@@ -3359,28 +3365,32 @@ var escapeCharacters = {
3359
3365
  return processed;
3360
3366
  }
3361
3367
  function parseWhitespaceAndSkipComments() {
3368
+ var skipNewline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3362
3369
  var start = i;
3363
- var changed = parseWhitespace();
3370
+ var changed = parseWhitespace(skipNewline);
3364
3371
  do {
3365
3372
  changed = parseComment();
3366
3373
  if (changed) {
3367
- changed = parseWhitespace();
3374
+ changed = parseWhitespace(skipNewline);
3368
3375
  }
3369
3376
  }while (changed);
3370
3377
  return i > start;
3371
3378
  }
3372
- function parseWhitespace() {
3379
+ function parseWhitespace(skipNewline) {
3380
+ var _isWhiteSpace = skipNewline ? isWhitespace : isWhitespaceExceptNewline;
3373
3381
  var whitespace = "";
3374
- var normal;
3375
- // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
3376
- while((normal = isWhitespace(text.charCodeAt(i))) || isSpecialWhitespace(text.charCodeAt(i))){
3377
- if (normal) {
3382
+ while(true){
3383
+ var c = text.charCodeAt(i);
3384
+ if (_isWhiteSpace(c)) {
3378
3385
  whitespace += text[i];
3379
- } else {
3386
+ i++;
3387
+ } else if (isSpecialWhitespace(c)) {
3380
3388
  // repair special whitespace
3381
3389
  whitespace += " ";
3390
+ i++;
3391
+ } else {
3392
+ break;
3382
3393
  }
3383
- i++;
3384
3394
  }
3385
3395
  if (whitespace.length > 0) {
3386
3396
  output += whitespace;
@@ -3586,9 +3596,11 @@ var escapeCharacters = {
3586
3596
  * - If it turns out that the string does not have a valid end quote followed
3587
3597
  * by a delimiter (which should be the case), the function runs again in a
3588
3598
  * more conservative way, stopping the string at the first next delimiter
3589
- * and fixing the string by inserting a quote there.
3599
+ * and fixing the string by inserting a quote there, or stopping at a
3600
+ * stop index detected in the first iteration.
3590
3601
  */ function parseString() {
3591
3602
  var stopAtDelimiter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3603
+ var stopAtIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
3592
3604
  var skipEscapeChars = text.charCodeAt(i) === codeBackslash;
3593
3605
  if (skipEscapeChars) {
3594
3606
  // repair: remove the first escape character
@@ -3622,6 +3634,12 @@ var escapeCharacters = {
3622
3634
  output += str;
3623
3635
  return true;
3624
3636
  // biome-ignore lint/style/noUselessElse: <explanation>
3637
+ } else if (i === stopAtIndex) {
3638
+ // use the stop index detected in the first iteration, and repair end quote
3639
+ str = insertBeforeLastWhitespace(str, '"');
3640
+ output += str;
3641
+ return true;
3642
+ // biome-ignore lint/style/noUselessElse: <explanation>
3625
3643
  } else if (isEndQuote(text.charCodeAt(i))) {
3626
3644
  // end quote
3627
3645
  // let us check what is before and after the quote to verify whether this is a legit end quote
@@ -3630,14 +3648,24 @@ var escapeCharacters = {
3630
3648
  str += '"';
3631
3649
  i++;
3632
3650
  output += str;
3633
- parseWhitespaceAndSkipComments();
3651
+ parseWhitespaceAndSkipComments(false);
3634
3652
  if (stopAtDelimiter || i >= text.length || isDelimiter(text.charAt(i)) || isQuote(text.charCodeAt(i)) || isDigit(text.charCodeAt(i))) {
3635
- // The quote is followed by the end of the text, a delimiter, or a next value
3636
- // so the quote is indeed the end of the string
3653
+ // The quote is followed by the end of the text, a delimiter,
3654
+ // or a next value. So the quote is indeed the end of the string.
3637
3655
  parseConcatenatedString();
3638
3656
  return true;
3639
3657
  }
3640
- if (isDelimiter(text.charAt(prevNonWhitespaceIndex(iQuote - 1)))) {
3658
+ var iPrevChar = prevNonWhitespaceIndex(iQuote - 1);
3659
+ var prevChar = text.charAt(iPrevChar);
3660
+ if (prevChar === ",") {
3661
+ // A comma followed by a quote, like '{"a":"b,c,"d":"e"}'.
3662
+ // We assume that the quote is a start quote, and that the end quote
3663
+ // should have been located right before the comma but is missing.
3664
+ i = iBefore;
3665
+ output = output.substring(0, oBefore);
3666
+ return parseString(false, iPrevChar);
3667
+ }
3668
+ if (isDelimiter(prevChar)) {
3641
3669
  // This is not the right end quote: it is preceded by a delimiter,
3642
3670
  // and NOT followed by a delimiter. So, there is an end quote missing
3643
3671
  // parse the string again and then stop at the first next delimiter
@@ -8897,9 +8925,90 @@ function memoizeOne(resultFn, isEqual) {
8897
8925
  return memoized;
8898
8926
  }
8899
8927
 
8900
- /**
8901
- The data structure for documents. @nonabstract
8902
- */ function _array_like_to_array$f(arr, len) {
8928
+ // These are filled with ranges (rangeFrom[i] up to but not including
8929
+ // rangeTo[i]) of code points that count as extending characters.
8930
+ var rangeFrom = [], rangeTo = [];
8931
+ (function() {
8932
+ // Compressed representation of the Grapheme_Cluster_Break=Extend
8933
+ // information from
8934
+ // http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.
8935
+ // Each pair of elements represents a range, as an offet from the
8936
+ // previous range and a length. Numbers are in base-36, with the empty
8937
+ // string being a shorthand for 1.
8938
+ var numbers = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(s) {
8939
+ return s ? parseInt(s, 36) : 1;
8940
+ });
8941
+ for(var i = 0, n = 0; i < numbers.length; i++)(i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i]);
8942
+ })();
8943
+ function isExtendingChar(code) {
8944
+ if (code < 768) return false;
8945
+ for(var from = 0, to = rangeFrom.length;;){
8946
+ var mid = from + to >> 1;
8947
+ if (code < rangeFrom[mid]) to = mid;
8948
+ else if (code >= rangeTo[mid]) from = mid + 1;
8949
+ else return true;
8950
+ if (from == to) return false;
8951
+ }
8952
+ }
8953
+ function isRegionalIndicator(code) {
8954
+ return code >= 0x1F1E6 && code <= 0x1F1FF;
8955
+ }
8956
+ var ZWJ = 0x200d;
8957
+ function findClusterBreak$1(str, pos) {
8958
+ var forward = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, includeExtending = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
8959
+ return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
8960
+ }
8961
+ function nextClusterBreak(str, pos, includeExtending) {
8962
+ if (pos == str.length) return pos;
8963
+ // If pos is in the middle of a surrogate pair, move to its start
8964
+ if (pos && surrogateLow$1(str.charCodeAt(pos)) && surrogateHigh$1(str.charCodeAt(pos - 1))) pos--;
8965
+ var prev = codePointAt$1(str, pos);
8966
+ pos += codePointSize$1(prev);
8967
+ while(pos < str.length){
8968
+ var next = codePointAt$1(str, pos);
8969
+ if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {
8970
+ pos += codePointSize$1(next);
8971
+ prev = next;
8972
+ } else if (isRegionalIndicator(next)) {
8973
+ var countBefore = 0, i = pos - 2;
8974
+ while(i >= 0 && isRegionalIndicator(codePointAt$1(str, i))){
8975
+ countBefore++;
8976
+ i -= 2;
8977
+ }
8978
+ if (countBefore % 2 == 0) break;
8979
+ else pos += 2;
8980
+ } else {
8981
+ break;
8982
+ }
8983
+ }
8984
+ return pos;
8985
+ }
8986
+ function prevClusterBreak(str, pos, includeExtending) {
8987
+ while(pos > 0){
8988
+ var found = nextClusterBreak(str, pos - 2, includeExtending);
8989
+ if (found < pos) return found;
8990
+ pos--;
8991
+ }
8992
+ return 0;
8993
+ }
8994
+ function codePointAt$1(str, pos) {
8995
+ var code0 = str.charCodeAt(pos);
8996
+ if (!surrogateHigh$1(code0) || pos + 1 == str.length) return code0;
8997
+ var code1 = str.charCodeAt(pos + 1);
8998
+ if (!surrogateLow$1(code1)) return code0;
8999
+ return (code0 - 0xd800 << 10) + (code1 - 0xdc00) + 0x10000;
9000
+ }
9001
+ function surrogateLow$1(ch) {
9002
+ return ch >= 0xDC00 && ch < 0xE000;
9003
+ }
9004
+ function surrogateHigh$1(ch) {
9005
+ return ch >= 0xD800 && ch < 0xDC00;
9006
+ }
9007
+ function codePointSize$1(code) {
9008
+ return code < 0x10000 ? 1 : 2;
9009
+ }
9010
+
9011
+ function _array_like_to_array$f(arr, len) {
8903
9012
  if (len == null || len > arr.length) len = arr.length;
8904
9013
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8905
9014
  return arr2;
@@ -9106,7 +9215,9 @@ function _create_super$9(Derived) {
9106
9215
  return _possible_constructor_return$9(this, result);
9107
9216
  };
9108
9217
  }
9109
- var Text = /*#__PURE__*/ function() {
9218
+ /**
9219
+ The data structure for documents. @nonabstract
9220
+ */ var Text = /*#__PURE__*/ function() {
9110
9221
  function Text() {
9111
9222
  _class_call_check$g(this, Text);
9112
9223
  }
@@ -9952,25 +10063,6 @@ function clip(text, from, to) {
9952
10063
  Math.max(from, Math.min(text.length, to))
9953
10064
  ];
9954
10065
  }
9955
- // Compressed representation of the Grapheme_Cluster_Break=Extend
9956
- // information from
9957
- // http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.
9958
- // Each pair of elements represents a range, as an offet from the
9959
- // previous range and a length. Numbers are in base-36, with the empty
9960
- // string being a shorthand for 1.
9961
- var extend = /*@__PURE__*/ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(s) {
9962
- return s ? parseInt(s, 36) : 1;
9963
- });
9964
- // Convert offsets into absolute values
9965
- for(var i$2 = 1; i$2 < extend.length; i$2++)extend[i$2] += extend[i$2 - 1];
9966
- function isExtendingChar(code) {
9967
- for(var i = 1; i < extend.length; i += 2)if (extend[i] > code) return extend[i - 1] <= code;
9968
- return false;
9969
- }
9970
- function isRegionalIndicator(code) {
9971
- return code >= 0x1F1E6 && code <= 0x1F1FF;
9972
- }
9973
- var ZWJ = 0x200d;
9974
10066
  /**
9975
10067
  Returns a next grapheme cluster break _after_ (not equal to)
9976
10068
  `pos`, if `forward` is true, or before otherwise. Returns `pos`
@@ -9980,40 +10072,7 @@ Moves across surrogate pairs, extending characters (when
9980
10072
  joiners, and flag emoji.
9981
10073
  */ function findClusterBreak(str, pos) {
9982
10074
  var forward = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, includeExtending = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
9983
- return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
9984
- }
9985
- function nextClusterBreak(str, pos, includeExtending) {
9986
- if (pos == str.length) return pos;
9987
- // If pos is in the middle of a surrogate pair, move to its start
9988
- if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1))) pos--;
9989
- var prev = codePointAt(str, pos);
9990
- pos += codePointSize(prev);
9991
- while(pos < str.length){
9992
- var next = codePointAt(str, pos);
9993
- if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {
9994
- pos += codePointSize(next);
9995
- prev = next;
9996
- } else if (isRegionalIndicator(next)) {
9997
- var countBefore = 0, i = pos - 2;
9998
- while(i >= 0 && isRegionalIndicator(codePointAt(str, i))){
9999
- countBefore++;
10000
- i -= 2;
10001
- }
10002
- if (countBefore % 2 == 0) break;
10003
- else pos += 2;
10004
- } else {
10005
- break;
10006
- }
10007
- }
10008
- return pos;
10009
- }
10010
- function prevClusterBreak(str, pos, includeExtending) {
10011
- while(pos > 0){
10012
- var found = nextClusterBreak(str, pos - 2, includeExtending);
10013
- if (found < pos) return found;
10014
- pos--;
10015
- }
10016
- return 0;
10075
+ return findClusterBreak$1(str, pos, forward, includeExtending);
10017
10076
  }
10018
10077
  function surrogateLow(ch) {
10019
10078
  return ch >= 0xDC00 && ch < 0xE000;
@@ -10042,7 +10101,7 @@ respresents it (like
10042
10101
  return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);
10043
10102
  }
10044
10103
  /**
10045
- The amount of positions a character takes up a JavaScript string.
10104
+ The amount of positions a character takes up in a JavaScript string.
10046
10105
  */ function codePointSize(code) {
10047
10106
  return code < 0x10000 ? 1 : 2;
10048
10107
  }
@@ -10174,7 +10233,7 @@ applied, but is cheaper to store and manipulate.
10174
10233
  Map this description, which should start with the same document
10175
10234
  as `other`, over another set of changes, so that it can be
10176
10235
  applied after it. When `before` is true, map as if the changes
10177
- in `other` happened before the ones in `this`.
10236
+ in `this` happened before the ones in `other`.
10178
10237
  */ key: "mapDesc",
10179
10238
  value: function mapDesc(other) {
10180
10239
  var before = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
@@ -10549,7 +10608,7 @@ function addSection(sections, len, ins) {
10549
10608
  if (len == 0 && ins <= 0) return;
10550
10609
  var last = sections.length - 2;
10551
10610
  if (last >= 0 && ins <= 0 && ins == sections[last + 1]) sections[last] += len;
10552
- else if (len == 0 && sections[last] == 0) sections[last + 1] += ins;
10611
+ else if (last >= 0 && len == 0 && sections[last] == 0) sections[last + 1] += ins;
10553
10612
  else if (forceJoin) {
10554
10613
  sections[last] += len;
10555
10614
  sections[last + 1] += ins;
@@ -10599,7 +10658,9 @@ function mapSet(setA, setB, before) {
10599
10658
  // content has been inserted already, and refers to the section
10600
10659
  // index.
10601
10660
  for(var inserted = -1;;){
10602
- if (a.ins == -1 && b.ins == -1) {
10661
+ if (a.done && b.len || b.done && a.len) {
10662
+ throw new Error("Mismatched change set lengths");
10663
+ } else if (a.ins == -1 && b.ins == -1) {
10603
10664
  // Move across ranges skipped by both sets.
10604
10665
  var len = Math.min(a.len, b.len);
10605
10666
  addSection(sections, len, -1);
@@ -14006,7 +14067,7 @@ function compare(a, startA, b, startB, length, comparator) {
14006
14067
  var endB = startB + length;
14007
14068
  var pos = startB, dPos = startB - startA;
14008
14069
  for(;;){
14009
- var diff = a.to + dPos - b.to || a.endSide - b.endSide;
14070
+ var dEnd = a.to + dPos - b.to, diff = dEnd || a.endSide - b.endSide;
14010
14071
  var end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);
14011
14072
  if (a.point || b.point) {
14012
14073
  if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) && sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to)))) comparator.comparePoint(pos, clipEnd, a.point, b.point);
@@ -14014,6 +14075,7 @@ function compare(a, startA, b, startB, length, comparator) {
14014
14075
  if (clipEnd > pos && !sameValues(a.active, b.active)) comparator.compareRange(pos, clipEnd, a.active, b.active);
14015
14076
  }
14016
14077
  if (end > endB) break;
14078
+ if ((dEnd || a.openEnd != b.openEnd) && comparator.boundChange) comparator.boundChange(end);
14017
14079
  pos = end;
14018
14080
  if (diff <= 0) a.next();
14019
14081
  if (diff >= 0) b.next();
@@ -14046,7 +14108,7 @@ taking extending characters and tab size into account.
14046
14108
  */ function countColumn(string, tabSize) {
14047
14109
  var to = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : string.length;
14048
14110
  var n = 0;
14049
- for(var i = 0; i < to;){
14111
+ for(var i = 0; i < to && i < string.length;){
14050
14112
  if (string.charCodeAt(i) == 9) {
14051
14113
  n += tabSize - n % tabSize;
14052
14114
  i++;
@@ -17968,6 +18030,17 @@ class, which describe what happened, whenever the view is updated.
17968
18030
  return (this.flags & 4 /* UpdateFlag.Viewport */ ) > 0;
17969
18031
  }
17970
18032
  },
18033
+ {
18034
+ key: "viewportMoved",
18035
+ get: /**
18036
+ Returns true when
18037
+ [`viewportChanged`](https://codemirror.net/6/docs/ref/#view.ViewUpdate.viewportChanged) is true
18038
+ and the viewport change is not just the result of mapping it in
18039
+ response to document changes.
18040
+ */ function get() {
18041
+ return (this.flags & 8 /* UpdateFlag.ViewportMoved */ ) > 0;
18042
+ }
18043
+ },
17971
18044
  {
17972
18045
  key: "heightChanged",
17973
18046
  get: /**
@@ -17983,7 +18056,7 @@ class, which describe what happened, whenever the view is updated.
17983
18056
  Returns true when the document was modified or the size of the
17984
18057
  editor, or elements within the editor, changed.
17985
18058
  */ function get() {
17986
- return this.docChanged || (this.flags & (8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ )) > 0;
18059
+ return this.docChanged || (this.flags & (16 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ )) > 0;
17987
18060
  }
17988
18061
  },
17989
18062
  {
@@ -18342,7 +18415,7 @@ var DocView = /*#__PURE__*/ function(ContentView1) {
18342
18415
  var mustRead = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, fromPointer = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
18343
18416
  if (mustRead || !this.view.observer.selectionRange.focusNode) this.view.observer.readSelectionRange();
18344
18417
  var activeElt = this.view.root.activeElement, focused = activeElt == this.dom;
18345
- var selectionNotFocus = !focused && hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
18418
+ var selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) && hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
18346
18419
  if (!(focused || fromPointer || selectionNotFocus)) return;
18347
18420
  var force = this.forceSelection;
18348
18421
  this.forceSelection = false;
@@ -18836,6 +18909,12 @@ var DecorationComparator$1 = /*#__PURE__*/ function() {
18836
18909
  value: function comparePoint(from, to) {
18837
18910
  addRange(from, to, this.changes);
18838
18911
  }
18912
+ },
18913
+ {
18914
+ key: "boundChange",
18915
+ value: function boundChange(pos) {
18916
+ addRange(pos, pos, this.changes);
18917
+ }
18839
18918
  }
18840
18919
  ]);
18841
18920
  return DecorationComparator;
@@ -19500,6 +19579,17 @@ function applyDOMChange(view, domChange) {
19500
19579
  to: sel.to,
19501
19580
  insert: view.state.doc.slice(sel.from, sel.to)
19502
19581
  };
19582
+ } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
19583
+ // Detect insert-period-on-double-space Mac and Android behavior,
19584
+ // and transform it into a regular space insert.
19585
+ if (newSel && change.insert.length == 2) newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
19586
+ change = {
19587
+ from: change.from,
19588
+ to: change.to,
19589
+ insert: Text.of([
19590
+ change.insert.toString().replace(".", " ")
19591
+ ])
19592
+ };
19503
19593
  } else if (change && change.from >= sel.from && change.to <= sel.to && (change.from != sel.from || change.to != sel.to) && sel.to - sel.from - (change.to - change.from) <= 4) {
19504
19594
  // If the change is inside the selection and covers most of it,
19505
19595
  // assume it is a selection replace (with identical characters at
@@ -19509,17 +19599,6 @@ function applyDOMChange(view, domChange) {
19509
19599
  to: sel.to,
19510
19600
  insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
19511
19601
  };
19512
- } else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {
19513
- // Detect insert-period-on-double-space Mac and Android behavior,
19514
- // and transform it into a regular space insert.
19515
- if (newSel && change.insert.length == 2) newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
19516
- change = {
19517
- from: sel.from,
19518
- to: sel.to,
19519
- insert: Text.of([
19520
- " "
19521
- ])
19522
- };
19523
19602
  } else if (browser.chrome && change && change.from == change.to && change.from == sel.head && change.insert.toString() == "\n " && view.lineWrapping) {
19524
19603
  // In Chrome, if you insert a space at the start of a wrapped
19525
19604
  // line, it will actually insert a newline and a space, causing a
@@ -21741,6 +21820,10 @@ function visiblePixelRange(dom, paddingTop) {
21741
21820
  bottom: Math.max(top, bottom) - (rect.top + paddingTop)
21742
21821
  };
21743
21822
  }
21823
+ function inWindow(elt) {
21824
+ var rect = elt.getBoundingClientRect(), win = elt.ownerDocument.defaultView || window;
21825
+ return rect.left < win.innerWidth && rect.right > 0 && rect.top < win.innerHeight && rect.bottom > 0;
21826
+ }
21744
21827
  function fullPixelRange(dom, paddingTop) {
21745
21828
  var rect = dom.getBoundingClientRect();
21746
21829
  return {
@@ -21969,7 +22052,7 @@ var ViewState = /*#__PURE__*/ function() {
21969
22052
  update.flags |= this.updateForViewport();
21970
22053
  if (viewportChange || !update.changes.empty || update.flags & 2 /* UpdateFlag.Height */ ) this.updateViewportLines();
21971
22054
  if (this.lineGaps.length || this.viewport.to - this.viewport.from > 2000 /* LG.Margin */ << 1) this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, update.changes)));
21972
- update.flags |= this.computeVisibleRanges();
22055
+ update.flags |= this.computeVisibleRanges(update.changes);
21973
22056
  if (scrollTarget) this.scrollTarget = scrollTarget;
21974
22057
  if (!this.mustEnforceCursorAssoc && update.selectionSet && update.view.lineWrapping && update.state.selection.main.empty && update.state.selection.main.assoc && !update.state.facet(nativeSelectionHidden)) this.mustEnforceCursorAssoc = true;
21975
22058
  }
@@ -21992,7 +22075,7 @@ var ViewState = /*#__PURE__*/ function() {
21992
22075
  if (scaleX > .005 && Math.abs(this.scaleX - scaleX) > .005 || scaleY > .005 && Math.abs(this.scaleY - scaleY) > .005) {
21993
22076
  this.scaleX = scaleX;
21994
22077
  this.scaleY = scaleY;
21995
- result |= 8 /* UpdateFlag.Geometry */ ;
22078
+ result |= 16 /* UpdateFlag.Geometry */ ;
21996
22079
  refresh = measureContent = true;
21997
22080
  }
21998
22081
  }
@@ -22002,12 +22085,12 @@ var ViewState = /*#__PURE__*/ function() {
22002
22085
  if (this.paddingTop != paddingTop || this.paddingBottom != paddingBottom) {
22003
22086
  this.paddingTop = paddingTop;
22004
22087
  this.paddingBottom = paddingBottom;
22005
- result |= 8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ ;
22088
+ result |= 16 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */ ;
22006
22089
  }
22007
22090
  if (this.editorWidth != view.scrollDOM.clientWidth) {
22008
22091
  if (oracle.lineWrapping) measureContent = true;
22009
22092
  this.editorWidth = view.scrollDOM.clientWidth;
22010
- result |= 8 /* UpdateFlag.Geometry */ ;
22093
+ result |= 16 /* UpdateFlag.Geometry */ ;
22011
22094
  }
22012
22095
  var scrollTop = view.scrollDOM.scrollTop * this.scaleY;
22013
22096
  if (this.scrollTop != scrollTop) {
@@ -22024,12 +22107,12 @@ var ViewState = /*#__PURE__*/ function() {
22024
22107
  this.inView = inView;
22025
22108
  if (inView) measureContent = true;
22026
22109
  }
22027
- if (!this.inView && !this.scrollTarget) return 0;
22110
+ if (!this.inView && !this.scrollTarget && !inWindow(view.dom)) return 0;
22028
22111
  var contentWidth = domRect.width;
22029
22112
  if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {
22030
22113
  this.contentDOMWidth = domRect.width;
22031
22114
  this.editorHeight = view.scrollDOM.clientHeight;
22032
- result |= 8 /* UpdateFlag.Geometry */ ;
22115
+ result |= 16 /* UpdateFlag.Geometry */ ;
22033
22116
  }
22034
22117
  if (measureContent) {
22035
22118
  var lineHeights = view.docView.measureVisibleLineHeights(this.viewport);
@@ -22039,7 +22122,7 @@ var ViewState = /*#__PURE__*/ function() {
22039
22122
  refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);
22040
22123
  if (refresh) {
22041
22124
  view.docView.minWidth = 0;
22042
- result |= 8 /* UpdateFlag.Geometry */ ;
22125
+ result |= 16 /* UpdateFlag.Geometry */ ;
22043
22126
  }
22044
22127
  }
22045
22128
  if (dTop > 0 && dBottom > 0) bias = Math.max(dTop, dBottom);
@@ -22350,7 +22433,7 @@ var ViewState = /*#__PURE__*/ function() {
22350
22433
  },
22351
22434
  {
22352
22435
  key: "computeVisibleRanges",
22353
- value: function computeVisibleRanges() {
22436
+ value: function computeVisibleRanges(changes) {
22354
22437
  var deco = this.stateDeco;
22355
22438
  if (this.lineGaps.length) deco = deco.concat(this.lineGapDeco);
22356
22439
  var ranges = [];
@@ -22363,11 +22446,20 @@ var ViewState = /*#__PURE__*/ function() {
22363
22446
  },
22364
22447
  point: function point() {}
22365
22448
  }, 20);
22366
- var changed = ranges.length != this.visibleRanges.length || this.visibleRanges.some(function(r, i) {
22367
- return r.from != ranges[i].from || r.to != ranges[i].to;
22368
- });
22449
+ var changed = 0;
22450
+ if (ranges.length != this.visibleRanges.length) {
22451
+ changed = 8 /* UpdateFlag.ViewportMoved */ | 4 /* UpdateFlag.Viewport */ ;
22452
+ } else {
22453
+ for(var i = 0; i < ranges.length && !(changed & 8 /* UpdateFlag.ViewportMoved */ ); i++){
22454
+ var old = this.visibleRanges[i], nw = ranges[i];
22455
+ if (old.from != nw.from || old.to != nw.to) {
22456
+ changed |= 4 /* UpdateFlag.Viewport */ ;
22457
+ if (!(changes && changes.mapPos(old.from, -1) == nw.from && changes.mapPos(old.to, 1) == nw.to)) changed |= 8 /* UpdateFlag.ViewportMoved */ ;
22458
+ }
22459
+ }
22460
+ }
22369
22461
  this.visibleRanges = ranges;
22370
- return changed ? 4 /* UpdateFlag.Viewport */ : 0;
22462
+ return changed;
22371
22463
  }
22372
22464
  },
22373
22465
  {
@@ -23617,6 +23709,9 @@ var EditContextManager = /*#__PURE__*/ function() {
23617
23709
  // user action on some Android keyboards)
23618
23710
  this.pendingContextChange = null;
23619
23711
  this.handlers = Object.create(null);
23712
+ // Kludge to work around the fact that EditContext does not respond
23713
+ // well to having its content updated during a composition (see #1472)
23714
+ this.composing = null;
23620
23715
  this.resetRange(view.state);
23621
23716
  var context = this.editContext = new window.EditContext({
23622
23717
  text: view.state.doc.sliceString(this.from, this.to),
@@ -23624,10 +23719,16 @@ var EditContextManager = /*#__PURE__*/ function() {
23624
23719
  selectionEnd: this.toContextPos(view.state.selection.main.head)
23625
23720
  });
23626
23721
  this.handlers.textupdate = function(e) {
23627
- var anchor = view.state.selection.main.anchor;
23722
+ var main = view.state.selection.main, anchor = main.anchor, head = main.head;
23723
+ var from = _this.toEditorPos(e.updateRangeStart), to = _this.toEditorPos(e.updateRangeEnd);
23724
+ if (view.inputState.composing >= 0 && !_this.composing) _this.composing = {
23725
+ contextBase: e.updateRangeStart,
23726
+ editorBase: from,
23727
+ drifted: false
23728
+ };
23628
23729
  var change = {
23629
- from: _this.toEditorPos(e.updateRangeStart),
23630
- to: _this.toEditorPos(e.updateRangeEnd),
23730
+ from: from,
23731
+ to: to,
23631
23732
  insert: Text.of(e.text.split("\n"))
23632
23733
  };
23633
23734
  // If the window doesn't include the anchor, assume changes
@@ -23635,9 +23736,26 @@ var EditContextManager = /*#__PURE__*/ function() {
23635
23736
  if (change.from == _this.from && anchor < _this.from) change.from = anchor;
23636
23737
  else if (change.to == _this.to && anchor > _this.to) change.to = anchor;
23637
23738
  // Edit contexts sometimes fire empty changes
23638
- if (change.from == change.to && !change.insert.length) return;
23739
+ if (change.from == change.to && !change.insert.length) {
23740
+ var newSel = EditorSelection.single(_this.toEditorPos(e.selectionStart), _this.toEditorPos(e.selectionEnd));
23741
+ if (!newSel.main.eq(main)) view.dispatch({
23742
+ selection: newSel,
23743
+ userEvent: "select"
23744
+ });
23745
+ return;
23746
+ }
23747
+ if ((browser.mac || browser.android) && change.from == head - 1 && /^\. ?$/.test(e.text) && view.contentDOM.getAttribute("autocorrect") == "off") change = {
23748
+ from: from,
23749
+ to: to,
23750
+ insert: Text.of([
23751
+ e.text.replace(".", " ")
23752
+ ])
23753
+ };
23639
23754
  _this.pendingContextChange = change;
23640
- if (!view.state.readOnly) applyDOMChangeInner(view, change, EditorSelection.single(_this.toEditorPos(e.selectionStart), _this.toEditorPos(e.selectionEnd)));
23755
+ if (!view.state.readOnly) {
23756
+ var newLen = _this.to - _this.from + (change.to - change.from + change.insert.length);
23757
+ applyDOMChangeInner(view, change, EditorSelection.single(_this.toEditorPos(e.selectionStart, newLen), _this.toEditorPos(e.selectionEnd, newLen)));
23758
+ }
23641
23759
  // If the transaction didn't flush our change, revert it so
23642
23760
  // that the context is in sync with the editor state again.
23643
23761
  if (_this.pendingContextChange) {
@@ -23662,12 +23780,15 @@ var EditContextManager = /*#__PURE__*/ function() {
23662
23780
  var format = _step.value;
23663
23781
  var lineStyle = format.underlineStyle, thickness = format.underlineThickness;
23664
23782
  if (lineStyle != "None" && thickness != "None") {
23665
- var style = "text-decoration: underline ".concat(lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : "").concat(thickness == "Thin" ? 1 : 2, "px");
23666
- deco.push(Decoration.mark({
23667
- attributes: {
23668
- style: style
23669
- }
23670
- }).range(_this.toEditorPos(format.rangeStart), _this.toEditorPos(format.rangeEnd)));
23783
+ var from = _this.toEditorPos(format.rangeStart), to = _this.toEditorPos(format.rangeEnd);
23784
+ if (from < to) {
23785
+ var style = "text-decoration: underline ".concat(lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : "").concat(thickness == "Thin" ? 1 : 2, "px");
23786
+ deco.push(Decoration.mark({
23787
+ attributes: {
23788
+ style: style
23789
+ }
23790
+ }).range(from, to));
23791
+ }
23671
23792
  }
23672
23793
  }
23673
23794
  } catch (err) {
@@ -23697,6 +23818,11 @@ var EditContextManager = /*#__PURE__*/ function() {
23697
23818
  this.handlers.compositionend = function() {
23698
23819
  view.inputState.composing = -1;
23699
23820
  view.inputState.compositionFirstChange = null;
23821
+ if (_this.composing) {
23822
+ var drifted = _this.composing.drifted;
23823
+ _this.composing = null;
23824
+ if (drifted) _this.reset(view.state);
23825
+ }
23700
23826
  };
23701
23827
  for(var event in this.handlers)context.addEventListener(event, this.handlers[event]);
23702
23828
  this.measureReq = {
@@ -23749,12 +23875,16 @@ var EditContextManager = /*#__PURE__*/ function() {
23749
23875
  {
23750
23876
  key: "update",
23751
23877
  value: function update(update) {
23878
+ var _this = this;
23752
23879
  var reverted = this.pendingContextChange;
23753
- if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
23880
+ if (this.composing && (this.composing.drifted || update.transactions.some(function(tr) {
23881
+ return !tr.isUserEvent("input.type") && tr.changes.touchesRange(_this.from, _this.to);
23882
+ }))) {
23883
+ this.composing.drifted = true;
23884
+ this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
23885
+ } else if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
23754
23886
  this.pendingContextChange = null;
23755
- this.resetRange(update.state);
23756
- this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
23757
- this.setSelection(update.state);
23887
+ this.reset(update.state);
23758
23888
  } else if (update.docChanged || update.selectionSet || reverted) {
23759
23889
  this.setSelection(update.state);
23760
23890
  }
@@ -23769,6 +23899,14 @@ var EditContextManager = /*#__PURE__*/ function() {
23769
23899
  this.to = Math.min(state.doc.length, head + 10000 /* CxVp.Margin */ );
23770
23900
  }
23771
23901
  },
23902
+ {
23903
+ key: "reset",
23904
+ value: function reset(state) {
23905
+ this.resetRange(state);
23906
+ this.editContext.updateText(0, this.editContext.text.length, state.doc.sliceString(this.from, this.to));
23907
+ this.setSelection(state);
23908
+ }
23909
+ },
23772
23910
  {
23773
23911
  key: "revertPending",
23774
23912
  value: function revertPending(state) {
@@ -23796,13 +23934,17 @@ var EditContextManager = /*#__PURE__*/ function() {
23796
23934
  {
23797
23935
  key: "toEditorPos",
23798
23936
  value: function toEditorPos(contextPos) {
23799
- return contextPos + this.from;
23937
+ var clipLen = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.to - this.from;
23938
+ contextPos = Math.min(contextPos, clipLen);
23939
+ var c = this.composing;
23940
+ return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
23800
23941
  }
23801
23942
  },
23802
23943
  {
23803
23944
  key: "toContextPos",
23804
23945
  value: function toContextPos(editorPos) {
23805
- return editorPos - this.from;
23946
+ var c = this.composing;
23947
+ return c && c.drifted ? c.contextBase + (editorPos - c.editorBase) : editorPos - this.from;
23806
23948
  }
23807
23949
  },
23808
23950
  {
@@ -24506,6 +24648,7 @@ transactions for editing actions.
24506
24648
  spellcheck: "false",
24507
24649
  autocorrect: "off",
24508
24650
  autocapitalize: "off",
24651
+ writingsuggestions: "false",
24509
24652
  translate: "no",
24510
24653
  contenteditable: !this.state.facet(editable) ? "false" : "true",
24511
24654
  class: "cm-content",
@@ -25776,7 +25919,7 @@ function rectanglesForRange(view, className, range) {
25776
25919
  return pieces(top).concat(between).concat(pieces(bottom));
25777
25920
  }
25778
25921
  function piece(left, top, right, bottom) {
25779
- return new RectangleMarker(className, left - base.left, top - base.top - 0.01 /* C.Epsilon */ , right - left, bottom - top + 0.01 /* C.Epsilon */ );
25922
+ return new RectangleMarker(className, left - base.left, top - base.top, right - left, bottom - top);
25780
25923
  }
25781
25924
  function pieces(param) {
25782
25925
  var top = param.top, bottom = param.bottom, horizontal = param.horizontal;
@@ -25996,7 +26139,7 @@ Define a layer.
25996
26139
  layerOrder.of(config)
25997
26140
  ];
25998
26141
  }
25999
- var CanHidePrimary = !browser.ios; // FIXME test IE
26142
+ var CanHidePrimary = !(browser.ios && browser.webkit && browser.webkit_version < 534);
26000
26143
  var selectionConfig = /*@__PURE__*/ Facet.define({
26001
26144
  combine: function combine(configs) {
26002
26145
  return combineConfig(configs, {
@@ -26372,12 +26515,12 @@ represent a matching configuration.
26372
26515
  value: function updateDeco(update, deco) {
26373
26516
  var changeFrom = 1e9, changeTo = -1;
26374
26517
  if (update.docChanged) update.changes.iterChanges(function(_f, _t, from, to) {
26375
- if (to > update.view.viewport.from && from < update.view.viewport.to) {
26518
+ if (to >= update.view.viewport.from && from <= update.view.viewport.to) {
26376
26519
  changeFrom = Math.min(from, changeFrom);
26377
26520
  changeTo = Math.max(to, changeTo);
26378
26521
  }
26379
26522
  });
26380
- if (update.viewportChanged || changeTo - changeFrom > 1000) return this.createDeco(update.view);
26523
+ if (update.viewportMoved || changeTo - changeFrom > 1000) return this.createDeco(update.view);
26381
26524
  if (changeTo > -1) return this.updateRange(update.view, deco.map(update.changes), changeFrom, changeTo);
26382
26525
  return deco;
26383
26526
  }
@@ -27210,7 +27353,6 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27210
27353
  key: "readMeasure",
27211
27354
  value: function readMeasure() {
27212
27355
  var _this = this;
27213
- var editor = this.view.dom.getBoundingClientRect();
27214
27356
  var scaleX = 1, scaleY = 1, makeAbsolute = false;
27215
27357
  if (this.position == "fixed" && this.manager.tooltipViews.length) {
27216
27358
  var dom = this.manager.tooltipViews[0].dom;
@@ -27238,9 +27380,15 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27238
27380
  ref = this.view.viewState, scaleX = ref.scaleX, scaleY = ref.scaleY;
27239
27381
  }
27240
27382
  }
27383
+ var visible = this.view.scrollDOM.getBoundingClientRect(), margins = getScrollMargins(this.view);
27241
27384
  return {
27242
- editor: editor,
27243
- parent: this.parent ? this.container.getBoundingClientRect() : editor,
27385
+ visible: {
27386
+ left: visible.left + margins.left,
27387
+ top: visible.top + margins.top,
27388
+ right: visible.right - margins.right,
27389
+ bottom: visible.bottom - margins.bottom
27390
+ },
27391
+ parent: this.parent ? this.container.getBoundingClientRect() : this.view.dom.getBoundingClientRect(),
27244
27392
  pos: this.manager.tooltips.map(function(t, i) {
27245
27393
  var tv = _this.manager.tooltipViews[i];
27246
27394
  return tv.getCoords ? tv.getCoords(t.pos) : _this.view.coordsAtPos(t.pos);
@@ -27284,13 +27432,13 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27284
27432
  }
27285
27433
  }
27286
27434
  }
27287
- var editor = measured.editor, space = measured.space, scaleX = measured.scaleX, scaleY = measured.scaleY;
27435
+ var visible = measured.visible, space = measured.space, scaleX = measured.scaleX, scaleY = measured.scaleY;
27288
27436
  var others = [];
27289
27437
  for(var i = 0; i < this.manager.tooltips.length; i++){
27290
27438
  var tooltip = this.manager.tooltips[i], tView = this.manager.tooltipViews[i], dom = tView.dom;
27291
27439
  var pos = measured.pos[i], size = measured.size[i];
27292
27440
  // Hide tooltips that are outside of the editor.
27293
- if (!pos || pos.bottom <= Math.max(editor.top, space.top) || pos.top >= Math.min(editor.bottom, space.bottom) || pos.right < Math.max(editor.left, space.left) - .1 || pos.left > Math.min(editor.right, space.right) + .1) {
27441
+ if (!pos || tooltip.clip !== false && (pos.bottom <= Math.max(visible.top, space.top) || pos.top >= Math.min(visible.bottom, space.bottom) || pos.right < Math.max(visible.left, space.left) - .1 || pos.left > Math.min(visible.right, space.right) + .1)) {
27294
27442
  dom.style.top = Outside;
27295
27443
  continue;
27296
27444
  }
@@ -27300,7 +27448,7 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27300
27448
  var offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR;
27301
27449
  var left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.max(space.left, Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width)) : Math.min(Math.max(space.left, pos.left - width + (arrow ? 14 /* Arrow.Offset */ : 0) - offset.x), space.right - width);
27302
27450
  var above = this.above[i];
27303
- if (!tooltip.strictSide && (above ? pos.top - (size.bottom - size.top) - offset.y < space.top : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) above = this.above[i] = !above;
27451
+ if (!tooltip.strictSide && (above ? pos.top - height - arrowHeight - offset.y < space.top : pos.bottom + height + arrowHeight + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) above = this.above[i] = !above;
27304
27452
  var spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
27305
27453
  if (spaceVert < height && tView.resize !== false) {
27306
27454
  if (spaceVert < this.view.defaultLineHeight) {
@@ -27338,10 +27486,10 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27338
27486
  }
27339
27487
  if (this.position == "absolute") {
27340
27488
  dom.style.top = (top - measured.parent.top) / scaleY + "px";
27341
- dom.style.left = (left - measured.parent.left) / scaleX + "px";
27489
+ setLeftStyle(dom, (left - measured.parent.left) / scaleX);
27342
27490
  } else {
27343
27491
  dom.style.top = top / scaleY + "px";
27344
- dom.style.left = left / scaleX + "px";
27492
+ setLeftStyle(dom, left / scaleX);
27345
27493
  }
27346
27494
  if (arrow) {
27347
27495
  var arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 /* Arrow.Offset */ - 7 /* Arrow.Size */ );
@@ -27399,9 +27547,13 @@ var tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(/*#__PURE__*/ function()
27399
27547
  }
27400
27548
  }
27401
27549
  });
27550
+ function setLeftStyle(elt, value) {
27551
+ var current = parseInt(elt.style.left, 10);
27552
+ if (isNaN(current) || Math.abs(value - current) > 1) elt.style.left = value + "px";
27553
+ }
27402
27554
  var baseTheme$5 = /*@__PURE__*/ EditorView.baseTheme({
27403
27555
  ".cm-tooltip": {
27404
- zIndex: 100,
27556
+ zIndex: 500,
27405
27557
  boxSizing: "border-box"
27406
27558
  },
27407
27559
  "&light .cm-tooltip": {
@@ -33862,10 +34014,10 @@ indicates that no definitive indentation can be determined.
33862
34014
  // Compute the indentation for a given position from the syntax tree.
33863
34015
  function syntaxIndentation(cx, ast, pos) {
33864
34016
  var stack = ast.resolveStack(pos);
33865
- var inner = stack.node.enterUnfinishedNodesBefore(pos);
34017
+ var inner = ast.resolveInner(pos, -1).resolve(pos, 0).enterUnfinishedNodesBefore(pos);
33866
34018
  if (inner != stack.node) {
33867
34019
  var add = [];
33868
- for(var cur = inner; cur != stack.node; cur = cur.parent)add.push(cur);
34020
+ for(var cur = inner; cur && !(cur.from == stack.node.from && cur.type == stack.node.type); cur = cur.parent)add.push(cur);
33869
34021
  for(var i = add.length - 1; i >= 0; i--)stack = {
33870
34022
  node: add[i],
33871
34023
  next: stack
@@ -37674,23 +37826,70 @@ var LintState = /*#__PURE__*/ function() {
37674
37826
  {
37675
37827
  key: "init",
37676
37828
  value: function init(diagnostics, panel, state) {
37829
+ var _loop = function(i1) {
37830
+ var next = i1 == sorted.length ? null : sorted[i1];
37831
+ if (!next && !active.length) return i = i1, "break";
37832
+ var from = void 0, to = void 0;
37833
+ if (active.length) {
37834
+ from = pos;
37835
+ to = active.reduce(function(p, d) {
37836
+ return Math.min(p, d.to);
37837
+ }, next && next.from > from ? next.from : 1e8);
37838
+ } else {
37839
+ from = next.from;
37840
+ to = next.to;
37841
+ active.push(next);
37842
+ i1++;
37843
+ }
37844
+ while(i1 < sorted.length){
37845
+ var next1 = sorted[i1];
37846
+ if (next1.from == from && (next1.to > next1.from || next1.to == from)) {
37847
+ active.push(next1);
37848
+ i1++;
37849
+ to = Math.min(next1.to, to);
37850
+ } else {
37851
+ to = Math.min(next1.from, to);
37852
+ break;
37853
+ }
37854
+ }
37855
+ var sev = maxSeverity(active);
37856
+ if (active.some(function(d) {
37857
+ return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from;
37858
+ })) {
37859
+ deco.add(from, from, Decoration.widget({
37860
+ widget: new DiagnosticWidget(sev),
37861
+ diagnostics: active.slice()
37862
+ }));
37863
+ } else {
37864
+ var markClass = active.reduce(function(c, d) {
37865
+ return d.markClass ? c + " " + d.markClass : c;
37866
+ }, "");
37867
+ deco.add(from, to, Decoration.mark({
37868
+ class: "cm-lintRange cm-lintRange-" + sev + markClass,
37869
+ diagnostics: active.slice(),
37870
+ inclusiveEnd: active.some(function(a) {
37871
+ return a.to > to;
37872
+ })
37873
+ }));
37874
+ }
37875
+ pos = to;
37876
+ for(var i2 = 0; i2 < active.length; i2++)if (active[i2].to <= pos) active.splice(i2--, 1);
37877
+ i = i1;
37878
+ };
37677
37879
  // Filter the list of diagnostics for which to create markers
37678
37880
  var markedDiagnostics = diagnostics;
37679
37881
  var diagnosticFilter = state.facet(lintConfig).markerFilter;
37680
37882
  if (diagnosticFilter) markedDiagnostics = diagnosticFilter(markedDiagnostics, state);
37681
- var ranges = Decoration.set(markedDiagnostics.map(function(d) {
37682
- // For zero-length ranges or ranges covering only a line break, create a widget
37683
- return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from ? Decoration.widget({
37684
- widget: new DiagnosticWidget(d),
37685
- diagnostic: d
37686
- }).range(d.from) : Decoration.mark({
37687
- attributes: {
37688
- class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "")
37689
- },
37690
- diagnostic: d
37691
- }).range(d.from, d.to);
37692
- }), true);
37693
- return new LintState(ranges, panel, findDiagnostic(ranges));
37883
+ var sorted = diagnostics.slice().sort(function(a, b) {
37884
+ return a.from - b.from || a.to - b.to;
37885
+ });
37886
+ var deco = new RangeSetBuilder(), active = [], pos = 0;
37887
+ for(var i = 0;;){
37888
+ var _ret = _loop(i);
37889
+ if (_ret === "break") break;
37890
+ }
37891
+ var set = deco.finish();
37892
+ return new LintState(set, panel, findDiagnostic(set));
37694
37893
  }
37695
37894
  }
37696
37895
  ]);
@@ -37701,9 +37900,10 @@ function findDiagnostic(diagnostics) {
37701
37900
  var found = null;
37702
37901
  diagnostics.between(after, 1e9, function(from, to, param) {
37703
37902
  var spec = param.spec;
37704
- if (diagnostic && spec.diagnostic != diagnostic) return;
37705
- found = new SelectedDiagnostic(from, to, spec.diagnostic);
37706
- return false;
37903
+ if (diagnostic && spec.diagnostics.indexOf(diagnostic) < 0) return;
37904
+ if (!found) found = new SelectedDiagnostic(from, to, diagnostic || spec.diagnostics[0]);
37905
+ else if (spec.diagnostics.indexOf(found.diagnostic) < 0) return false;
37906
+ else found = new SelectedDiagnostic(found.from, to, found.diagnostic);
37707
37907
  });
37708
37908
  return found;
37709
37909
  }
@@ -37795,22 +37995,23 @@ var activeMark = /*@__PURE__*/ Decoration.mark({
37795
37995
  });
37796
37996
  function lintTooltip(view, pos, side) {
37797
37997
  var diagnostics = view.state.field(lintState).diagnostics;
37798
- var found = [], stackStart = 2e8, stackEnd = 0;
37998
+ var found, start = -1, end = -1;
37799
37999
  diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), function(from, to, param) {
37800
38000
  var spec = param.spec;
37801
38001
  if (pos >= from && pos <= to && (from == to || (pos > from || side > 0) && (pos < to || side < 0))) {
37802
- found.push(spec.diagnostic);
37803
- stackStart = Math.min(from, stackStart);
37804
- stackEnd = Math.max(to, stackEnd);
38002
+ found = spec.diagnostics;
38003
+ start = from;
38004
+ end = to;
38005
+ return false;
37805
38006
  }
37806
38007
  });
37807
38008
  var diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
37808
- if (diagnosticFilter) found = diagnosticFilter(found, view.state);
37809
- if (!found.length) return null;
38009
+ if (found && diagnosticFilter) found = diagnosticFilter(found, view.state);
38010
+ if (!found) return null;
37810
38011
  return {
37811
- pos: stackStart,
37812
- end: stackEnd,
37813
- above: view.state.doc.lineAt(stackStart).to < stackEnd,
38012
+ pos: start,
38013
+ end: end,
38014
+ above: view.state.doc.lineAt(start).to < end,
37814
38015
  create: function create() {
37815
38016
  return {
37816
38017
  dom: diagnosticsTooltip(view, found)
@@ -37959,7 +38160,7 @@ function batchResults(promises, sink, error) {
37959
38160
  collected.push(value);
37960
38161
  clearTimeout(timeout);
37961
38162
  if (collected.length == promises.length) sink(collected);
37962
- else setTimeout(function() {
38163
+ else timeout = setTimeout(function() {
37963
38164
  return sink(collected);
37964
38165
  }, 200);
37965
38166
  }, error);
@@ -38104,25 +38305,25 @@ function renderDiagnostic(view, diagnostic, inPanel) {
38104
38305
  var DiagnosticWidget = /*#__PURE__*/ function(WidgetType) {
38105
38306
  _inherits$5(DiagnosticWidget, WidgetType);
38106
38307
  var _super = _create_super$5(DiagnosticWidget);
38107
- function DiagnosticWidget(diagnostic) {
38308
+ function DiagnosticWidget(sev) {
38108
38309
  _class_call_check$9(this, DiagnosticWidget);
38109
38310
  var _this;
38110
38311
  _this = _super.call(this);
38111
- _this.diagnostic = diagnostic;
38312
+ _this.sev = sev;
38112
38313
  return _this;
38113
38314
  }
38114
38315
  _create_class$6(DiagnosticWidget, [
38115
38316
  {
38116
38317
  key: "eq",
38117
38318
  value: function eq(other) {
38118
- return other.diagnostic == this.diagnostic;
38319
+ return other.sev == this.sev;
38119
38320
  }
38120
38321
  },
38121
38322
  {
38122
38323
  key: "toDOM",
38123
38324
  value: function toDOM() {
38124
38325
  return crelt("span", {
38125
- class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity
38326
+ class: "cm-lintPoint cm-lintPoint-" + this.sev
38126
38327
  });
38127
38328
  }
38128
38329
  }
@@ -38208,33 +38409,55 @@ var LintPanel = /*#__PURE__*/ function() {
38208
38409
  var _this = this;
38209
38410
  var _this_view_state_field = this.view.state.field(lintState), diagnostics = _this_view_state_field.diagnostics, selected = _this_view_state_field.selected;
38210
38411
  var i = 0, needsSync = false, newSelectedItem = null;
38412
+ var seen = new Set();
38211
38413
  diagnostics.between(0, this.view.state.doc.length, function(_start, _end, param) {
38212
38414
  var spec = param.spec;
38213
- var found = -1, item;
38214
- for(var j = i; j < _this.items.length; j++)if (_this.items[j].diagnostic == spec.diagnostic) {
38215
- found = j;
38216
- break;
38217
- }
38218
- if (found < 0) {
38219
- item = new PanelItem(_this.view, spec.diagnostic);
38220
- _this.items.splice(i, 0, item);
38221
- needsSync = true;
38222
- } else {
38223
- item = _this.items[found];
38224
- if (found > i) {
38225
- _this.items.splice(i, found - i);
38226
- needsSync = true;
38415
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
38416
+ try {
38417
+ for(var _iterator = spec.diagnostics[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
38418
+ var diagnostic = _step.value;
38419
+ if (seen.has(diagnostic)) continue;
38420
+ seen.add(diagnostic);
38421
+ var found = -1, item = void 0;
38422
+ for(var j = i; j < _this.items.length; j++)if (_this.items[j].diagnostic == diagnostic) {
38423
+ found = j;
38424
+ break;
38425
+ }
38426
+ if (found < 0) {
38427
+ item = new PanelItem(_this.view, diagnostic);
38428
+ _this.items.splice(i, 0, item);
38429
+ needsSync = true;
38430
+ } else {
38431
+ item = _this.items[found];
38432
+ if (found > i) {
38433
+ _this.items.splice(i, found - i);
38434
+ needsSync = true;
38435
+ }
38436
+ }
38437
+ if (selected && item.diagnostic == selected.diagnostic) {
38438
+ if (!item.dom.hasAttribute("aria-selected")) {
38439
+ item.dom.setAttribute("aria-selected", "true");
38440
+ newSelectedItem = item;
38441
+ }
38442
+ } else if (item.dom.hasAttribute("aria-selected")) {
38443
+ item.dom.removeAttribute("aria-selected");
38444
+ }
38445
+ i++;
38227
38446
  }
38228
- }
38229
- if (selected && item.diagnostic == selected.diagnostic) {
38230
- if (!item.dom.hasAttribute("aria-selected")) {
38231
- item.dom.setAttribute("aria-selected", "true");
38232
- newSelectedItem = item;
38447
+ } catch (err) {
38448
+ _didIteratorError = true;
38449
+ _iteratorError = err;
38450
+ } finally{
38451
+ try {
38452
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
38453
+ _iterator.return();
38454
+ }
38455
+ } finally{
38456
+ if (_didIteratorError) {
38457
+ throw _iteratorError;
38458
+ }
38233
38459
  }
38234
- } else if (item.dom.hasAttribute("aria-selected")) {
38235
- item.dom.removeAttribute("aria-selected");
38236
38460
  }
38237
- i++;
38238
38461
  });
38239
38462
  while(i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)){
38240
38463
  needsSync = true;
@@ -38465,6 +38688,34 @@ var baseTheme$3 = /*@__PURE__*/ EditorView.baseTheme({
38465
38688
  function severityWeight(sev) {
38466
38689
  return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1;
38467
38690
  }
38691
+ function maxSeverity(diagnostics) {
38692
+ var sev = "hint", weight = 1;
38693
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
38694
+ try {
38695
+ for(var _iterator = diagnostics[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
38696
+ var d = _step.value;
38697
+ var w = severityWeight(d.severity);
38698
+ if (w > weight) {
38699
+ weight = w;
38700
+ sev = d.severity;
38701
+ }
38702
+ }
38703
+ } catch (err) {
38704
+ _didIteratorError = true;
38705
+ _iteratorError = err;
38706
+ } finally{
38707
+ try {
38708
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
38709
+ _iterator.return();
38710
+ }
38711
+ } finally{
38712
+ if (_didIteratorError) {
38713
+ throw _iteratorError;
38714
+ }
38715
+ }
38716
+ }
38717
+ return sev;
38718
+ }
38468
38719
  var LintGutterMarker = /*#__PURE__*/ function(GutterMarker) {
38469
38720
  _inherits$5(LintGutterMarker, GutterMarker);
38470
38721
  var _super = _create_super$5(LintGutterMarker);
@@ -38473,9 +38724,7 @@ var LintGutterMarker = /*#__PURE__*/ function(GutterMarker) {
38473
38724
  var _this;
38474
38725
  _this = _super.call(this);
38475
38726
  _this.diagnostics = diagnostics;
38476
- _this.severity = diagnostics.reduce(function(max, d) {
38477
- return severityWeight(max) < severityWeight(d.severity) ? d.severity : max;
38478
- }, "hint");
38727
+ _this.severity = maxSeverity(diagnostics);
38479
38728
  return _this;
38480
38729
  }
38481
38730
  _create_class$6(LintGutterMarker, [
@@ -38519,6 +38768,7 @@ function gutterMarkerMouseOver(view, marker, diagnostics) {
38519
38768
  effects: setLintGutterTooltip.of({
38520
38769
  pos: line.from,
38521
38770
  above: false,
38771
+ clip: false,
38522
38772
  create: function create() {
38523
38773
  return {
38524
38774
  dom: diagnosticsTooltip(view, diagnostics),
@@ -38582,7 +38832,7 @@ var lintGutterExtension = /*@__PURE__*/ gutter({
38582
38832
  var diagnostics = [];
38583
38833
  view.state.field(lintGutterMarkers).between(block.from, block.to, function(from, to, value) {
38584
38834
  var _diagnostics;
38585
- (_diagnostics = diagnostics).push.apply(_diagnostics, _to_consumable_array$7(value.diagnostics));
38835
+ if (from > block.from && from < block.to) (_diagnostics = diagnostics).push.apply(_diagnostics, _to_consumable_array$7(value.diagnostics));
38586
38836
  });
38587
38837
  return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
38588
38838
  }
@@ -40847,17 +41097,17 @@ var jsonHighlighting = styleTags({
40847
41097
  "True False": tags.bool,
40848
41098
  PropertyName: tags.propertyName,
40849
41099
  Null: tags.null,
40850
- ",": tags.separator,
41100
+ ", :": tags.separator,
40851
41101
  "[ ]": tags.squareBracket,
40852
41102
  "{ }": tags.brace
40853
41103
  });
40854
41104
  // This file was generated by lezer-generator. You probably shouldn't edit it.
40855
41105
  var parser = LRParser.deserialize({
40856
41106
  version: 14,
40857
- states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
40858
- stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
40859
- goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
40860
- nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
41107
+ states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",
41108
+ stateData: "#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",
41109
+ goto: "!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
41110
+ nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",
40861
41111
  maxTerm: 25,
40862
41112
  nodeProps: [
40863
41113
  [
@@ -40871,14 +41121,14 @@ var parser = LRParser.deserialize({
40871
41121
  "openedBy",
40872
41122
  7,
40873
41123
  "{",
40874
- 12,
41124
+ 14,
40875
41125
  "["
40876
41126
  ],
40877
41127
  [
40878
41128
  "closedBy",
40879
41129
  8,
40880
41130
  "}",
40881
- 13,
41131
+ 15,
40882
41132
  "]"
40883
41133
  ]
40884
41134
  ],
@@ -40889,7 +41139,7 @@ var parser = LRParser.deserialize({
40889
41139
  0
40890
41140
  ],
40891
41141
  repeatNodeCount: 2,
40892
- tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
41142
+ tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
40893
41143
  tokenizers: [
40894
41144
  0
40895
41145
  ],
@@ -41691,7 +41941,7 @@ function findNextOccurrence(state, query) {
41691
41941
  var _loop = function(cycled1, cursor1) {
41692
41942
  cursor1.next();
41693
41943
  if (cursor1.done) {
41694
- if (cycled1) return cursor = cursor1, cycled = cycled1, {
41944
+ if (cycled1) return cycled = cycled1, cursor = cursor1, {
41695
41945
  v: null
41696
41946
  };
41697
41947
  cursor1 = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));
@@ -41699,16 +41949,16 @@ function findNextOccurrence(state, query) {
41699
41949
  } else {
41700
41950
  if (cycled1 && ranges.some(function(r) {
41701
41951
  return r.from == cursor1.value.from;
41702
- })) return cursor = cursor1, cycled = cycled1, "continue";
41952
+ })) return cycled = cycled1, cursor = cursor1, "continue";
41703
41953
  if (fullWord) {
41704
41954
  var word = state.wordAt(cursor1.value.from);
41705
- if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cursor = cursor1, cycled = cycled1, "continue";
41955
+ if (!word || word.from != cursor1.value.from || word.to != cursor1.value.to) return cycled = cycled1, cursor = cursor1, "continue";
41706
41956
  }
41707
- return cursor = cursor1, cycled = cycled1, {
41957
+ return cycled = cycled1, cursor = cursor1, {
41708
41958
  v: cursor1.value
41709
41959
  };
41710
41960
  }
41711
- cursor = cursor1, cycled = cycled1;
41961
+ cycled = cycled1, cursor = cursor1;
41712
41962
  };
41713
41963
  var _state_selection = state.selection, main = _state_selection.main, ranges = _state_selection.ranges;
41714
41964
  var word = state.wordAt(main.head), fullWord = word && word.from == main.from && word.to == main.to;
@@ -42179,8 +42429,9 @@ Replace the current match of the search query.
42179
42429
  var query = param.query;
42180
42430
  var state = view.state, _state_selection_main = state.selection.main, from = _state_selection_main.from, to = _state_selection_main.to;
42181
42431
  if (state.readOnly) return false;
42182
- var next = query.nextMatch(state, from, from);
42183
- if (!next) return false;
42432
+ var match = query.nextMatch(state, from, from);
42433
+ if (!match) return false;
42434
+ var next = match;
42184
42435
  var changes = [], selection, replacement;
42185
42436
  var effects = [];
42186
42437
  if (next.from == from && next.to == to) {
@@ -42194,7 +42445,7 @@ Replace the current match of the search query.
42194
42445
  effects.push(EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
42195
42446
  }
42196
42447
  if (next) {
42197
- var off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length;
42448
+ var off = changes.length == 0 || changes[0].from >= match.to ? 0 : match.to - match.from - replacement.length;
42198
42449
  selection = EditorSelection.single(next.from - off, next.to - off);
42199
42450
  effects.push(announceMatch(view, next));
42200
42451
  effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));
@@ -52995,6 +53246,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
52995
53246
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
52996
53247
  }
52997
53248
  var HEX = scopedChars.HEX;
53249
+ var IPV4_REG = RegExp("^(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)$", "u");
52998
53250
  function normalizeIPv4$1(host) {
52999
53251
  if (findToken(host, ".") < 3) {
53000
53252
  return {
@@ -53002,7 +53254,7 @@ function normalizeIPv4$1(host) {
53002
53254
  isIPV4: false
53003
53255
  };
53004
53256
  }
53005
- var matches = host.match(RegExp("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$", "u")) || [];
53257
+ var matches = host.match(IPV4_REG) || [];
53006
53258
  var _matches = _sliced_to_array$2(matches, 1), address = _matches[0];
53007
53259
  if (address) {
53008
53260
  return {
@@ -53229,7 +53481,7 @@ function normalizeComponentEncoding$1(components, esc) {
53229
53481
  }
53230
53482
  return components;
53231
53483
  }
53232
- function recomposeAuthority$1(components, options) {
53484
+ function recomposeAuthority$1(components) {
53233
53485
  var uriTokens = [];
53234
53486
  if (components.userinfo !== undefined) {
53235
53487
  uriTokens.push(components.userinfo);
@@ -53651,7 +53903,7 @@ function serialize(cmpts, opts) {
53651
53903
  if (options.reference !== "suffix" && components.scheme) {
53652
53904
  uriTokens.push(components.scheme, ":");
53653
53905
  }
53654
- var authority = recomposeAuthority(components, options);
53906
+ var authority = recomposeAuthority(components);
53655
53907
  if (authority !== undefined) {
53656
53908
  if (options.reference !== "suffix") {
53657
53909
  uriTokens.push("//");
@@ -53682,7 +53934,7 @@ function serialize(cmpts, opts) {
53682
53934
  }
53683
53935
  var hexLookUp = Array.from({
53684
53936
  length: 127
53685
- }, function(v, k) {
53937
+ }, function(_v, k) {
53686
53938
  return RegExp("[^!\"$&'()*+,\\-.;=_`a-z{}~]", "u").test(String.fromCharCode(k));
53687
53939
  });
53688
53940
  function nonSimpleDomain(value) {
@@ -53727,9 +53979,7 @@ function parse(uri, opts) {
53727
53979
  if (parsed.host) {
53728
53980
  var ipv4result = normalizeIPv4(parsed.host);
53729
53981
  if (ipv4result.isIPV4 === false) {
53730
- var ipv6result = normalizeIPv6(ipv4result.host, {
53731
- isIPV4: false
53732
- });
53982
+ var ipv6result = normalizeIPv6(ipv4result.host);
53733
53983
  parsed.host = ipv6result.host.toLowerCase();
53734
53984
  isIP = ipv6result.isIPV6;
53735
53985
  } else {
@@ -53772,10 +54022,10 @@ function parse(uri, opts) {
53772
54022
  if (gotEncoding && parsed.host !== undefined) {
53773
54023
  parsed.host = unescape(parsed.host);
53774
54024
  }
53775
- if (parsed.path !== undefined && parsed.path.length) {
54025
+ if (parsed.path && parsed.path.length) {
53776
54026
  parsed.path = escape(unescape(parsed.path));
53777
54027
  }
53778
- if (parsed.fragment !== undefined && parsed.fragment.length) {
54028
+ if (parsed.fragment && parsed.fragment.length) {
53779
54029
  parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
53780
54030
  }
53781
54031
  }