@uiw/react-codemirror 4.25.9 → 4.25.11

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.
@@ -48,7 +48,7 @@ var defaultLightThemeOption=_codemirror_view__WEBPACK_IMPORTED_MODULE_0__.Editor
48
48
 
49
49
  /***/ },
50
50
 
51
- /***/ 341
51
+ /***/ 637
52
52
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
53
53
 
54
54
 
@@ -183,11 +183,13 @@ function _createClass(e, r, t) {
183
183
  // Setting / Unsetting timeouts for every keystroke was a significant overhead
184
184
  // Inspired from https://github.com/iostreamer-X/timeout-latch
185
185
  var TimeoutLatch=/*#__PURE__*/function(){function TimeoutLatch(callback,timeoutMS){_classCallCheck(this,TimeoutLatch);this.timeLeftMS=void 0;this.timeoutMS=void 0;this.isCancelled=false;this.isTimeExhausted=false;this.callbacks=[];this.timeLeftMS=timeoutMS;this.timeoutMS=timeoutMS;this.callbacks.push(callback);}return _createClass(TimeoutLatch,[{key:"tick",value:function tick(){if(!this.isCancelled&&!this.isTimeExhausted){this.timeLeftMS--;if(this.timeLeftMS<=0){this.isTimeExhausted=true;var callbacks=this.callbacks.slice();this.callbacks.length=0;callbacks.forEach(function(callback){try{callback();}catch(error){console.error('TimeoutLatch callback error:',error);}});}}}},{key:"cancel",value:function cancel(){this.isCancelled=true;this.callbacks.length=0;}},{key:"reset",value:function reset(){this.timeLeftMS=this.timeoutMS;this.isCancelled=false;this.isTimeExhausted=false;}},{key:"isDone",get:function get(){return this.isCancelled||this.isTimeExhausted;}}]);}();var Scheduler=/*#__PURE__*/function(){function Scheduler(){_classCallCheck(this,Scheduler);this.interval=null;this.latches=new Set();}return _createClass(Scheduler,[{key:"add",value:function add(latch){this.latches.add(latch);this.start();}},{key:"remove",value:function remove(latch){this.latches["delete"](latch);if(this.latches.size===0){this.stop();}}},{key:"start",value:function start(){var _this=this;if(this.interval===null){this.interval=setInterval(function(){_this.latches.forEach(function(latch){latch.tick();if(latch.isDone){_this.remove(latch);}});},1);}}},{key:"stop",value:function stop(){if(this.interval!==null){clearInterval(this.interval);this.interval=null;}}}]);}();var globalScheduler=null;var getScheduler=function getScheduler(){if(typeof window==='undefined'){return new Scheduler();}if(!globalScheduler){globalScheduler=new Scheduler();}return globalScheduler;};
186
+ ;// ./src/theme/dimensionTheme.ts
187
+ var scrollerTheme=view_.EditorView.theme({'& .cm-scroller':{height:'100% !important'}});var lastDimensionKey=null;var lastDimensionTheme=null;function getDimensionTheme(height,minHeight,maxHeight,width,minWidth,maxWidth){if(!height&&!minHeight&&!maxHeight&&!width&&!minWidth&&!maxWidth){return null;}var cacheKey=JSON.stringify({height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth});if(cacheKey===lastDimensionKey){return lastDimensionTheme;}lastDimensionKey=cacheKey;lastDimensionTheme=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth}});return lastDimensionTheme;}
186
188
  ;// ./src/useCodeMirror.ts
187
189
  var ExternalChange=state_.Annotation.define();var TYPING_TIMOUT=200;// ms
188
- 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 typingLatch=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var pendingUpdate=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];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:
190
+ 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 typingLatch=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var pendingUpdate=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var defaultThemeOption=getDimensionTheme(height,minHeight,maxHeight,width,minWidth,maxWidth);var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
189
191
  // If transaction is market as remote we don't have to call `onChange` handler again
190
- !vu.transactions.some(function(tr){return tr.annotation(ExternalChange);})){if(typingLatch.current){typingLatch.current.reset();}else{typingLatch.current=new TimeoutLatch(function(){if(pendingUpdate.current){var forceUpdate=pendingUpdate.current;pendingUpdate.current=null;forceUpdate();}typingLatch.current=null;},TYPING_TIMOUT);getScheduler().add(typingLatch.current);}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_.useLayoutEffect)(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(){if(props.container){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);}if(typingLatch.current){typingLatch.current.cancel();typingLatch.current=null;}};},[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
192
+ !vu.transactions.some(function(tr){return tr.annotation(ExternalChange);})){if(typingLatch.current){typingLatch.current.reset();}else{typingLatch.current=new TimeoutLatch(function(){if(pendingUpdate.current){var forceUpdate=pendingUpdate.current;pendingUpdate.current=null;forceUpdate();}typingLatch.current=null;},TYPING_TIMOUT);getScheduler().add(typingLatch.current);}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].concat(_toConsumableArray(defaultThemeOption?[defaultThemeOption]:[]),[scrollerTheme],_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_.useLayoutEffect)(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(){if(props.container){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);}if(typingLatch.current){typingLatch.current.cancel();typingLatch.current=null;}};},[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
191
193
  },[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){var isTyping=typingLatch.current&&!typingLatch.current.isDone;var forceUpdate=function forceUpdate(){if(view&&value!==view.state.doc.toString()){view.dispatch({changes:{from:0,to:view.state.doc.toString().length,insert:value||''},annotations:[ExternalChange.of(true)]});}};if(!isTyping){forceUpdate();}else{pendingUpdate.current=forceUpdate;}}},[value,view]);return{state:state,setState:setState,view:view,setView:setView,container:container,setContainer:setContainer};}
192
194
 
193
195
  /***/ },
