@uiw/react-codemirror 4.21.20 → 4.21.22

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.
@@ -7,27 +7,27 @@
7
7
  exports["@uiw/codemirror"] = factory(require("react"), require("@codemirror/state"), require("@codemirror/theme-one-dark"), require("@codemirror/view"));
8
8
  else
9
9
  root["@uiw/codemirror"] = factory(root["React"], root["CM"]["@codemirror/state"], root["CM"]["@codemirror/theme-one-dark"], root["CM"]["@codemirror/view"]);
10
- })(self, (__WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__242__, __WEBPACK_EXTERNAL_MODULE__362__, __WEBPACK_EXTERNAL_MODULE__105__) => {
10
+ })(self, (__WEBPACK_EXTERNAL_MODULE__442__, __WEBPACK_EXTERNAL_MODULE__60__, __WEBPACK_EXTERNAL_MODULE__708__, __WEBPACK_EXTERNAL_MODULE__730__) => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
14
14
 
15
- /***/ 724:
15
+ /***/ 368:
16
16
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17
17
 
18
18
 
19
19
  // EXPORTS
20
20
  __webpack_require__.d(__webpack_exports__, {
21
- X: () => (/* binding */ basicSetup),
22
- w: () => (/* binding */ minimalSetup)
21
+ o: () => (/* binding */ basicSetup),
22
+ V: () => (/* binding */ minimalSetup)
23
23
  });
24
24
 
25
25
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/view"],"commonjs":"@codemirror/view","commonjs2":"@codemirror/view"}
26
- var view_ = __webpack_require__(105);
26
+ var view_ = __webpack_require__(730);
27
27
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
28
- var state_ = __webpack_require__(242);
28
+ var state_ = __webpack_require__(60);
29
29
  // EXTERNAL MODULE: ../node_modules/@codemirror/commands/dist/index.js
30
- var dist = __webpack_require__(617);
30
+ var dist = __webpack_require__(720);
31
31
  ;// CONCATENATED MODULE: ../node_modules/crelt/index.js
32
32
  function crelt() {
33
33
  var elt = arguments[0]
@@ -142,7 +142,7 @@ class SearchCursor {
142
142
  let norm = this.normalize(str);
143
143
  for (let i = 0, pos = start;; i++) {
144
144
  let code = norm.charCodeAt(i);
145
- let match = this.match(code, pos);
145
+ let match = this.match(code, pos, this.bufferPos + this.bufferStart);
146
146
  if (i == norm.length - 1) {
147
147
  if (match) {
148
148
  this.value = match;
@@ -155,13 +155,13 @@ class SearchCursor {
155
155
  }
156
156
  }
157
157
  }
158
- match(code, pos) {
158
+ match(code, pos, end) {
159
159
  let match = null;
160
160
  for (let i = 0; i < this.matches.length; i += 2) {
161
161
  let index = this.matches[i], keep = false;
162
162
  if (this.query.charCodeAt(index) == code) {
163
163
  if (index == this.query.length - 1) {
164
- match = { from: this.matches[i + 1], to: pos + 1 };
164
+ match = { from: this.matches[i + 1], to: end };
165
165
  }
166
166
  else {
167
167
  this.matches[i]++;
@@ -175,7 +175,7 @@ class SearchCursor {
175
175
  }
176
176
  if (this.query.charCodeAt(0) == code) {
177
177
  if (this.query.length == 1)
178
- match = { from: pos, to: pos + 1 };
178
+ match = { from: pos, to: end };
179
179
  else
180
180
  this.matches.push(1, pos);
181
181
  }
@@ -523,12 +523,12 @@ const matchHighlighter = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
523
523
  if (conf.wholeWords) {
524
524
  query = state.sliceDoc(range.from, range.to); // TODO: allow and include leading/trailing space?
525
525
  check = state.charCategorizer(range.head);
526
- if (!(insideWordBoundaries(check, state, range.from, range.to)
527
- && insideWord(check, state, range.from, range.to)))
526
+ if (!(insideWordBoundaries(check, state, range.from, range.to) &&
527
+ insideWord(check, state, range.from, range.to)))
528
528
  return view_.Decoration.none;
529
529
  }
530
530
  else {
531
- query = state.sliceDoc(range.from, range.to).trim();
531
+ query = state.sliceDoc(range.from, range.to);
532
532
  if (!query)
533
533
  return view_.Decoration.none;
534
534
  }
@@ -791,10 +791,10 @@ class RegExpQuery extends QueryType {
791
791
  this.prevMatchInRange(state, curTo, state.doc.length);
792
792
  }
793
793
  getReplacement(result) {
794
- return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g, (m, i) => i == "$" ? "$"
794
+ return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g, (m, i) => i == "$" ? "$"
795
795
  : i == "&" ? result.match[0]
796
796
  : i != "0" && +i < result.match.length ? result.match[i]
797
- : m));
797
+ : m);
798
798
  }
799
799
  matchAll(state, limit) {
800
800
  let cursor = regexpCursor(this.spec, state, 0, state.doc.length), ranges = [];
@@ -1087,7 +1087,7 @@ Default search-related key bindings.
1087
1087
  - Mod-f: [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel)
1088
1088
  - F3, Mod-g: [`findNext`](https://codemirror.net/6/docs/ref/#search.findNext)
1089
1089
  - Shift-F3, Shift-Mod-g: [`findPrevious`](https://codemirror.net/6/docs/ref/#search.findPrevious)
1090
- - Alt-g: [`gotoLine`](https://codemirror.net/6/docs/ref/#search.gotoLine)
1090
+ - Mod-Alt-g: [`gotoLine`](https://codemirror.net/6/docs/ref/#search.gotoLine)
1091
1091
  - Mod-d: [`selectNextOccurrence`](https://codemirror.net/6/docs/ref/#search.selectNextOccurrence)
1092
1092
  */
1093
1093
  const searchKeymap = [
@@ -1096,7 +1096,7 @@ const searchKeymap = [
1096
1096
  { key: "Mod-g", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true },
1097
1097
  { key: "Escape", run: closeSearchPanel, scope: "editor search-panel" },
1098
1098
  { key: "Mod-Shift-l", run: selectSelectionMatches },
1099
- { key: "Alt-g", run: gotoLine },
1099
+ { key: "Mod-Alt-g", run: gotoLine },
1100
1100
  { key: "Mod-d", run: selectNextOccurrence, preventDefault: true },
1101
1101
  ];
1102
1102
  class SearchPanel {
@@ -1280,7 +1280,7 @@ const searchExtensions = [
1280
1280
 
1281
1281
 
1282
1282
  // EXTERNAL MODULE: ../node_modules/@codemirror/language/dist/index.js + 2 modules
1283
- var language_dist = __webpack_require__(478);
1283
+ var language_dist = __webpack_require__(194);
1284
1284
  ;// CONCATENATED MODULE: ../node_modules/@codemirror/autocomplete/dist/index.js
1285
1285
 
1286
1286
 
@@ -1324,7 +1324,7 @@ class CompletionContext {
1324
1324
  token before `this.pos`.
1325
1325
  */
1326
1326
  tokenBefore(types) {
1327
- let token = (0,language_dist/* syntaxTree */.qz)(this.state).resolveInner(this.pos, -1);
1327
+ let token = (0,language_dist/* syntaxTree */.mv)(this.state).resolveInner(this.pos, -1);
1328
1328
  while (token && types.indexOf(token.name) < 0)
1329
1329
  token = token.parent;
1330
1330
  return token ? { from: token.from, to: this.pos,
@@ -1611,6 +1611,7 @@ const completionConfig = /*@__PURE__*/state_.Facet.define({
1611
1611
  combine(configs) {
1612
1612
  return (0,state_.combineConfig)(configs, {
1613
1613
  activateOnTyping: true,
1614
+ activateOnTypingDelay: 100,
1614
1615
  selectOnOpen: true,
1615
1616
  override: null,
1616
1617
  closeOnBlur: true,
@@ -1686,7 +1687,7 @@ function optionContent(config) {
1686
1687
  position: 20
1687
1688
  });
1688
1689
  content.push({
1689
- render(completion, _s, match) {
1690
+ render(completion, _s, _v, match) {
1690
1691
  let labelElt = document.createElement("span");
1691
1692
  labelElt.className = "cm-completionLabel";
1692
1693
  let label = completion.displayLabel || completion.label, off = 0;
@@ -1935,7 +1936,7 @@ class CompletionTooltip {
1935
1936
  if (cls)
1936
1937
  li.className = cls;
1937
1938
  for (let source of this.optionContent) {
1938
- let node = source(completion, this.view.state, match);
1939
+ let node = source(completion, this.view.state, this.view, match);
1939
1940
  if (node)
1940
1941
  li.appendChild(node);
1941
1942
  }
@@ -2315,6 +2316,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2315
2316
  this.debounceUpdate = -1;
2316
2317
  this.running = [];
2317
2318
  this.debounceAccept = -1;
2319
+ this.pendingStart = false;
2318
2320
  this.composing = 0 /* CompositionState.None */;
2319
2321
  for (let active of view.state.field(completionState).active)
2320
2322
  if (active.state == 1 /* State.Pending */)
@@ -2348,8 +2350,11 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2348
2350
  }
2349
2351
  if (this.debounceUpdate > -1)
2350
2352
  clearTimeout(this.debounceUpdate);
2353
+ if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect))))
2354
+ this.pendingStart = true;
2355
+ let delay = this.pendingStart ? 50 : update.state.facet(completionConfig).activateOnTypingDelay;
2351
2356
  this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))
2352
- ? setTimeout(() => this.startUpdate(), update.state.facet(completionConfig).updateSyncTime) : -1;
2357
+ ? setTimeout(() => this.startUpdate(), delay) : -1;
2353
2358
  if (this.composing != 0 /* CompositionState.None */)
2354
2359
  for (let tr of update.transactions) {
2355
2360
  if (getUserEvent(tr) == "input")
@@ -2360,6 +2365,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2360
2365
  }
2361
2366
  startUpdate() {
2362
2367
  this.debounceUpdate = -1;
2368
+ this.pendingStart = false;
2363
2369
  let { state } = this.view, cState = state.field(completionState);
2364
2370
  for (let active of cState.active) {
2365
2371
  if (active.state == 1 /* State.Pending */ && !this.running.some(r => r.active.source == active.source))
@@ -2439,7 +2445,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2439
2445
  if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
2440
2446
  let dialog = state.open && (0,view_.getTooltip)(this.view, state.open.tooltip);
2441
2447
  if (!dialog || !dialog.dom.contains(event.relatedTarget))
2442
- this.view.dispatch({ effects: closeCompletionEffect.of(null) });
2448
+ setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);
2443
2449
  }
2444
2450
  },
2445
2451
  compositionstart() {
@@ -2747,11 +2753,11 @@ function snippet(template) {
2747
2753
  let spec = {
2748
2754
  changes: { from, to, insert: Text.of(text) },
2749
2755
  scrollIntoView: true,
2750
- annotations: completion ? pickedCompletion.of(completion) : undefined
2756
+ annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : undefined
2751
2757
  };
2752
2758
  if (ranges.length)
2753
2759
  spec.selection = fieldSelection(ranges, 0);
2754
- if (ranges.length > 1) {
2760
+ if (ranges.some(r => r.field > 0)) {
2755
2761
  let active = new ActiveSnippet(ranges, 0);
2756
2762
  let effects = spec.effects = [setActive.of(active)];
2757
2763
  if (editor.state.field(snippetState, false) === undefined)
@@ -2944,13 +2950,11 @@ closedBracket.endSide = -1;
2944
2950
  const bracketState = /*@__PURE__*/state_.StateField.define({
2945
2951
  create() { return state_.RangeSet.empty; },
2946
2952
  update(value, tr) {
2953
+ value = value.map(tr.changes);
2947
2954
  if (tr.selection) {
2948
- let lineStart = tr.state.doc.lineAt(tr.selection.main.head).from;
2949
- let prevLineStart = tr.startState.doc.lineAt(tr.startState.selection.main.head).from;
2950
- if (lineStart != tr.changes.mapPos(prevLineStart, -1))
2951
- value = state_.RangeSet.empty;
2955
+ let line = tr.state.doc.lineAt(tr.selection.main.head);
2956
+ value = value.update({ filter: from => from >= line.from && from <= line.to });
2952
2957
  }
2953
- value = value.map(tr.changes);
2954
2958
  for (let effect of tr.effects)
2955
2959
  if (effect.is(closeBracketEffect))
2956
2960
  value = value.update({ add: [closedBracket.range(effect.value, effect.value + 1)] });
@@ -3136,11 +3140,11 @@ function handleSame(state, token, allowTriple, config) {
3136
3140
  });
3137
3141
  }
3138
3142
  function nodeStart(state, pos) {
3139
- let tree = (0,language_dist/* syntaxTree */.qz)(state).resolveInner(pos + 1);
3143
+ let tree = (0,language_dist/* syntaxTree */.mv)(state).resolveInner(pos + 1);
3140
3144
  return tree.parent && tree.from == pos;
3141
3145
  }
3142
3146
  function probablyInString(state, pos, quoteToken, prefixes) {
3143
- let node = (0,language_dist/* syntaxTree */.qz)(state).resolveInner(pos, -1);
3147
+ let node = (0,language_dist/* syntaxTree */.mv)(state).resolveInner(pos, -1);
3144
3148
  let maxPrefix = prefixes.reduce((m, p) => Math.max(m, p.length), 0);
3145
3149
  for (let i = 0; i < 5; i++) {
3146
3150
  let start = state.sliceDoc(node.from, Math.min(node.to, node.from + quoteToken.length + maxPrefix));
@@ -3281,7 +3285,7 @@ class LintState {
3281
3285
  let markedDiagnostics = diagnostics;
3282
3286
  let diagnosticFilter = state.facet(lintConfig).markerFilter;
3283
3287
  if (diagnosticFilter)
3284
- markedDiagnostics = diagnosticFilter(markedDiagnostics);
3288
+ markedDiagnostics = diagnosticFilter(markedDiagnostics, state);
3285
3289
  let ranges = view_.Decoration.set(markedDiagnostics.map((d) => {
3286
3290
  // For zero-length ranges or ranges covering only a line break, create a widget
3287
3291
  return d.from == d.to || (d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from)
@@ -3291,7 +3295,8 @@ class LintState {
3291
3295
  }).range(d.from)
3292
3296
  : view_.Decoration.mark({
3293
3297
  attributes: { class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "") },
3294
- diagnostic: d
3298
+ diagnostic: d,
3299
+ inclusive: true
3295
3300
  }).range(d.from, d.to);
3296
3301
  }), true);
3297
3302
  return new LintState(ranges, panel, findDiagnostic(ranges));
@@ -3367,7 +3372,7 @@ function diagnosticCount(state) {
3367
3372
  let lint = state.field(lintState, false);
3368
3373
  return lint ? lint.diagnostics.size : 0;
3369
3374
  }
3370
- const activeMark = /*@__PURE__*/view_.Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
3375
+ const activeMark = /*@__PURE__*/view_.Decoration.mark({ class: "cm-lintRange cm-lintRange-active", inclusive: true });
3371
3376
  function lintTooltip(view, pos, side) {
3372
3377
  let { diagnostics } = view.state.field(lintState);
3373
3378
  let found = [], stackStart = 2e8, stackEnd = 0;
@@ -3381,7 +3386,7 @@ function lintTooltip(view, pos, side) {
3381
3386
  });
3382
3387
  let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
3383
3388
  if (diagnosticFilter)
3384
- found = diagnosticFilter(found);
3389
+ found = diagnosticFilter(found, view.state);
3385
3390
  if (!found.length)
3386
3391
  return null;
3387
3392
  return {
@@ -3486,11 +3491,12 @@ const lintPlugin = /*@__PURE__*/(/* unused pure expression or super */ null && (
3486
3491
  else {
3487
3492
  this.set = false;
3488
3493
  let { state } = this.view, { sources } = state.facet(lintConfig);
3489
- Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {
3490
- let all = annotations.reduce((a, b) => a.concat(b));
3491
- if (this.view.state.doc == state.doc)
3492
- this.view.dispatch(setDiagnostics(this.view.state, all));
3493
- }, error => { logException(this.view.state, error); });
3494
+ if (sources.length)
3495
+ Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {
3496
+ let all = annotations.reduce((a, b) => a.concat(b));
3497
+ if (this.view.state.doc == state.doc)
3498
+ this.view.dispatch(setDiagnostics(this.view.state, all));
3499
+ }, error => { logException(this.view.state, error); });
3494
3500
  }
3495
3501
  }
3496
3502
  update(update) {
@@ -3516,7 +3522,7 @@ const lintPlugin = /*@__PURE__*/(/* unused pure expression or super */ null && (
3516
3522
  })));
3517
3523
  const lintConfig = /*@__PURE__*/state_.Facet.define({
3518
3524
  combine(input) {
3519
- return Object.assign({ sources: input.map(i => i.source) }, (0,state_.combineConfig)(input.map(i => i.config), {
3525
+ return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, (0,state_.combineConfig)(input.map(i => i.config), {
3520
3526
  delay: 750,
3521
3527
  markerFilter: null,
3522
3528
  tooltipFilter: null,
@@ -3529,7 +3535,8 @@ const lintConfig = /*@__PURE__*/state_.Facet.define({
3529
3535
  /**
3530
3536
  Given a diagnostic source, this function returns an extension that
3531
3537
  enables linting with that source. It will be called whenever the
3532
- editor is idle (after its content changed).
3538
+ editor is idle (after its content changed). If `null` is given as
3539
+ source, this only configures the lint extension.
3533
3540
  */
3534
3541
  function linter(source, config = {}) {
3535
3542
  return [
@@ -3887,7 +3894,7 @@ class LintGutterMarker extends view_.GutterMarker {
3887
3894
  let diagnostics = this.diagnostics;
3888
3895
  let diagnosticsFilter = view.state.facet(lintGutterConfig).tooltipFilter;
3889
3896
  if (diagnosticsFilter)
3890
- diagnostics = diagnosticsFilter(diagnostics);
3897
+ diagnostics = diagnosticsFilter(diagnostics, view.state);
3891
3898
  if (diagnostics.length)
3892
3899
  elt.onmouseover = () => gutterMarkerMouseOver(view, elt, diagnostics);
3893
3900
  return elt;
@@ -3966,7 +3973,7 @@ const lintGutterMarkers = /*@__PURE__*/state_.StateField.define({
3966
3973
  if (effect.is(setDiagnosticsEffect)) {
3967
3974
  let diagnostics = effect.value;
3968
3975
  if (diagnosticFilter)
3969
- diagnostics = diagnosticFilter(diagnostics || []);
3976
+ diagnostics = diagnosticFilter(diagnostics || [], tr.state);
3970
3977
  markers = markersForDiagnostics(tr.state.doc, diagnostics.slice(0));
3971
3978
  }
3972
3979
  }
@@ -4105,16 +4112,16 @@ var basicSetup = function basicSetup(options) {
4105
4112
  keymaps = keymaps.concat(closeBracketsKeymap);
4106
4113
  }
4107
4114
  if (options.defaultKeymap !== false) {
4108
- keymaps = keymaps.concat(dist/* defaultKeymap */.wQ);
4115
+ keymaps = keymaps.concat(dist/* defaultKeymap */.pw);
4109
4116
  }
4110
4117
  if (options.searchKeymap !== false) {
4111
4118
  keymaps = keymaps.concat(searchKeymap);
4112
4119
  }
4113
4120
  if (options.historyKeymap !== false) {
4114
- keymaps = keymaps.concat(dist/* historyKeymap */.f$);
4121
+ keymaps = keymaps.concat(dist/* historyKeymap */.cL);
4115
4122
  }
4116
4123
  if (options.foldKeymap !== false) {
4117
- keymaps = keymaps.concat(language_dist/* foldKeymap */.e7);
4124
+ keymaps = keymaps.concat(language_dist/* foldKeymap */.f7);
4118
4125
  }
4119
4126
  if (options.completionKeymap !== false) {
4120
4127
  keymaps = keymaps.concat(completionKeymap);
@@ -4126,23 +4133,23 @@ var basicSetup = function basicSetup(options) {
4126
4133
  if (options.lineNumbers !== false) extensions.push((0,view_.lineNumbers)());
4127
4134
  if (options.highlightActiveLineGutter !== false) extensions.push((0,view_.highlightActiveLineGutter)());
4128
4135
  if (options.highlightSpecialChars !== false) extensions.push((0,view_.highlightSpecialChars)());
4129
- if (options.history !== false) extensions.push((0,dist/* history */.m8)());
4130
- if (options.foldGutter !== false) extensions.push((0,language_dist/* foldGutter */.mi)());
4136
+ if (options.history !== false) extensions.push((0,dist/* history */.b6)());
4137
+ if (options.foldGutter !== false) extensions.push((0,language_dist/* foldGutter */.Lv)());
4131
4138
  if (options.drawSelection !== false) extensions.push((0,view_.drawSelection)());
4132
4139
  if (options.dropCursor !== false) extensions.push((0,view_.dropCursor)());
4133
4140
  if (options.allowMultipleSelections !== false) extensions.push(state_.EditorState.allowMultipleSelections.of(true));
4134
- if (options.indentOnInput !== false) extensions.push((0,language_dist/* indentOnInput */.nY)());
4135
- if (options.syntaxHighlighting !== false) extensions.push((0,language_dist/* syntaxHighlighting */.nF)(language_dist/* defaultHighlightStyle */.R_, {
4141
+ if (options.indentOnInput !== false) extensions.push((0,language_dist/* indentOnInput */.WD)());
4142
+ if (options.syntaxHighlighting !== false) extensions.push((0,language_dist/* syntaxHighlighting */.y9)(language_dist/* defaultHighlightStyle */.Zt, {
4136
4143
  fallback: true
4137
4144
  }));
4138
- if (options.bracketMatching !== false) extensions.push((0,language_dist/* bracketMatching */.n$)());
4145
+ if (options.bracketMatching !== false) extensions.push((0,language_dist/* bracketMatching */.SG)());
4139
4146
  if (options.closeBrackets !== false) extensions.push(closeBrackets());
4140
4147
  if (options.autocompletion !== false) extensions.push(autocompletion());
4141
4148
  if (options.rectangularSelection !== false) extensions.push((0,view_.rectangularSelection)());
4142
4149
  if (initCrosshairCursor !== false) extensions.push((0,view_.crosshairCursor)());
4143
4150
  if (options.highlightActiveLine !== false) extensions.push((0,view_.highlightActiveLine)());
4144
4151
  if (options.highlightSelectionMatches !== false) extensions.push(highlightSelectionMatches());
4145
- if (options.tabSize && typeof options.tabSize === 'number') extensions.push(language_dist/* indentUnit */.c.of(' '.repeat(options.tabSize)));
4152
+ if (options.tabSize && typeof options.tabSize === 'number') extensions.push(language_dist/* indentUnit */.Xt.of(' '.repeat(options.tabSize)));
4146
4153
  return extensions.concat([view_.keymap.of(keymaps.flat())]).filter(Boolean);
4147
4154
  };
4148
4155
  /**
@@ -4159,16 +4166,16 @@ var minimalSetup = function minimalSetup(options) {
4159
4166
  }
4160
4167
  var keymaps = [];
4161
4168
  if (options.defaultKeymap !== false) {
4162
- keymaps = keymaps.concat(dist/* defaultKeymap */.wQ);
4169
+ keymaps = keymaps.concat(dist/* defaultKeymap */.pw);
4163
4170
  }
4164
4171
  if (options.historyKeymap !== false) {
4165
- keymaps = keymaps.concat(dist/* historyKeymap */.f$);
4172
+ keymaps = keymaps.concat(dist/* historyKeymap */.cL);
4166
4173
  }
4167
4174
  var extensions = [];
4168
4175
  if (options.highlightSpecialChars !== false) extensions.push((0,view_.highlightSpecialChars)());
4169
- if (options.history !== false) extensions.push((0,dist/* history */.m8)());
4176
+ if (options.history !== false) extensions.push((0,dist/* history */.b6)());
4170
4177
  if (options.drawSelection !== false) extensions.push((0,view_.drawSelection)());
4171
- if (options.syntaxHighlighting !== false) extensions.push((0,language_dist/* syntaxHighlighting */.nF)(language_dist/* defaultHighlightStyle */.R_, {
4178
+ if (options.syntaxHighlighting !== false) extensions.push((0,language_dist/* syntaxHighlighting */.y9)(language_dist/* defaultHighlightStyle */.Zt, {
4172
4179
  fallback: true
4173
4180
  }));
4174
4181
  return extensions.concat([view_.keymap.of(keymaps.flat())]).filter(Boolean);
@@ -4176,49 +4183,49 @@ var minimalSetup = function minimalSetup(options) {
4176
4183
 
4177
4184
  /***/ }),
4178
4185
 
4179
- /***/ 180:
4186
+ /***/ 89:
4180
4187
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4181
4188
 
4182
4189
  __webpack_require__.r(__webpack_exports__);
4183
4190
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4184
- /* harmony export */ defaultLightThemeOption: () => (/* reexport safe */ _theme_light__WEBPACK_IMPORTED_MODULE_4__.d),
4191
+ /* harmony export */ defaultLightThemeOption: () => (/* reexport safe */ _theme_light__WEBPACK_IMPORTED_MODULE_4__.c),
4185
4192
  /* harmony export */ getDefaultExtensions: () => (/* binding */ getDefaultExtensions)
4186
4193
  /* harmony export */ });
4187
- /* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(617);
4188
- /* harmony import */ var _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(724);
4189
- /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(105);
4194
+ /* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(720);
4195
+ /* harmony import */ var _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(368);
4196
+ /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(730);
4190
4197
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__);
4191
- /* harmony import */ var _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(362);
4198
+ /* harmony import */ var _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(708);
4192
4199
  /* harmony import */ var _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__);
4193
- /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(242);
4200
+ /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(60);
4194
4201
  /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_codemirror_state__WEBPACK_IMPORTED_MODULE_3__);
4195
- /* harmony import */ var _theme_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
4202
+ /* harmony import */ var _theme_light__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(806);
4196
4203
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
4197
4204
  /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__) if(["default","getDefaultExtensions"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__[__WEBPACK_IMPORT_KEY__]
4198
4205
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
4199
- var getDefaultExtensions=function getDefaultExtensions(){var optios=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _optios$indentWithTab=optios.indentWithTab,defaultIndentWithTab=_optios$indentWithTab===void 0?true:_optios$indentWithTab,_optios$editable=optios.editable,editable=_optios$editable===void 0?true:_optios$editable,_optios$readOnly=optios.readOnly,readOnly=_optios$readOnly===void 0?false:_optios$readOnly,_optios$theme=optios.theme,theme=_optios$theme===void 0?'light':_optios$theme,_optios$placeholder=optios.placeholder,placeholderStr=_optios$placeholder===void 0?'':_optios$placeholder,_optios$basicSetup=optios.basicSetup,defaultBasicSetup=_optios$basicSetup===void 0?true:_optios$basicSetup;var getExtensions=[];if(defaultIndentWithTab){getExtensions.unshift(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.keymap.of([_codemirror_commands__WEBPACK_IMPORTED_MODULE_5__/* .indentWithTab */ .oc]));}if(defaultBasicSetup){if(typeof defaultBasicSetup==='boolean'){getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__/* .basicSetup */ .X)());}else{getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__/* .basicSetup */ .X)(defaultBasicSetup));}}if(placeholderStr){getExtensions.unshift((0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.placeholder)(placeholderStr));}switch(theme){case'light':getExtensions.push(_theme_light__WEBPACK_IMPORTED_MODULE_4__/* .defaultLightThemeOption */ .d);break;case'dark':getExtensions.push(_codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__.oneDark);break;case'none':break;default:getExtensions.push(theme);break;}if(editable===false){getExtensions.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.editable.of(false));}if(readOnly){getExtensions.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.readOnly.of(true));}return[].concat(getExtensions);};
4206
+ var getDefaultExtensions=function getDefaultExtensions(){var optios=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _optios$indentWithTab=optios.indentWithTab,defaultIndentWithTab=_optios$indentWithTab===void 0?true:_optios$indentWithTab,_optios$editable=optios.editable,editable=_optios$editable===void 0?true:_optios$editable,_optios$readOnly=optios.readOnly,readOnly=_optios$readOnly===void 0?false:_optios$readOnly,_optios$theme=optios.theme,theme=_optios$theme===void 0?'light':_optios$theme,_optios$placeholder=optios.placeholder,placeholderStr=_optios$placeholder===void 0?'':_optios$placeholder,_optios$basicSetup=optios.basicSetup,defaultBasicSetup=_optios$basicSetup===void 0?true:_optios$basicSetup;var getExtensions=[];if(defaultIndentWithTab){getExtensions.unshift(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.keymap.of([_codemirror_commands__WEBPACK_IMPORTED_MODULE_5__/* .indentWithTab */ .Yc]));}if(defaultBasicSetup){if(typeof defaultBasicSetup==='boolean'){getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__/* .basicSetup */ .o)());}else{getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_0__/* .basicSetup */ .o)(defaultBasicSetup));}}if(placeholderStr){getExtensions.unshift((0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.placeholder)(placeholderStr));}switch(theme){case'light':getExtensions.push(_theme_light__WEBPACK_IMPORTED_MODULE_4__/* .defaultLightThemeOption */ .c);break;case'dark':getExtensions.push(_codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_2__.oneDark);break;case'none':break;default:getExtensions.push(theme);break;}if(editable===false){getExtensions.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.editable.of(false));}if(readOnly){getExtensions.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.readOnly.of(true));}return[].concat(getExtensions);};
4200
4207
 
4201
4208
  /***/ }),
4202
4209
 
4203
- /***/ 8:
4210
+ /***/ 806:
4204
4211
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4205
4212
 
4206
4213
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4207
- /* harmony export */ d: () => (/* binding */ defaultLightThemeOption)
4214
+ /* harmony export */ c: () => (/* binding */ defaultLightThemeOption)
4208
4215
  /* harmony export */ });
4209
- /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(105);
4216
+ /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(730);
4210
4217
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_codemirror_view__WEBPACK_IMPORTED_MODULE_0__);
4211
4218
  var defaultLightThemeOption=_codemirror_view__WEBPACK_IMPORTED_MODULE_0__.EditorView.theme({'&':{backgroundColor:'#fff'}},{dark:false});
4212
4219
 
4213
4220
  /***/ }),
4214
4221
 
4215
- /***/ 80:
4222
+ /***/ 695:
4216
4223
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4217
4224
 
4218
4225
 
4219
4226
  // EXPORTS
4220
4227
  __webpack_require__.d(__webpack_exports__, {
4221
- U: () => (/* binding */ useCodeMirror)
4228
+ q: () => (/* binding */ useCodeMirror)
4222
4229
  });
4223
4230
 
4224
4231
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
@@ -4303,34 +4310,34 @@ function _slicedToArray(arr, i) {
4303
4310
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4304
4311
  }
4305
4312
  // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
4306
- var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
4313
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
4307
4314
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
4308
- var state_ = __webpack_require__(242);
4315
+ var state_ = __webpack_require__(60);
4309
4316
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/view"],"commonjs":"@codemirror/view","commonjs2":"@codemirror/view"}
4310
- var view_ = __webpack_require__(105);
4317
+ var view_ = __webpack_require__(730);
4311
4318
  // EXTERNAL MODULE: ./src/getDefaultExtensions.ts
4312
- var getDefaultExtensions = __webpack_require__(180);
4319
+ var getDefaultExtensions = __webpack_require__(89);
4313
4320
  // EXTERNAL MODULE: ./src/utils.ts
4314
- var utils = __webpack_require__(237);
4321
+ var utils = __webpack_require__(369);
4315
4322
  ;// CONCATENATED MODULE: ./src/useCodeMirror.ts
4316
4323
  var External=state_.Annotation.define();var emptyExtensions=[];function useCodeMirror(props){var value=props.value,selection=props.selection,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,_props$extensions=props.extensions,extensions=_props$extensions===void 0?emptyExtensions:_props$extensions,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,_props$height=props.height,height=_props$height===void 0?null:_props$height,_props$minHeight=props.minHeight,minHeight=_props$minHeight===void 0?null:_props$minHeight,_props$maxHeight=props.maxHeight,maxHeight=_props$maxHeight===void 0?null:_props$maxHeight,_props$width=props.width,width=_props$width===void 0?null:_props$width,_props$minWidth=props.minWidth,minWidth=_props$minWidth===void 0?null:_props$minWidth,_props$maxWidth=props.maxWidth,maxWidth=_props$maxWidth===void 0?null:_props$maxWidth,_props$placeholder=props.placeholder,placeholderStr=_props$placeholder===void 0?'':_props$placeholder,_props$editable=props.editable,editable=_props$editable===void 0?true:_props$editable,_props$readOnly=props.readOnly,readOnly=_props$readOnly===void 0?false:_props$readOnly,_props$indentWithTab=props.indentWithTab,defaultIndentWithTab=_props$indentWithTab===void 0?true:_props$indentWithTab,_props$basicSetup=props.basicSetup,defaultBasicSetup=_props$basicSetup===void 0?true:_props$basicSetup,root=props.root,initialState=props.initialState;var _useState=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState2=_slicedToArray(_useState,2),container=_useState2[0],setContainer=_useState2[1];var _useState3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState4=_slicedToArray(_useState3,2),view=_useState4[0],setView=_useState4[1];var _useState5=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState6=_slicedToArray(_useState5,2),state=_useState6[0],setState=_useState6[1];var defaultThemeOption=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth},'& .cm-scroller':{height:'100% !important'}});var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
4317
4324
  // If transaction is market as remote we don't have to call `onChange` handler again
4318
- !vu.transactions.some(function(tr){return tr.annotation(External);})){var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.a)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener,defaultThemeOption].concat(_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return setContainer(props.container);},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
4325
+ !vu.transactions.some(function(tr){return tr.annotation(External);})){var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.m)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener,defaultThemeOption].concat(_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return setContainer(props.container);},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
4319
4326
  },[theme,extensions,height,minHeight,maxHeight,width,minWidth,maxWidth,placeholderStr,editable,readOnly,defaultIndentWithTab,defaultBasicSetup,onChange,onUpdate]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(value===undefined){return;}var currentValue=view?view.state.doc.toString():'';if(view&&value!==currentValue){view.dispatch({changes:{from:0,to:currentValue.length,insert:value||''},annotations:[External.of(true)]});}},[value,view]);return{state:state,setState:setState,view:view,setView:setView,container:container,setContainer:setContainer};}
4320
4327
 
4321
4328
  /***/ }),
4322
4329
 
4323
- /***/ 237:
4330
+ /***/ 369:
4324
4331
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4325
4332
 
4326
4333
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4327
- /* harmony export */ a: () => (/* binding */ getStatistics)
4334
+ /* harmony export */ m: () => (/* binding */ getStatistics)
4328
4335
  /* harmony export */ });
4329
4336
  var getStatistics=function getStatistics(view){return{line:view.state.doc.lineAt(view.state.selection.main.from),lineCount:view.state.doc.lines,lineBreak:view.state.lineBreak,length:view.state.doc.length,readOnly:view.state.readOnly,tabSize:view.state.tabSize,selection:view.state.selection,selectionAsSingle:view.state.selection.asSingle().main,ranges:view.state.selection.ranges,selectionCode:view.state.sliceDoc(view.state.selection.main.from,view.state.selection.main.to),selections:view.state.selection.ranges.map(function(r){return view.state.sliceDoc(r.from,r.to);}),selectedText:view.state.selection.ranges.some(function(r){return!r.empty;})};};
4330
4337
 
4331
4338
  /***/ }),
4332
4339
 
4333
- /***/ 426:
4340
+ /***/ 192:
4334
4341
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4335
4342
 
4336
4343
  var __webpack_unused_export__;
@@ -4343,59 +4350,59 @@ var __webpack_unused_export__;
4343
4350
  * This source code is licensed under the MIT license found in the
4344
4351
  * LICENSE file in the root directory of this source tree.
4345
4352
  */
4346
- var f=__webpack_require__(787),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
4353
+ var f=__webpack_require__(442),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
4347
4354
  function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}__webpack_unused_export__=l;exports.jsx=q;__webpack_unused_export__=q;
4348
4355
 
4349
4356
 
4350
4357
  /***/ }),
