@notmrabhi/flowforge 0.1.32 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/GatewayBranchEdge-9YF32wwN.js +1 -0
  2. package/dist/GatewayBranchEdge-9YF32wwN.js.map +1 -0
  3. package/dist/GatewayBranchEdge-Dxoy5B1A.js +1 -0
  4. package/dist/GatewayBranchEdge-Dxoy5B1A.js.map +1 -0
  5. package/dist/SchemaBuilderDrawer-B1dLgTM1.js +1 -0
  6. package/dist/SchemaBuilderDrawer-B1dLgTM1.js.map +1 -0
  7. package/dist/SchemaBuilderDrawer-CkUfYbGB.js +1 -0
  8. package/dist/SchemaBuilderDrawer-CkUfYbGB.js.map +1 -0
  9. package/dist/bpmn-CcuE2X_Q.js +1 -0
  10. package/dist/bpmn-CcuE2X_Q.js.map +1 -0
  11. package/dist/bpmn-CtfWDaOY.js +1 -0
  12. package/dist/bpmn-CtfWDaOY.js.map +1 -0
  13. package/dist/canvas.cjs +1 -0
  14. package/dist/canvas.cjs.map +1 -0
  15. package/dist/canvas.js +1 -0
  16. package/dist/canvas.js.map +1 -0
  17. package/dist/canvasTokens-CAD6G24b.js +1 -0
  18. package/dist/canvasTokens-CAD6G24b.js.map +1 -0
  19. package/dist/canvasTokens-gKNYrPl4.js +1 -0
  20. package/dist/canvasTokens-gKNYrPl4.js.map +1 -0
  21. package/dist/core.cjs +1 -0
  22. package/dist/core.cjs.map +1 -0
  23. package/dist/core.js +1 -0
  24. package/dist/core.js.map +1 -0
  25. package/dist/defaultUi.cjs +1 -0
  26. package/dist/defaultUi.cjs.map +1 -0
  27. package/dist/defaultUi.js +1 -0
  28. package/dist/defaultUi.js.map +1 -0
  29. package/dist/form.cjs +1 -0
  30. package/dist/form.cjs.map +1 -0
  31. package/dist/form.js +1 -0
  32. package/dist/form.js.map +1 -0
  33. package/dist/index-8bqYHvzi.js +1 -0
  34. package/dist/index-8bqYHvzi.js.map +1 -0
  35. package/dist/index-B31-Y5uO.js +1 -0
  36. package/dist/index-B31-Y5uO.js.map +1 -0
  37. package/dist/index-B3aHpb84.js +1 -0
  38. package/dist/index-B3aHpb84.js.map +1 -0
  39. package/dist/index-BAg_DA8n.js +1 -0
  40. package/dist/index-BAg_DA8n.js.map +1 -0
  41. package/dist/index-BAiSdZW3.js +1 -0
  42. package/dist/index-BAiSdZW3.js.map +1 -0
  43. package/dist/index-BnzttJ4w.js +1 -0
  44. package/dist/index-BnzttJ4w.js.map +1 -0
  45. package/dist/index-BysKSEtZ.js +1 -0
  46. package/dist/index-BysKSEtZ.js.map +1 -0
  47. package/dist/index-CkjEllpd.js +1 -0
  48. package/dist/index-CkjEllpd.js.map +1 -0
  49. package/dist/index-Cw9DC-tf.js +1 -0
  50. package/dist/index-Cw9DC-tf.js.map +1 -0
  51. package/dist/index-CzPi8KQC.js +1 -0
  52. package/dist/index-CzPi8KQC.js.map +1 -0
  53. package/dist/index-D14V8rKX.js +1 -0
  54. package/dist/index-D14V8rKX.js.map +1 -0
  55. package/dist/index-DNDp8nLT.js +1 -0
  56. package/dist/index-DNDp8nLT.js.map +1 -0
  57. package/dist/index-Dlw7CMau.js +1 -0
  58. package/dist/index-Dlw7CMau.js.map +1 -0
  59. package/dist/index-Dpl-Q8a4.js +1 -0
  60. package/dist/index-Dpl-Q8a4.js.map +1 -0
  61. package/dist/index-gtgq_241.js +1 -0
  62. package/dist/index-gtgq_241.js.map +1 -0
  63. package/dist/index-l6kvDx-m.js +1 -0
  64. package/dist/index-l6kvDx-m.js.map +1 -0
  65. package/dist/index-lcviy90e.js +1 -0
  66. package/dist/index-lcviy90e.js.map +1 -0
  67. package/dist/index-wOnYb3DO.js +1 -0
  68. package/dist/index-wOnYb3DO.js.map +1 -0
  69. package/dist/index.cjs +1 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.js +1 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/messages-CO299wPN.js +1 -0
  74. package/dist/messages-CO299wPN.js.map +1 -0
  75. package/dist/messages-O9Tw_XXR.js +1 -0
  76. package/dist/messages-O9Tw_XXR.js.map +1 -0
  77. package/dist/nodeRegistry.cjs +1 -0
  78. package/dist/nodeRegistry.cjs.map +1 -0
  79. package/dist/nodeRegistry.js +1 -0
  80. package/dist/nodeRegistry.js.map +1 -0
  81. package/dist/templateRegistry.cjs +1 -0
  82. package/dist/templateRegistry.cjs.map +1 -0
  83. package/dist/templateRegistry.js +1 -0
  84. package/dist/templateRegistry.js.map +1 -0
  85. package/dist/templateSkeletons-B5x8nV9i.js +1 -0
  86. package/dist/templateSkeletons-B5x8nV9i.js.map +1 -0
  87. package/dist/templateSkeletons-BdFN__gr.js +1 -0
  88. package/dist/templateSkeletons-BdFN__gr.js.map +1 -0
  89. package/package.json +3 -2