@@ -314,8 +316,13 @@ class SearchCursor {
314
316
  The current match (only holds a meaningful value after
315
317
  [`next`](https://codemirror.net/6/docs/ref/#search.SearchCursor.next) has been called and when
316
318
  `done` is false).
319
+
320
+ The `precise` flag will be set to false if the match starts or
321
+ ends _inside_ a character that, when normalized, expands to
322
+ multiple characters. It indicates that the `from`-`to` range
323
+ covers content that isn't part of the actual match.
317
324
  */
318
- this.value = { from: 0, to: 0 };
325
+ this.value = { from: 0, to: 0, precise: false };
319
326
  /**
320
327
  Whether the end of the iterated region has been reached.
321
328
  */
@@ -366,44 +373,45 @@ class SearchCursor {
366
373
  this.bufferPos += (0,state_.codePointSize)(next);
367
374
  let norm = this.normalize(str);
368
375
  if (norm.length)
369
- for (let i = 0, pos = start;; i++) {
376
+ for (let i = 0, pos = start, posPrecise = true;; i++) {
370
377
  let code = norm.charCodeAt(i);
371
- let match = this.match(code, pos, this.bufferPos + this.bufferStart);
372
- if (i == norm.length - 1) {
373
- if (match) {
374
- this.value = match;
375
- return this;
376
- }
377
- break;
378
+ let match = this.match(code, pos, posPrecise, this.bufferPos + this.bufferStart, i == norm.length - 1);
379
+ if (match) {
380
+ this.value = match;
381
+ return this;
378
382
  }
379
- if (pos == start && i < str.length && str.charCodeAt(i) == code)
383
+ if (i == norm.length - 1)
384
+ break;
385
+ if (posPrecise && i < str.length && str.charCodeAt(i) == code)
380
386
  pos++;
387
+ else
388
+ posPrecise = false;
381
389
  }
382
390
  }
383
391
  }
384
- match(code, pos, end) {
392
+ match(code, pos, posPrecise, end, endPrecise) {
385
393
  let match = null;
386
- for (let i = 0; i < this.matches.length; i += 2) {
387
- let index = this.matches[i], keep = false;
388
- if (this.query.charCodeAt(index) == code) {
389
- if (index == this.query.length - 1) {
390
- match = { from: this.matches[i + 1], to: end };
394
+ for (let i = 0; i < this.matches.length;) {
395
+ let partial = this.matches[i], keep = false;
396
+ if (this.query.charCodeAt(partial.index) == code) {
397
+ if (partial.index == this.query.length - 1) {
398
+ match = { from: partial.from, to: end, precise: endPrecise && partial.precise };
391
399
  }
392
400
  else {
393
- this.matches[i]++;
401
+ partial.index++;
394
402
  keep = true;
395
403
  }
396
404
  }
397
- if (!keep) {
398
- this.matches.splice(i, 2);
399
- i -= 2;
400
- }
405
+ if (keep)
406
+ i++;
407
+ else
408
+ this.matches.splice(i, 1);
401
409
  }
402
410
  if (this.query.charCodeAt(0) == code) {
403
411
  if (this.query.length == 1)
404
- match = { from: pos, to: end };
412
+ match = { from: pos, to: end, precise: posPrecise && endPrecise };
405
413
  else
406
- this.matches.push(1, pos);
414
+ this.matches.push({ from: pos, index: 1, precise: posPrecise });
407
415
  }
408
416
  if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferStart))
409
417
  match = null;
@@ -413,7 +421,7 @@ class SearchCursor {
413
421
  if (typeof Symbol != "undefined")
414
422
  SearchCursor.prototype[Symbol.iterator] = function () { return this; };
415
423
 
416
- const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec("") };
424
+ const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec(""), precise: true };
417
425
  const baseFlags = "gm" + (/x/.unicode == null ? "" : "u");
418
426
  /**
419
427
  This class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)
@@ -438,7 +446,9 @@ class RegExpCursor {
438
446
  /**
439
447
  Will contain an object with the extent of the match and the
440
448
  match object when [`next`](https://codemirror.net/6/docs/ref/#search.RegExpCursor.next)
441
- sucessfully finds a match.
449
+ sucessfully finds a match. The `precise` flag is always true for
450
+ this type of cursor, and only there to make sure this cursor is
451
+ a subtype of `SearchCursor`.
442
452
  */
443
453
  this.value = empty;
444
454
  if (/\\[sWDnr]|\n|\r|\[\^/.test(query))
@@ -483,7 +493,7 @@ class RegExpCursor {
483
493
  if (from == this.curLineStart + this.curLine.length)
484
494
  this.nextLine();
485
495
  if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {
486
- this.value = { from, to, match };
496
+ this.value = { from, to, precise: true, match };
487
497
  return this;
488
498
  }
489
499
  off = this.matchPos - this.curLineStart;
@@ -556,7 +566,7 @@ class MultilineRegExpCursor {
556
566
  // again, since it'll likely be able to match more
557
567
  if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) &&
558
568
  (!this.test || this.test(from, to, match))) {
559
- this.value = { from, to, match };
569
+ this.value = { from, to, precise: true, match };
560
570
  this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));
561
571
  return this;
562
572
  }
@@ -1200,7 +1210,10 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
1200
1210
  let next = match;
1201
1211
  let changes = [], selection, replacement;
1202
1212
  let effects = [];
1203
- if (next.from == from && next.to == to) {
1213
+ if (!next.precise) {
1214
+ next = query.nextMatch(state, next.from, next.to);
1215
+ }
1216
+ else if (next.from == from && next.to == to) {
1204
1217
  replacement = state.toText(query.getReplacement(next));
1205
1218
  changes.push({ from: next.from, to: next.to, insert: replacement });
1206
1219
  next = query.nextMatch(state, next.from, next.to);
@@ -1227,10 +1240,12 @@ replacement.
1227
1240
  const replaceAll = /*@__PURE__*/searchCommand((view, { query }) => {
1228
1241
  if (view.state.readOnly)
1229
1242
  return false;
1230
- let changes = query.matchAll(view.state, 1e9).map(match => {
1231
- let { from, to } = match;
1232
- return { from, to, insert: query.getReplacement(match) };
1233
- });
1243
+ let changes = [];
1244
+ for (let match of query.matchAll(view.state, 1e9)) {
1245
+ let { from, to, precise } = match;
1246
+ if (precise)
1247
+ changes.push({ from, to, insert: query.getReplacement(match) });
1248
+ }
1234
1249
  if (!changes.length)
1235
1250
  return false;
1236
1251
  let announceText = view.state.phrase("replaced $ matches", changes.length) + ".";
@@ -1506,9 +1521,17 @@ const searchExtensions = [
1506
1521
  var language_dist = __webpack_require__(194);
1507
1522
  ;// ../node_modules/@codemirror/autocomplete/dist/index.js
1508
1523
  /* unused harmony import specifier */ var MapMode;
1524
+ /* unused harmony import specifier */ var StateEffect;
1525
+ /* unused harmony import specifier */ var StateField;
1526
+ /* unused harmony import specifier */ var EditorSelection;
1509
1527
  /* unused harmony import specifier */ var Text;
1510
1528
  /* unused harmony import specifier */ var Transaction;
1511
- /* unused harmony import specifier */ var StateEffect;
1529
+ /* unused harmony import specifier */ var Facet;
1530
+ /* unused harmony import specifier */ var Prec;
1531
+ /* unused harmony import specifier */ var Decoration;
1532
+ /* unused harmony import specifier */ var WidgetType;
1533
+ /* unused harmony import specifier */ var EditorView;
1534
+ /* unused harmony import specifier */ var keymap;
1512
1535
  /* unused harmony import specifier */ var syntaxTree;
1513
1536
  /* unused harmony import specifier */ var indentUnit;
1514
1537
 
@@ -2008,8 +2031,8 @@ function rangeAroundSelected(total, selected, max) {
2008
2031
  let off = Math.floor(selected / max);
2009
2032
  return { from: off * max, to: (off + 1) * max };
2010
2033
  }
2011
- let off = Math.floor((total - selected) / max);
2012
- return { from: total - (off + 1) * max, to: total - off * max };
2034
+ let off = Math.ceil((total - selected) / max);
2035
+ return { from: total - off * max, to: total - (off - 1) * max };
2013
2036
  }
2014
2037
  class CompletionTooltip {
2015
2038
  constructor(view, stateField, applyCompletion) {
@@ -2540,7 +2563,7 @@ class ActiveResult extends ActiveSource {
2540
2563
  let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
2541
2564
  if (!result)
2542
2565
  return new ActiveSource(this.source, 0 /* State.Inactive */);
2543
- return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
2566
+ return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
2544
2567
  }
2545
2568
  touches(tr) {
2546
2569
  return tr.changes.touchesRange(this.from, this.to);
@@ -2868,7 +2891,8 @@ const dist_baseTheme = /*@__PURE__*/view_.EditorView.baseTheme({
2868
2891
  content: '"···"',
2869
2892
  opacity: 0.5,
2870
2893
  display: "block",
2871
- textAlign: "center"
2894
+ textAlign: "center",
2895
+ cursor: "pointer",
2872
2896
  },
2873
2897
  ".cm-tooltip.cm-completionInfo": {
2874
2898
  position: "absolute",
@@ -2991,6 +3015,9 @@ class Snippet {
2991
3015
  for (let line of template.split(/\r\n?|\n/)) {
2992
3016
  while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
2993
3017
  let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
3018
+ // `${0}` is the cursor's final position, after every other tab stop.
3019
+ if (seq === 0)
3020
+ seq = 1e9;
2994
3021
  let name = rawName.replace(/\\[{}]/g, m => m[1]);
2995
3022
  for (let i = 0; i < fields.length; i++) {
2996
3023
  if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)
@@ -3028,20 +3055,20 @@ class Snippet {
3028
3055
  return new Snippet(lines, positions);
3029
3056
  }
3030
3057
  }
3031
- let fieldMarker = /*@__PURE__*/view_.Decoration.widget({ widget: /*@__PURE__*/new class extends view_.WidgetType {
3058
+ let fieldMarker = /*@__PURE__*/(/* unused pure expression or super */ null && (Decoration.widget({ widget: /*@__PURE__*/new class extends WidgetType {
3032
3059
  toDOM() {
3033
3060
  let span = document.createElement("span");
3034
3061
  span.className = "cm-snippetFieldPosition";
3035
3062
  return span;
3036
3063
  }
3037
3064
  ignoreEvent() { return false; }
3038
- } });
3039
- let fieldRange = /*@__PURE__*/view_.Decoration.mark({ class: "cm-snippetField" });
3065
+ } })));
3066
+ let fieldRange = /*@__PURE__*/(/* unused pure expression or super */ null && (Decoration.mark({ class: "cm-snippetField" })));
3040
3067
  class ActiveSnippet {
3041
3068
  constructor(ranges, active) {
3042
3069
  this.ranges = ranges;
3043
3070
  this.active = active;
3044
- this.deco = view_.Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
3071
+ this.deco = Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
3045
3072
  }
3046
3073
  map(changes) {
3047
3074
  let ranges = [];
@@ -3057,11 +3084,11 @@ class ActiveSnippet {
3057
3084
  return sel.ranges.every(range => this.ranges.some(r => r.field == this.active && r.from <= range.from && r.to >= range.to));
3058
3085
  }
3059
3086
  }
3060
- const setActive = /*@__PURE__*/state_.StateEffect.define({
3087
+ const setActive = /*@__PURE__*/(/* unused pure expression or super */ null && (StateEffect.define({
3061
3088
  map(value, changes) { return value && value.map(changes); }
3062
- });
3063
- const moveToField = /*@__PURE__*/state_.StateEffect.define();
3064
- const snippetState = /*@__PURE__*/state_.StateField.define({
3089
+ })));
3090
+ const moveToField = /*@__PURE__*/(/* unused pure expression or super */ null && (StateEffect.define()));
3091
+ const snippetState = /*@__PURE__*/(/* unused pure expression or super */ null && (StateField.define({
3065
3092
  create() { return null; },
3066
3093
  update(value, tr) {
3067
3094
  for (let effect of tr.effects) {
@@ -3076,10 +3103,10 @@ const snippetState = /*@__PURE__*/state_.StateField.define({
3076
3103
  value = null;
3077
3104
  return value;
3078
3105
  },
3079
- provide: f => view_.EditorView.decorations.from(f, val => val ? val.deco : view_.Decoration.none)
3080
- });
3106
+ provide: f => EditorView.decorations.from(f, val => val ? val.deco : Decoration.none)
3107
+ })));
3081
3108
  function fieldSelection(ranges, field) {
3082
- return state_.EditorSelection.create(ranges.filter(r => r.field == field).map(r => state_.EditorSelection.range(r.from, r.to)));
3109
+ return EditorSelection.create(ranges.filter(r => r.field == field).map(r => EditorSelection.range(r.from, r.to)));
3083
3110
  }
3084
3111
  /**
3085
3112
  Convert a snippet template to a function that can
@@ -3105,7 +3132,8 @@ cursor out of the current field deactivates the fields.
3105
3132
 
3106
3133
  The order of fields defaults to textual order, but you can add
3107
3134
  numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
3108
- a custom order.
3135
+ a custom order. `${0}` is special—it is always the last stop, where
3136
+ the cursor ends up after tabbing through the other fields.
3109
3137
 
3110
3138
  To include a literal `{` or `}` in your template, put a backslash
3111
3139
  in front of it. This will be removed and the brace will not be
@@ -3159,11 +3187,11 @@ const clearSnippet = ({ state, dispatch }) => {
3159
3187
  /**
3160
3188
  Move to the next snippet field, if available.
3161
3189
  */
3162
- const nextSnippetField = /*@__PURE__*/moveField(1);
3190
+ const nextSnippetField = /*@__PURE__*/(/* unused pure expression or super */ null && (moveField(1)));
3163
3191
  /**
3164
3192
  Move to the previous snippet field, if available.
3165
3193
  */
3166
- const prevSnippetField = /*@__PURE__*/moveField(-1);
3194
+ const prevSnippetField = /*@__PURE__*/(/* unused pure expression or super */ null && (moveField(-1)));
3167
3195
  /**
3168
3196
  Check if there is an active snippet with a next field for
3169
3197
  `nextSnippetField` to move to.
@@ -3180,10 +3208,10 @@ function hasPrevSnippetField(state) {
3180
3208
  let active = state.field(snippetState, false);
3181
3209
  return !!(active && active.active > 0);
3182
3210
  }
3183
- const defaultSnippetKeymap = [
3211
+ const defaultSnippetKeymap = (/* unused pure expression or super */ null && ([
3184
3212
  { key: "Tab", run: nextSnippetField, shift: prevSnippetField },
3185
3213
  { key: "Escape", run: clearSnippet }
3186
- ];
3214
+ ]));
3187
3215
  /**
3188
3216
  A facet that can be used to configure the key bindings used by
3189
3217
  snippets. The default binds Tab to
@@ -3191,10 +3219,10 @@ snippets. The default binds Tab to
3191
3219
  [`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape
3192
3220
  to [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).
3193
3221
  */
3194
- const snippetKeymap = /*@__PURE__*/state_.Facet.define({
3222
+ const snippetKeymap = /*@__PURE__*/(/* unused pure expression or super */ null && (Facet.define({
3195
3223
  combine(maps) { return maps.length ? maps[0] : defaultSnippetKeymap; }
3196
- });
3197
- const addSnippetKeymap = /*@__PURE__*/state_.Prec.highest(/*@__PURE__*/view_.keymap.compute([snippetKeymap], state => state.facet(snippetKeymap)));
3224
+ })));
3225
+ const addSnippetKeymap = /*@__PURE__*/(/* unused pure expression or super */ null && (Prec.highest(/*@__PURE__*/keymap.compute([snippetKeymap], state => state.facet(snippetKeymap)))));
3198
3226
  /**
3199
3227
  Create a completion from a snippet. Returns an object with the
3200
3228
  properties from `completion`, plus an `apply` function that
@@ -3203,7 +3231,7 @@ applies the snippet.
3203
3231
  function snippetCompletion(template, completion) {
3204
3232
  return { ...completion, apply: snippet(template) };
3205
3233
  }
3206
- const snippetPointerHandler = /*@__PURE__*/view_.EditorView.domEventHandlers({
3234
+ const snippetPointerHandler = /*@__PURE__*/(/* unused pure expression or super */ null && (EditorView.domEventHandlers({
3207
3235
  mousedown(event, view) {
3208
3236
  let active = view.state.field(snippetState, false), pos;
3209
3237
  if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
@@ -3219,7 +3247,7 @@ const snippetPointerHandler = /*@__PURE__*/view_.EditorView.domEventHandlers({
3219
3247
  });
3220
3248
  return true;
3221
3249
  }
3222
- });
3250
+ })));
3223
3251
 
3224
3252
  function wordRE(wordChars) {
3225
3253
  let escaped = wordChars.replace(/[\]\-\\]/g, "\\$&");
@@ -3591,7 +3619,7 @@ function completionStatus(state) {
3591
3619
  return cState && cState.active.some(a => a.isPending) ? "pending"
3592
3620
  : cState && cState.active.some(a => a.state != 0 /* State.Inactive */) ? "active" : null;
3593
3621
  }
3594
- const completionArrayCache = /*@__PURE__*/new WeakMap;
3622
+ const completionArrayCache = /*@__PURE__*/(/* unused pure expression or super */ null && (new WeakMap));
3595
3623
  /**
3596
3624
  Returns the available completions as an array.
3597
3625
  */
@@ -3633,9 +3661,13 @@ function setSelectedCompletion(index) {
3633
3661
 
3634
3662
 
3635
3663
  ;// ../node_modules/@codemirror/lint/dist/index.js
3664
+ /* unused harmony import specifier */ var activateHover;
3636
3665
  /* unused harmony import specifier */ var ViewPlugin;
3637
3666
  /* unused harmony import specifier */ var logException;
3667
+ /* unused harmony import specifier */ var gutter;
3668
+ /* unused harmony import specifier */ var dist_EditorView;
3638
3669
  /* unused harmony import specifier */ var RangeSet;
3670
+ /* unused harmony import specifier */ var dist_StateField;
3639
3671
 
3640
3672
 
3641
3673
 
@@ -3841,7 +3873,7 @@ function lintTooltip(view, pos, side) {
3841
3873
  return {
3842
3874
  pos: start,
3843
3875
  end: end,
3844
- above: view.state.doc.lineAt(start).to < end,
3876
+ above: true,
3845
3877
  create() {
3846
3878
  return { dom: diagnosticsTooltip(view, found) };
3847
3879
  }
@@ -3886,12 +3918,17 @@ const nextDiagnostic = (view) => {
3886
3918
  return false;
3887
3919
  }
3888
3920
  view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
3921
+ (0,view_.activateHover)(view, next.from, 1, {
3922
+ tooltip: lintHover,
3923
+ until: tr => tr.docChanged || tr.newSelection.main.head < next.from || tr.newSelection.main.head > next.to
3924
+ });
3889
3925
  return true;
3890
3926
  };
3891
3927
  /**
3892
3928
  Move the selection to the previous diagnostic.
3893
3929
  */
3894
3930
  const previousDiagnostic = (view) => {
3931
+ var _a;
3895
3932
  let { state } = view, field = state.field(lintState, false);
3896
3933
  if (!field)
3897
3934
  return false;
@@ -3909,7 +3946,12 @@ const previousDiagnostic = (view) => {
3909
3946
  });
3910
3947
  if (lastFrom == null || prevFrom == null && lastFrom == sel.from)
3911
3948
  return false;
3912
- view.dispatch({ selection: { anchor: prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, head: prevTo !== null && prevTo !== void 0 ? prevTo : lastTo }, scrollIntoView: true });
3949
+ let from = prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, to = (_a = prevTo !== null && prevTo !== void 0 ? prevTo : lastTo) !== null && _a !== void 0 ? _a : from;
3950
+ view.dispatch({ selection: { anchor: from, head: to }, scrollIntoView: true });
3951
+ activateHover(view, from, 1, {
3952
+ tooltip: lintHover,
3953
+ until: tr => tr.docChanged || tr.newSelection.main.head < from || tr.newSelection.main.head > to
3954
+ });
3913
3955
  return true;
3914
3956
  };
3915
3957
  /**
@@ -4303,7 +4345,7 @@ const lint_dist_baseTheme = /*@__PURE__*/view_.EditorView.baseTheme({
4303
4345
  backgroundRepeat: "repeat-x",
4304
4346
  paddingBottom: "0.7px",
4305
4347
  },
4306
- ".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#d11") },
4348
+ ".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#f11") },
4307
4349
  ".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
4308
4350
  ".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
4309
4351
  ".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },
@@ -4459,9 +4501,9 @@ function markersForDiagnostics(doc, diagnostics) {
4459
4501
  for (let line in byLine) {
4460
4502
  markers.push(new LintGutterMarker(byLine[line]).range(+line));
4461
4503
  }
4462
- return state_.RangeSet.of(markers, true);
4504
+ return RangeSet.of(markers, true);
4463
4505
  }
4464
- const lintGutterExtension = /*@__PURE__*/(0,view_.gutter)({
4506
+ const lintGutterExtension = /*@__PURE__*/(/* unused pure expression or super */ null && (gutter({
4465
4507
  class: "cm-gutter-lint",
4466
4508
  markers: view => view.state.field(lintGutterMarkers),
4467
4509
  widgetMarker: (view, widget, block) => {
@@ -4472,10 +4514,10 @@ const lintGutterExtension = /*@__PURE__*/(0,view_.gutter)({
4472
4514
  });
4473
4515
  return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
4474
4516
  }
4475
- });
4476
- const lintGutterMarkers = /*@__PURE__*/state_.StateField.define({
4517
+ })));
4518
+ const lintGutterMarkers = /*@__PURE__*/(/* unused pure expression or super */ null && (dist_StateField.define({
4477
4519
  create() {
4478
- return state_.RangeSet.empty;
4520
+ return RangeSet.empty;
4479
4521
  },
4480
4522
  update(markers, tr) {
4481
4523
  markers = markers.map(tr.changes);
@@ -4490,7 +4532,7 @@ const lintGutterMarkers = /*@__PURE__*/state_.StateField.define({
4490
4532
  }
4491
4533
  return markers;
4492
4534
  }
4493
- });
4535
+ })));
4494
4536
  const setLintGutterTooltip = /*@__PURE__*/state_.StateEffect.define();
4495
4537
  const lintGutterTooltip = /*@__PURE__*/state_.StateField.define({
4496
4538
  create() { return null; },
@@ -4501,7 +4543,7 @@ const lintGutterTooltip = /*@__PURE__*/state_.StateField.define({
4501
4543
  },
4502
4544
  provide: field => view_.showTooltip.from(field)
4503
4545
  });
4504
- const lintGutterTheme = /*@__PURE__*/view_.EditorView.baseTheme({
4546
+ const lintGutterTheme = /*@__PURE__*/(/* unused pure expression or super */ null && (dist_EditorView.baseTheme({
4505
4547
  ".cm-gutter-lint": {
4506
4548
  width: "1.4em",
4507
4549
  "& .cm-gutterElement": {
@@ -4521,7 +4563,8 @@ const lintGutterTheme = /*@__PURE__*/view_.EditorView.baseTheme({
4521
4563
  ".cm-lint-marker-error": {
4522
4564
  content: /*@__PURE__*/svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
4523
4565
  },
4524
- });
4566
+ })));
4567
+ const lintHover = /*@__PURE__*/(0,view_.hoverTooltip)(lintTooltip, { hideOn: hideTooltip });
4525
4568
  const lintExtensions = [
4526
4569
  lintState,
4527
4570
  /*@__PURE__*/view_.EditorView.decorations.compute([lintState], state => {
@@ -4530,7 +4573,7 @@ const lintExtensions = [
4530
4573
  activeMark.range(selected.from, selected.to)
4531
4574
  ]);
4532
4575
  }),
4533
- /*@__PURE__*/(0,view_.hoverTooltip)(lintTooltip, { hideOn: hideTooltip }),
4576
+ lintHover,
4534
4577
  lint_dist_baseTheme
4535
4578
  ];
4536
4579
  const lintGutterConfig = /*@__PURE__*/state_.Facet.define({
@@ -4631,9 +4674,9 @@ var basicSetup = function basicSetup(options) {
4631
4674
  if (options === void 0) {
4632
4675
  options = {};
4633
4676
  }
4634
- var {
4635
- crosshairCursor: initCrosshairCursor = false
4636
- } = options;
4677
+ var _options = options,
4678
+ _options$crosshairCur = _options.crosshairCursor,
4679
+ initCrosshairCursor = _options$crosshairCur === void 0 ? false : _options$crosshairCur;
4637
4680
  var keymaps = [];
4638
4681
  if (options.closeBracketsKeymap !== false) {
4639
4682
  keymaps = keymaps.concat(closeBracketsKeymap);
@@ -4844,10 +4887,7 @@ function toPropertyKey(t) {
4844
4887
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4845
4888
 
4846
4889
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4847
- /* harmony export */ Yc: () => (/* binding */ indentWithTab),
4848
- /* harmony export */ b6: () => (/* binding */ history),
4849
- /* harmony export */ cL: () => (/* binding */ historyKeymap),
4850
- /* harmony export */ pw: () => (/* binding */ defaultKeymap)
4890
+ /* harmony export */ b6: () => (/* binding */ history)
4851
4891
  /* harmony export */ });
4852
4892
  /* unused harmony exports addCursorAbove, addCursorBelow, blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteGroupForwardWin, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection */
4853
4893
  /* unused harmony import specifier */ var findClusterBreak;
@@ -5746,8 +5786,10 @@ Extend the selection to the bracket matching the one the selection
5746
5786
  head is currently on, if any.
5747
5787
  */
5748
5788
  const selectMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, true);
5749
- function extendSel(target, how) {
5789
+ function extendSel(target, forward, how) {
5750
5790
  let selection = updateSel(target.state.selection, range => {
5791
+ if (range.undirectional && (range.head >= range.anchor) != forward)
5792
+ range = _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.head, range.anchor);
5751
5793
  let head = how(range);
5752
5794
  return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined, head.assoc);
5753
5795
  });
@@ -5757,7 +5799,7 @@ function extendSel(target, how) {
5757
5799
  return true;
5758
5800
  }
5759
5801
  function selectByChar(view, forward) {
5760
- return extendSel(view, range => view.moveByChar(range, forward));
5802
+ return extendSel(view, forward, range => view.moveByChar(range, forward));
5761
5803
  }
5762
5804
  /**
5763
5805
  Move the selection head one character to the left, while leaving
@@ -5780,14 +5822,14 @@ const selectCharBackward = view => selectByChar(view, false);
5780
5822
  Move the selection head one character forward by logical
5781
5823
  (non-direction aware) string index order.
5782
5824
  */
5783
- const selectCharForwardLogical = target => extendSel(target, range => byCharLogical(target.state, range, true));
5825
+ const selectCharForwardLogical = target => extendSel(target, true, range => byCharLogical(target.state, range, true));
5784
5826
  /**
5785
5827
  Move the selection head one character backward by logical string
5786
5828
  index order.
5787
5829
  */
5788
- const selectCharBackwardLogical = target => extendSel(target, range => byCharLogical(target.state, range, false));
5830
+ const selectCharBackwardLogical = target => extendSel(target, false, range => byCharLogical(target.state, range, false));
5789
5831
  function selectByGroup(view, forward) {
5790
- return extendSel(view, range => view.moveByGroup(range, forward));
5832
+ return extendSel(view, forward, range => view.moveByGroup(range, forward));
5791
5833
  }
5792
5834
  /**
5793
5835
  Move the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to
@@ -5811,10 +5853,10 @@ Move the selection head one group forward in the default Windows
5811
5853
  style, skipping to the start of the next group.
5812
5854
  */
5813
5855
  const selectGroupForwardWin = view => {
5814
- return extendSel(view, range => view.moveByChar(range, true, start => toGroupStart(view, range.head, start)));
5856
+ return extendSel(view, true, range => view.moveByChar(range, true, start => toGroupStart(view, range.head, start)));
5815
5857
  };
5816
5858
  function selectBySubword(view, forward) {
5817
- return extendSel(view, range => moveBySubword(view, range, forward));
5859
+ return extendSel(view, forward, range => moveBySubword(view, range, forward));
5818
5860
  }
5819
5861
  /**
5820
5862
  Move the selection head one group or camel-case subword forward.
@@ -5827,13 +5869,19 @@ const selectSubwordBackward = view => selectBySubword(view, false);
5827
5869
  /**
5828
5870
  Move the selection head over the next syntactic element to the left.
5829
5871
  */
5830
- const selectSyntaxLeft = view => extendSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));
5872
+ const selectSyntaxLeft = view => {
5873
+ let forward = !ltrAtCursor(view);
5874
+ return extendSel(view, forward, range => moveBySyntax(view.state, range, forward));
5875
+ };
5831
5876
  /**
5832
5877
  Move the selection head over the next syntactic element to the right.
5833
5878
  */
5834
- const selectSyntaxRight = view => extendSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));
5879
+ const selectSyntaxRight = view => {
5880
+ let forward = ltrAtCursor(view);
5881
+ return extendSel(view, forward, range => moveBySyntax(view.state, range, forward));
5882
+ };
5835
5883
  function selectByLine(view, forward) {
5836
- return extendSel(view, range => view.moveVertically(range, forward));
5884
+ return extendSel(view, forward, range => view.moveVertically(range, forward));
5837
5885
  }
5838
5886
  /**
5839
5887
  Move the selection head one line up.
@@ -5844,7 +5892,7 @@ Move the selection head one line down.
5844
5892
  */
5845
5893
  const selectLineDown = view => selectByLine(view, true);
5846
5894
  function selectByPage(view, forward) {
5847
- return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));
5895
+ return extendSel(view, forward, range => view.moveVertically(range, forward, pageInfo(view).height));
5848
5896
  }
5849
5897
  /**
5850
5898
  Move the selection head one page up.
@@ -5857,27 +5905,33 @@ const selectPageDown = view => selectByPage(view, true);
5857
5905
  /**
5858
5906
  Move the selection head to the next line boundary.
5859
5907
  */
5860
- const selectLineBoundaryForward = view => extendSel(view, range => moveByLineBoundary(view, range, true));
5908
+ const selectLineBoundaryForward = view => extendSel(view, true, range => moveByLineBoundary(view, range, true));
5861
5909
  /**
5862
5910
  Move the selection head to the previous line boundary.
5863
5911
  */
5864
- const selectLineBoundaryBackward = view => extendSel(view, range => moveByLineBoundary(view, range, false));
5912
+ const selectLineBoundaryBackward = view => extendSel(view, false, range => moveByLineBoundary(view, range, false));
5865
5913
  /**
5866
5914
  Move the selection head one line boundary to the left.
5867
5915
  */
5868
- const selectLineBoundaryLeft = view => extendSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));
5916
+ const selectLineBoundaryLeft = view => {
5917
+ let forward = !ltrAtCursor(view);
5918
+ return extendSel(view, forward, range => moveByLineBoundary(view, range, forward));
5919
+ };
5869
5920
  /**
5870
5921
  Move the selection head one line boundary to the right.
5871
5922
  */
5872
- const selectLineBoundaryRight = view => extendSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));
5923
+ const selectLineBoundaryRight = view => {
5924
+ let forward = ltrAtCursor(view);
5925
+ return extendSel(view, forward, range => moveByLineBoundary(view, range, forward));
5926
+ };
5873
5927
  /**
5874
5928
  Move the selection head to the start of the line.
5875
5929
  */
5876
- const selectLineStart = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).from));
5930
+ const selectLineStart = view => extendSel(view, false, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).from));
5877
5931
  /**
5878
5932
  Move the selection head to the end of the line.
5879
5933
  */
5880
- const selectLineEnd = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to));
5934
+ const selectLineEnd = view => extendSel(view, true, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to));
5881
5935
  /**
5882
5936
  Move the selection to the start of the document.
5883
5937
  */
@@ -6653,6 +6707,12 @@ const indentWithTab = { key: "Tab", run: indentMore, shift: indentLess };
6653
6707
 
6654
6708
 
6655
6709
 
6710
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
6711
+ /* harmony export */ "Yc", 0, /* binding */ indentWithTab,
6712
+ /* harmony export */ "cL", 0, /* binding */ historyKeymap,
6713
+ /* harmony export */ "pw", 0, /* binding */ defaultKeymap
6714
+ /* harmony export */ ]);
6715
+
6656
6716
 
6657
6717
  /***/ },