4351
4358
 
4352
- /***/ 246:
4359
+ /***/ 540:
4353
4360
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4354
4361
 
4355
4362
 
4356
4363
 
4357
4364
  if (true) {
4358
- module.exports = __webpack_require__(426);
4365
+ module.exports = __webpack_require__(192);
4359
4366
  } else {}
4360
4367
 
4361
4368
 
4362
4369
  /***/ }),
4363
4370
 
4364
- /***/ 787:
4371
+ /***/ 442:
4365
4372
  /***/ ((module) => {
4366
4373
 
4367
- module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
4374
+ module.exports = __WEBPACK_EXTERNAL_MODULE__442__;
4368
4375
 
4369
4376
  /***/ }),
4370
4377
 
4371
- /***/ 242:
4378
+ /***/ 60:
4372
4379
  /***/ ((module) => {
4373
4380
 
4374
- module.exports = __WEBPACK_EXTERNAL_MODULE__242__;
4381
+ module.exports = __WEBPACK_EXTERNAL_MODULE__60__;
4375
4382
 
4376
4383
  /***/ }),
4377
4384
 
4378
- /***/ 362:
4385
+ /***/ 708:
4379
4386
  /***/ ((module) => {
4380
4387
 
4381
- module.exports = __WEBPACK_EXTERNAL_MODULE__362__;
4388
+ module.exports = __WEBPACK_EXTERNAL_MODULE__708__;
4382
4389
 
4383
4390
  /***/ }),