@@ -9,3 +9,4 @@
9
9
  `&&s.lineWrapping&&(i&&(i=k.single(i.main.anchor-1,i.main.head-1)),e={from:r.from,to:r.to,insert:H.of([" "])}),e)return As(s,e,i,o);if(i&&!Fi(i,r)){let l=!1,a="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(l=!0),a=s.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=tl(n.facet(si).map(h=>h(s)),i))),s.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function As(s,t,e,i=-1){if(M.ios&&s.inputState.flushIOSKey(t))return!0;let n=s.state.selection.main;if(M.android&&(t.to==n.to&&(t.from==n.from||t.from==n.from-1&&s.state.sliceDoc(t.from,n.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&ye(s.contentDOM,"Enter",13)||(t.from==n.from-1&&t.to==n.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>n.head)&&ye(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&ye(s.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let o,l=()=>o||(o=Sh(s,t,e));return s.state.facet(qo).some(a=>a(s,t.from,t.to,r,l))||s.dispatch(l()),!0}function Sh(s,t,e){let i,n=s.state,r=n.selection.main,o=-1;if(t.from==t.to&&t.from<r.from||t.from>r.to){let a=t.from<r.from?-1:1,h=a<0?r.from:r.to,f=ze(n.facet(si).map(c=>c(s)),h,a);t.from==f&&(o=f)}if(o>-1)i={changes:t,selection:k.cursor(t.from+t.insert.length,-1)};else if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&s.inputState.composing<0){let a=r.from<t.from?n.sliceDoc(r.from,t.from):"",h=r.to>t.to?n.sliceDoc(t.to,r.to):"";i=n.replaceSelection(s.state.toText(a+t.insert.sliceString(0,void 0,s.state.lineBreak)+h))}else{let a=n.changes(t),h=e&&e.main.to<=a.newLength?e.main:void 0;if(n.selection.ranges.length>1&&(s.inputState.composing>=0||s.inputState.compositionPendingChange)&&t.to<=r.to+10&&t.to>=r.to-10){let f=s.state.sliceDoc(t.from,t.to),c,u=e&&Zo(s,e.main.head);if(u){let p=t.insert.length-(t.to-t.from);c={from:u.from,to:u.to-p}}else c=s.state.doc.lineAt(r.head);let d=r.to-t.to;i=n.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,m=g-f.length;if(s.state.sliceDoc(m,g)!=f||g>=c.from&&m<=c.to)return{range:p};let b=n.changes({from:m,to:g,insert:t.insert}),S=p.to-r.to;return{changes:b,range:h?k.range(Math.max(0,h.anchor+S),Math.max(0,h.head+S)):p.map(b)}})}else i={changes:a,selection:h&&n.selection.replaceRange(h)}}let l="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,l+=".compose",s.inputState.compositionFirstChange&&(l+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:l,scrollIntoView:!0})}function nl(s,t,e,i){let n=Math.min(s.length,t.length),r=0;for(;r<n&&s.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==n&&s.length==t.length)return null;let o=s.length,l=t.length;for(;o>0&&l>0&&s.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));e-=o+a-r}if(o<r&&s.length<t.length){let a=e<=r&&e>=o?r-e:0;r-=a,l=r+(l-o),o=r}else if(l<r){let a=e<=r&&e>=l?r-e:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Ch(s){let t=[];if(s.root.activeElement!=s.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return e&&(t.push(new hr(e,i)),(n!=e||r!=i)&&t.push(new hr(n,r))),t}function Mh(s,t){if(s.length==0)return null;let e=s[0].pos,i=s.length==2?s[1].pos:e;return e>-1&&i>-1?k.single(e+t,i+t):null}function Fi(s,t){return t.head==s.main.head&&t.anchor==s.main.anchor}class Ah{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,M.safari&&t.contentDOM.addEventListener("input",()=>null),M.gecko&&zh(t.contentDOM.ownerDocument)}handleEvent(t){!Lh(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let n of i.observers)n(this.view,e);for(let n of i.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Th(t),i=this.handlers,n=this.view.contentDOM;for(let r in e)if(r!="scroll"){let o=!e[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(n.removeEventListener(r,this.handleEvent),l=null),l||n.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!e[r]&&n.removeEventListener(r,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&rl.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),M.android&&M.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return M.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((e=sl.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||Dh.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,ye(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:M.safari&&!M.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function fr(s,t){return(e,i)=>{try{return t.call(s,i,e)}catch(n){mt(e.state,n)}}}function Th(s){let t=Object.create(null);function e(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of s){let n=i.spec,r=n&&n.plugin.domEventHandlers,o=n&&n.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&e(l).handlers.push(fr(i.value,a))}if(o)for(let l in o){let a=o[l];a&&e(l).observers.push(fr(i.value,a))}}for(let i in kt)e(i).handlers.push(kt[i]);for(let i in lt)e(i).observers.push(lt[i]);return t}const sl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Dh="dthko",rl=[16,17,18,20,91,92,224,225],ui=6;function di(s){return Math.max(0,s)*.7+8}function Oh(s,t){return Math.max(Math.abs(s.clientX-t.clientX),Math.abs(s.clientY-t.clientY))}class Bh{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=Do(t.contentDOM),this.atoms=t.state.facet(si).map(o=>o(t));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(V.allowMultipleSelections)&&Eh(t,e),this.dragging=Ph(t,e)&&al(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Oh(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,i=0,n=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:n,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Ms(this.view);t.clientX-a.left<=n+ui?e=-di(n-t.clientX):t.clientX+a.right>=o-ui&&(e=di(t.clientX-o)),t.clientY-a.top<=r+ui?i=-di(r-t.clientY):t.clientY+a.bottom>=l-ui&&(i=di(t.clientY-l)),this.setScrollSpeed(e,i)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:e}=this,i=tl(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!i.eq(e.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Eh(s,t){let e=s.state.facet(Wo);return e.length?e[0](t):M.mac?t.metaKey:t.ctrlKey}function Rh(s,t){let e=s.state.facet(Vo);return e.length?e[0](t):M.mac?!t.altKey:!t.ctrlKey}function Ph(s,t){let{main:e}=s.state.selection;if(e.empty)return!1;let i=_e(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r<n.length;r++){let o=n[r];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function Lh(s,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=s.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=U.get(e))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const kt=Object.create(null),lt=Object.create(null),ol=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;function Ih(s){let t=s.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{s.focus(),e.remove(),ll(s,e.value)},50)}function en(s,t,e){for(let i of s.facet(t))e=i(e,s);return e}function ll(s,t){t=en(s.state,vs,t);let{state:e}=s,i,n=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(Zn!=null&&e.selection.ranges.every(a=>a.empty)&&Zn==r.toString()){let a=-1;i=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?r.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:k.cursor(h.from+c.length)}})}else o?i=e.changeByRange(a=>{let h=r.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:k.cursor(a.from+h.length)}}):i=e.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}lt.scroll=s=>{s.inputState.lastScrollTop=s.scrollDOM.scrollTop,s.inputState.lastScrollLeft=s.scrollDOM.scrollLeft};lt.wheel=lt.mousewheel=s=>{s.inputState.lastWheelEvent=Date.now()};kt.keydown=(s,t)=>(s.inputState.setSelectionOrigin("select"),t.keyCode==27&&s.inputState.tabFocusMode!=0&&(s.inputState.tabFocusMode=Date.now()+2e3),!1);lt.touchstart=(s,t)=>{let e=s.inputState,i=t.targetTouches[0];e.lastTouchTime=Date.now(),i&&(e.lastTouchX=i.clientX,e.lastTouchY=i.clientY),e.setSelectionOrigin("select.pointer")};lt.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};kt.mousedown=(s,t)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let i of s.state.facet(Fo))if(e=i(s,t),e)break;if(!e&&t.button==0&&(e=Hh(s,t)),e){let i=!s.hasFocus;s.inputState.startMouseSelection(new Bh(s,t,e,i)),i&&s.observer.ignore(()=>{Oo(s.contentDOM);let r=s.root.activeElement;r&&!r.contains(s.contentDOM)&&r.blur()});let n=s.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}else s.inputState.setSelectionOrigin("select.pointer");return!1};function cr(s,t,e,i){if(i==1)return k.cursor(t,e);if(i==2)return dh(s.state,t,e);{let n=s.docView.lineAt(t,e),r=s.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:r.from,l=n?n.posAtEnd:r.to;return l<s.state.doc.length&&l==r.to&&l++,k.range(o,l)}}const Nh=M.ie&&M.ie_version<=11;let ur=null,dr=0,pr=0;function al(s){if(!Nh)return s.detail;let t=ur,e=pr;return ur=s,pr=Date.now(),dr=!t||e>Date.now()-400&&Math.abs(t.clientX-s.clientX)<2&&Math.abs(t.clientY-s.clientY)<2?(dr+1)%3:1}function Hh(s,t){let e=s.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=al(t),n=s.state.selection;return{update(r){r.docChanged&&(e.pos=r.changes.mapPos(e.pos),n=n.map(r.changes))},get(r,o,l){let a=s.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,f=cr(s,a.pos,a.assoc,i);if(e.pos!=a.pos&&!o){let c=cr(s,e.pos,e.assoc,i),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u<f.from?k.range(u,d,f.assoc):k.range(d,u,f.assoc)}return o?n.replaceRange(n.main.extend(f.from,f.to,f.assoc)):l&&i==1&&n.ranges.length>1&&(h=Wh(n,a.pos))?h:l?n.addRange(f):k.create([f])}}}function Wh(s,t){for(let e=0;e<s.ranges.length;e++){let{from:i,to:n}=s.ranges[e];if(i<=t&&n>=t)return k.create(s.ranges.slice(0,e).concat(s.ranges.slice(e+1)),s.mainIndex==e?0:s.mainIndex-(s.mainIndex>e?1:0))}return null}kt.dragstart=(s,t)=>{let{selection:{main:e}}=s.state;if(t.target.draggable){let n=s.docView.tile.nearest(t.target);if(n&&n.isWidget()){let r=n.posAtStart,o=r+n.length;(r>=e.to||o<=e.from)&&(e=k.range(r,o))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",en(s.state,ks,s.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};kt.dragend=s=>(s.inputState.draggedContent=null,!1);function gr(s,t,e,i){if(e=en(s.state,vs,e),!e)return;let n=s.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=s.inputState,o=i&&r&&Rh(s,t)?{from:r.from,to:r.to}:null,l={from:n,insert:e},a=s.state.changes(o?[o,l]:l);s.focus(),s.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),s.inputState.draggedContent=null}kt.drop=(s,t)=>{if(!t.dataTransfer)return!1;if(s.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let i=Array(e.length),n=0,r=()=>{++n==e.length&&gr(s,t,i.filter(o=>o!=null).join(s.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(e[o])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return gr(s,t,i,!0),!0}return!1};kt.paste=(s,t)=>{if(s.state.readOnly)return!0;s.observer.flush();let e=ol?null:t.clipboardData;return e?(ll(s,e.getData("text/plain")||e.getData("text/uri-list")),!0):(Ih(s),!1)};function Vh(s,t){let e=s.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),s.focus()},50)}function Fh(s){let t=[],e=[],i=!1;for(let n of s.selection.ranges)n.empty||(t.push(s.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:r}of s.selection.ranges){let o=s.doc.lineAt(r);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(s.doc.length,o.to+1)})),n=o.number}i=!0}return{text:en(s,ks,t.join(s.lineBreak)),ranges:e,linewise:i}}let Zn=null;kt.copy=kt.cut=(s,t)=>{if(!We(s.contentDOM,s.observer.selectionRange))return!1;let{text:e,ranges:i,linewise:n}=Fh(s.state);if(!e&&!n)return!1;Zn=n?e:null,t.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=ol?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(Vh(s,e),!1)};const hl=fe.define();function fl(s,t){let e=[];for(let i of s.facet(Ko)){let n=i(s,t);n&&e.push(n)}return e.length?s.update({effects:e,annotations:hl.of(!0)}):null}function cl(s){setTimeout(()=>{let t=s.hasFocus;if(t!=s.inputState.notifiedFocused){let e=fl(s.state,t);e?s.dispatch(e):s.update([])}},10)}lt.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),cl(s)};lt.blur=s=>{s.observer.clearSelectionRange(),cl(s)};lt.compositionstart=lt.compositionupdate=s=>{s.observer.editContext||(s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0))};lt.compositionend=s=>{s.observer.editContext||(s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,M.chrome&&M.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50))};lt.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};kt.beforeinput=(s,t)=>{var e,i;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(s.inputState.insertingText=t.data,s.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&s.observer.editContext){let r=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(r&&o.length){let l=o[0],a=s.posAtDOM(l.startContainer,l.startOffset),h=s.posAtDOM(l.endContainer,l.endOffset);return As(s,{from:a,to:h,insert:s.state.toText(r)},null),!0}}let n;if(M.chrome&&M.android&&(n=sl.find(r=>r.inputType==t.inputType))&&(s.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return M.ios&&t.inputType=="deleteContentForward"&&s.observer.flushSoon(),M.safari&&t.inputType=="insertText"&&s.inputState.composing>=0&&setTimeout(()=>lt.compositionend(s,t),20),!1};const mr=new Set;function zh(s){mr.has(s)||(mr.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const br=["pre-wrap","normal","pre-line","break-spaces"];let Ce=!1;function yr(){Ce=!1}class qh{constructor(t){this.lineWrapping=t,this.doc=H.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return br.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let n=t[i];n<0?i++:this.heightSamples[Math.floor(n*10)]||(e=!0,this.heightSamples[Math.floor(n*10)]=!0)}return e}refresh(t,e,i,n,r,o){let l=br.indexOf(t)>-1,a=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){this.heightSamples={};for(let h=0;h<o.length;h++){let f=o[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return a}}class Kh{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class pt{constructor(t,e,i,n,r){this.from=t,this.length=e,this.top=i,this.height=n,this._content=r}get type(){return typeof this._content=="number"?exports.BlockType.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof oe?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new pt(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var j=function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s}(j||(j={}));const Di=.001;class st{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Di&&(Ce=!0),this.height=t)}replace(t,e,i){return st.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let r=this,o=i.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=r.lineAt(a,j.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=h?u:r.lineAt(h,j.ByPosNoHeight,i,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,a<u.from&&(u=r.lineAt(a,j.ByPosNoHeight,i,0,0));f+=u.from-a,a=u.from;let p=Ts.build(i.setDoc(o),t,f,c);r=zi(r,r.replace(a,h,p))}return r.updateHeight(i,0)}static empty(){return new ft(0,0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,n=0,r=0;for(;;)if(e==i)if(n>r*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),i+=1+l.break,n-=l.size}else if(r>n*2){let l=t[i];l.break?t.splice(i,1,l.left,null,l.right):t.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(n<r){let l=t[e++];l&&(n+=l.size)}else{let l=t[--i];l&&(r+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,i++),new jh(st.of(t.slice(0,e)),o,st.of(t.slice(i)))}}function zi(s,t){return s==t?s:(s.constructor!=t.constructor&&(Ce=!0),t)}st.prototype.size=1;const $h=I.replace({});class ul extends st{constructor(t,e,i){super(t,e),this.deco=i,this.spaceAbove=0}mainBlock(t,e){return new pt(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,i,n){return this.spaceAbove&&t<i+this.spaceAbove?new pt(n,0,i,this.spaceAbove,$h):this.mainBlock(i,n)}lineAt(t,e,i,n,r){let o=this.mainBlock(n,r);return this.spaceAbove?this.blockAt(0,i,n,r).join(o):o}forEachLine(t,e,i,n,r,o){t<=r+this.length&&e>=r&&o(this.lineAt(0,j.ByPos,i,n,r))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ft extends ul{constructor(t,e,i){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(t,e){return new pt(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,i){let n=i[0];return i.length==1&&(n instanceof ft||n instanceof Q&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Q?n=new ft(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):st.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setMeasuredHeight(n):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Q extends st{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,r=n-i+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,i,n){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(i,t-c/2);return new pt(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((t-i)/l))),{from:f,length:c}=e.doc.line(r+h);return new pt(f,c,i+l*h,l,0)}}lineAt(t,e,i,n,r){if(e==j.ByHeight)return this.blockAt(t,i,n,r);if(e==j.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(t);return new pt(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,r),h=i.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-r-c);return new pt(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,i,n,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,r);for(let f=t,c=n;f<=e;){let u=i.doc.lineAt(f);if(f==t){let p=u.number-l;c+=a*p+h*(t-r-p)}let d=a+h*u.length;o(new pt(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let r=i[i.length-1];r instanceof Q?i[i.length-1]=new Q(r.length+n):i.push(null,new Q(n-1))}if(t>0){let r=i[0];r instanceof Q?i[0]=new Q(t+r.length):i.unshift(new Q(t-1),null)}return st.of(i)}decomposeLeft(t,e){e.push(new Q(t-1),null)}decomposeRight(t,e){e.push(null,new Q(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let r=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new Q(n.from-e-1).updateHeight(t,e));l<=r&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++],u=0;c<0&&(u=-c,c=n.heights[n.index++]),a==-1?a=c:Math.abs(c-a)>=Di&&(a=-2);let d=new ft(f,c,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new Q(r-l).updateHeight(t,l));let h=st.of(o);return(a<0||Math.abs(h.height-this.height)>=Di||Math.abs(a-this.heightMetrics(t,e).perLine)>=Di)&&(Ce=!0),zi(this,h)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class jh extends st{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,n){let r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,r,n+this.left.length+this.break)}lineAt(t,e,i,n,r){let o=n+this.left.height,l=r+this.left.length+this.break,a=e==j.ByHeight?t<o:t<l,h=a?this.left.lineAt(t,e,i,n,r):this.right.lineAt(t,e,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let f=e==j.ByPosNoHeight?j.ByPosNoHeight:j.ByPos;return a?h.join(this.right.lineAt(l,f,i,o,l)):this.left.lineAt(l,f,i,n,r).join(h)}forEachLine(t,e,i,n,r,o){let l=n+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,i,n,r,o),e>=a&&this.right.forEachLine(t,e,i,l,a,o);else{let h=this.lineAt(a,j.ByPos,i,n,r);t<h.from&&this.left.forEachLine(t,h.from-1,i,n,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,l,a,o)}}replace(t,e,i){let n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let l of i)r.push(l);if(t>0&&wr(r,o-1),e<this.length){let l=r.length;this.decomposeRight(e,r),wr(r,l)}return st.of(r)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?st.of(this.break?[t,null,e]:[t,e]):(this.left=zi(this.left,t),this.right=zi(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:r,right:o}=this,l=e+r.length+this.break,a=null;return n&&n.from<=e+r.length&&n.more?a=r=r.updateHeight(t,e,i,n):r.updateHeight(t,e,i),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,i,n):o.updateHeight(t,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function wr(s,t){let e,i;s[t]==null&&(e=s[t-1])instanceof Q&&(i=s[t+1])instanceof Q&&s.splice(t-1,3,new Q(e.length+1+i.length))}const Uh=5;class Ts{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof ft?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ft(i-this.pos,-1,0)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let o=e-t;i.block?this.addBlock(new ul(o,n,i)):(o||r||n>=Uh)&&this.addLineDeco(n,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new ft(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new Q(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof ft)return t;let e=new ft(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof ft)&&!this.isCovered?this.nodes.push(new ft(0,-1,0)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let n of this.nodes)n instanceof ft&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(t,e,i,n){let r=new Ts(i,t);return P.spans(e,i,n,r,0),r.finish(i)}}function Gh(s,t,e){let i=new _h;return P.compare(s,t,e,i,0),i.changes}class _h{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&be(t,e,this.changes,5)}}function Yh(s,t){let e=s.getBoundingClientRect(),i=s.ownerDocument,n=i.defaultView||window,r=Math.max(0,e.left),o=Math.min(n.innerWidth,e.right),l=Math.max(0,e.top),a=Math.min(n.innerHeight,e.bottom);for(let h=s.parentNode;h&&h!=i.body;)if(h.nodeType==1){let f=h,c=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!="visible"){let u=f.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==s.parentNode?n.innerHeight:a,u.bottom)}h=c.position=="absolute"||c.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-e.left,right:Math.max(r,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function Xh(s){let t=s.getBoundingClientRect(),e=s.ownerDocument.defaultView||window;return t.left<e.innerWidth&&t.right>0&&t.top<e.innerHeight&&t.bottom>0}function Jh(s,t){let e=s.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class pn{constructor(t,e,i,n){this.from=t,this.to=e,this.size=i,this.displaySize=n}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let n=t[i],r=e[i];if(n.from!=r.from||n.to!=r.to||n.size!=r.size)return!1}return!0}draw(t,e){return I.replace({widget:new Qh(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class Qh extends It{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class xr{constructor(t,e){this.view=t,this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=vr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=exports.Direction.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(Ss).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new qh(i),this.stateDeco=kr(e),this.heightMap=st.empty().applyChanges(this.stateDeco,H.empty,this.heightOracle.setDoc(e.doc),[new bt(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=I.set(this.lineGaps.map(n=>n.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some(({from:r,to:o})=>n>=r&&n<=o)){let{from:r,to:o}=this.lineBlockAt(n);t.push(new pi(r,o))}}return this.viewports=t.sort((i,n)=>i.from-n.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?vr:new Ds(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(Pe(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=kr(this.state);let n=t.changedRanges,r=bt.extendWithRanges(n,Gh(i,this.stateDeco,t?t.changes:Y.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);yr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Ce)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<a.from||e.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,t.flags|=this.updateForViewport(),(h||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(jo)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,e=t.contentDOM,i=window.getComputedStyle(e),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?exports.Direction.RTL:exports.Direction.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:C,scaleY:w}=To(e,l);(C>.005&&Math.abs(this.scaleX-C)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=C,this.scaleY=w,h|=16,o=a=!0)}let c=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let d=Do(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Bo(this.scrollParent||t.win);let g=(this.printing?Jh:Yh)(e,this.paddingTop),m=g.top-this.pixelViewport.top,b=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let S=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(S!=this.inView&&(this.inView=S,S&&(a=!0)),!this.inView&&!this.scrollTarget&&!Xh(t.dom))return 0;let A=l.width;if((this.contentDOMWidth!=A||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),a){let C=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(C)&&(o=!0),o||n.lineWrapping&&Math.abs(A-this.contentDOMWidth)>n.charWidth){let{lineHeight:w,charWidth:x,textHeight:E}=t.docView.measureTextSize();o=w>0&&n.refresh(r,w,x,E,Math.max(5,A/x),C),o&&(t.docView.minWidth=0,h|=16)}m>0&&b>0?f=Math.max(m,b):m<0&&b<0&&(f=Math.min(m,b)),yr();for(let w of this.viewports){let x=w.from==this.viewport.from?C:t.docView.measureVisibleLineHeights(w);this.heightMap=(o?st.empty().applyChanges(this.stateDeco,H.empty,this.heightOracle,[new bt(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Kh(w.from,x))}Ce&&(h|=2)}let B=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return B&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||B)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new pi(n.lineAt(o-i*1e3,j.ByHeight,r,0,0).from,n.lineAt(l+(1-i)*1e3,j.ByHeight,r,0,0).to);if(e){let{head:h}=e.range;if(h<a.from||h>a.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,j.ByPos,r,0,0),u;e.y=="center"?u=(c.top+c.bottom)/2-f/2:e.y=="start"||e.y=="nearest"&&h<a.from?u=c.top:u=c.bottom-f,a=new pi(n.lineAt(u-1e3/2,j.ByHeight,r,0,0).from,n.lineAt(u+f+1e3/2,j.ByHeight,r,0,0).to)}}return a}mapViewport(t,e){let i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new pi(this.heightMap.lineAt(i,j.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,j.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(t,j.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,j.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||n<=o-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&r<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let n of t)e.touchesRange(n.from,n.to)||i.push(new pn(e.mapPos(n.from),e.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,r=n>>1,o=n<<1;if(this.defaultTextDirection!=exports.Direction.LTR&&!i)return[];let l=[],a=(f,c,u,d)=>{if(c-f<r)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let b of g)if(b>f&&b<c){a(f,b-10,u,d),a(b+10,c,u,d);return}let m=tf(t,b=>b.from>=u.from&&b.to<=u.to&&Math.abs(b.from-f)<r&&Math.abs(b.to-c)<r&&!g.some(S=>b.from<S&&b.to>S));if(!m){if(c<u.to&&e&&i&&e.visibleRanges.some(A=>A.from<=c&&A.to>=c)){let A=e.moveToLineBoundary(k.cursor(c),!1,!0).head;A>f&&(c=A)}let b=this.gapSize(u,f,c,d),S=i||b<2e6?b:2e6;m=new pn(f,c,b,S)}l.push(m)},h=f=>{if(f.length<o||f.type!=exports.BlockType.Text)return;let c=Zh(f.from,f.to,this.stateDeco);if(c.total<o)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(i){let g=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,m,b;if(u!=null){let S=mi(c,u),A=((this.visibleBottom-this.visibleTop)/2+g)/f.height;m=S-A,b=S+A}else m=(this.visibleTop-f.top-g)/f.height,b=(this.visibleBottom-f.top+g)/f.height;d=gi(c,m),p=gi(c,b)}else{let g=c.total*this.heightOracle.charWidth,m=n*this.heightOracle.charWidth,b=0;if(g>2e6)for(let w of t)w.from>=f.from&&w.from<f.to&&w.size!=w.displaySize&&w.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=w.size-w.displaySize);let S=this.pixelViewport.left+b,A=this.pixelViewport.right+b,B,C;if(u!=null){let w=mi(c,u),x=((A-S)/2+m)/g;B=w-x,C=w+x}else B=(S-m)/g,C=(A+m)/g;d=gi(c,B),p=gi(c,C)}d>f.from&&a(f.from,d,f,c),p<f.to&&a(p,f.to,f,c)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return l}gapSize(t,e,i,n){let r=mi(n,i)-mi(n,e);return this.heightOracle.lineWrapping?t.height*r:n.total*this.heightOracle.charWidth*r}updateLineGaps(t){pn.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=I.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let i=[];P.spans(e,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let r=0;r<i.length&&!(n&8);r++){let o=this.visibleRanges[r],l=i[r];(o.from!=l.from||o.to!=l.to)&&(n|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Pe(this.heightMap.lineAt(t,j.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||Pe(this.heightMap.lineAt(this.scaler.fromDOM(t),j.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Pe(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class pi{constructor(t,e){this.from=t,this.to=e}}function Zh(s,t,e){let i=[],n=s,r=0;return P.spans(e,s,t,{span(){},point(o,l){o>n&&(i.push({from:n,to:o}),r+=o-n),n=l}},20),n<t&&(i.push({from:n,to:t}),r+=t-n),{total:r,ranges:i}}function gi({total:s,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(s*e);for(let n=0;;n++){let{from:r,to:o}=t[n],l=o-r;if(i<=l)return r+i;i-=l}}function mi(s,t){let e=0;for(let{from:i,to:n}of s.ranges){if(t<=n){e+=t-i;break}e+=n-i}return e/s.total}function tf(s,t){for(let e of s)if(t(e))return e}const vr={toDOM(s){return s},fromDOM(s){return s},scale:1,eq(s){return s==this}};function kr(s){let t=s.facet(Qi).filter(i=>typeof i!="function"),e=s.facet(Cs).filter(i=>typeof i!="function");return e.length&&t.push(P.join(e)),t}class Ds{constructor(t,e,i){let n=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=e.lineAt(l,j.ByPos,t,0,0).top,f=e.lineAt(a,j.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return n+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,n=r.domBottom}}fromDOM(t){for(let e=0,i=0,n=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-n)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,n=r.domBottom}}eq(t){return t instanceof Ds?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to):!1}}function Pe(s,t){if(t.scale==1)return s;let e=t.toDOM(s.top),i=t.toDOM(s.bottom);return new pt(s.from,s.length,e,i-e,Array.isArray(s._content)?s._content.map(n=>Pe(n,t)):s._content)}const bi=T.define({combine:s=>s.join(" ")}),ts=T.define({combine:s=>s.indexOf(!0)>-1}),es=_t.newName(),dl=_t.newName(),pl=_t.newName(),gl={"&light":"."+dl,"&dark":"."+pl};function is(s,t,e){return new _t(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return s;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):s+" "+i}})}const ef=is("."+es,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},gl),nf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},gn=M.ie&&M.ie_version<=11;class sf{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Pa,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(M.ie&&M.ie_version<=11||M.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&M.android&&t.constructor.EDIT_CONTEXT!==!1&&!(M.chrome&&M.chrome_version<126)&&(this.editContext=new of(t),t.state.facet(Ht)&&(t.contentDOM.editContext=this.editContext.editContext)),gn&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(Ht)?i.root.activeElement!=this.dom:!We(this.dom,n))return;let r=n.anchorNode&&i.docView.tile.nearest(n.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(M.ie&&M.ie_version<=11||M.android&&M.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Fe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=_e(t.root);if(!e)return!1;let i=M.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&rf(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=We(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Ia(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(i.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=e)i.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,nf),gn&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),gn&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let n=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ye(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let r of t){let o=this.readMutation(r);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:i}=o:(e=Math.min(o.from,e),i=Math.max(o.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&We(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new kh(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,n=il(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!Fi(this.view.state.selection,e.newSel.main))&&this.view.update([]),n}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty(t.type=="attributes"),t.type=="childList"){let i=Sr(e,t.previousSibling||t.target.previousSibling,-1),n=Sr(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Ht)!=t.state.facet(Ht)&&(t.view.contentDOM.editContext=t.state.facet(Ht)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Sr(s,t,e){for(;t;){let i=U.get(t);if(i&&i.parent==s)return i;let n=t.parentNode;t=n!=s.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function Cr(s,t){let e=t.startContainer,i=t.startOffset,n=t.endContainer,r=t.endOffset,o=s.docView.domAtPos(s.state.selection.main.anchor,1);return Fe(o.node,o.offset,n,r)&&([e,i,n,r]=[n,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:n,focusOffset:r}}function rf(s,t){if(t.getComposedRanges){let n=t.getComposedRanges(s.root)[0];if(n)return Cr(s,n)}let e=null;function i(n){n.preventDefault(),n.stopImmediatePropagation(),e=n.getTargetRanges()[0]}return s.contentDOM.addEventListener("beforeinput",i,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",i,!0),e?Cr(s,e):null}class of{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=i=>{let n=t.state.selection.main,{anchor:r,head:o}=n,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&r<this.from?l=r:a==this.to&&r>this.to&&(a=r);let f=nl(t.state.sliceDoc(l,a),i.text,(h?n.from:n.to)-l,h?"end":null);if(!f){let u=k.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Fi(u,n)||t.dispatch({selection:u,userEvent:"select"});return}let c={from:f.from+l,to:f.toA+l,insert:H.of(i.text.slice(f.from,f.toB).split(`