6658
6718
 
@@ -7789,7 +7849,15 @@ class StyleSet {
7789
7849
  // (min-width: 400px)": {...}}`.
7790
7850
 
7791
7851
  ;// ../node_modules/@codemirror/language/dist/index.js
7852
+ /* unused harmony import specifier */ var NodeProp;
7792
7853
  /* unused harmony import specifier */ var RangeSet;
7854
+ /* unused harmony import specifier */ var Facet;
7855
+ /* unused harmony import specifier */ var Prec;
7856
+ /* unused harmony import specifier */ var RangeSetBuilder;
7857
+ /* unused harmony import specifier */ var ViewPlugin;
7858
+ /* unused harmony import specifier */ var Direction;
7859
+ /* unused harmony import specifier */ var EditorView;
7860
+ /* unused harmony import specifier */ var Decoration;
7793
7861
 
7794
7862
 
7795
7863
 
@@ -7944,8 +8012,7 @@ function topNodeAt(state, pos, side) {
7944
8012
  }
7945
8013
  /**
7946
8014
  A subclass of [`Language`](https://codemirror.net/6/docs/ref/#language.Language) for use with Lezer
7947
- [LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser)
7948
- parsers.
8015
+ [LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser).
7949
8016
  */
7950
8017
  class LRLanguage extends Language {
7951
8018
  constructor(data, parser, name) {
@@ -9111,18 +9178,25 @@ const foldState = /*@__PURE__*/state_.StateField.define({
9111
9178
  if (tr.isUserEvent("delete"))
9112
9179
  tr.changes.iterChangedRanges((fromA, toA) => folded = clearTouchedFolds(folded, fromA, toA));
9113
9180
  folded = folded.map(tr.changes);
9181
+ let rangesToFold = [];
9114
9182
  for (let e of tr.effects) {
9115
9183
  if (e.is(foldEffect) && !foldExists(folded, e.value.from, e.value.to)) {
9116
- let { preparePlaceholder } = tr.state.facet(foldConfig);
9117
- let widget = !preparePlaceholder ? foldWidget :
9118
- view_.Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, e.value)) });
9119
- folded = folded.update({ add: [widget.range(e.value.from, e.value.to)] });
9184
+ rangesToFold.push(e.value);
9120
9185
  }
9121
9186
  else if (e.is(unfoldEffect)) {
9122
9187
  folded = folded.update({ filter: (from, to) => e.value.from != from || e.value.to != to,
9123
9188
  filterFrom: e.value.from, filterTo: e.value.to });
9124
9189
  }
9125
9190
  }
9191
+ if (rangesToFold.length) {
9192
+ let { preparePlaceholder } = tr.state.facet(foldConfig);
9193
+ let decorations = rangesToFold.map(value => {
9194
+ let widget = !preparePlaceholder ? foldWidget :
9195
+ view_.Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, value)) });
9196
+ return widget.range(value.from, value.to);
9197
+ });
9198
+ folded = folded.update({ add: decorations });
9199
+ }
9126
9200
  // Clear folded ranges that cover the selection head