4384
4391
 
4385
- /***/ 105:
4392
+ /***/ 730:
4386
4393
  /***/ ((module) => {
4387
4394
 
4388
- module.exports = __WEBPACK_EXTERNAL_MODULE__105__;
4395
+ module.exports = __WEBPACK_EXTERNAL_MODULE__730__;
4389
4396
 
4390
4397
  /***/ }),
4391
4398
 
4392
- /***/ 215:
4399
+ /***/ 957:
4393
4400
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4394
4401
 
4395
4402
 
4396
4403
  // EXPORTS
4397
4404
  __webpack_require__.d(__webpack_exports__, {
4398
- Z: () => (/* binding */ _objectSpread2)
4405
+ A: () => (/* binding */ _objectSpread2)
4399
4406
  });
4400
4407
 
4401
4408
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/typeof.js
@@ -4410,27 +4417,27 @@ function _typeof(o) {
4410
4417
  }
4411
4418
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
4412
4419
 
4413
- function _toPrimitive(input, hint) {
4414
- if (_typeof(input) !== "object" || input === null) return input;
4415
- var prim = input[Symbol.toPrimitive];
4416
- if (prim !== undefined) {
4417
- var res = prim.call(input, hint || "default");
4418
- if (_typeof(res) !== "object") return res;
4420
+ function toPrimitive(t, r) {
4421
+ if ("object" != _typeof(t) || !t) return t;
4422
+ var e = t[Symbol.toPrimitive];
4423
+ if (void 0 !== e) {
4424
+ var i = e.call(t, r || "default");
4425
+ if ("object" != _typeof(i)) return i;
4419
4426
  throw new TypeError("@@toPrimitive must return a primitive value.");
4420
4427
  }
4421
- return (hint === "string" ? String : Number)(input);
4428
+ return ("string" === r ? String : Number)(t);
4422
4429
  }
4423
4430
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
4424
4431
 
4425
4432
 
4426
- function _toPropertyKey(arg) {
4427
- var key = _toPrimitive(arg, "string");
4428
- return _typeof(key) === "symbol" ? key : String(key);
4433
+ function toPropertyKey(t) {
4434
+ var i = toPrimitive(t, "string");
4435
+ return "symbol" == _typeof(i) ? i : String(i);
4429
4436
  }
4430
4437
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
4431
4438
 
4432
4439
  function _defineProperty(obj, key, value) {
4433
- key = _toPropertyKey(key);
4440
+ key = toPropertyKey(key);
4434
4441
  if (key in obj) {
4435
4442
  Object.defineProperty(obj, key, {
4436
4443
  value: value,
@@ -4469,13 +4476,13 @@ function _objectSpread2(e) {
4469
4476
 
4470
4477
  /***/ }),
4471
4478
 
4472
- /***/ 808:
4479
+ /***/ 644:
4473
4480
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4474
4481
 
4475
4482
 
4476
4483
  // EXPORTS
4477
4484
  __webpack_require__.d(__webpack_exports__, {
4478
- Z: () => (/* binding */ _objectWithoutProperties)
4485
+ A: () => (/* binding */ _objectWithoutProperties)
4479
4486
  });
4480
4487
 
4481
4488
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
@@ -4511,20 +4518,20 @@ function _objectWithoutProperties(source, excluded) {
4511
4518
 
4512
4519
  /***/ }),
4513
4520
 
4514
- /***/ 617:
4521
+ /***/ 720:
4515
4522
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4516
4523
 
4517
4524
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4518
- /* harmony export */ f$: () => (/* binding */ historyKeymap),
4519
- /* harmony export */ m8: () => (/* binding */ history),
4520
- /* harmony export */ oc: () => (/* binding */ indentWithTab),
4521
- /* harmony export */ wQ: () => (/* binding */ defaultKeymap)
4525
+ /* harmony export */ Yc: () => (/* binding */ indentWithTab),
4526
+ /* harmony export */ b6: () => (/* binding */ history),
4527
+ /* harmony export */ cL: () => (/* binding */ historyKeymap),
4528
+ /* harmony export */ pw: () => (/* binding */ defaultKeymap)
4522
4529
  /* harmony export */ });
4523
4530
  /* unused harmony exports blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharForward, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharForward, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, transposeChars, undo, undoDepth, undoSelection */
4524
- /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(242);
4525
- /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(105);
4526
- /* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(478);
4527
- /* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59);
4531
+ /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60);
4532
+ /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(730);
4533
+ /* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(194);
4534
+ /* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(203);
4528
4535
 
4529
4536
 
4530
4537
 
@@ -4741,11 +4748,6 @@ const historyConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_0_
4741
4748
  });
4742
4749
  }
4743
4750
  });
4744
- function changeEnd(changes) {
4745
- let end = 0;
4746
- changes.iterChangedRanges((_, to) => end = to);
4747
- return end;
4748
- }
4749
4751
  const historyField_ = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.StateField.define({
4750
4752
  create() {
4751
4753
  return HistoryState.empty;
@@ -4754,8 +4756,7 @@ const historyField_ = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_0_
4754
4756
  let config = tr.state.facet(historyConfig);
4755
4757
  let fromHist = tr.annotation(fromHistory);
4756
4758
  if (fromHist) {
4757
- let selection = tr.docChanged ? _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.single(changeEnd(tr.changes)) : undefined;
4758
- let item = HistEvent.fromTransaction(tr, selection), from = fromHist.side;
4759
+ let item = HistEvent.fromTransaction(tr, fromHist.selection), from = fromHist.side;
4759
4760
  let other = from == 0 /* BranchName.Done */ ? state.undone : state.done;
4760
4761
  if (item)
4761
4762
  other = updateBranch(other, other.length, config.minDepth, item);
@@ -5036,15 +5037,15 @@ class HistoryState {
5036
5037
  addMapping(mapping) {
5037
5038
  return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);
5038
5039
  }
5039
- pop(side, state, selection) {
5040
+ pop(side, state, onlySelection) {
5040
5041
  let branch = side == 0 /* BranchName.Done */ ? this.done : this.undone;
5041
5042
  if (branch.length == 0)
5042
5043
  return null;
5043
- let event = branch[branch.length - 1];
5044
- if (selection && event.selectionsAfter.length) {
5044
+ let event = branch[branch.length - 1], selection = event.selectionsAfter[0] || state.selection;
5045
+ if (onlySelection && event.selectionsAfter.length) {
5045
5046
  return state.update({
5046
5047
  selection: event.selectionsAfter[event.selectionsAfter.length - 1],
5047
- annotations: fromHistory.of({ side, rest: popSelection(branch) }),
5048
+ annotations: fromHistory.of({ side, rest: popSelection(branch), selection }),
5048
5049
  userEvent: side == 0 /* BranchName.Done */ ? "select.undo" : "select.redo",
5049
5050
  scrollIntoView: true
5050
5051
  });
@@ -5060,7 +5061,7 @@ class HistoryState {
5060
5061
  changes: event.changes,
5061
5062
  selection: event.startSelection,
5062
5063
  effects: event.effects,
5063
- annotations: fromHistory.of({ side, rest }),
5064
+ annotations: fromHistory.of({ side, rest, selection }),
5064
5065
  filter: false,
5065
5066
  userEvent: side == 0 /* BranchName.Done */ ? "undo" : "redo",
5066
5067
  scrollIntoView: true
@@ -5093,7 +5094,7 @@ function setSel(state, selection) {
5093
5094
  }
5094
5095
  function moveSel({ state, dispatch }, how) {
5095
5096
  let selection = updateSel(state.selection, how);
5096
- if (selection.eq(state.selection))
5097
+ if (selection.eq(state.selection, true))
5097
5098
  return false;
5098
5099
  dispatch(setSel(state, selection));
5099
5100
  return true;
@@ -5218,8 +5219,8 @@ function interestingNode(state, node, bracketProp) {
5218
5219
  return len && (len > 2 || /[^\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild;
5219
5220
  }
5220
5221
  function moveBySyntax(state, start, forward) {
5221
- let pos = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .qz)(state).resolveInner(start.head);
5222
- let bracketProp = forward ? _lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .md.closedBy : _lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .md.openedBy;
5222
+ let pos = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .mv)(state).resolveInner(start.head);
5223
+ let bracketProp = forward ? _lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .uY.closedBy : _lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .uY.openedBy;
5223
5224
  // Scan forward through child nodes to see if there's an interesting
5224
5225
  // node ahead.
5225
5226
  for (let at = start.head;;) {
@@ -5232,7 +5233,7 @@ function moveBySyntax(state, start, forward) {
5232
5233
  at = forward ? next.to : next.from;
5233
5234
  }
5234
5235
  let bracket = pos.type.prop(bracketProp), match, newPos;
5235
- if (bracket && (match = forward ? (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, pos.from, 1) : (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, pos.to, -1)) && match.matched)
5236
+ if (bracket && (match = forward ? (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, pos.from, 1) : (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, pos.to, -1)) && match.matched)
5236
5237
  newPos = forward ? match.end.to : match.end.from;
5237
5238
  else
5238
5239
  newPos = forward ? pos.to : pos.from;
@@ -5349,10 +5350,10 @@ Move the selection to the end of the line.
5349
5350
  const cursorLineEnd = view => moveSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));
5350
5351
  function toMatchingBracket(state, dispatch, extend) {
5351
5352
  let found = false, selection = updateSel(state.selection, range => {
5352
- let matching = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, range.head, -1)
5353
- || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, range.head, 1)
5354
- || (range.head > 0 && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, range.head - 1, 1))
5355
- || (range.head < state.doc.length && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .Um)(state, range.head + 1, -1));
5353
+ let matching = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, range.head, -1)
5354
+ || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, range.head, 1)
5355
+ || (range.head > 0 && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, range.head - 1, 1))
5356
+ || (range.head < state.doc.length && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .matchBrackets */ .jU)(state, range.head + 1, -1));
5356
5357
  if (!matching || !matching.end)
5357
5358
  return range;
5358
5359
  found = true;
@@ -5541,7 +5542,7 @@ syntax tree.
5541
5542
  const selectParentSyntax = ({ state, dispatch }) => {
5542
5543
  let selection = updateSel(state.selection, range => {
5543
5544
  var _a;
5544
- let stack = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .qz)(state).resolveStack(range.from, 1);
5545
+ let stack = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .mv)(state).resolveStack(range.from, 1);
5545
5546
  for (let cur = stack; cur; cur = cur.next) {
5546
5547
  let { node } = cur;
5547
5548
  if (((node.from < range.from && node.to >= range.to) ||
@@ -5619,7 +5620,7 @@ const deleteByChar = (target, forward) => deleteBy(target, range => {
5619
5620
  !/[^ \t]/.test(before = line.text.slice(0, pos - line.from))) {
5620
5621
  if (before[before.length - 1] == "\t")
5621
5622
  return pos - 1;
5622
- let col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.countColumn)(before, state.tabSize), drop = col % (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .y1)(state) || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .y1)(state);
5623
+ let col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.countColumn)(before, state.tabSize), drop = col % (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .tp)(state) || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .tp)(state);
5623
5624
  for (let i = 0; i < drop && before[before.length - 1 - i] == " "; i++)
5624
5625
  pos--;
5625
5626
  targetPos = pos;
@@ -5628,6 +5629,8 @@ const deleteByChar = (target, forward) => deleteBy(target, range => {
5628
5629
  targetPos = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.findClusterBreak)(line.text, pos - line.from, forward, forward) + line.from;
5629
5630
  if (targetPos == pos && line.number != (forward ? state.doc.lines : 1))
5630
5631
  targetPos += forward ? 1 : -1;
5632
+ else if (!forward && /[\ufe00-\ufe0f]/.test(line.text.slice(targetPos - line.from, pos - line.from)))
5633
+ targetPos = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.findClusterBreak)(line.text, targetPos - line.from, false, false) + line.from;
5631
5634
  }
5632
5635
  return targetPos;
5633
5636
  });
@@ -5870,10 +5873,10 @@ const insertNewline = ({ state, dispatch }) => {
5870
5873
  function isBetweenBrackets(state, pos) {
5871
5874
  if (/\(\)|\[\]|\{\}/.test(state.sliceDoc(pos - 1, pos + 1)))
5872
5875
  return { from: pos, to: pos };
5873
- let context = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .qz)(state).resolveInner(pos);
5876
+ let context = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .syntaxTree */ .mv)(state).resolveInner(pos);
5874
5877
  let before = context.childBefore(pos), after = context.childAfter(pos), closedBy;
5875
5878
  if (before && after && before.to <= pos && after.from >= pos &&
5876
- (closedBy = before.type.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .md.closedBy)) && closedBy.indexOf(after.name) > -1 &&
5879
+ (closedBy = before.type.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_2__/* .NodeProp */ .uY.closedBy)) && closedBy.indexOf(after.name) > -1 &&
5877
5880
  state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from &&
5878
5881
  !/\S/.test(state.sliceDoc(before.to, after.from)))
5879
5882
  return { from: before.to, to: after.from };
@@ -5900,8 +5903,8 @@ function newlineAndIndent(atEof) {
5900
5903
  let explode = !atEof && from == to && isBetweenBrackets(state, from);
5901
5904
  if (atEof)
5902
5905
  from = to = (to <= line.to ? line : state.doc.lineAt(to)).to;
5903
- let cx = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .IndentContext */ .Gn(state, { simulateBreak: from, simulateDoubleBreak: !!explode });
5904
- let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentation */ .K0)(cx, from);
5906
+ let cx = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .IndentContext */ .KB(state, { simulateBreak: from, simulateDoubleBreak: !!explode });
5907
+ let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentation */ ._v)(cx, from);
5905
5908
  if (indent == null)
