code-playpad 0.7.0 → 0.9.0

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 (72) hide show
  1. package/JAVA-COMPATIBILITY.md +12 -12
  2. package/README.md +104 -14
  3. package/dist/COMPILER-LICENSE-AUDIT.md +104 -0
  4. package/dist/COMPILER-NOTICES.txt +16973 -0
  5. package/dist/THIRD-PARTY-NOTICES.txt +102 -0
  6. package/dist/cdn.js +2 -2
  7. package/dist/compiler-license-manifest.json +198 -0
  8. package/dist/{config-D9w0xYhX.js → config-cwuPIQ48.js} +1 -1
  9. package/dist/cpp-D2TrExLz.js +1 -0
  10. package/dist/cpp-DakNa4ys.js +6 -0
  11. package/dist/dist--J_vhCIU.js +14 -0
  12. package/dist/{dist-B5vq9x6M.js → dist-BIgiGgKu.js} +1 -1
  13. package/dist/dist-BNvM_BAY.js +6 -0
  14. package/dist/{dist-XlpaG2JF.js → dist-BkpKCrXQ.js} +1 -1
  15. package/dist/{dist-BKRQwpg6.js → dist-CJxiVI4a.js} +1 -1
  16. package/dist/dist-CNOK8CHE.js +6 -0
  17. package/dist/dist-D25hs99E.js +10 -0
  18. package/dist/dist-D2igTc4m.js +6 -0
  19. package/dist/{dist-CqpVTRAq.js → dist-D7jBL3Ib.js} +9 -9
  20. package/dist/dist-DXjodKfp.js +6 -0
  21. package/dist/dist-DfFrsBkU.js +8 -0
  22. package/dist/dist-Vr-fb58P.js +12 -0
  23. package/dist/{element-DaStU7U7.js → element-BQWrbSEp.js} +7 -7
  24. package/dist/element.js +1 -1
  25. package/dist/{hints-v5iHTd1l.js → hints-CCMgezw9.js} +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/java-DeBiVPXO.js +6 -0
  29. package/dist/java-Xf1xYcVv.js +1 -0
  30. package/dist/{java-library-bitset.generated-Duwl7F-b.js → java-library-bitset.generated-C3m-nf8F.js} +1 -1
  31. package/dist/{java-library-math.generated-DmUvund7.js → java-library-math.generated-BQwpn8sQ.js} +1 -1
  32. package/dist/{java-library-regex.generated-a8crcad3.js → java-library-regex.generated-ItYSF2aV.js} +1 -1
  33. package/dist/java-library-time.generated-Dl0XA7nZ.js +6 -0
  34. package/dist/java-library.generated-B7ib0gOX.js +6 -0
  35. package/dist/{javascript-CSfl5gbA.js → javascript-CTY3U1Mc.js} +4 -2
  36. package/dist/{javascript-CX-lsX2u.js → javascript-DkarEcEB.js} +4 -2
  37. package/dist/{pyodide-Crdd9em4.js → pyodide-B1U3JD9Z.js} +2 -2
  38. package/dist/{pyodide-CdDlM0du.js → pyodide-BGBI232i.js} +1 -1
  39. package/dist/react.js +1 -1
  40. package/dist/runtime/compiler-assets.d.ts +5 -0
  41. package/dist/runtime/compiler-cache.d.ts +9 -0
  42. package/dist/runtime/config.d.ts +11 -0
  43. package/dist/runtime/cpp/assets.d.ts +6 -0
  44. package/dist/runtime/cpp/project.d.ts +9 -0
  45. package/dist/runtime/cpp/worker.d.ts +1 -0
  46. package/dist/runtime/cpp-worker.generated.d.ts +1 -0
  47. package/dist/runtime/cpp.d.ts +3 -0
  48. package/dist/runtime/java-library-bitset.generated.d.ts +2 -2
  49. package/dist/runtime/java-library-math.generated.d.ts +2 -2
  50. package/dist/runtime/java-library-regex.generated.d.ts +2 -2
  51. package/dist/runtime/java-library-time.generated.d.ts +3 -3
  52. package/dist/runtime/java-library.generated.d.ts +3 -3
  53. package/dist/runtime/java-worker.generated.d.ts +3 -3
  54. package/dist/runtime/worker-runtime.d.ts +1 -0
  55. package/dist/standalone.js +9 -9
  56. package/dist/types.d.ts +13 -1
  57. package/dist/worker-runtime-DfYet3xy.js +9 -0
  58. package/dist/worker-runtime-Dq71SbjR.js +4 -0
  59. package/package.json +18 -6
  60. package/dist/dist-BThnYaQ5.js +0 -12
  61. package/dist/dist-CnC1nMtN.js +0 -6
  62. package/dist/dist-D0FPZcUi.js +0 -8
  63. package/dist/dist-DOsLUKSb.js +0 -10
  64. package/dist/dist-D_qJovVA.js +0 -14
  65. package/dist/dist-DlIO0dzi.js +0 -6
  66. package/dist/dist-DmrP6yta.js +0 -6
  67. package/dist/java-DIL6bxPF.js +0 -1
  68. package/dist/java-DxQWnfHu.js +0 -6
  69. package/dist/java-library-time.generated-mFyqZ0pg.js +0 -6
  70. package/dist/java-library.generated-1yFV284B.js +0 -6
  71. package/dist/worker-runtime-C8pmmgW9.js +0 -4
  72. package/dist/worker-runtime-CNPpMRo1.js +0 -9
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ import{b as e,d as t,l as n,m as r,o as i,p as a,s as o,u as s,y as c}from"./dist-D25hs99E.js";import{a as l,d as u,i as d,l as f,n as p,o as m,p as h,r as g,t as _}from"./dist-Vr-fb58P.js";var ee=1024,v=0,y=class{constructor(e,t){this.from=e,this.to=t}},b=class{constructor(e={}){this.id=v++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=C.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};b.closedBy=new b({deserialize:e=>e.split(` `)}),b.openedBy=new b({deserialize:e=>e.split(` `)}),b.group=new b({deserialize:e=>e.split(` `)}),b.isolate=new b({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),b.contextHash=new b({perNode:!0}),b.lookAhead=new b({perNode:!0}),b.mounted=new b({perNode:!0});var x=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[b.mounted.id]}},S=Object.create(null),C=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):S,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(b.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(b.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};C.none=new C(``,Object.create(null),0,8);var w=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new C(e.name,r,e.id,e.flags):e)}return new e(n)}},T=/* @__PURE__ */ new WeakMap,E=/* @__PURE__ */ new WeakMap,D;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(D||={});var O=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=x.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new ue(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new ue(T.get(this)||this.topNode);return r.moveTo(e,t),T.set(this,r._tree),r}get topNode(){return new j(this,0,0,null)}resolve(e,t=0){let n=A(T.get(this)||this.topNode,e,t,!1);return T.set(this,n),n}resolveInner(e,t=0){let n=A(E.get(this)||this.topNode,e,t,!0);return E.set(this,n),n}resolveStack(e,t=0){return le(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&D.IncludeAnonymous)>0;for(let e=this.cursor(a|D.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:he(C.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(C.none,t,n,r)))}static build(e){return fe(e)}};O.empty=new O(C.none,[],[],0);var te=class e{constructor(e,t){this.buffer=e,this.index=t}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 e(this.buffer,this.index)}},k=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return C.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(ne(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function ne(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function A(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof j&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:D.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof j&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var re=class{cursor(e=0){return new ue(this,e)}getChild(e,t=null,n=null){let r=ie(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return ie(this,e,t,n)}resolve(e,t=0){return A(this,e,t,!1)}resolveInner(e,t=0){return A(this,e,t,!0)}matchContext(e){return ae(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},j=class e extends re{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&D.EnterBracketed&&l instanceof O&&(d=x.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||ne(i,r,u,u+l.length)){if(l instanceof k){if(a&D.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new M(new oe(o,l,t,u),null,e)}else if(a&D.IncludeAnonymous||!l.type.isAnonymous||de(l)){let s;if(!(a&D.IgnoreMounts)&&(s=x.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&D.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&D.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&D.IgnoreOverlays)&&(i=x.get(this._tree))&&i.overlay){let a=t-this.from,o=r&D.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 ie(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function ae(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var oe=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},M=class e extends re{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&D.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new O(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function se(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof j&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new ce(i,n)}var ce=class{constructor(e,t){this.heads=e,this.node=t}get next(){return se(this.heads)}};function le(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof j?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=x.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new j(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(A(o,t,n,!1))}}return i?se(i):r}var ue=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~D.EnterBracketed,e instanceof j)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof j?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&D.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&D.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&D.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&D.IncludeAnonymous||e instanceof k||!e.type.isAnonymous||de(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new M(this.buffer,t,this.stack[e]);return this.bufferNode=new M(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return ae(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return ae(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function de(e){return e.children.some(e=>e instanceof k||!e.type.isAnonymous||de(e))}function fe(e){let{buffer:t,nodeSet:n,maxBufferLength:r=ee,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new te(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,ee,v,y){let{id:b,start:x,end:S,size:C}=o,w=l,T=c;if(C<0){if(o.next(),C==-1){let t=i[b];_.push(t),ee.push(x-e);return}if(C==-3){c=b;return}if(C==-4){l=b;return}throw RangeError(`Unrecognized record size: ${C}`)}let E=s[b],D,O,te=x-e;if(S-x<=r&&(O=h(o.pos-t,v))){let t=new Uint16Array(O.size-O.skip),r=o.pos-O.size,i=t.length;for(;o.pos>r;)i=g(O.start,t,i);D=new k(t,S-O.start,n),te=O.start-e}else{let e=o.pos-C;o.next();let t=[],n=[],i=b>=a?b:-1,s=0,c=S;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,x,s,o.end,c,i,w,T),s=t.length,c=o.end),o.next()):y>2500?d(x,e,t,n):u(x,e,t,n,i,y+1);if(i>=0&&s>0&&s<t.length&&p(t,n,x,s,x,c,i,w,T),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(E,T);D=he(E,t,n,0,t.length,0,S-x,e,e)}else D=m(E,t,n,S-x,w-S,T)}_.push(D),ee.push(te)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new k(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof O){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(b.lookAhead))&&(a=r[o]+s.length+c)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[b.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[b.lookAhead,i];o=o?[e].concat(o):[e]}return new O(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new O(s[e.topID],_.reverse(),v.reverse(),y)}var pe=/* @__PURE__ */ new WeakMap;function me(e,t){if(!e.isAnonymous||t instanceof k||t.type!=e)return 1;let n=pe.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof O)){n=1;break}n+=me(e,r)}pe.set(t,n)}return n}function he(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=me(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=me(e,t[s]);for(s++;s<i;s++){let n=me(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(he(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var ge=class{constructor(){this.map=/* @__PURE__ */ new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=/* @__PURE__ */ new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof M?this.setBuffer(e.context.buffer,e.index,t):e instanceof j&&this.map.set(e.tree,t)}get(e){return e instanceof M?this.getBuffer(e.context.buffer,e.index):e instanceof j?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},_e=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},ve=class{startParse(e,t,n){return typeof e==`string`&&(e=new ye(e)),n=n?n.length?n.map(e=>new y(e.from,e.to)):[new y(0,0)]:[new y(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},ye=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new b({perNode:!0});var be=0,N=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=be++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Se(e);return e=>e.modified.indexOf(t)>-1?e:Se.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},xe=0,Se=class e{constructor(e){this.name=e,this.instances=[],this.id=xe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Ce(n,e.modified));if(r)return r;let i=[],a=new N(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=we(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function Ce(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function we(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Te(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new P(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Ee.add(t)}var Ee=new b({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new P(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),P=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};P.empty=new P([],2,null);function De(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Oe(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function ke(e,t,n,r=0,i=e.length){let a=new Ae(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Ae=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=je(e)||P.empty,u=Oe(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(b.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function je(e){let t=e.type.prop(Ee);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var F=N.define,Me=F(),I=F(),Ne=F(I),Pe=F(I),L=F(),Fe=F(L),Ie=F(L),R=F(),z=F(R),B=F(),V=F(),Le=F(),H=F(Le),Re=F(),U={comment:Me,lineComment:F(Me),blockComment:F(Me),docComment:F(Me),name:I,variableName:F(I),typeName:Ne,tagName:F(Ne),propertyName:Pe,attributeName:F(Pe),className:F(I),labelName:F(I),namespace:F(I),macroName:F(I),literal:L,string:Fe,docString:F(Fe),character:F(Fe),attributeValue:F(Fe),number:Ie,integer:F(Ie),float:F(Ie),bool:F(L),regexp:F(L),escape:F(L),color:F(L),url:F(L),keyword:B,self:F(B),null:F(B),atom:F(B),unit:F(B),modifier:F(B),operatorKeyword:F(B),controlKeyword:F(B),definitionKeyword:F(B),moduleKeyword:F(B),operator:V,derefOperator:F(V),arithmeticOperator:F(V),logicOperator:F(V),bitwiseOperator:F(V),compareOperator:F(V),updateOperator:F(V),definitionOperator:F(V),typeOperator:F(V),controlOperator:F(V),punctuation:Le,separator:F(Le),bracket:H,angleBracket:F(H),squareBracket:F(H),paren:F(H),brace:F(H),content:R,heading:z,heading1:F(z),heading2:F(z),heading3:F(z),heading4:F(z),heading5:F(z),heading6:F(z),contentSeparator:F(R),list:F(R),quote:F(R),emphasis:F(R),strong:F(R),link:F(R),monospace:F(R),strikethrough:F(R),inserted:F(),deleted:F(),changed:F(),invalid:F(),meta:Re,documentMeta:F(Re),annotation:F(Re),processingInstruction:F(Re),definition:N.defineModifier(`definition`),constant:N.defineModifier(`constant`),function:N.defineModifier(`function`),standard:N.defineModifier(`standard`),local:N.defineModifier(`local`),special:N.defineModifier(`special`)};for(let e in U){let t=U[e];t instanceof N&&(t.name=e)}De([{tag:U.link,class:`tok-link`},{tag:U.heading,class:`tok-heading`},{tag:U.emphasis,class:`tok-emphasis`},{tag:U.strong,class:`tok-strong`},{tag:U.keyword,class:`tok-keyword`},{tag:U.atom,class:`tok-atom`},{tag:U.bool,class:`tok-bool`},{tag:U.url,class:`tok-url`},{tag:U.labelName,class:`tok-labelName`},{tag:U.inserted,class:`tok-inserted`},{tag:U.deleted,class:`tok-deleted`},{tag:U.literal,class:`tok-literal`},{tag:U.string,class:`tok-string`},{tag:U.number,class:`tok-number`},{tag:[U.regexp,U.escape,U.special(U.string)],class:`tok-string2`},{tag:U.variableName,class:`tok-variableName`},{tag:U.local(U.variableName),class:`tok-variableName tok-local`},{tag:U.definition(U.variableName),class:`tok-variableName tok-definition`},{tag:U.special(U.variableName),class:`tok-variableName2`},{tag:U.definition(U.propertyName),class:`tok-propertyName tok-definition`},{tag:U.typeName,class:`tok-typeName`},{tag:U.namespace,class:`tok-namespace`},{tag:U.className,class:`tok-className`},{tag:U.macroName,class:`tok-macroName`},{tag:U.propertyName,class:`tok-propertyName`},{tag:U.operator,class:`tok-operator`},{tag:U.comment,class:`tok-comment`},{tag:U.meta,class:`tok-meta`},{tag:U.invalid,class:`tok-invalid`},{tag:U.punctuation,class:`tok-punctuation`}]);var W=/*@__PURE__*/ new b;function ze(e){return o.define({combine:e?t=>t.concat(e):void 0})}var Be=/*@__PURE__*/ new b,G=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,i.prototype.hasOwnProperty(`tree`)||Object.defineProperty(i.prototype,"tree",{get(){return K(this)}}),this.parser=t,this.extension=[q.of(this),i.languageData.of((e,t,n)=>{let r=Ve(e,t,n),i=r.type.prop(W);if(!i)return[];let a=e.facet(i),o=r.type.prop(Be);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return Ve(e,t,n).type.prop(W)==this.data}findRegions(e){let t=e.facet(q);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(W)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(b.mounted);if(i){if(i.tree.prop(W)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof O&&r(i,e.positions[n]+t)}};return r(K(e),0),n}get allowsNesting(){return!0}};G.setState=/*@__PURE__*/ a.define();function Ve(e,t,n){let r=e.facet(q),i=K(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,D.ExcludeBuffers|D.EnterBracketed))e.type.isTop&&(i=e);return i}var He=class e extends G{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=ze(t.languageData);return new e(n,t.parser.configure({props:[W.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function K(e){let t=e.field(G.state,!1);return t?t.tree:O.empty}function Ue(e,t,n=50){let r=e.field(G.state,!1)?.context;if(!r)return null;let i=r.viewport;r.updateViewport({from:0,to:t});let a=r.isDone(t)||r.work(n,t)?r.tree:null;return r.updateViewport(i),a}function We(e,t=e.doc.length){return e.field(G.state,!1)?.context.isDone(t)||!1}function Ge(e,t=e.viewport.to,n=100){let r=Ue(e.state,t,n);return r!=K(e.state)&&e.dispatch({}),!!r}function Ke(e){return e.plugin(et)?.isWorking()||!1}var qe=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},Je=null,Ye=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],O.empty,0,r,[],null)}startParse(){return this.parser.startParse(new qe(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=O.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(_e.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(_e.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Je;Je=this;try{return e()}finally{Je=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Xe(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=_e.applyChanges(r,e),i=O.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=Xe(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ve{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=Je;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new O(C.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Je}};function Xe(e,t,n){return _e.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var Ze=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Ye.create(t.facet(q).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};G.state=/*@__PURE__*/ r.define({create:Ze.init,update(e,t){for(let e of t.effects)if(e.is(G.setState))return e.value;return t.startState.facet(q)==t.state.facet(q)?e.apply(t):Ze.init(t.state)}});var Qe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(Qe=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var $e=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,et=/*@__PURE__*/ l.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(G.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(G.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Qe(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(G.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!$e?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>$e&&$e()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:G.setState.of(new Ze(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>u(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),q=/*@__PURE__*/ o.define({combine(e){return e.length?e[0]:null},enables:e=>[G.state,et,g.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),tt=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},nt=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},rt=/*@__PURE__*/ o.define(),it=/*@__PURE__*/ o.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function at(e){let t=e.facet(it);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function ot(e,t){let n=``,r=e.tabSize,i=e.facet(it)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function st(e,t){e instanceof i&&(e=new lt(e));for(let n of e.state.facet(rt)){let r=n(e,t);if(r!==void 0)return r}let n=K(e.state);return n.length>=t?dt(e,n,t):null}function ct(e,t,n){let r=Object.create(null),i=new lt(e,{overrideIndentation:e=>r[e]??-1}),a=[];for(let o=t;o<=n;){let t=e.doc.lineAt(o);o=t.to+1;let n=st(i,t.from);if(n==null)continue;/\S/.test(t.text)||(n=0);let s=/^\s*/.exec(t.text)[0],c=ot(e,n);s!=c&&(r[t.from]=n,a.push({from:t.from,to:t.from+s.length,insert:c}))}return e.changes(a)}var lt=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=at(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(t,n=t.length){return e(t,this.state.tabSize,n)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},ut=/*@__PURE__*/ new b;function dt(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return ft(r,e,n)}function ft(e,t,n){for(let r=e;r;r=r.next){let e=mt(r.node);if(e)return e(gt.create(t,n,r))}return 0}function pt(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function mt(e){let t=e.type.prop(ut);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(b.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>bt(e,!0,1,void 0,n&&!pt(e)?t.from:void 0)}return e.parent==null?ht:null}function ht(){return 0}var gt=class e extends lt{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(_t(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return ft(this.context.next,this.base,this.pos)}};function _t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function vt(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function yt({closing:e,align:t=!0,units:n=1}){return r=>bt(r,t,n,e)}function bt(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?vt(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var xt=e=>e.baseIndent;function St({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Ct=200;function wt(){return i.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent(`input.type`)&&!e.isUserEvent(`input.complete`))return e;let t=e.startState.languageDataAt(`indentOnInput`,e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+Ct)return e;let a=n.sliceString(i.from,r);if(!t.some(e=>e.test(a)))return e;let{state:o}=e,s=-1,c=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==s)continue;s=t.from;let n=st(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=ot(o,n);r!=i&&c.push({from:t.from,to:t.from+r.length,insert:i})}return c.length?[e,{changes:c,sequential:!0}]:e})}var Tt=/*@__PURE__*/ o.define(),Et=/*@__PURE__*/ new b;function Dt(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function Ot(e,t,n){let r=K(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(Et);if(s&&(i.to<r.length-50||r.length==e.doc.length||!kt(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function kt(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function J(e,t,n){for(let r of e.facet(Tt)){let i=r(e,t,n);if(i)return i}return Ot(e,t,n)}function At(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var Y=/*@__PURE__*/ a.define({map:At}),X=/*@__PURE__*/ a.define({map:At});function jt(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var Z=/*@__PURE__*/ r.define({create(){return _.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=Mt(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(Y)&&!Ft(e,r.value.from,r.value.to)?n.push(r.value):r.is(X)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(Kt),i=n.map(e=>(r?_.replace({widget:new Xt(r(t.state,e))}):Yt).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=Mt(e,t.selection.main.head)),e},provide:e=>g.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(Yt.range(r,i))}return _.set(t,!0)}});function Mt(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Nt(e){return e.field(Z,!1)||s.empty}function Pt(e,t,n){var r;let i=null;return(r=e.field(Z,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Ft(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function It(e,t){return e.field(Z,!1)?t:t.concat(a.appendConfig.of(qt()))}var Lt=e=>{for(let t of jt(e)){let n=J(e.state,t.from,t.to);if(n)return e.dispatch({effects:It(e.state,[Y.of(n),zt(e,n)])}),!0}return!1},Rt=e=>{if(!e.state.field(Z,!1))return!1;let t=[];for(let n of jt(e)){let r=Pt(e.state,n.from,n.to);r&&t.push(X.of(r),zt(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function zt(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return g.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var Bt=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=J(t,i.from,i.to);a&&n.push(Y.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:It(e.state,n)}),!!n.length},Vt=e=>{let t=e.state.field(Z,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(X.of({from:e,to:t}))}),e.dispatch({effects:n}),!0};function Ht(e,t){for(let n=t;;){let r=J(e.state,n.from,n.to);if(r&&r.to>t.from)return r;if(!n.from)return null;n=e.lineBlockAt(n.from-1)}}var Ut=e=>{let t=[];for(let n of jt(e)){let r=Pt(e.state,n.from,n.to);if(r)t.push(X.of(r),zt(e,r,!1));else{let r=Ht(e,n);r&&t.push(Y.of(r),zt(e,r))}}return t.length>0&&e.dispatch({effects:It(e.state,t)}),!!t.length},Wt=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:Lt},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:Rt},{key:`Ctrl-Alt-[`,run:Bt},{key:`Ctrl-Alt-]`,run:Vt}],Gt={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},Kt=/*@__PURE__*/ o.define({combine(e){return c(e,Gt)}});function qt(e){let t=[Z,en];return e&&t.push(Kt.of(e)),t}function Jt(e,t){let{state:n}=e,r=n.facet(Kt),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Pt(e.state,n.from,n.to);r&&e.dispatch({effects:X.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var Yt=/*@__PURE__*/ _.replace({widget:/*@__PURE__*/ new class extends m{toDOM(e){return Jt(e,null)}}}),Xt=class extends m{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Jt(e,this.value)}},Zt={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},Qt=class extends d{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement(`span`);return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?`Fold line`:`Unfold line`),t}};function $t(e={}){let n={...Zt,...e},r=new Qt(n,!0),i=new Qt(n,!1),a=l.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(q)!=e.state.facet(q)||e.startState.field(Z,!1)!=e.state.field(Z,!1)||K(e.startState)!=K(e.state)||n.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let n=new t;for(let t of e.viewportLineBlocks){let a=Pt(e.state,t.from,t.to)?i:J(e.state,t.from,t.to)?r:null;a&&n.add(t.from,t.from,a)}return n.finish()}}),{domEventHandlers:o}=n;return[a,f({class:`cm-foldGutter`,markers(e){return e.plugin(a)?.markers||s.empty},initialSpacer(){return new Qt(n,!1)},domEventHandlers:{...o,click:(e,t,n)=>{if(o.click&&o.click(e,t,n))return!0;let r=Pt(e.state,t.from,t.to);if(r)return e.dispatch({effects:X.of(r)}),!0;let i=J(e.state,t.from,t.to);return i?(e.dispatch({effects:Y.of(i)}),!0):!1}}}),qt()]}var en=/*@__PURE__*/ g.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`}}),tn=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=h.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof G?e=>e.prop(W)==a.data:a?e=>e==a:void 0,this.style=De(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new h(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},nn=/*@__PURE__*/ o.define(),rn=/*@__PURE__*/ o.define({combine(e){return e.length?[e[0]]:null}});function an(e){let t=e.facet(nn);return t.length?t:e.facet(rn)}function on(e,t){let n=[ln],r;return e instanceof tn&&(e.module&&n.push(g.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(rn.of(e)):r?n.push(nn.computeN([g.darkTheme],t=>t.facet(g.darkTheme)==(r==`dark`)?[e]:[])):n.push(nn.of(e)),n}function sn(e,t,n){let r=an(e),i=null;if(r){for(let e of r)if(!e.scope||n&&e.scope(n)){let n=e.style(t);n&&(i=i?i+` `+n:n)}}return i}var cn=class{constructor(e){this.markCache=Object.create(null),this.tree=K(e.state),this.decorations=this.buildDeco(e,an(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=K(e.state),n=an(e.state),r=n!=an(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return _.none;let r=new t;for(let{from:t,to:i}of e.visibleRanges)ke(this.tree,n,(e,t,n)=>{r.add(e,t,this.markCache[n]||(this.markCache[n]=_.mark({class:n})))},t,i);return r.finish()}},ln=/*@__PURE__*/ n.high(/*@__PURE__*/ l.fromClass(cn,{decorations:e=>e.decorations})),un=/*@__PURE__*/ tn.define([{tag:U.meta,color:`#404740`},{tag:U.link,textDecoration:`underline`},{tag:U.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:U.emphasis,fontStyle:`italic`},{tag:U.strong,fontWeight:`bold`},{tag:U.strikethrough,textDecoration:`line-through`},{tag:U.keyword,color:`#708`},{tag:[U.atom,U.bool,U.url,U.contentSeparator,U.labelName],color:`#219`},{tag:[U.literal,U.inserted],color:`#164`},{tag:[U.string,U.deleted],color:`#a11`},{tag:[U.regexp,U.escape,/*@__PURE__*/ U.special(U.string)],color:`#e40`},{tag:/*@__PURE__*/ U.definition(U.variableName),color:`#00f`},{tag:/*@__PURE__*/ U.local(U.variableName),color:`#30a`},{tag:[U.typeName,U.namespace],color:`#085`},{tag:U.className,color:`#167`},{tag:[/*@__PURE__*/ U.special(U.variableName),U.macroName],color:`#256`},{tag:/*@__PURE__*/ U.definition(U.propertyName),color:`#00c`},{tag:U.comment,color:`#940`},{tag:U.invalid,color:`#f00`}]),dn=/*@__PURE__*/ g.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),fn=1e4,pn=`()[]{}`,mn=/*@__PURE__*/ o.define({combine(e){return c(e,{afterCursor:!0,brackets:pn,maxScanDistance:fn,renderMatch:_n})}}),hn=/*@__PURE__*/ _.mark({class:`cm-matchingBracket`}),gn=/*@__PURE__*/ _.mark({class:`cm-nonmatchingBracket`});function _n(e){let t=[],n=e.matched?hn:gn;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function vn(e){let t=[],n=e.facet(mn);for(let r of e.selection.ranges){if(!r.empty)continue;let i=Q(e,r.head,-1,n)||r.head>0&&Q(e,r.head-1,1,n)||n.afterCursor&&(Q(e,r.head,1,n)||r.head<e.doc.length&&Q(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return _.set(t,!0)}var yn=[/* @__PURE__ */ l.fromClass(class{constructor(e){this.paused=!1,this.decorations=vn(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=vn(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),dn];function bn(e={}){return[mn.of(e),yn]}var xn=/*@__PURE__*/ new b;function Sn(e,t,n){let r=e.prop(t<0?b.openedBy:b.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function Cn(e){let t=e.type.prop(xn);return t?t(e.node):e}function Q(e,t,n,r={}){let i=r.maxScanDistance||fn,a=r.brackets||pn,o=K(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=Sn(r.type,n,a);if(i&&r.from<r.to){let o=Cn(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return wn(e,t,n,r,o,i,a)}}return Tn(e,t,n,o,s.type,i,a)}function wn(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=Cn(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Sn(u.type,n,o))l++;else if(Sn(u.type,-n,o)){if(l==0){let e=Cn(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function Tn(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}function En(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var Dn=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=En(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??En(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}};function On(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||kn,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Ln,mergeTokens:e.mergeTokens!==!1}}function kn(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var An=/*@__PURE__*/ new WeakMap,jn=class e extends G{constructor(e){let t=ze(e.languageData),n=On(e),r,i=new class extends ve{createParse(e,t,n){return new Fn(r,e,t,n)}};super(t,i,[],e.name),this.topNode=Kn(t,this),r=this,this.streamParser=n,this.stateAfter=new b({perNode:!0}),this.tokenTable=e.tokenTable?new Hn(n.tokenTable):Un}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=An.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Mn(this,e.node.tree,e.node.from,e.node.from,t??e.pos),i,a;if(r?(a=r.state,i=r.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let t=e.state.doc.lineAt(i),r=Math.min(e.pos,t.to);if(t.length){let i=n?n(t.from):-1,o=new Dn(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)In(this.streamParser.token,o,a)}else this.streamParser.blankLine(a,e.unit);if(r==e.pos)break;i=t.to+1}let o=e.lineAt(e.pos);return n&&t==null&&An.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function Mn(e,t,n,r,i){let a=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],s=n+t.positions[a],c=o instanceof O&&s<i&&Mn(e,o,s,r,i);if(c)return c}return null}function Nn(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],c;if(o<r&&s instanceof O){if(!(c=Nn(e,s,n-o,r-o,i)))break;return i?new O(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function Pn(e,t,n,r,i){for(let i of t){let t=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),o=t<=n&&a>n&&Mn(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=Nn(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?at(i):4),tree:O.empty}}var Fn=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=Ye.get(),a=r[0].from,{state:o,tree:s}=Pn(e,n,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+s.length;for(let e=0;e<s.children.length;e++)this.chunks.push(s.children[e]),this.chunkPos.push(s.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(at(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=Ye.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
7
+ `&&(t=``);else{let e=t.indexOf(`
8
+ `);e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n||(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length))break;let i=this.ranges[e].from,a=this.lineAfter(i);t+=a,n=i+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;let a=this.ranges[++this.rangeIndex].from;t+=a-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let e=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,i+=this.chunk.length-e}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==t?this.chunk[a+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,a=new Dn(t,e?e.state.tabSize:4,e?at(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=In(i.token,a,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=O.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Rn,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new O(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new O(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function In(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw Error(`Stream parser failed to advance stream.`)}var Ln=/*@__PURE__*/ Object.create(null),$=[C.none],Rn=/*@__PURE__*/ new w($),zn=[],Bn=/*@__PURE__*/ Object.create(null),Vn=/*@__PURE__*/ Object.create(null);for(let[e,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`]])Vn[e]=/*@__PURE__*/ Gn(Ln,t);var Hn=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Vn)}resolve(e){return e?this.table[e]||(this.table[e]=Gn(this.extra,e)):0}},Un=/*@__PURE__*/ new Hn(Ln);function Wn(e,t){zn.indexOf(e)>-1||(zn.push(e),console.warn(t))}function Gn(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||U[n];r?typeof r==`function`?t.length?t=t.map(r):Wn(n,`Modifier ${n} used at start of tag`):t.length?Wn(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Wn(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=Bn[i];if(a)return a.id;let o=Bn[i]=C.define({id:$.length,name:r,props:[Te({[r]:n})]});return $.push(o),o.id}function Kn(e,t){let n=C.define({id:$.length,name:`Document`,props:[W.add(()=>e),ut.add(()=>e=>t.getIndent(e))],top:!0});return $.push(n),n}function qn(e){return e.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e)}function Jn(e){for(let t=e.iter();!t.next().done;)if(qn(t.value))return!0;return!1}function Yn(e){let t=!1;return e.iterChanges((e,n,r,i,a)=>{!t&&Jn(a)&&(t=!0)}),t}var Xn=/*@__PURE__*/ o.define({combine:e=>e.some(e=>e)});function Zn(e={}){let t=[Qn];return e.alwaysIsolate&&t.push(Xn.of(!0)),t}var Qn=/*@__PURE__*/ l.fromClass(class{constructor(e){this.always=e.state.facet(Xn)||e.textDirection!=p.LTR||e.state.facet(g.perLineTextDirection),this.hasRTL=!this.always&&Jn(e.state.doc),this.tree=K(e.state),this.decorations=this.always||this.hasRTL?$n(e,this.tree,this.always):_.none}update(e){let t=e.state.facet(Xn)||e.view.textDirection!=p.LTR||e.state.facet(g.perLineTextDirection);if(!t&&!this.hasRTL&&Yn(e.changes)&&(this.hasRTL=!0),!t&&!this.hasRTL)return;let n=K(e.state);(t!=this.always||n!=this.tree||e.docChanged||e.viewportChanged)&&(this.tree=n,this.always=t,this.decorations=$n(e.view,n,t))}},{provide:e=>{function t(t){return t.plugin(e)?.decorations??_.none}return[g.outerDecorations.of(t),n.lowest(g.bidiIsolatedRanges.of(t))]}});function $n(e,n,r){let i=new t,a=e.visibleRanges;r||(a=er(a,e.state.doc));for(let{from:e,to:t}of a)n.iterate({enter:e=>{let t=e.type.prop(b.isolate);t&&i.add(e.from,e.to,tr[t])},from:e,to:t});return i.finish()}function er(e,t){let n=t.iter(),r=0,i=[],a=null;for(let{from:t,to:o}of e)if(!(a&&a.to>t&&(t=a.to,t>=o)))for(r+n.value.length<t&&(n.next(t-(r+n.value.length)),r=t);;){let e=r,t=r+n.value.length;if(!n.lineBreak&&qn(n.value)&&(a&&a.to>e-10?a.to=Math.min(o,t):i.push(a={from:e,to:Math.min(o,t)})),t>=o)break;r=t,n.next()}return i}var tr={rtl:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`rtl`},bidiIsolate:p.RTL}),ltr:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`ltr`},bidiIsolate:p.LTR}),auto:/*@__PURE__*/ _.mark({class:`cm-iso`,inclusive:!0,attributes:{dir:`auto`},bidiIsolate:null})};export{qe as DocInput,tn as HighlightStyle,lt as IndentContext,He as LRLanguage,G as Language,nt as LanguageDescription,tt as LanguageSupport,Ye as ParseContext,jn as StreamLanguage,Dn as StringStream,gt as TreeIndentContext,b as a,Zn as bidiIsolates,bn as bracketMatching,xn as bracketMatchingHandle,ge as c,qt as codeFolding,St as continuedIndent,un as defaultHighlightStyle,ze as defineLanguageFacet,yt as delimitedIndent,Ue as ensureSyntaxTree,xt as flatIndent,Bt as foldAll,Lt as foldCode,Y as foldEffect,$t as foldGutter,Dt as foldInside,Wt as foldKeymap,Et as foldNodeProp,Tt as foldService,Z as foldState,J as foldable,Nt as foldedRanges,Ge as forceParsing,at as getIndentUnit,st as getIndentation,sn as highlightingFor,D as i,ut as indentNodeProp,wt as indentOnInput,ct as indentRange,rt as indentService,ot as indentString,it as indentUnit,ve as l,q as language,W as languageDataProp,Q as matchBrackets,U as n,w as o,ee as r,C as s,Be as sublanguageProp,on as syntaxHighlighting,Ke as syntaxParserRunning,K as syntaxTree,We as syntaxTreeAvailable,Te as t,Ut as toggleFold,O as u,Vt as unfoldAll,Rt as unfoldCode,X as unfoldEffect};