9127
9201
  if (tr.selection)
9128
9202
  folded = clearTouchedFolds(folded, tr.selection.main.head);
@@ -9482,7 +9556,7 @@ class HighlightStyle {
9482
9556
  or array of tags in their `tag` property, and either a single
9483
9557
  `class` property providing a static CSS class (for highlighter
9484
9558
  that rely on external styling), or a
9485
- [`style-mod`](https://github.com/marijnh/style-mod#documentation)-style
9559
+ [`style-mod`](https://code.haverbeke.berlin/marijn/style-mod#documentation)-style
9486
9560
  set of CSS properties (which define the styling for those tags).
9487
9561
 
9488
9562
  The CSS rules created for a highlighter will be emitted in the
@@ -10378,7 +10452,7 @@ function changeAddsRTL(change) {
10378
10452
  });
10379
10453
  return added;
10380
10454
  }
10381
- const alwaysIsolate = /*@__PURE__*/state_.Facet.define({ combine: values => values.some(x => x) });
10455
+ const alwaysIsolate = /*@__PURE__*/(/* unused pure expression or super */ null && (Facet.define({ combine: values => values.some(x => x) })));
10382
10456
  /**
10383
10457
  Make sure nodes
10384
10458
  [marked](https://lezer.codemirror.net/docs/ref/#common.NodeProp^isolate)
@@ -10391,19 +10465,19 @@ function bidiIsolates(options = {}) {
10391
10465
  extensions.push(alwaysIsolate.of(true));
10392
10466
  return extensions;
10393
10467
  }
10394
- const isolateMarks = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
10468
+ const isolateMarks = /*@__PURE__*/(/* unused pure expression or super */ null && (ViewPlugin.fromClass(class {
10395
10469
  constructor(view) {
10396
10470
  this.always = view.state.facet(alwaysIsolate) ||
10397
- view.textDirection != view_.Direction.LTR ||
10398
- view.state.facet(view_.EditorView.perLineTextDirection);
10471
+ view.textDirection != Direction.LTR ||
10472
+ view.state.facet(EditorView.perLineTextDirection);
10399
10473
  this.hasRTL = !this.always && textHasRTL(view.state.doc);
10400
10474
  this.tree = syntaxTree(view.state);
10401
- this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : view_.Decoration.none;
10475
+ this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : Decoration.none;
10402
10476
  }
10403
10477
  update(update) {
10404
10478
  let always = update.state.facet(alwaysIsolate) ||
10405
- update.view.textDirection != view_.Direction.LTR ||
10406
- update.state.facet(view_.EditorView.perLineTextDirection);
10479
+ update.view.textDirection != Direction.LTR ||
10480
+ update.state.facet(EditorView.perLineTextDirection);
10407
10481
  if (!always && !this.hasRTL && changeAddsRTL(update.changes))
10408
10482
  this.hasRTL = true;
10409
10483
  if (!always && !this.hasRTL)
@@ -10419,21 +10493,21 @@ const isolateMarks = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
10419
10493
  provide: plugin => {
10420
10494
  function access(view) {
10421
10495
  var _a, _b;
10422
- return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b : view_.Decoration.none;
10496
+ return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b : Decoration.none;
10423
10497
  }
10424
- return [view_.EditorView.outerDecorations.of(access),
10425
- state_.Prec.lowest(view_.EditorView.bidiIsolatedRanges.of(access))];
10498
+ return [EditorView.outerDecorations.of(access),
10499
+ Prec.lowest(EditorView.bidiIsolatedRanges.of(access))];
10426
10500
  }
10427
- });
10501
+ })));
10428
10502
  function buildDeco(view, tree, always) {
10429
- let deco = new state_.RangeSetBuilder();
10503
+ let deco = new RangeSetBuilder();
10430
10504
  let ranges = view.visibleRanges;
10431
10505
  if (!always)
10432
10506
  ranges = clipRTLLines(ranges, view.state.doc);
10433
10507
  for (let { from, to } of ranges) {
10434
10508
  tree.iterate({
10435
10509
  enter: node => {
10436
- let iso = node.type.prop(dist/* NodeProp */.uY.isolate);
10510
+ let iso = node.type.prop(NodeProp.isolate);
10437
10511
  if (iso)
10438
10512
  deco.add(node.from, node.to, marks[iso]);
10439
10513
  },
@@ -12526,8 +12600,14 @@ class StructureCursor {
12526
12600
  let { cursor } = this, p = pos - this.offset;
12527
12601
  while (!this.done && cursor.from < p) {
12528
12602
  if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
12529
- else if (!cursor.next(false))
12530
- this.done = true;
12603
+ else if (cursor.to <= pos) {
12604
+ if (!cursor.next(false))
12605
+ this.done = true;
12606
+ // Moved to next node
12607
+ }
12608
+ else {
12609
+ break;
12610
+ }
12531
12611
  }
12532
12612
  }
12533
12613
  hasNode(cursor) {
@@ -12697,17 +12777,17 @@ function enterFragments(mounts, ranges) {
12697
12777
  /******/ });
12698
12778
  /************************************************************************/
12699
12779
  /******/ // The module cache
12700
- /******/ var __webpack_module_cache__ = {};
12780
+ /******/ const __webpack_module_cache__ = {};
12701
12781
  /******/
12702
12782
  /******/ // The require function
12703
12783
  /******/ function __webpack_require__(moduleId) {
12704
12784
  /******/ // Check if module is in cache
12705
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
12785
+ /******/ const cachedModule = __webpack_module_cache__[moduleId];
12706
12786
  /******/ if (cachedModule !== undefined) {
12707
12787
  /******/ return cachedModule.exports;
12708
12788
  /******/ }
12709
12789
  /******/ // Create a new module (and put it into the cache)
12710
- /******/ var module = __webpack_module_cache__[moduleId] = {
12790
+ /******/ const module = __webpack_module_cache__[moduleId] = {
12711
12791
  /******/ // no module.id needed
12712
12792
  /******/ // no module.loaded needed
12713
12793
  /******/ exports: {}
@@ -12725,7 +12805,7 @@ function enterFragments(mounts, ranges) {
12725
12805
  /******/ (() => {
12726
12806
  /******/ // getDefaultExport function for compatibility with non-harmony modules
12727
12807
  /******/ __webpack_require__.n = (module) => {
12728
- /******/ var getter = module && module.__esModule ?
12808
+ /******/ const getter = module && module.__esModule ?
12729
12809
  /******/ () => (module['default']) :
12730
12810
  /******/ () => (module);
12731
12811
  /******/ __webpack_require__.d(getter, { a: getter });
@@ -12735,11 +12815,26 @@ function enterFragments(mounts, ranges) {
12735
12815
  /******/
12736
12816
  /******/ /* webpack/runtime/define property getters */
12737
12817
  /******/ (() => {
12738
- /******/ // define getter functions for harmony exports
12818
+ /******/ // define getter/value functions for harmony exports
12739
12819
  /******/ __webpack_require__.d = (exports, definition) => {
12740
- /******/ for(var key in definition) {
12741
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
12742
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
12820
+ /******/ if(Array.isArray(definition)) {
12821
+ /******/ var i = 0;
12822
+ /******/ while(i < definition.length) {
12823
+ /******/ var key = definition[i++];
12824
+ /******/ var binding = definition[i++];
12825
+ /******/ if(!__webpack_require__.o(exports, key)) {
12826
+ /******/ if(binding === 0) {
12827
+ /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
12828
+ /******/ } else {
12829
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
12830
+ /******/ }
12831
+ /******/ } else if(binding === 0) { i++; }
12832
+ /******/ }
12833
+ /******/ } else {
12834
+ /******/ for(var key in definition) {
12835
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
12836
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
12837
+ /******/ }
12743
12838
  /******/ }
12744
12839
  /******/ }
12745
12840
  /******/ };
@@ -12754,7 +12849,7 @@ function enterFragments(mounts, ranges) {
12754
12849
  /******/ (() => {
12755
12850
  /******/ // define __esModule on exports
12756
12851
  /******/ __webpack_require__.r = (exports) => {
12757
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
12852
+ /******/ if(Symbol.toStringTag) {
12758
12853
  /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
12759
12854
  /******/ }
12760
12855
  /******/ Object.defineProperty(exports, '__esModule', { value: true });
@@ -12762,12 +12857,11 @@ function enterFragments(mounts, ranges) {
12762
12857
  /******/ })();
12763
12858
  /******/
12764
12859
  /************************************************************************/
12765
- var __webpack_exports__ = {};
12860
+ let __webpack_exports__ = {};
12766
12861
  __webpack_require__.r(__webpack_exports__);
12767
12862
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12768
12863
  /* harmony export */ ExternalChange: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__.Q),
12769
12864
  /* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_7__.o),
12770
- /* harmony export */ "default": () => (src),
12771
12865
  /* harmony export */ getStatistics: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.m),
12772
12866
  /* harmony export */ minimalSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_7__.V),
12773
12867
  /* harmony export */ useCodeMirror: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__.q)
@@ -12776,7 +12870,7 @@ __webpack_require__.r(__webpack_exports__);
12776
12870
  /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(644);
12777
12871
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(442);
12778
12872
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
12779
- /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(341);
12873
+ /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(637);
12780
12874
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(742);
12781
12875
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
12782
12876
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(730);
@@ -12797,6 +12891,10 @@ __webpack_require__.r(__webpack_exports__);
12797
12891
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(369);
12798
12892
  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_2__.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_1__/* ["default"] */ .A)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);var _useCodeMirror=(0,_useCodeMirror__WEBPACK_IMPORTED_MODULE_3__/* .useCodeMirror */ .q)({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,setContainer=_useCodeMirror.setContainer;(0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);var setEditorRef=(0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function(el){editor.current=el;setContainer(el);},[setContainer]);// check type of value
12799
12893
  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_4__.jsx)("div",(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({ref:setEditorRef,className:"".concat(defaultClassNames).concat(className?" ".concat(className):'')},other));});ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const src = (ReactCodeMirror);
12894
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
12895
+ /* harmony export */ "default", 0, /* export default binding */ src
12896
+ /* harmony export */ ]);
12897
+
12800
12898
  /******/ return __webpack_exports__;
12801
12899
  /******/ })()
12802
12900
  ;