5906
5909
  indent = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.countColumn)(/^\s*/.exec(state.doc.lineAt(from).text)[0], state.tabSize);
5907
5910
  while (to < line.to && /\s/.test(line.text[to - line.from]))
@@ -5910,9 +5913,9 @@ function newlineAndIndent(atEof) {
5910
5913
  ({ from, to } = explode);
5911
5914
  else if (from > line.from && from < line.from + 100 && !/\S/.test(line.text.slice(0, from)))
5912
5915
  from = line.from;
5913
- let insert = ["", (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .SS)(state, indent)];
5916
+ let insert = ["", (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .EI)(state, indent)];
5914
5917
  if (explode)
5915
- insert.push((0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .SS)(state, cx.lineIndent(line.from, -1)));
5918
+ insert.push((0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .EI)(state, cx.lineIndent(line.from, -1)));
5916
5919
  return { changes: { from, to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.Text.of(insert) },
5917
5920
  range: _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(from + 1 + insert[1].length) };
5918
5921
  });
@@ -5946,18 +5949,18 @@ const indentSelection = ({ state, dispatch }) => {
5946
5949
  if (state.readOnly)
5947
5950
  return false;
5948
5951
  let updated = Object.create(null);
5949
- let context = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .IndentContext */ .Gn(state, { overrideIndentation: start => {
5952
+ let context = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .IndentContext */ .KB(state, { overrideIndentation: start => {
5950
5953
  let found = updated[start];
5951
5954
  return found == null ? -1 : found;
5952
5955
  } });
5953
5956
  let changes = changeBySelectedLine(state, (line, changes, range) => {
5954
- let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentation */ .K0)(context, line.from);
5957
+ let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentation */ ._v)(context, line.from);
5955
5958
  if (indent == null)
5956
5959
  return;
5957
5960
  if (!/\S/.test(line.text))
5958
5961
  indent = 0;
5959
5962
  let cur = /^\s*/.exec(line.text)[0];
5960
- let norm = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .SS)(state, indent);
5963
+ let norm = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .EI)(state, indent);
5961
5964
  if (cur != norm || range.from < line.from + cur.length) {
5962
5965
  updated[line.from] = indent;
5963
5966
  changes.push({ from: line.from, to: line.from + cur.length, insert: norm });
@@ -5975,7 +5978,7 @@ const indentMore = ({ state, dispatch }) => {
5975
5978
  if (state.readOnly)
5976
5979
  return false;
5977
5980
  dispatch(state.update(changeBySelectedLine(state, (line, changes) => {
5978
- changes.push({ from: line.from, insert: state.facet(_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentUnit */ .c) });
5981
+ changes.push({ from: line.from, insert: state.facet(_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentUnit */ .Xt) });
5979
5982
  }), { userEvent: "input.indent" }));
5980
5983
  return true;
5981
5984
  };
@@ -5991,7 +5994,7 @@ const indentLess = ({ state, dispatch }) => {
5991
5994
  if (!space)
5992
5995
  return;
5993
5996
  let col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.countColumn)(space, state.tabSize), keep = 0;
5994
- let insert = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .SS)(state, Math.max(0, col - (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .y1)(state)));
5997
+ let insert = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .indentString */ .EI)(state, Math.max(0, col - (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__/* .getIndentUnit */ .tp)(state)));
5995
5998
  while (keep < space.length && keep < insert.length && space.charCodeAt(keep) == insert.charCodeAt(keep))
5996
5999
  keep++;
5997
6000
  changes.push({ from: line.from + keep, to: line.from + space.length, insert: insert.slice(keep) });
@@ -6158,35 +6161,35 @@ const indentWithTab = { key: "Tab", run: indentMore, shift: indentLess };
6158
6161
 
6159
6162
  /***/ }),
6160
6163
 
6161
- /***/ 478:
6164
+ /***/ 194:
6162
6165
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
6163
6166
 
6164
6167
 
6165
6168
  // EXPORTS
6166
6169
  __webpack_require__.d(__webpack_exports__, {
6167
- Gn: () => (/* binding */ IndentContext),
6168
- n$: () => (/* binding */ bracketMatching),
6169
- R_: () => (/* binding */ defaultHighlightStyle),
6170
- mi: () => (/* binding */ foldGutter),
6171
- e7: () => (/* binding */ foldKeymap),
6172
- y1: () => (/* binding */ getIndentUnit),
6173
- K0: () => (/* binding */ getIndentation),
6174
- nY: () => (/* binding */ indentOnInput),
6175
- SS: () => (/* binding */ indentString),
6176
- c: () => (/* binding */ indentUnit),
6177
- Um: () => (/* binding */ matchBrackets),
6178
- nF: () => (/* binding */ syntaxHighlighting),
6179
- qz: () => (/* binding */ syntaxTree)
6170
+ KB: () => (/* binding */ IndentContext),
6171
+ SG: () => (/* binding */ bracketMatching),
6172
+ Zt: () => (/* binding */ defaultHighlightStyle),
6173
+ Lv: () => (/* binding */ foldGutter),
6174
+ f7: () => (/* binding */ foldKeymap),
6175
+ tp: () => (/* binding */ getIndentUnit),
6176
+ _v: () => (/* binding */ getIndentation),
6177
+ WD: () => (/* binding */ indentOnInput),
6178
+ EI: () => (/* binding */ indentString),
6179
+ Xt: () => (/* binding */ indentUnit),
6180
+ jU: () => (/* binding */ matchBrackets),
6181
+ y9: () => (/* binding */ syntaxHighlighting),
6182
+ mv: () => (/* binding */ syntaxTree)
6180
6183
  });