10
10
  `))};if((M.mac||M.android)&&c.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:H.of([i.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);As(t,c,k.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),c.from<c.to&&!c.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(e.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let n=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=t.coordsForChar(o);r=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||r||new DOMRect,n.push(r)}e.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a<h){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;n.push(I.mark({attributes:{style:f}}).range(a,h))}}}t.dispatch({effects:Go.of(I.set(n))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(t.state)}};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let n=_e(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,n=this.pendingContextChange;return t.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let f=h.length-(o-r);if(n&&o>=n.to)if(n.from==r&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,e+=f,this.to+=f;return}else n=null,this.revertPending(t.state);if(r+=e,o+=e,o<=this.from)this.from+=f,this.to+=f;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=f}e+=f}),n&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange,i=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(i.from,i.to)&&t.transactions.some(n=>!n.isUserEvent("input.type")&&n.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),n=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let i=this.composing;return i&&i.drifted?i.editorBase+(t-i.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class O{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(n=>n.forEach(r=>i(r,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=t.root||La(t.parent)||document,this.viewState=new xr(this,t.state||V.create(t)),t.scrollTo&&t.scrollTo.is(ci)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(de).map(n=>new hn(n));for(let n of this.plugins)n.update(this);this.observer=new sf(this),this.inputState=new Ah(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let e=t.length==1&&t[0]instanceof tt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,n,r=this.state;for(let u of t){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(hl))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=fl(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(f=null)):this.observer.clear(),r.facet(V.phrases)!=this.state.facet(V.phrases))return this.setState(r);n=Je.create(this,r,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection,{x:p,y:g}=this.state.facet(O.cursorScrollMargin);c=new we(d.empty?d:k.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",g,p)}for(let d of u.effects)d.is(ci)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=qi.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Re)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(bi)!=n.state.facet(bi)&&(this.viewState.mustMeasureContent=!0),(e||i||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!n.empty)for(let u of this.state.facet(Yn))try{u(n)}catch(d){mt(this.state,d,"update listener")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!il(this,f)&&h.force&&ye(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new xr(this,t),this.plugins=t.facet(de).map(i=>new hn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new lr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(de),i=t.state.facet(de);if(e!=i){let n=[];for(let r of i){let o=e.indexOf(r);if(o<0)n.push(new hn(r));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(i){mt(this.state,i,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Bo(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(p){return mt(this.state,p),Mr}}),c=Je.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c),u&&this.docViewUpdate());for(let d=0;d<h.length;d++)if(f[d]!=Mr)try{let p=h[d];p.write&&p.write(f[d],this)}catch(p){mt(this.state,p)}if(u&&this.docView.updateSelection(!0),!c.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o)/this.scaleY;if((p>1||p<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n=n+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(Yn))l(e)}get themeClasses(){return es+" "+(this.state.facet(ts)?pl:dl)+" "+this.state.facet(bi)}updateAttrs(){let t=Ar(this,_o,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ht)?"true":"false",class:"cm-content",style:`${M.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ar(this,Ss,e);let i=this.observer.ignore(()=>{let n=er(this.contentDOM,this.contentAttrs,e),r=er(this.dom,this.editorAttrs,t);return n||r});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let n of i.effects)if(n.is(O.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Re);let t=this.state.facet(O.cspNonce);_t.mount(this.root,this.styleModules.concat(ef).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return dn(this,t,ar(this,t,e,i))}moveByGroup(t,e){return dn(this,t,ar(this,t,e,i=>mh(this,t.head,i)))}visualLineSide(t,e){let i=this.bidiSpans(t),n=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return k.cursor(r.side(e,n)+t.from,r.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,i=!0){return gh(this,t,e,i)}moveVertically(t,e,i){return dn(this,t,bh(this,t,e,i))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let i=Qn(this,t,e);return i&&i.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),Qn(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),r=this.bidiSpans(n),o=r[xt.find(r,t-n.from,-1,e)];return Ye(i,o.dir==exports.Direction.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet($o)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>lf)return No(t.length);let e=this.textDirectionAt(t.from),i;for(let r of this.bidiCache)if(r.from==t.from&&r.dir==e&&(r.fresh||Io(r.isolates,i=sr(this,t))))return r.order;i||(i=sr(this,t));let n=qa(t.text,e,i);return this.bidiCache.push(new qi(t.from,t.to,e,i,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||M.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Oo(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){var i,n,r,o;return ci.of(new we(typeof t=="number"?k.cursor(t):t,(i=e.y)!==null&&i!==void 0?i:"nearest",(n=e.x)!==null&&n!==void 0?n:"nearest",(r=e.yMargin)!==null&&r!==void 0?r:5,(o=e.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return ci.of(new we(k.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return _.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return _.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=_t.newName(),n=[bi.of(i),Re.of(is(`.${i}`,t))];return e&&e.dark&&n.push(ts.of(!0)),n}static baseTheme(t){return ti.lowest(Re.of(is("."+es,t,gl)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&U.get(i)||U.get(t);return((e=n==null?void 0:n.root)===null||e===void 0?void 0:e.view)||null}}O.styleModule=Re;O.inputHandler=qo;O.clipboardInputFilter=vs;O.clipboardOutputFilter=ks;O.scrollHandler=Uo;O.focusChangeEffect=Ko;O.perLineTextDirection=$o;O.exceptionSink=zo;O.updateListener=Yn;O.editable=Ht;O.mouseSelectionStyle=Fo;O.dragMovesSelection=Vo;O.clickAddsSelectionRange=Wo;O.decorations=Qi;O.blockWrappers=Yo;O.outerDecorations=Cs;O.atomicRanges=si;O.bidiIsolatedRanges=Xo;O.cursorScrollMargin=T.define({combine:s=>{let t=5,e=5;for(let i of s)typeof i=="number"?t=e=i:{x:t,y:e}=i;return{x:t,y:e}}});O.scrollMargins=Jo;O.darkTheme=ts;O.cspNonce=T.define({combine:s=>s.length?s[0]:""});O.contentAttributes=Ss;O.editorAttributes=_o;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=z.define();const lf=4096,Mr={};class qi{constructor(t,e,i,n,r,o){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=r,this.order=o}static update(t,e){if(e.empty&&!t.some(r=>r.fresh))return t;let i=[],n=t.length?t[t.length-1].dir:exports.Direction.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let o=t[r];o.dir==n&&!e.touchesRange(o.from,o.to)&&i.push(new qi(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function Ar(s,t,e){for(let i=s.state.facet(t),n=i.length-1;n>=0;n--){let r=i[n],o=typeof r=="function"?r(s):r;o&&ys(o,e)}return e}const af=M.mac?"mac":M.windows?"win":M.linux?"linux":"key";function hf(s,t){const e=s.split(/-(?!$)/);let i=e[e.length-1];i=="Space"&&(i=" ");let n,r,o,l;for(let a=0;a<e.length-1;++a){const h=e[a];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))n=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))t=="mac"?l=!0:r=!0;else throw new Error("Unrecognized modifier name: "+h)}return n&&(i="Alt-"+i),r&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function yi(s,t,e){return t.altKey&&(s="Alt-"+s),t.ctrlKey&&(s="Ctrl-"+s),t.metaKey&&(s="Meta-"+s),e!==!1&&t.shiftKey&&(s="Shift-"+s),s}const ff=ti.default(O.domEventHandlers({keydown(s,t){return yl(bl(t.state),s,t,"editor")}})),ml=T.define({enables:ff}),Tr=new WeakMap;function bl(s){let t=s.facet(ml),e=Tr.get(t);return e||Tr.set(t,e=df(t.reduce((i,n)=>i.concat(n),[]))),e}function cf(s,t,e){return yl(bl(s.state),t,s,e)}let qt=null;const uf=4e3;function df(s,t=af){let e=Object.create(null),i=Object.create(null),n=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),p=l.split(/ (?!$)/).map(b=>hf(b,t));for(let b=1;b<p.length;b++){let S=p.slice(0,b).join(" ");n(S,!0),d[S]||(d[S]={preventDefault:!0,stopPropagation:!1,run:[A=>{let B=qt={view:A,prefix:S,scope:o};return setTimeout(()=>{qt==B&&(qt=null)},uf),!0}]})}let g=p.join(" ");n(g,!1);let m=d[g]||(d[g]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&m.run.push(a),h&&(m.preventDefault=!0),f&&(m.stopPropagation=!0)};for(let o of s){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:c}=o;for(let u in f)f[u].run.push(d=>c(d,ns))}let a=o[t]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}let ns=null;function yl(s,t,e,i){ns=t;let n=Ta(t),r=ds(n,0),o=lo(r)==n.length&&n!=" ",l="",a=!1,h=!1,f=!1;qt&&qt.view==e&&qt.scope==i&&(l=qt.prefix+" ",rl.indexOf(t.keyCode)<0&&(h=!0,qt=null));let c=new Set,u=m=>{if(m){for(let b of m.run)if(!c.has(b)&&(c.add(b),b(e)))return m.stopPropagation&&(f=!0),!0;m.preventDefault&&(m.stopPropagation&&(f=!0),h=!0)}return!1},d=s[i],p,g;return d&&(u(d[l+yi(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(M.windows&&t.ctrlKey&&t.altKey)&&!(M.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Yt[t.keyCode])&&p!=n?(u(d[l+yi(p,t,!0)])||t.shiftKey&&(g=Ge[t.keyCode])!=n&&g!=p&&u(d[l+yi(g,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+yi(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),ns=null,a}class jt{constructor(t,e,i,n,r){this.className=t,this.left=e,this.top=i,this.width=n,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let n=t.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=wl(t);return[new jt(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return pf(t,e,i)}}function wl(s){let t=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==exports.Direction.LTR?t.left:t.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:t.top-s.scrollDOM.scrollTop*s.scaleY}}function Dr(s,t,e,i){let n=s.coordsAtPos(t,e*2);if(!n)return i;let r=s.dom.getBoundingClientRect(),o=(n.top+n.bottom)/2,l=s.posAtCoords({x:r.left+1,y:o}),a=s.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function pf(s,t,e){if(e.to<=s.viewport.from||e.from>=s.viewport.to)return[];let i=Math.max(e.from,s.viewport.from),n=Math.min(e.to,s.viewport.to),r=s.textDirection==exports.Direction.LTR,o=s.contentDOM,l=o.getBoundingClientRect(),a=wl(s),h=o.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=Jn(s,i,1),p=Jn(s,n,-1),g=d.type==exports.BlockType.Text?d:null,m=p.type==exports.BlockType.Text?p:null;if(g&&(s.lineWrapping||d.widgetLineBreaks)&&(g=Dr(s,i,1,g)),m&&(s.lineWrapping||p.widgetLineBreaks)&&(m=Dr(s,n,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return S(A(e.from,e.to,g));{let C=g?A(e.from,null,g):B(d,!1),w=m?A(null,e.to,m):B(p,!0),x=[];return(g||d).to<(m||p).from-(g&&m?1:0)||d.widgetLineBreaks>1&&C.bottom+s.defaultLineHeight/2<w.top?x.push(b(c,C.bottom,u,w.top)):C.bottom<w.top&&s.elementAtHeight((C.bottom+w.top)/2).type==exports.BlockType.Text&&(C.bottom=w.top=(C.bottom+w.top)/2),S(C).concat(x).concat(S(w))}function b(C,w,x,E){return new jt(t,C-a.left,w-a.top,Math.max(0,x-C),E-w)}function S({top:C,bottom:w,horizontal:x}){let E=[];for(let L=0;L<x.length;L+=2)E.push(b(x[L],C,x[L+1],w));return E}function A(C,w,x){let E=1e9,L=-1e9,q=[];function R(W,$,it,ht,Ct){let J=s.coordsAtPos(W,W==x.to?-2:2),ct=s.coordsAtPos(it,it==x.from?2:-2);!J||!ct||(E=Math.min(J.top,ct.top,E),L=Math.max(J.bottom,ct.bottom,L),Ct==exports.Direction.LTR?q.push(r&&$?c:J.left,r&&ht?u:ct.right):q.push(!r&&ht?c:ct.left,!r&&$?u:J.right))}let D=C??x.from,F=w??x.to;for(let W of s.visibleRanges)if(W.to>D&&W.from<F)for(let $=Math.max(W.from,D),it=Math.min(W.to,F);;){let ht=s.state.doc.lineAt($);for(let Ct of s.bidiSpans(ht)){let J=Ct.from+ht.from,ct=Ct.to+ht.from;if(J>=it)break;ct>$&&R(Math.max(J,$),C==null&&J<=D,Math.min(ct,it),w==null&&ct>=F,Ct.dir)}if($=ht.to+1,$>=it)break}return q.length==0&&R(D,C==null,F,w==null,s.textDirection),{top:E,bottom:L,horizontal:q}}function B(C,w){let x=l.top+(w?C.top:C.bottom);return{top:x,bottom:x,horizontal:[]}}}function gf(s,t){return s.constructor==t.constructor&&s.eq(t)}class mf{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Oi)!=t.state.facet(Oi)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Oi);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:e}=this.view;(t!=this.scaleX||e!=this.scaleY)&&(this.scaleX=t,this.scaleY=e,this.dom.style.transform=`scale(${1/t}, ${1/e})`)}draw(t){if(t.length!=this.drawn.length||t.some((e,i)=>!gf(e,this.drawn[i]))){let e=this.dom.firstChild,i=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[i].constructor&&n.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t,M.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Oi=T.define();function Os(s){return[_.define(t=>new mf(t,s)),Oi.of(s)]}const Me=T.define({combine(s){return Te(s,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function bf(s={}){return[Me.of(s),yf,wf,xf,jo.of(!0)]}function xl(s){return s.startState.facet(Me)!=s.state.facet(Me)}const yf=Os({above:!0,markers(s){let{state:t}=s,e=t.facet(Me),i=[];for(let n of t.selection.ranges){let r=n==t.selection.main;if(n.empty||e.drawRangeCursor&&!(r&&M.ios&&e.iosSelectionHandles)){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=n.empty?n:k.cursor(n.head,n.assoc);for(let a of jt.forRange(s,o,l))i.push(a)}}return i},update(s,t){s.transactions.some(i=>i.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let e=xl(s);return e&&Or(s.state,t),s.docChanged||s.selectionSet||e},mount(s,t){Or(t.state,s)},class:"cm-cursorLayer"});function Or(s,t){t.style.animationDuration=s.facet(Me).cursorBlinkRate+"ms"}const wf=Os({above:!1,markers(s){let t=[],{main:e,ranges:i}=s.state.selection;for(let n of i)if(!n.empty)for(let r of jt.forRange(s,"cm-selectionBackground",n))t.push(r);if(M.ios&&!e.empty&&s.state.facet(Me).iosSelectionHandles){for(let n of jt.forRange(s,"cm-selectionHandle cm-selectionHandle-start",k.cursor(e.from,1)))t.push(n);for(let n of jt.forRange(s,"cm-selectionHandle cm-selectionHandle-end",k.cursor(e.to,1)))t.push(n)}return t},update(s,t){return s.docChanged||s.selectionSet||s.viewportChanged||xl(s)},class:"cm-selectionLayer"}),xf=ti.highest(O.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),vl=z.define({map(s,t){return s==null?null:t.mapPos(s)}}),Le=yt.define({create(){return null},update(s,t){return s!=null&&(s=t.changes.mapPos(s)),t.effects.reduce((e,i)=>i.is(vl)?i.value:e,s)}}),vf=_.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var t;let e=s.state.field(Le);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(s.startState.field(Le)!=e||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:s}=this,t=s.state.field(Le),e=t!=null&&s.coordsAtPos(t);if(!e)return null;let i=s.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+s.scrollDOM.scrollLeft*s.scaleX,top:e.top-i.top+s.scrollDOM.scrollTop*s.scaleY,height:e.bottom-e.top}}drawCursor(s){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;s?(this.cursor.style.left=s.left/t+"px",this.cursor.style.top=s.top/e+"px",this.cursor.style.height=s.height/e+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(Le)!=s&&this.view.dispatch({effects:vl.of(s)})}},{eventObservers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function kf(){return[Le,vf]}function Br(s,t,e,i,n){t.lastIndex=0;for(let r=s.iterRange(e,i),o=e,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=t.exec(r.value);)n(o+l.index,l)}function Sf(s,t){let e=s.visibleRanges;if(e.length==1&&e[0].from==s.viewport.from&&e[0].to==s.viewport.to)return e;let i=[];for(let{from:n,to:r}of e)n=Math.max(s.state.doc.lineAt(n).from,n-t),r=Math.min(s.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=n?i[i.length-1].to=r:i.push({from:n,to:r});return i}class kl{constructor(t){const{regexp:e,decoration:i,decorate:n,boundary:r,maxLength:o=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,n)this.addMatch=(l,a,h,f)=>n(f,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,f)=>{let c=i(l,a,h);c&&f(h,h+l[0].length,c)};else if(i)this.addMatch=(l,a,h,f)=>f(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(t){let e=new Gt,i=e.add.bind(e);for(let{from:n,to:r}of Sf(t,this.maxLength))Br(t.state.doc,this.regexp,n,r,(o,l)=>this.addMatch(l,t,o,i));return e.finish()}updateDeco(t,e){let i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges((r,o,l,a)=>{a>=t.view.viewport.from&&l<=t.view.viewport.to&&(i=Math.min(l,i),n=Math.max(a,n))}),t.viewportMoved||n-i>1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}updateRange(t,e,i,n){for(let r of t.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,n);if(l>=o){let a=t.state.doc.lineAt(o),h=a.to<l?t.state.doc.lineAt(l):a,f=Math.max(r.from,a.from),c=Math.min(r.to,h.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){f=o;break}for(;l<h.to;l++)if(this.boundary.test(h.text[l-h.from])){c=l;break}}let u=[],d,p=(g,m,b)=>u.push(b.range(g,m));if(a==h)for(this.regexp.lastIndex=f-a.from;(d=this.regexp.exec(a.text))&&d.index<c-a.from;)this.addMatch(d,t,d.index+a.from,p);else Br(t.state.doc,this.regexp,f,c,(g,m)=>this.addMatch(m,t,g,p));e=e.update({filterFrom:f,filterTo:c,filter:(g,m)=>g<f||m>c,add:u})}}return e}}const ss=/x/.unicode!=null?"gu":"g",Cf=new RegExp(`[\0-\b
11
11
  --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,ss),Mf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let mn=null;function Af(){var s;if(mn==null&&typeof document<"u"&&document.body){let t=document.body.style;mn=((s=t.tabSize)!==null&&s!==void 0?s:t.MozTabSize)!=null}return mn||!1}const Bi=T.define({combine(s){let t=Te(s,{render:null,specialChars:Cf,addSpecialChars:null});return(t.replaceTabs=!Af())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,ss)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,ss)),t}});function Tf(s={}){return[Bi.of(s),Df()]}let Er=null;function Df(){return Er||(Er=_.fromClass(class{constructor(s){this.view=s,this.decorations=I.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(Bi)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new kl({regexp:s.specialChars,decoration:(t,e,i)=>{let{doc:n}=e.state,r=ds(t[0],0);if(r==9){let o=n.lineAt(i),l=e.state.tabSize,a=Xi(o.text,l,i-o.from);return I.replace({widget:new Rf((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=I.replace({widget:new Ef(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let t=s.state.facet(Bi);s.startState.facet(Bi)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const Of="•";function Bf(s){return s>=32?Of:s==10?"␤":String.fromCharCode(9216+s)}class Ef extends It{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=Bf(this.code),i=t.state.phrase("Control character")+" "+(Mf[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,e);if(n)return n;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Rf extends It{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function Pf(){return If}const Lf=I.line({class:"cm-activeLine"}),If=_.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let t=-1,e=[];for(let i of s.state.selection.ranges){let n=s.lineBlockAt(i.head);n.from>t&&(e.push(Lf.range(n.from)),t=n.from)}return I.set(e)}},{decorations:s=>s.decorations});class Nf extends It{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?Ve(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),n=Ye(e[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}}function Hf(s){let t=_.fromClass(class{constructor(e){this.view=e,this.placeholder=s?I.set([I.widget({widget:new Nf(s),side:1}).range(0)]):I.none}get decorations(){return this.view.state.doc.length?I.none:this.placeholder}},{decorations:e=>e.decorations});return typeof s=="string"?[t,O.contentAttributes.of({"aria-placeholder":s})]:t}const rs=2e3;function Wf(s,t,e){let i=Math.min(t.line,e.line),n=Math.max(t.line,e.line),r=[];if(t.off>rs||e.off>rs||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=i;a<=n;a++){let h=s.doc.line(a);h.length<=l&&r.push(k.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=i;a<=n;a++){let h=s.doc.line(a),f=Ii(h.text,o,s.tabSize,!0);if(f<0)r.push(k.cursor(h.to));else{let c=Ii(h.text,l,s.tabSize);r.push(k.range(h.from+f,h.from+c))}}}return r}function Vf(s,t){let e=s.coordsAtPos(s.viewport.from);return e?Math.round(Math.abs((e.left-t)/s.defaultCharacterWidth)):-1}function Rr(s,t){let e=s.posAtCoords({x:t.clientX,y:t.clientY},!1),i=s.state.doc.lineAt(e),n=e-i.from,r=n>rs?-1:n==i.length?Vf(s,t.clientX):Xi(i.text,s.state.tabSize,e-i.from);return{line:i.number,col:r,off:n}}function Ff(s,t){let e=Rr(s,t),i=s.state.selection;return e?{update(n){if(n.docChanged){let r=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(r);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},i=i.map(n.changes)}},get(n,r,o){let l=Rr(s,n);if(!l)return i;let a=Wf(s.state,e,l);return a.length?o?k.create(a.concat(i.ranges)):k.create(a):i}}:null}function zf(s){let t=e=>e.altKey&&e.button==0;return O.mouseSelectionStyle.of((e,i)=>t(i)?Ff(e,i):null)}const qf={Alt:[18,s=>!!s.altKey],Control:[17,s=>!!s.ctrlKey],Shift:[16,s=>!!s.shiftKey],Meta:[91,s=>!!s.metaKey]},Kf={style:"cursor: crosshair"};function $f(s={}){let[t,e]=qf[s.key||"Alt"],i=_.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[i,O.contentAttributes.of(n=>{var r;return!((r=n.plugin(i))===null||r===void 0)&&r.isDown?Kf:null})]}const wi="-10000px";class Sl{constructor(t,e,i,n){this.facet=e,this.createTooltipView=i,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(t,e){var i;let n=t.state.facet(this.facet),r=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;a<r.length;a++){let h=r[a],f=-1;if(h){for(let c=0;c<this.tooltips.length;c++){let u=this.tooltips[c];u&&u.create==h.create&&(f=c)}if(f<0)o[a]=this.createTooltipView(h,a?o[a-1]:null),l&&(l[a]=!!h.above);else{let c=o[a]=this.tooltipViews[f];l&&(l[a]=e[f]),c.update&&c.update(t)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(i=a.destroy)===null||i===void 0||i.call(a));return e&&(l.forEach((a,h)=>e[h]=a),e.length=l.length),this.input=n,this.tooltips=r,this.tooltipViews=o,!0}}function jf(s){let t=s.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const bn=T.define({combine:s=>{var t,e,i;return{position:M.ios?"absolute":((t=s.find(n=>n.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((e=s.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((i=s.find(n=>n.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||jf}}}),Pr=new WeakMap,Bs=_.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=s.state.facet(bn);this.position=t.position,this.parent=t.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Sl(s,Es,(e,i)=>this.createTooltip(e,i),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),s.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(s,this.above);t&&this.observeIntersection();let e=t||s.geometryChanged,i=s.state.facet(bn);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(s,t){let e=s.create(this.view),i=t?t.dom:null;if(e.dom.classList.add("cm-tooltip"),s.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",e.dom.appendChild(n)}return e.dom.style.position=this.position,e.dom.style.top=wi,e.dom.style.left="0px",this.container.insertBefore(e.dom,i),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var s,t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(s=i.destroy)===null||s===void 0||s.call(i);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=1,t=1,e=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(M.safari){let o=r.getBoundingClientRect();e=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else e=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(e||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(s=r.width/this.parent.offsetWidth,t=r.height/this.parent.offsetHeight)}else({scaleX:s,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),n=Ms(this.view);return{visible:{left:i.left+n.left,top:i.top+n.top,right:i.right-n.right,bottom:i.bottom-n.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(bn).tooltipSpace(this.view),scaleX:s,scaleY:t,makeAbsolute:e}}writeMeasure(s){var t;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:e,space:i,scaleX:n,scaleY:r}=s,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:f}=h,c=s.pos[l],u=s.size[l];if(!c||a.clip!==!1&&(c.bottom<=Math.max(e.top,i.top)||c.top>=Math.min(e.bottom,i.bottom)||c.right<Math.max(e.left,i.left)-.1||c.left>Math.min(e.right,i.right)+.1)){f.style.top=wi;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,g=u.right-u.left,m=(t=Pr.get(h))!==null&&t!==void 0?t:u.bottom-u.top,b=h.offset||Gf,S=this.view.textDirection==exports.Direction.LTR,A=u.width>i.right-i.left?S?i.left:i.right-u.width:S?Math.max(i.left,Math.min(c.left-(d?14:0)+b.x,i.right-g)):Math.min(Math.max(i.left,c.left-g+(d?14:0)-b.x),i.right-g),B=this.above[l];!a.strictSide&&(B?c.top-m-p-b.y<i.top:c.bottom+m+p+b.y>i.bottom)&&B==i.bottom-c.bottom>c.top-i.top&&(B=this.above[l]=!B);let C=(B?c.top-i.top:i.bottom-c.bottom)-p;if(C<m&&h.resize!==!1){if(C<this.view.defaultLineHeight){f.style.top=wi;continue}Pr.set(h,m),f.style.height=(m=C)/r+"px"}else f.style.height&&(f.style.height="");let w=B?c.top-m-p-b.y:c.bottom+p+b.y,x=A+g;if(h.overlap!==!0)for(let E of o)E.left<x&&E.right>A&&E.top<w+m&&E.bottom>w&&(w=B?E.top-m-2-p:E.bottom+p+2);if(this.position=="absolute"?(f.style.top=(w-s.parent.top)/r+"px",Lr(f,(A-s.parent.left)/n)):(f.style.top=w/r+"px",Lr(f,A/n)),d){let E=c.left+(S?b.x:-b.x)-(A+14-7);d.style.left=E/n+"px"}h.overlap!==!0&&o.push({left:A,top:w,right:x,bottom:w+m}),f.classList.toggle("cm-tooltip-above",B),f.classList.toggle("cm-tooltip-below",!B),h.positioned&&h.positioned(s.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let s of this.manager.tooltipViews)s.dom.style.top=wi}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Lr(s,t){let e=parseInt(s.style.left,10);(isNaN(e)||Math.abs(t-e)>1)&&(s.style.left=t+"px")}const Uf=O.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Gf={x:0,y:0},Es=T.define({enables:[Bs,Uf]}),Ki=T.define({combine:s=>s.reduce((t,e)=>t.concat(e),[])});class nn{static create(t){return new nn(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Sl(t,Ki,(e,i)=>this.createHostedView(e,i),e=>e.dom.remove())}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let n=i[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const _f=Es.compute([Ki],s=>{let t=s.facet(Ki);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var i;return(i=e.end)!==null&&i!==void 0?i:e.pos})),create:nn.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Yf{constructor(t,e,i,n,r){this.view=t,this.source=e,this.field=i,this.setHover=n,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,i=t.docView.tile.nearest(e.target);if(!i)return;let n,r=1;if(i.isWidget())n=i.posAtStart;else{if(n=t.posAtCoords(e),n==null)return;let l=t.coordsAtPos(n);if(!l||e.y<l.top||e.y>l.bottom||e.x<l.left-t.defaultCharacterWidth||e.x>l.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==exports.Direction.RTL?-1:1;r=e.x<l.left?-h:h}let o=this.source(t,n,r);if(o!=null&&o.then){let l=this.pending={pos:n};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>mt(t.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Bs),e=t?t.manager.tooltips.findIndex(i=>i.create==nn.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:r}=this;if(n.length&&r&&!Xf(r.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(i=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Jf(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:i}=this;i&&i.dom.contains(t.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const xi=4;function Xf(s,t){let{left:e,right:i,top:n,bottom:r}=s.getBoundingClientRect(),o;if(o=s.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();n=Math.min(l.top,n),r=Math.max(l.bottom,r)}return t.clientX>=e-xi&&t.clientX<=i+xi&&t.clientY>=n-xi&&t.clientY<=r+xi}function Jf(s,t,e,i,n,r){let o=s.scrollDOM.getBoundingClientRect(),l=s.documentTop+s.documentPadding.top+s.contentHeight;if(o.left>i||o.right<i||o.top>n||Math.min(o.bottom,l)<n)return!1;let a=s.posAtCoords({x:i,y:n},!1);return a>=t&&a<=e}function Qf(s,t={}){let e=z.define(),i=yt.define({create(){return[]},update(n,r){if(n.length&&(t.hideOnChange&&(r.docChanged||r.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(r,o))),r.docChanged)){let o=[];for(let l of n){let a=r.changes.mapPos(l.pos,-1,exports.MapMode.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of r.effects)o.is(e)&&(n=o.value),o.is(tc)&&(n=[]);return n},provide:n=>Ki.from(n)});return{active:i,extension:[i,_.define(n=>new Yf(n,s,i,e,t.hoverTime||300)),_f]}}function Zf(s,t){let e=s.plugin(Bs);if(!e)return null;let i=e.manager.tooltips.indexOf(t);return i<0?null:e.manager.tooltipViews[i]}const tc=z.define(),Ir=T.define({combine(s){let t,e;for(let i of s)t=t||i.topContainer,e=e||i.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ec(s,t){let e=s.plugin(Cl),i=e?e.specs.indexOf(t):-1;return i>-1?e.panels[i]:null}const Cl=_.fromClass(class{constructor(s){this.input=s.state.facet($i),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(s));let t=s.state.facet(Ir);this.top=new vi(s,!0,t.topContainer),this.bottom=new vi(s,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(s){let t=s.state.facet(Ir);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new vi(s.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new vi(s.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=s.state.facet($i);if(e!=this.input){let i=e.filter(a=>a),n=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),f;h<0?(f=a(s.view),l.push(f)):(f=this.panels[h],f.update&&f.update(s)),n.push(f),(f.top?r:o).push(f)}this.specs=i,this.panels=n,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>O.scrollMargins.of(t=>{let e=t.plugin(s);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})});class vi{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Nr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Nr(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Nr(s){let t=s.nextSibling;return s.remove(),t}const $i=T.define({enables:Cl});function ic(s,t){let e,i=new Promise(o=>e=o),n=o=>nc(o,t,e);s.state.field(yn,!1)?s.dispatch({effects:Ml.of(n)}):s.dispatch({effects:z.appendConfig.of(yn.init(()=>[n]))});let r=Al.of(n);return{close:r,result:i.then(o=>((s.win.queueMicrotask||(a=>s.win.setTimeout(a,10)))(()=>{s.state.field(yn).indexOf(n)>-1&&s.dispatch({effects:r})}),o))}}const yn=yt.define({create(){return[]},update(s,t){for(let e of t.effects)e.is(Ml)?s=[e.value].concat(s):e.is(Al)&&(s=s.filter(i=>i!=e.value));return s},provide:s=>$i.computeN([s],t=>t.field(s))}),Ml=z.define(),Al=z.define();function nc(s,t,e){let i=t.content?t.content(s,()=>o(null)):null;if(!i){if(i=ee("form"),t.input){let l=ee("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(ee("label",(t.label||"")+": ",l))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(ee("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let n=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l<n.length;l++){let a=n[l];a.addEventListener("keydown",h=>{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let r=ee("div",i,ee("button",{onclick:()=>o(null),"aria-label":s.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(r.className=t.class),r.classList.add("cm-dialog");function o(l){r.contains(r.ownerDocument.activeElement)&&s.focus(),e(l)}return{dom:r,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=i.querySelector(t.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Lt extends Ut{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Lt.prototype.elementClass="";Lt.prototype.toDOM=void 0;Lt.prototype.mapMode=exports.MapMode.TrackBefore;Lt.prototype.startSide=Lt.prototype.endSide=-1;Lt.prototype.point=!0;const qe=T.define(),Tl=T.define(),sc={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>P.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ke=T.define();function Dl(s){return[Rs(),Ke.of({...sc,...s})]}const Hr=T.define({combine:s=>s.some(t=>t)});function Rs(s){return[rc]}const rc=_.fromClass(class{constructor(s){this.view=s,this.domAfter=null,this.prevViewport=s.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=s.state.facet(Ke).map(t=>new Vr(s,t)),this.fixed=!s.state.facet(Hr);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),s.scrollDOM.insertBefore(this.dom,s.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(s){if(this.updateGutters(s)){let t=this.prevViewport,e=s.view.viewport,i=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(i<(e.to-e.from)*.8)}if(s.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(Hr)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=s.view.viewport}syncGutters(s){let t=this.dom.nextSibling;s&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let e=P.iter(this.view.state.facet(qe),this.view.viewport.from),i=[],n=this.gutters.map(r=>new oc(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==exports.BlockType.Text&&o){os(e,i,l.from);for(let a of n)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(r.type==exports.BlockType.Text){os(e,i,r.from);for(let o of n)o.line(this.view,r,i)}else if(r.widget)for(let o of n)o.widget(this.view,r);for(let r of n)r.finish();s&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(s){let t=s.startState.facet(Ke),e=s.state.facet(Ke),i=s.docChanged||s.heightChanged||s.viewportChanged||!P.eq(s.startState.facet(qe),s.state.facet(qe),s.view.viewport.from,s.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(s)&&(i=!0);else{i=!0;let n=[];for(let r of e){let o=t.indexOf(r);o<0?n.push(new Vr(this.view,r)):(this.gutters[o].update(s),n.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),n.indexOf(r)<0&&r.destroy();for(let r of n)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=n}return i}destroy(){for(let s of this.gutters)s.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:s=>O.scrollMargins.of(t=>{let e=t.plugin(s);if(!e||e.gutters.length==0||!e.fixed)return null;let i=e.dom.offsetWidth*t.scaleX,n=e.domAfter?e.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==exports.Direction.LTR?{left:i,right:n}:{right:i,left:n}})});function Wr(s){return Array.isArray(s)?s:[s]}function os(s,t,e){for(;s.value&&s.from<=e;)s.from==e&&t.push(s.value),s.next()}class oc{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=P.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,r=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ol(t,o,r,i);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,r,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];os(this.cursor,n,e.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e),n=i?[i]:null;for(let r of t.state.facet(Tl)){let o=r(t,e.widget,e);o&&(n||(n=[])).push(o)}n&&this.addElement(t,e,n)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Vr{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,n=>{let r=n.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[i](t,l,n)&&n.preventDefault()});this.markers=Wr(e.markers(t)),e.initialSpacer&&(this.spacer=new Ol(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Wr(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let i=t.view.viewport;return!P.eq(this.markers,e,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Ol{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),lc(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let i="cm-gutterElement",n=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=r<e.length?e[r++]:null,h=!1;if(a){let f=a.elementClass;f&&(i+=" "+f);for(let c=o;c<this.markers.length;c++)if(this.markers[c].compare(a)){l=c,h=!0;break}}else l=this.markers.length;for(;o<l;){let f=this.markers[o++];if(f.toDOM){f.destroy(n);let c=n.nextSibling;n.remove(),n=c}}if(!a)break;a.toDOM&&(h?n=n.nextSibling:this.dom.insertBefore(a.toDOM(t),n)),h&&o++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}}function lc(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(!s[e].compare(t[e]))return!1;return!0}const Bl=T.define(),El=T.define(),pe=T.define({combine(s){return Te(s,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let n in e){let r=i[n],o=e[n];i[n]=r?(l,a,h)=>r(l,a,h)||o(l,a,h):o}return i}})}});class wn extends Lt{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function xn(s,t){return s.state.facet(pe).formatNumber(t,s.state)}const ac=Ke.compute([pe],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Bl)},lineMarker(t,e,i){return i.some(n=>n.toDOM)?null:new wn(xn(t,t.state.doc.lineAt(e.from).number))},widgetMarker:(t,e,i)=>{for(let n of t.state.facet(El)){let r=n(t,e,i);if(r)return r}return null},lineMarkerChange:t=>t.startState.facet(pe)!=t.state.facet(pe),initialSpacer(t){return new wn(xn(t,Fr(t.state.doc.lines)))},updateSpacer(t,e){let i=xn(e.view,Fr(e.view.state.doc.lines));return i==t.number?t:new wn(i)},domEventHandlers:s.facet(pe).domEventHandlers,side:"before"}));function hc(s={}){return[pe.of(s),Rs(),ac]}function Fr(s){let t=9;for(;t<s;)t=t*10+9;return t}const fc=new class extends Lt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},cc=qe.compute(["selection"],s=>{let t=[],e=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.head).from;n>e&&(e=n,t.push(fc.range(n)))}return P.of(t)});function uc(){return cc}const Rl=1024;let dc=0;class vn{constructor(t,e){this.from=t,this.to=e}}class N{constructor(t={}){this.id=dc++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=at.match(t)),e=>{let i=t(e);return i===void 0?null:[this,i]}}}N.closedBy=new N({deserialize:s=>s.split(" ")});N.openedBy=new N({deserialize:s=>s.split(" ")});N.group=new N({deserialize:s=>s.split(" ")});N.isolate=new N({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});N.contextHash=new N({perNode:!0});N.lookAhead=new N({perNode:!0});N.mounted=new N({perNode:!0});class $e{constructor(t,e,i,n=!1){this.tree=t,this.overlay=e,this.parser=i,this.bracketed=n}static get(t){return t&&t.props&&t.props[N.mounted.id]}}const pc=Object.create(null);class at{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):pc,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new at(t.name||"",e,t.id,i);if(t.props){for(let r of t.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[r[0].id]=r[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(N.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return i=>{for(let n=i.prop(N.group),r=-1;r<(n?n.length:0);r++){let o=e[r<0?i.name:n[r]];if(o)return o}}}}at.none=new at("",Object.create(null),0,8);class Ps{constructor(t){this.types=t;for(let e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let e=[];for(let i of this.types){let n=null;for(let r of t){let o=r(i);if(o){n||(n=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in n&&(l=a.combine(n[a.id],l)),n[a.id]=l}}e.push(n?new at(i.name,n,i.id,i.flags):i)}return new Ps(e)}}const ki=new WeakMap,zr=new WeakMap;exports.IterMode=void 0;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(exports.IterMode||(exports.IterMode={}));class X{constructor(t,e,i,n,r){if(this.type=t,this.children=e,this.positions=i,this.length=n,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,l]of r)this.props[typeof o=="number"?o:o.id]=l}}toString(){let t=$e.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let i of this.children){let n=i.toString();n&&(e&&(e+=","),e+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new as(this.topNode,t)}cursorAt(t,e=0,i=0){let n=ki.get(this)||this.topNode,r=new as(n);return r.moveTo(t,e),ki.set(this,r._tree),r}get topNode(){return new ot(this,0,0,null)}resolve(t,e=0){let i=Qe(ki.get(this)||this.topNode,t,e,!1);return ki.set(this,i),i}resolveInner(t,e=0){let i=Qe(zr.get(this)||this.topNode,t,e,!0);return zr.set(this,i),i}resolveStack(t,e=0){return bc(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,o=t.mode||0,l=(o&exports.IterMode.IncludeAnonymous)>0;for(let a=this.cursor(o|exports.IterMode.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ns(at.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new X(this.type,e,i,n,this.propValues),t.makeTree||((e,i,n)=>new X(at.none,e,i,n)))}static build(t){return yc(t)}}X.empty=new X(at.none,[],[],0);class Ls{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ls(this.buffer,this.index)}}class Jt{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return at.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],i=this.buffer[t+3],n=this.set.types[e],r=n.name;if(/\W/.test(r)&&!n.isError&&(r=JSON.stringify(r)),t+=4,i==t)return r;let o=[];for(;t<i;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}findChild(t,e,i,n,r){let{buffer:o}=this,l=-1;for(let a=t;a!=e&&!(Pl(r,n,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(t,e,i){let n=this.buffer,r=new Uint16Array(e-t),o=0;for(let l=t,a=0;l<e;){r[a++]=n[l++],r[a++]=n[l++]-i;let h=r[a++]=n[l++]-i;r[a++]=n[l++]-t,o=Math.max(o,h)}return new Jt(r,o,this.set)}}function Pl(s,t,e,i){switch(s){case-2:return e<t;case-1:return i>=t&&e<t;case 0:return e<t&&i>t;case 1:return e<=t&&i>t;case 2:return i>t;case 4:return!0}}function Qe(s,t,e,i){for(var n;s.from==s.to||(e<1?s.from>=t:s.from>t)||(e>-1?s.to<=t:s.to<t);){let o=!i&&s instanceof ot&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:exports.IterMode.IgnoreOverlays;if(i)for(let o=s,l=o.parent;l;o=l,l=o.parent)o instanceof ot&&o.index<0&&((n=l.enter(t,e,r))===null||n===void 0?void 0:n.from)!=o.from&&(s=l);for(;;){let o=s.enter(t,e,r);if(!o)return s;s=o}}class Ll{cursor(t=0){return new as(this,t)}getChild(t,e=null,i=null){let n=qr(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return qr(this,t,e,i)}resolve(t,e=0){return Qe(this,t,e,!1)}resolveInner(t,e=0){return Qe(this,t,e,!0)}matchContext(t){return ls(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),i=this;for(;e;){let n=e.lastChild;if(!n||n.to!=e.to)break;n.type.isError&&n.from==n.to?(i=e,e=n.prevSibling):e=n}return i}get node(){return this}get next(){return this.parent}}class ot extends Ll{constructor(t,e,i,n){super(),this._tree=t,this.from=e,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,i,n,r=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=e>0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from,u;if(!(!(r&exports.IterMode.EnterBracketed&&f instanceof X&&(u=$e.get(f))&&!u.overlay&&u.bracketed&&i>=c&&i<=c+f.length)&&!Pl(n,i,c,c+f.length))){if(f instanceof Jt){if(r&exports.IterMode.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,e,i-c,n);if(d>-1)return new Rt(new gc(o,f,t,c),null,d)}else if(r&exports.IterMode.IncludeAnonymous||!f.type.isAnonymous||Is(f)){let d;if(!(r&exports.IterMode.IgnoreMounts)&&(d=$e.get(f))&&!d.overlay)return new ot(d.tree,c,t,o);let p=new ot(f,c,t,o);return r&exports.IterMode.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?f.children.length-1:0,e,i,n,r)}}}if(r&exports.IterMode.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,i=0){let n;if(!(i&exports.IterMode.IgnoreOverlays)&&(n=$e.get(this._tree))&&n.overlay){let r=t-this.from,o=i&exports.IterMode.EnterBracketed&&n.bracketed;for(let{from:l,to:a}of n.overlay)if((e>0||o?l<=r:l<r)&&(e<0||o?a>=r:a>r))return new ot(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function qr(s,t,e,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(t)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function ls(s,t,e=t.length-1){for(let i=s;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[e]&&t[e]!=i.name)return!1;e--}}return!0}class gc{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Rt extends Ll{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Rt(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,i=0){if(i&exports.IterMode.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Rt(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Rt(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Rt(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];t.push(i.slice(n,r,o)),e.push(0)}return new X(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Il(s){if(!s.length)return null;let t=0,e=s[0];for(let r=1;r<s.length;r++){let o=s[r];(o.from>e.from||o.to<e.to)&&(e=o,t=r)}let i=e instanceof ot&&e.index<0?null:e.parent,n=s.slice();return i?n[t]=i:n.splice(t,1),new mc(n,e)}class mc{constructor(t,e){this.heads=t,this.node=e}get next(){return Il(this.heads)}}function bc(s,t,e){let i=s.resolveInner(t,e),n=null;for(let r=i instanceof ot?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(n||(n=[i])).push(o.resolve(t,e)),r=o}else{let o=$e.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new ot(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Qe(l,t,e,!1))}}return n?Il(n):i}class as{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~exports.IterMode.EnterBracketed,t instanceof ot)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let i=t._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:i,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=i+n.buffer[t+1],this.to=i+n.buffer[t+2],!0}yield(t){return t?t instanceof ot?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,i){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));let{buffer:n}=this.buffer,r=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,i=this.mode){return this.buffer?i&exports.IterMode.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,i=this.stack.length-1;if(t<0){let n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(n)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,i,{buffer:n}=this;if(n){if(t>0){if(this.index<n.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(n.buffer.buffer[r+3]<this.index)return!1;({index:e,parent:i}=n)}else({index:e,_parent:i}=this._tree);for(;i;{index:e,_parent:i}=i)if(e>-1)for(let r=e+t,o=t<0?-1:i._tree.children.length;r!=o;r+=t){let l=i._tree.children[r];if(this.mode&exports.IterMode.IncludeAnonymous||l instanceof Jt||!l.type.isAnonymous||Is(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(let n=this.index,r=this.stack.length;r>=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,i=r+1;break t}n=this.stack[--r]}for(let n=i;n<this.stack.length;n++)e=new Rt(this.buffer,e,this.stack[n]);return this.bufferNode=new Rt(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let i=0;;){let n=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&e&&e(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(t){if(!this.buffer)return ls(this.node.parent,t);let{buffer:e}=this.buffer,{types:i}=e.set;for(let n=t.length-1,r=this.stack.length-1;n>=0;r--){if(r<0)return ls(this._tree,t,n);let o=i[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}}function Is(s){return s.children.some(t=>t instanceof Jt||!t.type.isAnonymous||Is(t))}function yc(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:n=Rl,reused:r=[],minRepeatType:o=i.types.length}=s,l=Array.isArray(e)?new Ls(e,e.length):e,a=i.types,h=0,f=0;function c(C,w,x,E,L,q){let{id:R,start:D,end:F,size:W}=l,$=f,it=h;if(W<0)if(l.next(),W==-1){let Nt=r[R];x.push(Nt),E.push(D-C);return}else if(W==-3){h=R;return}else if(W==-4){f=R;return}else throw new RangeError(`Unrecognized record size: ${W}`);let ht=a[R],Ct,J,ct=D-C;if(F-D<=n&&(J=m(l.pos-w,L))){let Nt=new Uint16Array(J.size-J.skip),ut=l.pos-J.size,Mt=Nt.length;for(;l.pos>ut;)Mt=b(J.start,Nt,Mt);Ct=new Jt(Nt,F-J.start,i),ct=J.start-C}else{let Nt=l.pos-W;l.next();let ut=[],Mt=[],Zt=R>=o?R:-1,ce=0,li=F;for(;l.pos>Nt;)Zt>=0&&l.id==Zt&&l.size>=0?(l.end<=li-n&&(p(ut,Mt,D,ce,l.end,li,Zt,$,it),ce=ut.length,li=l.end),l.next()):q>2500?u(D,Nt,ut,Mt):c(D,Nt,ut,Mt,Zt,q+1);if(Zt>=0&&ce>0&&ce<ut.length&&p(ut,Mt,D,ce,D,li,Zt,$,it),ut.reverse(),Mt.reverse(),Zt>-1&&ce>0){let Fs=d(ht,it);Ct=Ns(ht,ut,Mt,0,ut.length,0,F-D,Fs,Fs)}else Ct=g(ht,ut,Mt,F-D,$-F,it)}x.push(Ct),E.push(ct)}function u(C,w,x,E){let L=[],q=0,R=-1;for(;l.pos>w;){let{id:D,start:F,end:W,size:$}=l;if($>4)l.next();else{if(R>-1&&F<R)break;R<0&&(R=W-n),L.push(D,F,W),q++,l.next()}}if(q){let D=new Uint16Array(q*4),F=L[L.length-2];for(let W=L.length-3,$=0;W>=0;W-=3)D[$++]=L[W],D[$++]=L[W+1]-F,D[$++]=L[W+2]-F,D[$++]=$;x.push(new Jt(D,L[2]-F,i)),E.push(F-C)}}function d(C,w){return(x,E,L)=>{let q=0,R=x.length-1,D,F;if(R>=0&&(D=x[R])instanceof X){if(!R&&D.type==C&&D.length==L)return D;(F=D.prop(N.lookAhead))&&(q=E[R]+D.length+F)}return g(C,x,E,L,q,w)}}function p(C,w,x,E,L,q,R,D,F){let W=[],$=[];for(;C.length>E;)W.push(C.pop()),$.push(w.pop()+x-L);C.push(g(i.types[R],W,$,q-L,D-q,F)),w.push(L-x)}function g(C,w,x,E,L,q,R){if(q){let D=[N.contextHash,q];R=R?[D].concat(R):[D]}if(L>25){let D=[N.lookAhead,L];R=R?[D].concat(R):[D]}return new X(C,w,x,E,R)}function m(C,w){let x=l.fork(),E=0,L=0,q=0,R=x.end-n,D={size:0,start:0,skip:0};t:for(let F=x.pos-C;x.pos>F;){let W=x.size;if(x.id==w&&W>=0){D.size=E,D.start=L,D.skip=q,q+=4,E+=4,x.next();continue}let $=x.pos-W;if(W<0||$<F||x.start<R)break;let it=x.id>=o?4:0,ht=x.start;for(x.next();x.pos>$;){if(x.size<0)if(x.size==-3||x.size==-4)it+=4;else break t;else x.id>=o&&(it+=4);x.next()}L=ht,E+=W,q+=it}return(w<0||E==C)&&(D.size=E,D.start=L,D.skip=q),D.size>4?D:void 0}function b(C,w,x){let{id:E,start:L,end:q,size:R}=l;if(l.next(),R>=0&&E<o){let D=x;if(R>4){let F=l.pos-(R-4);for(;l.pos>F;)x=b(C,w,x)}w[--x]=D,w[--x]=q-C,w[--x]=L-C,w[--x]=E}else R==-3?h=E:R==-4&&(f=E);return x}let S=[],A=[];for(;l.pos>0;)c(s.start||0,s.bufferStart||0,S,A,-1,0);let B=(t=s.length)!==null&&t!==void 0?t:S.length?A[0]+S[0].length:0;return new X(a[s.topID],S.reverse(),A.reverse(),B)}const Kr=new WeakMap;function Ei(s,t){if(!s.isAnonymous||t instanceof Jt||t.type!=s)return 1;let e=Kr.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof X)){e=1;break}e+=Ei(s,i)}Kr.set(t,e)}return e}function Ns(s,t,e,i,n,r,o,l,a){let h=0;for(let p=i;p<n;p++)h+=Ei(s,t[p]);let f=Math.ceil(h*1.5/8),c=[],u=[];function d(p,g,m,b,S){for(let A=m;A<b;){let B=A,C=g[A],w=Ei(s,p[A]);for(A++;A<b;A++){let x=Ei(s,p[A]);if(w+x>=f)break;w+=x}if(A==B+1){if(w>f){let x=p[B];d(x.children,x.positions,0,x.children.length,g[B]+S);continue}c.push(p[B])}else{let x=g[A-1]+p[A-1].length-C;c.push(Ns(s,p,g,B,A,C,x,null,a))}u.push(C+S-r)}}return d(t,e,i,n,0),(l||a)(c,u,o)}class wc{constructor(){this.map=new WeakMap}setBuffer(t,e,i){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,i)}getBuffer(t,e){let i=this.map.get(t);return i&&i.get(e)}set(t,e){t instanceof Rt?this.setBuffer(t.context.buffer,t.index,e):t instanceof ot&&this.map.set(t.tree,e)}get(t){return t instanceof Rt?this.getBuffer(t.context.buffer,t.index):t instanceof ot?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class re{constructor(t,e,i,n,r=!1,o=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],i=!1){let n=[new re(0,t.length,t,0,!1,i)];for(let r of e)r.to>t.length&&n.push(r);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],r=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l<e.length?e[l]:null,c=f?f.fromA:1e9;if(c-a>=i)for(;o&&o.from<c;){let u=o;if(a>=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,c)-h;u=d>=p?null:new re(d,p,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=r<t.length?t[r++]:null}if(!f)break;a=f.toA,h=f.toA-f.toB}return n}}class Nl{startParse(t,e,i){return typeof t=="string"&&(t=new xc(t)),i=i?i.length?i.map(n=>new vn(n.from,n.to)):[new vn(0,0)]:[new vn(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let r=n.advance();if(r)return r}}}class xc{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new N({perNode:!0});let vc=0;class dt{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=vc++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let i=typeof t=="string"?t:"?";if(t instanceof dt&&(e=t),e!=null&&e.base)throw new Error("Can not derive from a modified tag");let n=new dt(i,[],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(t){let e=new ji(t);return i=>i.modified.indexOf(e)>-1?i:ji.get(i.base||i,i.modified.concat(e).sort((n,r)=>n.id-r.id))}}let kc=0;class ji{constructor(t){this.name=t,this.instances=[],this.id=kc++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(l=>l.base==t&&Sc(e,l.modified));if(i)return i;let n=[],r=new dt(t.name,n,t,e);for(let l of e)l.instances.push(r);let o=Cc(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(ji.get(l,a));return r}}function Sc(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function Cc(s){let t=[[]];for(let e=0;e<s.length;e++)for(let i=0,n=t.length;i<n;i++)t.push(t[i].concat(s[e]));return t.sort((e,i)=>i.length-e.length)}function Hl(s){let t=Object.create(null);for(let e in s){let i=s[e];Array.isArray(i)||(i=[i]);for(let n of e.split(" "))if(n){let r=[],o=2,l=n;for(let c=0;;){if(l=="..."&&c>0&&c+3==n.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+n);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);l=n.slice(c)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+n);let f=new Ze(i,o,a>0?r.slice(0,a):null);t[h]=f.sort(t[h])}}return Wl.add(t)}const Wl=new N({combine(s,t){let e,i,n;for(;s||t;){if(!s||t&&s.depth>=t.depth?(n=t,t=t.next):(n=s,s=s.next),e&&e.mode==n.mode&&!n.context&&!e.context)continue;let r=new Ze(n.tags,n.mode,n.context);e?e.next=r:i=r,e=r}return i}});class Ze{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}Ze.empty=new Ze([],2,null);function Vl(s,t){let e=Object.create(null);for(let r of s)if(!Array.isArray(r.tag))e[r.tag.id]=r.class;else for(let o of r.tag)e[o.id]=r.class;let{scope:i,all:n=null}=t||{};return{style:r=>{let o=n;for(let l of r)for(let a of l.set){let h=e[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Mc(s,t){let e=null;for(let i of s){let n=i.style(t);n&&(e=e?e+" "+n:n)}return e}function Ac(s,t,e,i=0,n=s.length){let r=new Tc(i,Array.isArray(t)?t:[t],e);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}class Tc{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,r){let{type:o,from:l,to:a}=t;if(l>=i||a<=e)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=Dc(t)||Ze.empty,c=Mc(r,f.tags);if(c&&(h&&(h+=" "),h+=c,f.mode==1&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(N.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(m=>!m.scope||m.scope(u.tree.type)),g=t.firstChild();for(let m=0,b=l;;m++){let S=m<u.overlay.length?u.overlay[m]:null,A=S?S.from+l:a,B=Math.max(e,b),C=Math.min(i,A);if(B<C&&g)for(;t.from<C&&(this.highlightRange(t,B,C,n,r),this.startSpan(Math.min(C,t.to),h),!(t.to>=A||!t.nextSibling())););if(!S||A>i)break;b=S.to+l,b>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(i,b),"",p),this.startSpan(Math.min(i,b),h))}g&&t.parent()}else if(t.firstChild()){u&&(n="");do if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,r),this.startSpan(Math.min(i,t.to),h)}while(t.nextSibling());t.parent()}}}function Dc(s){let t=s.type.prop(Wl);for(;t&&t.context&&!s.matchContext(t.context);)t=t.next;return t||null}const y=dt.define,Si=y(),Ft=y(),$r=y(Ft),jr=y(Ft),zt=y(),Ci=y(zt),kn=y(zt),Ot=y(),te=y(Ot),Tt=y(),Dt=y(),hs=y(),Be=y(hs),Mi=y(),v={comment:Si,lineComment:y(Si),blockComment:y(Si),docComment:y(Si),name:Ft,variableName:y(Ft),typeName:$r,tagName:y($r),propertyName:jr,attributeName:y(jr),className:y(Ft),labelName:y(Ft),namespace:y(Ft),macroName:y(Ft),literal:zt,string:Ci,docString:y(Ci),character:y(Ci),attributeValue:y(Ci),number:kn,integer:y(kn),float:y(kn),bool:y(zt),regexp:y(zt),escape:y(zt),color:y(zt),url:y(zt),keyword:Tt,self:y(Tt),null:y(Tt),atom:y(Tt),unit:y(Tt),modifier:y(Tt),operatorKeyword:y(Tt),controlKeyword:y(Tt),definitionKeyword:y(Tt),moduleKeyword:y(Tt),operator:Dt,derefOperator:y(Dt),arithmeticOperator:y(Dt),logicOperator:y(Dt),bitwiseOperator:y(Dt),compareOperator:y(Dt),updateOperator:y(Dt),definitionOperator:y(Dt),typeOperator:y(Dt),controlOperator:y(Dt),punctuation:hs,separator:y(hs),bracket:Be,angleBracket:y(Be),squareBracket:y(Be),paren:y(Be),brace:y(Be),content:Ot,heading:te,heading1:y(te),heading2:y(te),heading3:y(te),heading4:y(te),heading5:y(te),heading6:y(te),contentSeparator:y(Ot),list:y(Ot),quote:y(Ot),emphasis:y(Ot),strong:y(Ot),link:y(Ot),monospace:y(Ot),strikethrough:y(Ot),inserted:y(),deleted:y(),changed:y(),invalid:y(),meta:Mi,documentMeta:y(Mi),annotation:y(Mi),processingInstruction:y(Mi),definition:dt.defineModifier("definition"),constant:dt.defineModifier("constant"),function:dt.defineModifier("function"),standard:dt.defineModifier("standard"),local:dt.defineModifier("local"),special:dt.defineModifier("special")};for(let s in v){let t=v[s];t instanceof dt&&(t.name=s)}Vl([{tag:v.link,class:"tok-link"},{tag:v.heading,class:"tok-heading"},{tag:v.emphasis,class:"tok-emphasis"},{tag:v.strong,class:"tok-strong"},{tag:v.keyword,class:"tok-keyword"},{tag:v.atom,class:"tok-atom"},{tag:v.bool,class:"tok-bool"},{tag:v.url,class:"tok-url"},{tag:v.labelName,class:"tok-labelName"},{tag:v.inserted,class:"tok-inserted"},{tag:v.deleted,class:"tok-deleted"},{tag:v.literal,class:"tok-literal"},{tag:v.string,class:"tok-string"},{tag:v.number,class:"tok-number"},{tag:[v.regexp,v.escape,v.special(v.string)],class:"tok-string2"},{tag:v.variableName,class:"tok-variableName"},{tag:v.local(v.variableName),class:"tok-variableName tok-local"},{tag:v.definition(v.variableName),class:"tok-variableName tok-definition"},{tag:v.special(v.variableName),class:"tok-variableName2"},{tag:v.definition(v.propertyName),class:"tok-propertyName tok-definition"},{tag:v.typeName,class:"tok-typeName"},{tag:v.namespace,class:"tok-namespace"},{tag:v.className,class:"tok-className"},{tag:v.macroName,class:"tok-macroName"},{tag:v.propertyName,class:"tok-propertyName"},{tag:v.operator,class:"tok-operator"},{tag:v.comment,class:"tok-comment"},{tag:v.meta,class:"tok-meta"},{tag:v.invalid,class:"tok-invalid"},{tag:v.punctuation,class:"tok-punctuation"}]);var Sn;const ge=new N;function Fl(s){return T.define({combine:s?t=>t.concat(s):void 0})}const zl=new N;class vt{constructor(t,e,i=[],n=""){this.data=t,this.name=n,V.prototype.hasOwnProperty("tree")||Object.defineProperty(V.prototype,"tree",{get(){return St(this)}}),this.parser=e,this.extension=[Qt.of(this),V.languageData.of((r,o,l)=>{let a=Ur(r,o,l),h=a.type.prop(ge);if(!h)return[];let f=r.facet(h),c=a.type.prop(zl);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(f)}}return f})].concat(i)}isActiveAt(t,e,i=-1){return Ur(t,e,i).type.prop(ge)==this.data}findRegions(t){let e=t.facet(Qt);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(ge)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(N.mounted);if(l){if(l.tree.prop(ge)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(n(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<r.children.length;a++){let h=r.children[a];h instanceof X&&n(h,r.positions[a]+o)}};return n(St(t),0),i}get allowsNesting(){return!0}}vt.setState=z.define();function Ur(s,t,e){let i=s.facet(Qt),n=St(s).topNode;if(!i||i.allowsNesting)for(let r=n;r;r=r.enter(t,e,exports.IterMode.ExcludeBuffers|exports.IterMode.EnterBracketed))r.type.isTop&&(n=r);return n}class Ui extends vt{constructor(t,e,i){super(t,e,[],i),this.parser=e}static define(t){let e=Fl(t.languageData);return new Ui(e,t.parser.configure({props:[ge.add(i=>i.isTop?e:void 0)]}),t.name)}configure(t,e){return new Ui(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function St(s){let t=s.field(vt.state,!1);return t?t.tree:X.empty}class Oc{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Ee=null;class Gi{constructor(t,e,i=[],n,r,o,l,a){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Gi(t,e,[],X.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Oc(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=X.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof t=="number"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(re.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(e??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(re.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Ee;Ee=this;try{return t()}finally{Ee=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Gr(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),i=re.applyChanges(i,a),n=X.empty,r=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);f<c&&l.push({from:f,to:c})}}}return new Gi(this.parser,e,i,n,r,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:n,to:r}=this.skipped[i];n<t.to&&r>t.from&&(this.fragments=Gr(this.fragments,n,r),this.skipped.splice(i--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Nl{createParse(e,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let a=Ee;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new X(at.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Ee}}function Gr(s,t,e){return re.applyChanges(s,[{fromA:t,toA:e,fromB:t,toB:e}])}class Ae{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Ae(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Gi.create(t.facet(Qt).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Ae(i)}}vt.state=yt.define({create:Ae.init,update(s,t){for(let e of t.effects)if(e.is(vt.setState))return e.value;return t.startState.facet(Qt)!=t.state.facet(Qt)?Ae.init(t.state):s.apply(t)}});let ql=s=>{let t=setTimeout(()=>s(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(ql=s=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(s,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const Cn=typeof navigator<"u"&&(!((Sn=navigator.scheduling)===null||Sn===void 0)&&Sn.isInputPending)?()=>navigator.scheduling.isInputPending():null,Bc=_.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(vt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(vt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=ql(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,r=i.field(vt.state);if(r.tree==r.context.tree&&r.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!Cn?Math.max(25,t.timeRemaining()-5):1e9),l=r.context.treeLen<n&&i.doc.length>n+1e3,a=r.context.work(()=>Cn&&Cn()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:vt.setState.of(new Ae(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>mt(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Qt=T.define({combine(s){return s.length?s[0]:null},enables:s=>[vt.state,Bc,O.contentAttributes.compute([s],t=>{let e=t.facet(s);return e&&e.name?{"data-language":e.name}:{}})]});class Ec{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Rc=T.define(),Hs=T.define({combine:s=>{if(!s.length)return" ";let t=s[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return t}});function Kl(s){let t=s.facet(Hs);return t.charCodeAt(0)==9?s.tabSize*t.length:t.length}function $l(s,t){let e="",i=s.tabSize,n=s.facet(Hs)[0];if(n==" "){for(;t>=i;)e+=" ",t-=i;n=" "}for(let r=0;r<t;r++)e+=n;return e}function jl(s,t){s instanceof V&&(s=new Ws(s));for(let i of s.state.facet(Rc)){let n=i(s,t);if(n!==void 0)return n}let e=St(s.state);return e.length>=t?Pc(s,e,t):null}class Ws{constructor(t,e={}){this.state=t,this.options=e,this.unit=Kl(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return n!=null&&n>=i.from&&n<=i.to?r&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(t,e);return i.slice(t-n,Math.min(i.length,t+100-n))}column(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.countColumn(i,t-n),o=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return o>-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(t,e=t.length){return Xi(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let o=r(n);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ul=new N;function Pc(s,t,e){let i=t.resolveStack(e),n=t.resolveInner(e,-1).resolve(e,0).enterUnfinishedNodesBefore(e);if(n!=i.node){let r=[];for(let o=n;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Gl(i,s,e)}function Gl(s,t,e){for(let i=s;i;i=i.next){let n=Ic(i.node);if(n)return n(Vs.create(t,e,i))}return 0}function Lc(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function Ic(s){let t=s.type.prop(Ul);if(t)return t;let e=s.firstChild,i;if(e&&(i=e.type.prop(N.closedBy))){let n=s.lastChild,r=n&&i.indexOf(n.name)>-1;return o=>_l(o,!0,1,void 0,r&&!Lc(o)?n.from:void 0)}return s.parent==null?Nc:null}function Nc(){return 0}class Vs extends Ws{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(t,e,i){return new Vs(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Hc(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return Gl(this.context.next,this.base,this.pos)}}function Hc(s,t){for(let e=t;e;e=e.parent)if(s==e)return!0;return!1}function Wc(s){let t=s.node,e=t.childAfter(t.from),i=t.lastChild;if(!e)return null;let n=s.options.simulateBreak,r=s.state.doc.lineAt(e.from),o=n==null||n<=r.from?r.to:Math.min(r.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(e.to-r.from))[0].length;return{from:e.from,to:e.to+h}}l=a.to}}function Vc({closing:s,align:t=!0,units:e=1}){return i=>_l(i,t,e,s)}function _l(s,t,e,i,n){let r=s.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||n==s.pos+o,a=t?Wc(s):null;return a?l?s.column(a.from):s.column(a.to):s.baseIndent+(l?0:s.unit*e)}const Fc=s=>s.baseIndent;function zc({except:s,units:t=1}={}){return e=>{let i=s&&s.test(e.textAfter);return e.baseIndent+(i?0:t*e.unit)}}const qc=200;function Kc(){return V.transactionFilter.of(s=>{if(!s.docChanged||!s.isUserEvent("input.type")&&!s.isUserEvent("input.complete"))return s;let t=s.startState.languageDataAt("indentOnInput",s.startState.selection.main.head);if(!t.length)return s;let e=s.newDoc,{head:i}=s.newSelection.main,n=e.lineAt(i);if(i>n.from+qc)return s;let r=e.sliceString(n.from,i);if(!t.some(h=>h.test(r)))return s;let{state:o}=s,l=-1,a=[];for(let{head:h}of o.selection.ranges){let f=o.doc.lineAt(h);if(f.from==l)continue;l=f.from;let c=jl(o,f.from);if(c==null)continue;let u=/^\s*/.exec(f.text)[0],d=$l(o,c);u!=d&&a.push({from:f.from,to:f.from+u.length,insert:d})}return a.length?[s,{changes:a,sequential:!0}]:s})}const $c=T.define(),Yl=new N;function jc(s){let t=s.firstChild,e=s.lastChild;return t&&t.to<e.from?{from:t.to,to:e.type.isError?s.to:e.from}:null}function Uc(s,t,e){let i=St(s);if(i.length<e)return null;let n=i.resolveStack(e,1),r=null;for(let o=n;o;o=o.next){let l=o.node;if(l.to<=e||l.from>e)continue;if(r&&l.from<t)break;let a=l.type.prop(Yl);if(a&&(l.to<i.length-50||i.length==s.doc.length||!Gc(l))){let h=a(l,s);h&&h.from<=e&&h.from>=t&&h.to>e&&(r=h)}}return r}function Gc(s){let t=s.lastChild;return t&&t.to==s.to&&t.type.isError}function _i(s,t,e){for(let i of s.facet($c)){let n=i(s,t,e);if(n)return n}return Uc(s,t,e)}function Xl(s,t){let e=t.mapPos(s.from,1),i=t.mapPos(s.to,-1);return e>=i?void 0:{from:e,to:i}}const sn=z.define({map:Xl}),ri=z.define({map:Xl});function Jl(s){let t=[];for(let{head:e}of s.state.selection.ranges)t.some(i=>i.from<=e&&i.to>=e)||t.push(s.lineBlockAt(e));return t}const he=yt.define({create(){return I.none},update(s,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((e,i)=>s=_r(s,e,i)),s=s.map(t.changes);for(let e of t.effects)if(e.is(sn)&&!_c(s,e.value.from,e.value.to)){let{preparePlaceholder:i}=t.state.facet(ta),n=i?I.replace({widget:new eu(i(t.state,e.value))}):Yr;s=s.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(ri)&&(s=s.update({filter:(i,n)=>e.value.from!=i||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));return t.selection&&(s=_r(s,t.selection.main.head)),s},provide:s=>O.decorations.from(s),toJSON(s,t){let e=[];return s.between(0,t.doc.length,(i,n)=>{e.push(i,n)}),e},fromJSON(s){if(!Array.isArray(s)||s.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let e=0;e<s.length;){let i=s[e++],n=s[e++];if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid JSON for fold state");t.push(Yr.range(i,n))}return I.set(t,!0)}});function _r(s,t,e=t){let i=!1;return s.between(t,e,(n,r)=>{n<e&&r>t&&(i=!0)}),i?s.update({filterFrom:t,filterTo:e,filter:(n,r)=>n>=e||r<=t}):s}function Yi(s,t,e){var i;let n=null;return(i=s.field(he,!1))===null||i===void 0||i.between(t,e,(r,o)=>{(!n||n.from>r)&&(n={from:r,to:o})}),n}function _c(s,t,e){let i=!1;return s.between(t,t,(n,r)=>{n==t&&r==e&&(i=!0)}),i}function Ql(s,t){return s.field(he,!1)?t:t.concat(z.appendConfig.of(ea()))}const Yc=s=>{for(let t of Jl(s)){let e=_i(s.state,t.from,t.to);if(e)return s.dispatch({effects:Ql(s.state,[sn.of(e),Zl(s,e)])}),!0}return!1},Xc=s=>{if(!s.state.field(he,!1))return!1;let t=[];for(let e of Jl(s)){let i=Yi(s.state,e.from,e.to);i&&t.push(ri.of(i),Zl(s,i,!1))}return t.length&&s.dispatch({effects:t}),t.length>0};function Zl(s,t,e=!0){let i=s.state.doc.lineAt(t.from).number,n=s.state.doc.lineAt(t.to).number;return O.announce.of(`${s.state.phrase(e?"Folded lines":"Unfolded lines")} ${i} ${s.state.phrase("to")} ${n}.`)}const Jc=s=>{let{state:t}=s,e=[];for(let i=0;i<t.doc.length;){let n=s.lineBlockAt(i),r=_i(t,n.from,n.to);r&&e.push(sn.of(r)),i=(r?s.lineBlockAt(r.to):n).to+1}return e.length&&s.dispatch({effects:Ql(s.state,e)}),!!e.length},Qc=s=>{let t=s.state.field(he,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,s.state.doc.length,(i,n)=>{e.push(ri.of({from:i,to:n}))}),s.dispatch({effects:e}),!0},Zc=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Yc},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Xc},{key:"Ctrl-Alt-[",run:Jc},{key:"Ctrl-Alt-]",run:Qc}],tu={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ta=T.define({combine(s){return Te(s,tu)}});function ea(s){return[he,su]}function ia(s,t){let{state:e}=s,i=e.facet(ta),n=o=>{let l=s.lineBlockAt(s.posAtDOM(o.target)),a=Yi(s.state,l.from,l.to);a&&s.dispatch({effects:ri.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(s,n,t);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",e.phrase("folded code")),r.title=e.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=n,r}const Yr=I.replace({widget:new class extends It{toDOM(s){return ia(s,null)}}});class eu extends It{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return ia(t,this.value)}}const iu={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Mn extends Lt{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function nu(s={}){let t={...iu,...s},e=new Mn(t,!0),i=new Mn(t,!1),n=_.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Qt)!=o.state.facet(Qt)||o.startState.field(he,!1)!=o.state.field(he,!1)||St(o.startState)!=St(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Gt;for(let a of o.viewportLineBlocks){let h=Yi(o.state,a.from,a.to)?i:_i(o.state,a.from,a.to)?e:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=t;return[n,Dl({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(n))===null||l===void 0?void 0:l.markers)||P.empty},initialSpacer(){return new Mn(t,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=Yi(o.state,l.from,l.to);if(h)return o.dispatch({effects:ri.of(h)}),!0;let f=_i(o.state,l.from,l.to);return f?(o.dispatch({effects:sn.of(f)}),!0):!1}}}),ea()]}const su=O.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class oi{constructor(t,e){this.specs=t;let i;function n(l){let a=_t.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof e.all=="string"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof vt?l=>l.prop(ge)==o.data:o?l=>l==o:void 0,this.style=Vl(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new _t(i):null,this.themeType=e.themeType}static define(t,e){return new oi(t,e||{})}}const fs=T.define(),na=T.define({combine(s){return s.length?[s[0]]:null}});function An(s){let t=s.facet(fs);return t.length?t:s.facet(na)}function ru(s,t){let e=[lu],i;return s instanceof oi&&(s.module&&e.push(O.styleModule.of(s.module)),i=s.themeType),t!=null&&t.fallback?e.push(na.of(s)):i?e.push(fs.computeN([O.darkTheme],n=>n.facet(O.darkTheme)==(i=="dark")?[s]:[])):e.push(fs.of(s)),e}class ou{constructor(t){this.markCache=Object.create(null),this.tree=St(t.state),this.decorations=this.buildDeco(t,An(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=St(t.state),i=An(t.state),n=i!=An(t.startState),{viewport:r}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!n&&e.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return I.none;let i=new Gt;for(let{from:n,to:r}of t.visibleRanges)Ac(this.tree,e,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=I.mark({class:a})))},n,r);return i.finish()}}const lu=ti.high(_.fromClass(ou,{decorations:s=>s.decorations})),au=oi.define([{tag:v.meta,color:"#404740"},{tag:v.link,textDecoration:"underline"},{tag:v.heading,textDecoration:"underline",fontWeight:"bold"},{tag:v.emphasis,fontStyle:"italic"},{tag:v.strong,fontWeight:"bold"},{tag:v.strikethrough,textDecoration:"line-through"},{tag:v.keyword,color:"#708"},{tag:[v.atom,v.bool,v.url,v.contentSeparator,v.labelName],color:"#219"},{tag:[v.literal,v.inserted],color:"#164"},{tag:[v.string,v.deleted],color:"#a11"},{tag:[v.regexp,v.escape,v.special(v.string)],color:"#e40"},{tag:v.definition(v.variableName),color:"#00f"},{tag:v.local(v.variableName),color:"#30a"},{tag:[v.typeName,v.namespace],color:"#085"},{tag:v.className,color:"#167"},{tag:[v.special(v.variableName),v.macroName],color:"#256"},{tag:v.definition(v.propertyName),color:"#00c"},{tag:v.comment,color:"#940"},{tag:v.invalid,color:"#f00"}]),hu=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),sa=1e4,ra="()[]{}",oa=T.define({combine(s){return Te(s,{afterCursor:!0,brackets:ra,maxScanDistance:sa,renderMatch:uu})}}),fu=I.mark({class:"cm-matchingBracket"}),cu=I.mark({class:"cm-nonmatchingBracket"});function uu(s){let t=[],e=s.matched?fu:cu;return t.push(e.range(s.start.from,s.start.to)),s.end&&t.push(e.range(s.end.from,s.end.to)),t}function Xr(s){let t=[],e=s.facet(oa);for(let i of s.selection.ranges){if(!i.empty)continue;let n=Ie(s,i.head,-1,e)||i.head>0&&Ie(s,i.head-1,1,e)||e.afterCursor&&(Ie(s,i.head,1,e)||i.head<s.doc.length&&Ie(s,i.head+1,-1,e));n&&(t=t.concat(e.renderMatch(n,s)))}return I.set(t,!0)}const du=_.fromClass(class{constructor(s){this.paused=!1,this.decorations=Xr(s.state)}update(s){(s.docChanged||s.selectionSet||this.paused)&&(s.view.composing?(this.decorations=this.decorations.map(s.changes),this.paused=!0):(this.decorations=Xr(s.state),this.paused=!1))}},{decorations:s=>s.decorations}),pu=[du,hu];function gu(s={}){return[oa.of(s),pu]}const mu=new N;function cs(s,t,e){let i=s.prop(t<0?N.openedBy:N.closedBy);if(i)return i;if(s.name.length==1){let n=e.indexOf(s.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function us(s){let t=s.type.prop(mu);return t?t(s.node):s}function Ie(s,t,e,i={}){let n=i.maxScanDistance||sa,r=i.brackets||ra,o=St(s),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=cs(a.type,e,r);if(h&&a.from<a.to){let f=us(a);if(f&&(e>0?t>=f.from&&t<f.to:t>f.from&&t<=f.to))return bu(s,t,e,a,f,h,r)}}return yu(s,t,e,o,l.type,n,r)}function bu(s,t,e,i,n,r,o){let l=i.parent,a={from:n.from,to:n.to},h=0,f=l==null?void 0:l.cursor();if(f&&(e<0?f.childBefore(i.from):f.childAfter(i.to)))do if(e<0?f.to<=i.from:f.from>=i.to){if(h==0&&r.indexOf(f.type.name)>-1&&f.from<f.to){let c=us(f);return{start:a,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(cs(f.type,e,o))h++;else if(cs(f.type,-e,o)){if(h==0){let c=us(f);return{start:a,end:c&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1}}h--}}while(e<0?f.prevSibling():f.nextSibling());return{start:a,matched:!1}}function yu(s,t,e,i,n,r,o){if(e<0?!t:t==s.doc.length)return null;let l=e<0?s.sliceDoc(t-1,t):s.sliceDoc(t,t+1),a=o.indexOf(l);if(a<0||a%2==0!=e>0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=s.doc.iterRange(t,e>0?s.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=r;){let d=f.value;e<0&&(u+=d.length);let p=t+u*e;for(let g=e>0?0:d.length-1,m=e>0?d.length:-1;g!=m;g+=e){let b=o.indexOf(d[g]);if(!(b<0||i.resolveInner(p+g,1).type!=n))if(b%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:p+g,to:p+g+1},matched:b>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}const wu=Object.create(null),Jr=[at.none],Qr=[],Zr=Object.create(null),xu=Object.create(null);for(let[s,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])xu[s]=vu(wu,t);function Tn(s,t){Qr.indexOf(s)>-1||(Qr.push(s),console.warn(t))}function vu(s,t){let e=[];for(let l of t.split(" ")){let a=[];for(let h of l.split(".")){let f=s[h]||v[h];f?typeof f=="function"?a.length?a=a.map(f):Tn(h,`Modifier ${h} used at start of tag`):a.length?Tn(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:Tn(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let i=t.replace(/ /g,"_"),n=i+" "+e.map(l=>l.id),r=Zr[n];if(r)return r.id;let o=Zr[n]=at.define({id:Jr.length,name:i,props:[Hl({[i]:e})]});return Jr.push(o),o.id}exports.Direction.RTL,exports.Direction.LTR;exports.Annotation=fe;exports.AnnotationType=yo;exports.BidiSpan=xt;exports.BlockInfo=pt;exports.BlockWrapper=ve;exports.ChangeDesc=Pt;exports.ChangeSet=Y;exports.Compartment=ei;exports.Decoration=I;exports.DefaultBufferLength=Rl;exports.EditorSelection=k;exports.EditorState=V;exports.EditorView=O;exports.Facet=T;exports.GutterMarker=Lt;exports.HighlightStyle=oi;exports.IndentContext=Ws;exports.LRLanguage=Ui;exports.LanguageSupport=Ec;exports.Line=oo;exports.MatchDecorator=kl;exports.NodeProp=N;exports.NodeSet=Ps;exports.NodeType=at;exports.NodeWeakMap=wc;exports.Parser=Nl;exports.Prec=ti;exports.Range=Li;exports.RangeSet=P;exports.RangeSetBuilder=Gt;exports.RangeValue=Ut;exports.RectangleMarker=jt;exports.SelectionRange=$t;exports.StateEffect=z;exports.StateEffectType=wo;exports.StateField=yt;exports.Text=H;exports.Transaction=tt;exports.Tree=X;exports.ViewPlugin=_;exports.ViewUpdate=Je;exports.WidgetType=It;exports.bracketMatching=gu;exports.codePointAt=ds;exports.codePointSize=lo;exports.combineConfig=Te;exports.continuedIndent=zc;exports.countColumn=Xi;exports.crelt=ee;exports.crosshairCursor=$f;exports.defaultHighlightStyle=au;exports.defineLanguageFacet=Fl;exports.delimitedIndent=Vc;exports.drawSelection=bf;exports.dropCursor=kf;exports.findClusterBreak=gt;exports.findColumn=Ii;exports.flatIndent=Fc;exports.foldGutter=nu;exports.foldInside=jc;exports.foldKeymap=Zc;exports.foldNodeProp=Yl;exports.fromCodePoint=da;exports.getIndentUnit=Kl;exports.getIndentation=jl;exports.getPanel=ec;exports.getTooltip=Zf;exports.gutter=Dl;exports.gutterLineClass=qe;exports.gutterWidgetClass=Tl;exports.gutters=Rs;exports.highlightActiveLine=Pf;exports.highlightActiveLineGutter=uc;exports.highlightSpecialChars=Tf;exports.hoverTooltip=Qf;exports.indentNodeProp=Ul;exports.indentOnInput=Kc;exports.indentString=$l;exports.indentUnit=Hs;exports.keymap=ml;exports.layer=Os;exports.lineNumberMarkers=Bl;exports.lineNumberWidgetMarker=El;exports.lineNumbers=hc;exports.logException=mt;exports.matchBrackets=Ie;exports.placeholder=Hf;exports.rectangularSelection=zf;exports.runScopeHandlers=cf;exports.showDialog=ic;exports.showPanel=$i;exports.showTooltip=Es;exports.styleTags=Hl;exports.sublanguageProp=zl;exports.syntaxHighlighting=ru;exports.syntaxTree=St;exports.tags=v;
12
+ //# sourceMappingURL=index-B31-Y5uO.js.map