6181
6184
 
6182
- // UNUSED EXPORTS: DocInput, HighlightStyle, LRLanguage, Language, LanguageDescription, LanguageSupport, ParseContext, StreamLanguage, StringStream, TreeIndentContext, bracketMatchingHandle, codeFolding, continuedIndent, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldInside, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, highlightingFor, indentNodeProp, indentRange, indentService, language, languageDataProp, sublanguageProp, syntaxParserRunning, syntaxTreeAvailable, toggleFold, unfoldAll, unfoldCode, unfoldEffect
6185
+ // UNUSED EXPORTS: DocInput, HighlightStyle, LRLanguage, Language, LanguageDescription, LanguageSupport, ParseContext, StreamLanguage, StringStream, TreeIndentContext, bidiIsolates, bracketMatchingHandle, codeFolding, continuedIndent, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldInside, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, highlightingFor, indentNodeProp, indentRange, indentService, language, languageDataProp, sublanguageProp, syntaxParserRunning, syntaxTreeAvailable, toggleFold, unfoldAll, unfoldCode, unfoldEffect
6183
6186
 
6184
6187
  // EXTERNAL MODULE: ../node_modules/@lezer/common/dist/index.js
6185
- var dist = __webpack_require__(59);
6188
+ var dist = __webpack_require__(203);
6186
6189
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
6187
- var state_ = __webpack_require__(242);
6190
+ var state_ = __webpack_require__(60);
6188
6191
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/view"],"commonjs":"@codemirror/view","commonjs2":"@codemirror/view"}
6189
- var view_ = __webpack_require__(105);
6192
+ var view_ = __webpack_require__(730);
6190
6193
  ;// CONCATENATED MODULE: ../node_modules/@lezer/highlight/dist/index.js
6191
6194
 
6192
6195
 
@@ -6369,10 +6372,10 @@ function styleTags(spec) {
6369
6372
  tags = [tags];
6370
6373
  for (let part of prop.split(" "))
6371
6374
  if (part) {
6372
- let pieces = [], mode = 2 /* Normal */, rest = part;
6375
+ let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
6373
6376
  for (let pos = 0;;) {
6374
6377
  if (rest == "..." && pos > 0 && pos + 3 == part.length) {
6375
- mode = 1 /* Inherit */;
6378
+ mode = 1 /* Mode.Inherit */;
6376
6379
  break;
6377
6380
  }
6378
6381
  let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
@@ -6384,7 +6387,7 @@ function styleTags(spec) {
6384
6387
  break;
6385
6388
  let next = part[pos++];
6386
6389
  if (pos == part.length && next == "!") {
6387
- mode = 0 /* Opaque */;
6390
+ mode = 0 /* Mode.Opaque */;
6388
6391
  break;
6389
6392
  }
6390
6393
  if (next != "/")
@@ -6400,7 +6403,7 @@ function styleTags(spec) {
6400
6403
  }
6401
6404
  return ruleNodeProp.add(byName);
6402
6405
  }
6403
- const ruleNodeProp = new dist/* NodeProp */.md();
6406
+ const ruleNodeProp = new dist/* NodeProp */.uY();
6404
6407
  class Rule {
6405
6408
  constructor(tags, mode, context, next) {
6406
6409
  this.tags = tags;
@@ -6408,8 +6411,8 @@ class Rule {
6408
6411
  this.context = context;
6409
6412
  this.next = next;
6410
6413
  }
6411
- get opaque() { return this.mode == 0 /* Opaque */; }
6412
- get inherit() { return this.mode == 1 /* Inherit */; }
6414
+ get opaque() { return this.mode == 0 /* Mode.Opaque */; }
6415
+ get inherit() { return this.mode == 1 /* Mode.Inherit */; }
6413
6416
  sort(other) {
6414
6417
  if (!other || other.depth < this.depth) {
6415
6418
  this.next = other;
@@ -6420,7 +6423,7 @@ class Rule {
6420
6423
  }
6421
6424
  get depth() { return this.context ? this.context.length : 0; }
6422
6425
  }
6423
- Rule.empty = new Rule([], 2 /* Normal */, null);
6426
+ Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
6424
6427
  /**
6425
6428
  Define a [highlighter](#highlight.Highlighter) from an array of
6426
6429
  tag/class pairs. Classes associated with more specific tags will
@@ -6464,7 +6467,9 @@ function highlightTags(highlighters, tags) {
6464
6467
  }
6465
6468
  /**
6466
6469
  Highlight the given [tree](#common.Tree) with the given
6467
- [highlighter](#highlight.Highlighter).
6470
+ [highlighter](#highlight.Highlighter). Often, the higher-level
6471
+ [`highlightCode`](#highlight.highlightCode) function is easier to
6472
+ use.
6468
6473
  */
6469
6474
  function highlightTree(tree, highlighter,
6470
6475
  /**
@@ -6485,6 +6490,35 @@ to = tree.length) {
6485
6490
  builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters);
6486
6491
  builder.flush(to);
6487
6492
  }
6493
+ /**
6494
+ Highlight the given tree with the given highlighter, calling
6495
+ `putText` for every piece of text, either with a set of classes or
6496
+ with the empty string when unstyled, and `putBreak` for every line
6497
+ break.
6498
+ */
6499
+ function highlightCode(code, tree, highlighter, putText, putBreak, from = 0, to = code.length) {
6500
+ let pos = from;
6501
+ function writeTo(p, classes) {
6502
+ if (p <= pos)
6503
+ return;
6504
+ for (let text = code.slice(pos, p), i = 0;;) {
6505
+ let nextBreak = text.indexOf("\n", i);
6506
+ let upto = nextBreak < 0 ? text.length : nextBreak;
6507
+ if (upto > i)
6508
+ putText(text.slice(i, upto), classes);
6509
+ if (nextBreak < 0)
6510
+ break;
6511
+ putBreak();
6512
+ i = nextBreak + 1;
6513
+ }
6514
+ pos = p;
6515
+ }
6516
+ highlightTree(tree, highlighter, (from, to, classes) => {
6517
+ writeTo(from, "");
6518
+ writeTo(to, classes);
6519
+ }, from, to);
6520
+ writeTo(to, "");
6521
+ }
6488
6522
  class HighlightBuilder {
6489
6523
  constructor(at, highlighters, span) {
6490
6524
  this.at = at;
@@ -6517,13 +6551,13 @@ class HighlightBuilder {
6517
6551
  if (cls)
6518
6552
  cls += " ";
6519
6553
  cls += tagCls;
6520
- if (rule.mode == 1 /* Inherit */)
6554
+ if (rule.mode == 1 /* Mode.Inherit */)
6521
6555
  inheritedClass += (inheritedClass ? " " : "") + tagCls;
6522
6556
  }
6523
6557
  this.startSpan(Math.max(from, start), cls);
6524
6558
  if (rule.opaque)
6525
6559
  return;
6526
- let mounted = cursor.tree && cursor.tree.prop(dist/* NodeProp */.md.mounted);
6560
+ let mounted = cursor.tree && cursor.tree.prop(dist/* NodeProp */.uY.mounted);
6527
6561
  if (mounted && mounted.overlay) {
6528
6562
  let inner = cursor.node.enter(mounted.overlay[0].from + start, 1);
6529
6563
  let innerHighlighters = this.highlighters.filter(h => !h.scope || h.scope(mounted.tree.type));
@@ -7234,7 +7268,7 @@ var _a;
7234
7268
  Node prop stored in a parser's top syntax node to provide the
7235
7269
  facet that stores language-specific data for that language.
7236
7270
  */
7237
- const languageDataProp = /*@__PURE__*/new dist/* NodeProp */.md();
7271
+ const languageDataProp = /*@__PURE__*/new dist/* NodeProp */.uY();
7238
7272
  /**
7239
7273
  Helper function to define a facet (to be added to the top syntax
7240
7274
  node(s) for a language via
@@ -7244,7 +7278,7 @@ probably only need this when subclassing
7244
7278
  [`Language`](https://codemirror.net/6/docs/ref/#language.Language).
7245
7279
  */
7246
7280
  function defineLanguageFacet(baseData) {
7247
- return Facet.define({
7281
+ return state_.Facet.define({
7248
7282
  combine: baseData ? values => values.concat(baseData) : undefined
7249
7283
  });
7250
7284
  }
@@ -7252,7 +7286,7 @@ function defineLanguageFacet(baseData) {
7252
7286
  Syntax node prop used to register sublanguages. Should be added to
7253
7287
  the top level node type for the language.
7254
7288
  */
7255
- const sublanguageProp = /*@__PURE__*/new dist/* NodeProp */.md();
7289
+ const sublanguageProp = /*@__PURE__*/new dist/* NodeProp */.uY();
7256
7290
  /**
7257
7291
  A language object manages parsing and per-language
7258
7292
  [metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is
@@ -7330,7 +7364,7 @@ class Language {
7330
7364
  result.push({ from, to: from + tree.length });
7331
7365
  return;
7332
7366
  }
7333
- let mount = tree.prop(dist/* NodeProp */.md.mounted);
7367
+ let mount = tree.prop(dist/* NodeProp */.uY.mounted);
7334
7368
  if (mount) {
7335
7369
  if (mount.tree.prop(languageDataProp) == this.data) {
7336
7370
  if (mount.overlay)
@@ -7349,7 +7383,7 @@ class Language {
7349
7383
  }
7350
7384
  for (let i = 0; i < tree.children.length; i++) {
7351
7385
  let ch = tree.children[i];
7352
- if (ch instanceof dist/* Tree */.mp)
7386
+ if (ch instanceof dist/* Tree */.PH)
7353
7387
  explore(ch, tree.positions[i] + from);
7354
7388
  }
7355
7389
  };
@@ -7369,7 +7403,7 @@ Language.setState = /*@__PURE__*/state_.StateEffect.define();
7369
7403
  function topNodeAt(state, pos, side) {
7370
7404
  let topLang = state.facet(language), tree = syntaxTree(state).topNode;
7371
7405
  if (!topLang || topLang.allowsNesting) {
7372
- for (let node = tree; node; node = node.enter(pos, side, dist/* IterMode */.vj.ExcludeBuffers))
7406
+ for (let node = tree; node; node = node.enter(pos, side, dist/* IterMode */.Qj.ExcludeBuffers))
7373
7407
  if (node.type.isTop)
7374
7408
  tree = node;
7375
7409
  }
@@ -7380,7 +7414,7 @@ A subclass of [`Language`](https://codemirror.net/6/docs/ref/#language.Language)
7380
7414
  [LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser)
7381
7415
  parsers.
7382
7416
  */
7383
- class LRLanguage extends (/* unused pure expression or super */ null && (Language)) {
7417
+ class LRLanguage extends Language {
7384
7418
  constructor(data, parser, name) {
7385
7419
  super(data, parser, [], name);
7386
7420
  this.parser = parser;
@@ -7411,7 +7445,7 @@ language available.
7411
7445
  */
7412
7446
  function syntaxTree(state) {
7413
7447
  let field = state.field(Language.state, false);
7414
- return field ? field.tree : dist/* Tree */.mp.empty;
7448
+ return field ? field.tree : dist/* Tree */.PH.empty;
7415
7449
  }
7416
7450
  /**
7417
7451
  Try to get a parse tree that spans at least up to `upto`. The
@@ -7558,7 +7592,7 @@ class ParseContext {
7558
7592
  @internal
7559
7593
  */
7560
7594
  static create(parser, state, viewport) {
7561
- return new ParseContext(parser, state, [], dist/* Tree */.mp.empty, 0, viewport, [], null);
7595
+ return new ParseContext(parser, state, [], dist/* Tree */.PH.empty, 0, viewport, [], null);
7562
7596
  }
7563
7597
  startParse() {
7564
7598
  return this.parser.startParse(new DocInput(this.state.doc), this.fragments);
@@ -7569,7 +7603,7 @@ class ParseContext {
7569
7603
  work(until, upto) {
7570
7604
  if (upto != null && upto >= this.state.doc.length)
7571
7605
  upto = undefined;
7572
- if (this.tree != dist/* Tree */.mp.empty && this.isDone(upto !== null && upto !== void 0 ? upto : this.state.doc.length)) {
7606
+ if (this.tree != dist/* Tree */.PH.empty && this.isDone(upto !== null && upto !== void 0 ? upto : this.state.doc.length)) {
7573
7607
  this.takeTree();
7574
7608
  return true;
7575
7609
  }
@@ -7587,7 +7621,7 @@ class ParseContext {
7587
7621
  for (;;) {
7588
7622
  let done = this.parse.advance();
7589
7623
  if (done) {
7590
- this.fragments = this.withoutTempSkipped(dist/* TreeFragment */.i9.addTree(done, this.fragments, this.parse.stoppedAt != null));
7624
+ this.fragments = this.withoutTempSkipped(dist/* TreeFragment */.rr.addTree(done, this.fragments, this.parse.stoppedAt != null));
7591
7625
  this.treeLen = (_a = this.parse.stoppedAt) !== null && _a !== void 0 ? _a : this.state.doc.length;
7592
7626
  this.tree = done;
7593
7627
  this.parse = null;
@@ -7612,7 +7646,7 @@ class ParseContext {
7612
7646
  this.withContext(() => { while (!(tree = this.parse.advance())) { } });
7613
7647
  this.treeLen = pos;
7614
7648
  this.tree = tree;
7615
- this.fragments = this.withoutTempSkipped(dist/* TreeFragment */.i9.addTree(this.tree, this.fragments, true));
7649
+ this.fragments = this.withoutTempSkipped(dist/* TreeFragment */.rr.addTree(this.tree, this.fragments, true));
7616
7650
  this.parse = null;
7617
7651
  }
7618
7652
  }
@@ -7640,8 +7674,8 @@ class ParseContext {
7640
7674
  if (!changes.empty) {
7641
7675
  let ranges = [];
7642
7676
  changes.iterChangedRanges((fromA, toA, fromB, toB) => ranges.push({ fromA, toA, fromB, toB }));
7643
- fragments = dist/* TreeFragment */.i9.applyChanges(fragments, ranges);
7644
- tree = dist/* Tree */.mp.empty;
7677
+ fragments = dist/* TreeFragment */.rr.applyChanges(fragments, ranges);
7678
+ tree = dist/* Tree */.PH.empty;
7645
7679
  treeLen = 0;
7646
7680
  viewport = { from: changes.mapPos(viewport.from, -1), to: changes.mapPos(viewport.to, 1) };
7647
7681
  if (this.skipped.length) {
@@ -7702,7 +7736,7 @@ class ParseContext {
7702
7736
  promise resolves.
7703
7737
  */
7704
7738
  static getSkippingParser(until) {
7705
- return new class extends dist/* Parser */._b {
7739
+ return new class extends dist/* Parser */.iX {
7706
7740
  createParse(input, fragments, ranges) {
7707
7741
  let from = ranges[0].from, to = ranges[ranges.length - 1].to;
7708
7742
  let parser = {
@@ -7716,7 +7750,7 @@ class ParseContext {
7716
7750
  cx.scheduleOn = cx.scheduleOn ? Promise.all([cx.scheduleOn, until]) : until;
7717
7751
  }
7718
7752
  this.parsedPos = to;
7719
- return new dist/* Tree */.mp(dist/* NodeType */.Jq.none, [], [], to - from);
7753
+ return new dist/* Tree */.PH(dist/* NodeType */.Z6.none, [], [], to - from);
7720
7754
  },
7721
7755
  stoppedAt: null,
7722
7756
  stopAt() { }
@@ -7740,7 +7774,7 @@ class ParseContext {
7740
7774
  static get() { return currentContext; }
7741
7775
  }
7742
7776
  function cutFragments(fragments, from, to) {
7743
- return dist/* TreeFragment */.i9.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]);
7777
+ return dist/* TreeFragment */.rr.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]);
7744
7778
  }
7745
7779
  class LanguageState {
7746
7780
  constructor(
@@ -8214,7 +8248,7 @@ context to a column number (see also
8214
8248
  [`indentString`](https://codemirror.net/6/docs/ref/#language.indentString)) or null, where null
8215
8249
  indicates that no definitive indentation can be determined.
8216
8250
  */
8217
- const indentNodeProp = /*@__PURE__*/new dist/* NodeProp */.md();
8251
+ const indentNodeProp = /*@__PURE__*/new dist/* NodeProp */.uY();
8218
8252
  // Compute the indentation for a given position from the syntax tree.
8219
8253
  function syntaxIndentation(cx, ast, pos) {
8220
8254
  let stack = ast.resolveStack(pos);
@@ -8244,7 +8278,7 @@ function indentStrategy(tree) {
8244
8278
  if (strategy)
8245
8279
  return strategy;
8246
8280
  let first = tree.firstChild, close;
8247
- if (first && (close = first.type.prop(dist/* NodeProp */.md.closedBy))) {
8281
+ if (first && (close = first.type.prop(dist/* NodeProp */.uY.closedBy))) {
8248
8282
  let last = tree.lastChild, closed = last && close.indexOf(last.name) > -1;
8249
8283
  return cx => delimitedStrategy(cx, true, 1, undefined, closed && !ignoreClosed(cx) ? last.from : undefined);
8250
8284
  }
@@ -8448,7 +8482,7 @@ syntax node types. Given a syntax node, it should check whether
8448
8482
  that tree is foldable and return the range that can be collapsed
8449
8483
  when it is.
8450
8484
  */
8451
- const foldNodeProp = /*@__PURE__*/new dist/* NodeProp */.md();
8485
+ const foldNodeProp = /*@__PURE__*/new dist/* NodeProp */.uY();
8452
8486
  /**
8453
8487
  [Fold](https://codemirror.net/6/docs/ref/#language.foldNodeProp) function that folds everything but
8454
8488
  the first and the last child of a syntax node. Useful for nodes
@@ -8974,16 +9008,20 @@ class TreeHighlighter {
8974
9008
  this.markCache = Object.create(null);
8975
9009
  this.tree = syntaxTree(view.state);
8976
9010
  this.decorations = this.buildDeco(view, getHighlighters(view.state));
9011
+ this.decoratedTo = view.viewport.to;
8977
9012
  }
8978
9013
  update(update) {
8979
9014
  let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);
8980
9015
  let styleChange = highlighters != getHighlighters(update.startState);
8981
- if (tree.length < update.view.viewport.to && !styleChange && tree.type == this.tree.type) {
9016
+ let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);
9017
+ if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {
8982
9018
  this.decorations = this.decorations.map(update.changes);
9019
+ this.decoratedTo = decoratedToMapped;
8983
9020
  }
8984
9021
  else if (tree != this.tree || update.viewportChanged || styleChange) {
8985
9022
  this.tree = tree;
8986
9023
  this.decorations = this.buildDeco(update.view, highlighters);
9024
+ this.decoratedTo = viewport.to;
8987
9025
  }
8988
9026
  }
8989
9027
  buildDeco(view, highlighters) {
@@ -9113,9 +9151,9 @@ a node, a ‘handle’—the part of the node that is highlighted, and
9113
9151
  that the cursor must be on to activate highlighting in the first
9114
9152
  place.
9115
9153
  */
9116
- const bracketMatchingHandle = /*@__PURE__*/new dist/* NodeProp */.md();
9154
+ const bracketMatchingHandle = /*@__PURE__*/new dist/* NodeProp */.uY();
9117
9155
  function matchingNodes(node, dir, brackets) {
9118
- let byProp = node.prop(dir < 0 ? dist/* NodeProp */.md.openedBy : dist/* NodeProp */.md.closedBy);
9156
+ let byProp = node.prop(dir < 0 ? dist/* NodeProp */.uY.openedBy : dist/* NodeProp */.uY.closedBy);
9119
9157
  if (byProp)
9120
9158
  return byProp;
9121
9159
  if (node.name.length == 1) {
@@ -9414,11 +9452,11 @@ const IndentedFrom = /*@__PURE__*/new WeakMap();
9414
9452
  A [language](https://codemirror.net/6/docs/ref/#language.Language) class based on a CodeMirror
9415
9453
  5-style [streaming parser](https://codemirror.net/6/docs/ref/#language.StreamParser).
9416
9454
  */
9417
- class StreamLanguage extends (/* unused pure expression or super */ null && (Language)) {
9455
+ class StreamLanguage extends Language {
9418
9456
  constructor(parser) {
9419
9457
  let data = defineLanguageFacet(parser.languageData);
9420
9458
  let p = fullParser(parser), self;
9421
- let impl = new class extends Parser {
9459
+ let impl = new class extends dist/* Parser */.iX {
9422
9460
  createParse(input, fragments, ranges) {
9423
9461
  return new Parse(self, input, fragments, ranges);
9424
9462
  }
@@ -9427,7 +9465,7 @@ class StreamLanguage extends (/* unused pure expression or super */ null && (Lan
9427
9465
  this.topNode = docID(data);
9428
9466
  self = this;
9429
9467
  this.streamParser = p;
9430
- this.stateAfter = new NodeProp({ perNode: true });
9468
+ this.stateAfter = new dist/* NodeProp */.uY({ perNode: true });
9431
9469
  this.tokenTable = parser.tokenTable ? new TokenTable(p.tokenTable) : defaultTokenTable;
9432
9470
  }
9433
9471
  /**
@@ -9486,7 +9524,7 @@ function findState(lang, tree, off, startPos, before) {
9486
9524
  return { state: lang.streamParser.copyState(state), pos: off + tree.length };
9487
9525
  for (let i = tree.children.length - 1; i >= 0; i--) {
9488
9526
  let child = tree.children[i], pos = off + tree.positions[i];
9489
- let found = child instanceof Tree && pos < before && findState(lang, child, pos, startPos, before);
9527
+ let found = child instanceof dist/* Tree */.PH && pos < before && findState(lang, child, pos, startPos, before);
9490
9528
  if (found)
9491
9529
  return found;
9492
9530
  }
@@ -9499,11 +9537,11 @@ function cutTree(lang, tree, from, to, inside) {
9499
9537
  inside = true;
9500
9538
  for (let i = tree.children.length - 1; i >= 0; i--) {
9501
9539
  let pos = tree.positions[i], child = tree.children[i], inner;
9502
- if (pos < to && child instanceof Tree) {
9540
+ if (pos < to && child instanceof dist/* Tree */.PH) {
9503
9541
  if (!(inner = cutTree(lang, child, from - pos, to - pos, inside)))
9504
9542
  break;
9505
9543
  return !inside ? inner
9506
- : new Tree(tree.type, tree.children.slice(0, i).concat(inner), tree.positions.slice(0, i + 1), pos + inner.length);
9544
+ : new dist/* Tree */.PH(tree.type, tree.children.slice(0, i).concat(inner), tree.positions.slice(0, i + 1), pos + inner.length);
9507
9545
  }
9508
9546
  }
9509
9547
  return null;
@@ -9515,7 +9553,7 @@ function findStartInFragments(lang, fragments, startPos, editorState) {
9515
9553
  if (found && (tree = cutTree(lang, f.tree, startPos + f.offset, found.pos + f.offset, false)))
9516
9554
  return { state: found.state, tree };
9517
9555
  }
9518
- return { state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4), tree: Tree.empty };
9556
+ return { state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4), tree: dist/* Tree */.PH.empty };
9519
9557
  }
9520
9558
  class Parse {
9521
9559
  constructor(lang, input, fragments, ranges) {
@@ -9642,7 +9680,7 @@ class Parse {
9642
9680
  this.parsedPos++;
9643
9681
  }
9644
9682
  finishChunk() {
9645
- let tree = Tree.build({
9683
+ let tree = dist/* Tree */.PH.build({
9646
9684
  buffer: this.chunk,
9647
9685
  start: this.chunkStart,
9648
9686
  length: this.parsedPos - this.chunkStart,
@@ -9651,7 +9689,7 @@ class Parse {
9651
9689
  maxBufferLength: 2048 /* C.ChunkSize */,
9652
9690
  reused: this.chunkReused
9653
9691
  });
9654
- tree = new Tree(tree.type, tree.children, tree.positions, tree.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]);
9692
+ tree = new dist/* Tree */.PH(tree.type, tree.children, tree.positions, tree.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]);
9655
9693
  this.chunks.push(tree);
9656
9694
  this.chunkPos.push(this.chunkStart - this.ranges[0].from);
9657
9695
  this.chunk = [];
@@ -9659,7 +9697,7 @@ class Parse {
9659
9697
  this.chunkStart = this.parsedPos;
9660
9698
  }
9661
9699
  finish() {
9662
- return new Tree(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();
9700
+ return new dist/* Tree */.PH(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();
9663
9701
  }
9664
9702
  }
9665
9703
  function readToken(token, stream, state) {
@@ -9672,9 +9710,11 @@ function readToken(token, stream, state) {
9672
9710
  throw new Error("Stream parser failed to advance stream.");
9673
9711
  }
9674
9712
  const noTokens = /*@__PURE__*/Object.create(null);
9675
- const typeArray = [dist/* NodeType */.Jq.none];
9676
- const nodeSet = /*@__PURE__*/new dist/* NodeSet */.Lj(typeArray);
9713
+ const typeArray = [dist/* NodeType */.Z6.none];
9714
+ const nodeSet = /*@__PURE__*/new dist/* NodeSet */.fI(typeArray);
9677
9715
  const warned = [];
9716
+ // Cache of node types by name and tags
9717
+ const byTag = /*@__PURE__*/Object.create(null);
9678
9718
  const defaultTable = /*@__PURE__*/Object.create(null);
9679
9719
  for (let [legacyName, name] of [
9680
9720
  ["variable", "variableName"],
@@ -9708,57 +9748,177 @@ function warnForPart(part, msg) {
9708
9748
  console.warn(msg);
9709
9749
  }
9710
9750
  function createTokenType(extra, tagStr) {
9711
- let tag = null;
9712
- for (let part of tagStr.split(".")) {
9713
- let value = (extra[part] || tags[part]);
9714
- if (!value) {
9715
- warnForPart(part, `Unknown highlighting tag ${part}`);
9716
- }
9717
- else if (typeof value == "function") {
9718
- if (!tag)
9719
- warnForPart(part, `Modifier ${part} used at start of tag`);
9720
- else
9721
- tag = value(tag);
9722
- }
9723
- else {
9724
- if (tag)
9725
- warnForPart(part, `Tag ${part} used as modifier`);
9726
- else
9727
- tag = value;
9751
+ let tags$1 = [];
9752
+ for (let name of tagStr.split(" ")) {
9753
+ let found = [];
9754
+ for (let part of name.split(".")) {
9755
+ let value = (extra[part] || tags[part]);
9756
+ if (!value) {
9757
+ warnForPart(part, `Unknown highlighting tag ${part}`);
9758
+ }
9759
+ else if (typeof value == "function") {
9760
+ if (!found.length)
9761
+ warnForPart(part, `Modifier ${part} used at start of tag`);
9762
+ else
9763
+ found = found.map(value);
9764
+ }
9765
+ else {
9766
+ if (found.length)
9767
+ warnForPart(part, `Tag ${part} used as modifier`);
9768
+ else
9769
+ found = Array.isArray(value) ? value : [value];
9770
+ }
9728
9771
  }
9772
+ for (let tag of found)
9773
+ tags$1.push(tag);
9729
9774
  }
9730
- if (!tag)
9775
+ if (!tags$1.length)
9731
9776
  return 0;
9732
- let name = tagStr.replace(/ /g, "_"), type = dist/* NodeType */.Jq.define({
9777
+ let name = tagStr.replace(/ /g, "_"), key = name + " " + tags$1.map(t => t.id);
9778
+ let known = byTag[key];
9779
+ if (known)
9780
+ return known.id;
9781
+ let type = byTag[key] = dist/* NodeType */.Z6.define({
9733
9782
  id: typeArray.length,
9734
9783
  name,
9735
- props: [styleTags({ [name]: tag })]
9784
+ props: [styleTags({ [name]: tags$1 })]
9736
9785
  });
9737
9786
  typeArray.push(type);
9738
9787
  return type.id;
9739
9788
  }
9740
9789
  function docID(data) {
9741
- let type = NodeType.define({ id: typeArray.length, name: "Document", props: [languageDataProp.add(() => data)], top: true });
9790
+ let type = dist/* NodeType */.Z6.define({ id: typeArray.length, name: "Document", props: [languageDataProp.add(() => data)], top: true });
9742
9791
  typeArray.push(type);
9743
9792
  return type;
9744
9793
  }
9745
9794
 
9795
+ function buildForLine(line) {
9796
+ return line.length <= 4096 && /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(line);
9797
+ }
9798
+ function textHasRTL(text) {
9799
+ for (let i = text.iter(); !i.next().done;)
9800
+ if (buildForLine(i.value))
9801
+ return true;
9802
+ return false;
9803
+ }
9804
+ function changeAddsRTL(change) {
9805
+ let added = false;
9806
+ change.iterChanges((fA, tA, fB, tB, ins) => {
9807
+ if (!added && textHasRTL(ins))
9808
+ added = true;
9809
+ });
9810
+ return added;
9811
+ }
9812
+ const alwaysIsolate = /*@__PURE__*/state_.Facet.define({ combine: values => values.some(x => x) });
9813
+ /**
9814
+ Make sure nodes
9815
+ [marked](https://lezer.codemirror.net/docs/ref/#common.NodeProp^isolate)
9816
+ as isolating for bidirectional text are rendered in a way that
9817
+ isolates them from the surrounding text.
9818
+ */
9819
+ function bidiIsolates(options = {}) {
9820
+ let extensions = [isolateMarks];
9821
+ if (options.alwaysIsolate)
9822
+ extensions.push(alwaysIsolate.of(true));
9823
+ return extensions;
9824
+ }
9825
+ const isolateMarks = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
9826
+ constructor(view) {
9827
+ this.always = view.state.facet(alwaysIsolate) ||
9828
+ view.textDirection != view_.Direction.LTR ||
9829
+ view.state.facet(view_.EditorView.perLineTextDirection);
9830
+ this.hasRTL = !this.always && textHasRTL(view.state.doc);
9831
+ this.tree = syntaxTree(view.state);
9832
+ this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : view_.Decoration.none;
9833
+ }
9834
+ update(update) {
9835
+ let always = update.state.facet(alwaysIsolate) ||
9836
+ update.view.textDirection != view_.Direction.LTR ||
9837
+ update.state.facet(view_.EditorView.perLineTextDirection);
9838
+ if (!always && !this.hasRTL && changeAddsRTL(update.changes))
9839
+ this.hasRTL = true;
9840
+ if (!always && !this.hasRTL)
9841
+ return;
9842
+ let tree = syntaxTree(update.state);
9843
+ if (always != this.always || tree != this.tree || update.docChanged || update.viewportChanged) {
9844
+ this.tree = tree;
9845
+ this.always = always;
9846
+ this.decorations = buildDeco(update.view, tree, always);
9847
+ }
9848
+ }
9849
+ }, {
9850
+ provide: plugin => {
9851
+ function access(view) {
9852
+ var _a, _b;
9853
+ return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b : view_.Decoration.none;
9854
+ }
9855
+ return [view_.EditorView.outerDecorations.of(access),
9856
+ state_.Prec.lowest(view_.EditorView.bidiIsolatedRanges.of(access))];
9857
+ }
9858
+ });
9859
+ function buildDeco(view, tree, always) {
9860
+ let deco = new state_.RangeSetBuilder();
9861
+ let ranges = view.visibleRanges;
9862
+ if (!always)
9863
+ ranges = clipRTLLines(ranges, view.state.doc);
9864
+ for (let { from, to } of ranges) {
9865
+ tree.iterate({
9866
+ enter: node => {
9867
+ let iso = node.type.prop(dist/* NodeProp */.uY.isolate);
9868
+ if (iso)
9869
+ deco.add(node.from, node.to, marks[iso]);
9870
+ },
9871
+ from, to
9872
+ });
9873
+ }
9874
+ return deco.finish();
9875
+ }
9876
+ function clipRTLLines(ranges, doc) {
9877
+ let cur = doc.iter(), pos = 0, result = [], last = null;
9878
+ for (let { from, to } of ranges) {
9879
+ if (from != pos) {
9880
+ if (pos < from)
9881
+ cur.next(from - pos);
9882
+ pos = from;
9883
+ }
9884
+ for (;;) {
9885
+ let start = pos, end = pos + cur.value.length;
9886
+ if (!cur.lineBreak && buildForLine(cur.value)) {
9887
+ if (last && last.to > start - 10)
9888
+ last.to = Math.min(to, end);
9889
+ else
9890
+ result.push(last = { from: start, to: Math.min(to, end) });
9891
+ }
9892
+ if (pos >= to)
9893
+ break;
9894
+ pos = end;
9895
+ cur.next();
9896
+ }
9897
+ }
9898
+ return result;
9899
+ }
9900
+ const marks = {
9901
+ rtl: /*@__PURE__*/view_.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "rtl" }, bidiIsolate: view_.Direction.RTL }),
9902
+ ltr: /*@__PURE__*/view_.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "ltr" }, bidiIsolate: view_.Direction.LTR }),
9903
+ auto: /*@__PURE__*/view_.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "auto" }, bidiIsolate: null })
9904
+ };
9905
+
9746
9906
 
9747
9907
 
9748
9908
 
9749
9909
  /***/ }),
9750
9910
 
9751
- /***/ 59:
9911
+ /***/ 203:
9752
9912
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
9753
9913
 
9754
9914
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9755
- /* harmony export */ Jq: () => (/* binding */ NodeType),
9756
- /* harmony export */ Lj: () => (/* binding */ NodeSet),
9757
- /* harmony export */ _b: () => (/* binding */ Parser),
9758
- /* harmony export */ i9: () => (/* binding */ TreeFragment),
9759
- /* harmony export */ md: () => (/* binding */ NodeProp),
9760
- /* harmony export */ mp: () => (/* binding */ Tree),
9761
- /* harmony export */ vj: () => (/* binding */ IterMode)
9915
+ /* harmony export */ PH: () => (/* binding */ Tree),
9916
+ /* harmony export */ Qj: () => (/* binding */ IterMode),
9917
+ /* harmony export */ Z6: () => (/* binding */ NodeType),
9918
+ /* harmony export */ fI: () => (/* binding */ NodeSet),
9919
+ /* harmony export */ iX: () => (/* binding */ Parser),
9920
+ /* harmony export */ rr: () => (/* binding */ TreeFragment),
9921
+ /* harmony export */ uY: () => (/* binding */ NodeProp)
9762
9922
  /* harmony export */ });
9763
9923
  /* unused harmony exports DefaultBufferLength, MountedTree, NodeWeakMap, TreeBuffer, TreeCursor, parseMixed */
9764
9924
  /**
@@ -9828,6 +9988,22 @@ types that represent an expression could be tagged with an
9828
9988
  */
9829
9989
  NodeProp.group = new NodeProp({ deserialize: str => str.split(" ") });
9830
9990
  /**
9991
+ Attached to nodes to indicate these should be
9992
+ [displayed](https://codemirror.net/docs/ref/#language.syntaxTree)
9993
+ in a bidirectional text isolate, so that direction-neutral
9994
+ characters on their sides don't incorrectly get associated with
9995
+ surrounding text. You'll generally want to set this for nodes
9996
+ that contain arbitrary text, like strings and comments, and for
9997
+ nodes that appear _inside_ arbitrary text, like HTML tags. When
9998
+ not given a value, in a grammar declaration, defaults to
9999
+ `"auto"`.
10000
+ */
10001
+ NodeProp.isolate = new NodeProp({ deserialize: value => {
10002
+ if (value && value != "rtl" && value != "ltr" && value != "auto")
10003
+ throw new RangeError("Invalid value for isolate: " + value);
10004
+ return value || "auto";
10005
+ } });
10006
+ /**
9831
10007
  The hash of the [context](#lr.ContextTracker.constructor)
9832
10008
  that the node was parsed in, if any. Used to limit reuse of
9833
10009
  contextual nodes.
@@ -10547,9 +10723,11 @@ function getChildren(node, type, before, after) {
10547
10723
  if (!cur.firstChild())
10548
10724
  return result;
10549
10725
  if (before != null)
10550
- while (!cur.type.is(before))
10726
+ for (let found = false; !found;) {
10727
+ found = cur.type.is(before);
10551
10728
  if (!cur.nextSibling())
10552
10729
  return result;
10730
+ }
10553
10731
  for (;;) {
10554
10732
  if (after != null && cur.type.is(after))
10555
10733
  return result;
@@ -10646,8 +10824,6 @@ class BufferNode extends BaseNode {
10646
10824
  function iterStack(heads) {
10647
10825
  if (!heads.length)
10648
10826
  return null;
10649
- if (heads.length == 1)
10650
- return heads[0];
10651
10827
  let pick = 0, picked = heads[0];
10652
10828
  for (let i = 1; i < heads.length; i++) {
10653
10829
  let node = heads[i];
@@ -10683,7 +10859,7 @@ function stackIterator(tree, pos, side) {
10683
10859
  let mount = MountedTree.get(scan.tree);
10684
10860
  // Relevant overlay branching off
10685
10861
  if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) {
10686
- let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, 0, null);
10862
+ let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, -1, scan);
10687
10863
  (layers || (layers = [inner])).push(resolveNode(root, pos, side, false));
10688
10864
  }
10689
10865
  }
@@ -10747,6 +10923,9 @@ class TreeCursor {
10747
10923
  this.to = start + buffer.buffer[index + 2];
10748
10924
  return true;
10749
10925
  }
10926
+ /**
10927
+ @internal
10928
+ */
10750
10929
  yield(node) {
10751
10930
  if (!node)
10752
10931
  return false;
@@ -11012,7 +11191,7 @@ function buildTree(data) {
11012
11191
  let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;
11013
11192
  let types = nodeSet.types;
11014
11193
  let contextHash = 0, lookAhead = 0;
11015
- function takeNode(parentStart, minPos, children, positions, inRepeat) {
11194
+ function takeNode(parentStart, minPos, children, positions, inRepeat, depth) {
11016
11195
  let { id, start, end, size } = cursor;
11017
11196
  let lookAheadAtStart = lookAhead;
11018
11197
  while (size < 0) {
@@ -11061,8 +11240,11 @@ function buildTree(data) {
11061
11240
  }
11062
11241
  cursor.next();
11063
11242
  }
11243
+ else if (depth > 2500 /* CutOff.Depth */) {
11244
+ takeFlatNode(start, endPos, localChildren, localPositions);
11245
+ }
11064
11246
  else {
11065
- takeNode(start, endPos, localChildren, localPositions, localInRepeat);
11247
+ takeNode(start, endPos, localChildren, localPositions, localInRepeat, depth + 1);
11066
11248
  }
11067
11249
  }
11068
11250
  if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
@@ -11080,6 +11262,38 @@ function buildTree(data) {
11080
11262
  children.push(node);
11081
11263
  positions.push(startPos);
11082
11264
  }
11265
+ function takeFlatNode(parentStart, minPos, children, positions) {
11266
+ let nodes = []; // Temporary, inverted array of leaf nodes found, with absolute positions
11267
+ let nodeCount = 0, stopAt = -1;
11268
+ while (cursor.pos > minPos) {
11269
+ let { id, start, end, size } = cursor;
11270
+ if (size > 4) { // Not a leaf
11271
+ cursor.next();
11272
+ }
11273
+ else if (stopAt > -1 && start < stopAt) {
11274
+ break;
11275
+ }
11276
+ else {
11277
+ if (stopAt < 0)
11278
+ stopAt = end - maxBufferLength;
11279
+ nodes.push(id, start, end);
11280
+ nodeCount++;
11281
+ cursor.next();
11282
+ }
11283
+ }
11284
+ if (nodeCount) {
11285
+ let buffer = new Uint16Array(nodeCount * 4);
11286
+ let start = nodes[nodes.length - 2];
11287
+ for (let i = nodes.length - 3, j = 0; i >= 0; i -= 3) {
11288
+ buffer[j++] = nodes[i];
11289
+ buffer[j++] = nodes[i + 1] - start;
11290
+ buffer[j++] = nodes[i + 2] - start;
11291
+ buffer[j++] = j;
11292
+ }
11293
+ children.push(new TreeBuffer(buffer, nodes[2] - start, nodeSet));
11294
+ positions.push(start - parentStart);
11295
+ }
11296
+ }
11083
11297
  function makeBalanced(type) {
11084
11298
  return (children, positions, length) => {
11085
11299
  let lookAhead = 0, lastI = children.length - 1, last, lookAheadProp;
@@ -11190,7 +11404,7 @@ function buildTree(data) {
11190
11404
  }
11191
11405
  let children = [], positions = [];
11192
11406
  while (cursor.pos > 0)
11193
- takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1);
11407
+ takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1, 0);
11194
11408
  let length = (_a = data.length) !== null && _a !== void 0 ? _a : (children.length ? positions[0] + children[0].length : 0);
11195
11409
  return new Tree(types[data.topID], children.reverse(), positions.reverse(), length);
11196
11410
  }
@@ -11471,16 +11685,18 @@ function parseMixed(nest) {
11471
11685
  return (parse, input, fragments, ranges) => new MixedParse(parse, nest, input, fragments, ranges);
11472
11686
  }
11473
11687
  class InnerParse {
11474
- constructor(parser, parse, overlay, target, ranges) {
11688
+ constructor(parser, parse, overlay, target, from) {
11475
11689
  this.parser = parser;
11476
11690
  this.parse = parse;
11477
11691
  this.overlay = overlay;
11478
11692
  this.target = target;
11479
- this.ranges = ranges;
11480
- if (!ranges.length || ranges.some(r => r.from >= r.to))
11481
- throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges));
11693
+ this.from = from;
11482
11694
  }
11483
11695
  }
11696
+ function checkRanges(ranges) {
11697
+ if (!ranges.length || ranges.some(r => r.from >= r.to))
11698
+ throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges));
11699
+ }
11484
11700
  class ActiveOverlay {
11485
11701
  constructor(parser, predicate, mounts, index, start, target, prev) {
11486
11702
  this.parser = parser;
@@ -11543,7 +11759,7 @@ class MixedParse {
11543
11759
  return 0;
11544
11760
  let pos = this.input.length;
11545
11761
  for (let i = this.innerDone; i < this.inner.length; i++) {
11546
- if (this.inner[i].ranges[0].from < pos)
11762
+ if (this.inner[i].from < pos)
11547
11763
  pos = Math.min(pos, this.inner[i].parse.parsedPos);
11548
11764
  }
11549
11765
  return pos;
@@ -11561,9 +11777,12 @@ class MixedParse {
11561
11777
  let overlay = null;
11562
11778
  let covered = null;
11563
11779
  let cursor = new TreeCursor(new TreeNode(this.baseTree, this.ranges[0].from, 0, null), IterMode.IncludeAnonymous | IterMode.IgnoreMounts);
11564
- scan: for (let nest, isCovered; this.stoppedAt == null || cursor.from < this.stoppedAt;) {
11780
+ scan: for (let nest, isCovered;;) {
11565
11781
  let enter = true, range;
11566
- if (fragmentCursor.hasNode(cursor)) {
11782
+ if (this.stoppedAt != null && cursor.from >= this.stoppedAt) {
11783
+ enter = false;
11784
+ }
11785
+ else if (fragmentCursor.hasNode(cursor)) {
11567
11786
  if (overlay) {
11568
11787
  let match = overlay.mounts.find(m => m.frag.from <= cursor.from && m.frag.to >= cursor.to && m.mount.overlay);
11569
11788
  if (match)
@@ -11578,7 +11797,8 @@ class MixedParse {
11578
11797
  else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) {
11579
11798
  enter = isCovered != 2 /* Cover.Full */;
11580
11799
  }
11581
- else if (!cursor.type.isAnonymous && cursor.from < cursor.to && (nest = this.nest(cursor, this.input))) {
11800
+ else if (!cursor.type.isAnonymous && (nest = this.nest(cursor, this.input)) &&
11801
+ (cursor.from < cursor.to || !nest.overlay)) {
11582
11802
  if (!cursor.tree)
11583
11803
  materialize(cursor);
11584
11804
  let oldMounts = fragmentCursor.findMounts(cursor.from, nest.parser);
@@ -11586,9 +11806,13 @@ class MixedParse {
11586
11806
  overlay = new ActiveOverlay(nest.parser, nest.overlay, oldMounts, this.inner.length, cursor.from, cursor.tree, overlay);
11587
11807
  }
11588
11808
  else {
11589
- let ranges = punchRanges(this.ranges, nest.overlay || [new Range(cursor.from, cursor.to)]);
11809
+ let ranges = punchRanges(this.ranges, nest.overlay ||
11810
+ (cursor.from < cursor.to ? [new Range(cursor.from, cursor.to)] : []));
11590
11811
  if (ranges.length)
11591
- this.inner.push(new InnerParse(nest.parser, nest.parser.startParse(this.input, enterFragments(oldMounts, ranges), ranges), nest.overlay ? nest.overlay.map(r => new Range(r.from - cursor.from, r.to - cursor.from)) : null, cursor.tree, ranges));
11812
+ checkRanges(ranges);
11813
+ if (ranges.length || !nest.overlay)
11814
+ this.inner.push(new InnerParse(nest.parser, ranges.length ? nest.parser.startParse(this.input, enterFragments(oldMounts, ranges), ranges)
11815
+ : nest.parser.startParse(""), nest.overlay ? nest.overlay.map(r => new Range(r.from - cursor.from, r.to - cursor.from)) : null, cursor.tree, ranges.length ? ranges[0].from : cursor.from));
11592
11816
  if (!nest.overlay)
11593
11817
  enter = false;
11594
11818
  else if (ranges.length)
@@ -11615,8 +11839,10 @@ class MixedParse {
11615
11839
  break scan;
11616
11840
  if (overlay && !--overlay.depth) {
11617
11841
  let ranges = punchRanges(this.ranges, overlay.ranges);
11618
- if (ranges.length)
11619
- this.inner.splice(overlay.index, 0, new InnerParse(overlay.parser, overlay.parser.startParse(this.input, enterFragments(overlay.mounts, ranges), ranges), overlay.ranges.map(r => new Range(r.from - overlay.start, r.to - overlay.start)), overlay.target, ranges));
11842
+ if (ranges.length) {
11843
+ checkRanges(ranges);
11844
+ this.inner.splice(overlay.index, 0, new InnerParse(overlay.parser, overlay.parser.startParse(this.input, enterFragments(overlay.mounts, ranges), ranges), overlay.ranges.map(r => new Range(r.from - overlay.start, r.to - overlay.start)), overlay.target, ranges[0].from));
11845
+ }
11620
11846
  overlay = overlay.prev;
11621
11847
  }
11622
11848
  if (covered && !--covered.depth)
@@ -11650,39 +11876,38 @@ function sliceBuf(buf, startI, endI, nodes, positions, off) {
11650
11876
  // parse that was ran via the mix parser, and thus aren't shared with
11651
11877
  // any other code, making violations of the immutability safe.
11652
11878
  function materialize(cursor) {
11653
- let { node } = cursor, depth = 0;
11879
+ let { node } = cursor, stack = [];
11880
+ let buffer = node.context.buffer;
11654
11881
  // Scan up to the nearest tree
11655
11882
  do {
11883
+ stack.push(cursor.index);
11656
11884
  cursor.parent();
11657
- depth++;
11658
11885
  } while (!cursor.tree);
11659
11886
  // Find the index of the buffer in that tree
11660
- let i = 0, base = cursor.tree, off = 0;
11661
- for (;; i++) {
11662
- off = base.positions[i] + cursor.from;
11663
- if (off <= node.from && off + base.children[i].length >= node.to)
11664
- break;
11665
- }
11666
- let buf = base.children[i], b = buf.buffer;
11887
+ let base = cursor.tree, i = base.children.indexOf(buffer);
11888
+ let buf = base.children[i], b = buf.buffer, newStack = [i];
11667
11889
  // Split a level in the buffer, putting the nodes before and after
11668
11890
  // the child that contains `node` into new buffers.
11669
- function split(startI, endI, type, innerOffset, length) {
11670
- let i = startI;
11671
- while (b[i + 2] + off <= node.from)
11672
- i = b[i + 3];
11891
+ function split(startI, endI, type, innerOffset, length, stackPos) {
11892
+ let targetI = stack[stackPos];
11673
11893
  let children = [], positions = [];
11674
- sliceBuf(buf, startI, i, children, positions, innerOffset);
11675
- let from = b[i + 1], to = b[i + 2];
11676
- let isTarget = from + off == node.from && to + off == node.to && b[i] == node.type.id;
11677
- children.push(isTarget ? node.toTree() : split(i + 4, b[i + 3], buf.set.types[b[i]], from, to - from));
11894
+ sliceBuf(buf, startI, targetI, children, positions, innerOffset);
11895
+ let from = b[targetI + 1], to = b[targetI + 2];
11896
+ newStack.push(children.length);
11897
+ let child = stackPos
11898
+ ? split(targetI + 4, b[targetI + 3], buf.set.types[b[targetI]], from, to - from, stackPos - 1)
11899
+ : node.toTree();
11900
+ children.push(child);
11678
11901
  positions.push(from - innerOffset);
11679
- sliceBuf(buf, b[i + 3], endI, children, positions, innerOffset);
11902
+ sliceBuf(buf, b[targetI + 3], endI, children, positions, innerOffset);
11680
11903
  return new Tree(type, children, positions, length);
11681
11904
  }
11682
- base.children[i] = split(0, b.length, NodeType.none, 0, buf.length);
11905
+ base.children[i] = split(0, b.length, NodeType.none, 0, buf.length, stack.length - 1);
11683
11906
  // Move the cursor back to the target node
11684
- for (let d = 0; d <= depth; d++)
11685
- cursor.childAfter(node.from);
11907
+ for (let index of newStack) {
11908
+ let tree = cursor.tree.children[index], pos = cursor.tree.positions[index];
11909
+ cursor.yield(new TreeNode(tree, pos + cursor.from, index, cursor._tree));
11910
+ }
11686
11911
  }
11687
11912
  class StructureCursor {
11688
11913
  constructor(root, offset) {
@@ -11936,36 +12161,36 @@ var __webpack_exports__ = {};
11936
12161
  (() => {
11937
12162
  __webpack_require__.r(__webpack_exports__);
11938
12163
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11939
- /* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.X),
12164
+ /* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.o),
11940
12165
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
11941
- /* harmony export */ getStatistics: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_7__.a),
11942
- /* harmony export */ minimalSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.w),
11943
- /* harmony export */ useCodeMirror: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__.U)
12166
+ /* harmony export */ getStatistics: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_7__.m),
12167
+ /* harmony export */ minimalSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.V),
12168
+ /* harmony export */ useCodeMirror: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__.q)
11944
12169
  /* harmony export */ });
11945
- /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(215);
11946
- /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(808);
11947
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
12170
+ /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(957);
12171
+ /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(644);
12172
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(442);
11948
12173
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
11949
- /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80);
11950
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(246);
11951
- /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(105);
12174
+ /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(695);
12175
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(540);
12176
+ /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(730);
11952
12177
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_codemirror_view__WEBPACK_IMPORTED_MODULE_3__);
11953
12178
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
11954
12179
  /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _codemirror_view__WEBPACK_IMPORTED_MODULE_3__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _codemirror_view__WEBPACK_IMPORTED_MODULE_3__[__WEBPACK_IMPORT_KEY__]
11955
12180
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
11956
- /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(242);
12181
+ /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(60);
11957
12182
  /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_codemirror_state__WEBPACK_IMPORTED_MODULE_4__);
11958
12183
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
11959
12184
  /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _codemirror_state__WEBPACK_IMPORTED_MODULE_4__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _codemirror_state__WEBPACK_IMPORTED_MODULE_4__[__WEBPACK_IMPORT_KEY__]
11960
12185
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
11961
- /* harmony import */ var _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(724);
11962
- /* harmony import */ var _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(180);
12186
+ /* harmony import */ var _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(368);
12187
+ /* harmony import */ var _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(89);
11963
12188
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
11964
12189
  /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__) if(["default","basicSetup","minimalSetup","useCodeMirror"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__]
11965
12190
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
11966
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(237);
11967
- var _excluded=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"];var ReactCodeMirror=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function(props,ref){var className=props.className,_props$value=props.value,value=_props$value===void 0?'':_props$value,selection=props.selection,_props$extensions=props.extensions,extensions=_props$extensions===void 0?[]:_props$extensions,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,height=props.height,minHeight=props.minHeight,maxHeight=props.maxHeight,width=props.width,minWidth=props.minWidth,maxWidth=props.maxWidth,basicSetup=props.basicSetup,placeholder=props.placeholder,indentWithTab=props.indentWithTab,editable=props.editable,readOnly=props.readOnly,root=props.root,initialState=props.initialState,other=(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);var _useCodeMirror=(0,_useCodeMirror__WEBPACK_IMPORTED_MODULE_1__/* .useCodeMirror */ .U)({container:editor.current,root:root,value:value,autoFocus:autoFocus,theme:theme,height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth,basicSetup:basicSetup,placeholder:placeholder,indentWithTab:indentWithTab,editable:editable,readOnly:readOnly,selection:selection,onChange:onChange,onStatistics:onStatistics,onCreateEditor:onCreateEditor,onUpdate:onUpdate,extensions:extensions,initialState:initialState}),state=_useCodeMirror.state,view=_useCodeMirror.view,container=_useCodeMirror.container;(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);// check type of value
11968
- if(typeof value!=='string'){throw new Error("value must be typeof string but got ".concat(typeof value));}var defaultClassNames=typeof theme==='string'?"cm-theme-".concat(theme):'cm-theme';return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)({ref:editor,className:"".concat(defaultClassNames).concat(className?" ".concat(className):'')},other));});ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactCodeMirror);
12191
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(369);
12192
+ var _excluded=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"];var ReactCodeMirror=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function(props,ref){var className=props.className,_props$value=props.value,value=_props$value===void 0?'':_props$value,selection=props.selection,_props$extensions=props.extensions,extensions=_props$extensions===void 0?[]:_props$extensions,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,height=props.height,minHeight=props.minHeight,maxHeight=props.maxHeight,width=props.width,minWidth=props.minWidth,maxWidth=props.maxWidth,basicSetup=props.basicSetup,placeholder=props.placeholder,indentWithTab=props.indentWithTab,editable=props.editable,readOnly=props.readOnly,root=props.root,initialState=props.initialState,other=(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);var _useCodeMirror=(0,_useCodeMirror__WEBPACK_IMPORTED_MODULE_1__/* .useCodeMirror */ .q)({container:editor.current,root:root,value:value,autoFocus:autoFocus,theme:theme,height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth,basicSetup:basicSetup,placeholder:placeholder,indentWithTab:indentWithTab,editable:editable,readOnly:readOnly,selection:selection,onChange:onChange,onStatistics:onStatistics,onCreateEditor:onCreateEditor,onUpdate:onUpdate,extensions:extensions,initialState:initialState}),state=_useCodeMirror.state,view=_useCodeMirror.view,container=_useCodeMirror.container;(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);// check type of value
12193
+ if(typeof value!=='string'){throw new Error("value must be typeof string but got ".concat(typeof value));}var defaultClassNames=typeof theme==='string'?"cm-theme-".concat(theme):'cm-theme';return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)({ref:editor,className:"".concat(defaultClassNames).concat(className?" ".concat(className):'')},other));});ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactCodeMirror);
11969
12194
  })();
11970
12195
 
11971
12196
  /******/ return __webpack_exports__;