@fnndsc/argus 0.43.0 → 0.44.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.
- package/dist/assets/{Settings-BMJaDptb.js → Settings-CA_Y9_tD.js} +1 -1
- package/dist/assets/{Texture-DMlqpdeR.js → Texture-CiCQeubr.js} +1 -1
- package/dist/assets/__vite-browser-external-D7Ct-6yo.js +1 -0
- package/dist/assets/{addVolumesToViewports-Df-xtrvy.js → addVolumesToViewports-DMbI2RL0.js} +1 -1
- package/dist/assets/asciidoc-CY89DR7y.js +1 -0
- package/dist/assets/cornerstoneEngine-DOq401ca.js +2 -0
- package/dist/assets/documentEngines-DVCBo-Z6.js +1960 -0
- package/dist/assets/field-DLtY8hYm.js +2 -0
- package/dist/assets/index-BQPxeCl8.js +1 -0
- package/dist/assets/{index-B6zltrBv.js → index-BQltAD7K.js} +1 -1
- package/dist/assets/index-BtxxK29d.js +13 -0
- package/dist/assets/{index-M_ElGUhd.js → index-BuNudOlE.js} +245 -245
- package/dist/assets/index-CH0i1dT3.js +1 -0
- package/dist/assets/{index-CumqcIR1.js → index-CPY1fYxX.js} +5 -5
- package/dist/assets/index-CRipsi7X.js +1 -0
- package/dist/assets/{index-CbXrICMA.js → index-CewxfqE7.js} +1 -1
- package/dist/assets/index-D6WqGtsG.js +27876 -0
- package/dist/assets/{index-BlsRHH5_.js → index-D6nj2sGK.js} +2 -2
- package/dist/assets/index-D9307TXO.js +3 -0
- package/dist/assets/{index-DPOsCEOj.js → index-DAPJ1asE.js} +1 -1
- package/dist/assets/index-DBDbe82G.js +1 -0
- package/dist/assets/index-DTiNKN3t.js +1 -0
- package/dist/assets/index-Da39IMz6.css +1 -0
- package/dist/assets/{index-BDdjtqhe.js → index-dGoK1HyL.js} +2 -2
- package/dist/assets/{niivueEngine-CxKW1mDW.js → niivueEngine-GirHHMsU.js} +2 -2
- package/dist/assets/{slabScene-CYO8ilc7.js → slabScene-DZaFF3AA.js} +2 -2
- package/dist/assets/syntax-1x8StFCS.js +15 -0
- package/dist/build.json +1 -1
- package/dist/index.html +2 -2
- package/dist/notes.json +1 -1
- package/package.json +4 -1
- package/dist/assets/cornerstoneEngine-CCys6hXi.js +0 -2
- package/dist/assets/field-Gyij1-2V.js +0 -12
- package/dist/assets/index-B2I3zHKh.js +0 -1
- package/dist/assets/index-CdJijRXE.js +0 -1
- package/dist/assets/index-CgllecgK.js +0 -3
- package/dist/assets/index-DQZiM6Ic.css +0 -1
- package/dist/assets/index-DvIjGJJA.js +0 -13
- package/dist/assets/index-LXTkv5wy.js +0 -1
- package/dist/assets/index-dqYVVnOj.js +0 -1
- package/dist/assets/index-edPOjgBj.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CH0i1dT3.js","./index-DTiNKN3t.js","./index-BuNudOlE.js","./index-Da39IMz6.css","./index-BQPxeCl8.js","./index-DAPJ1asE.js","./index-DBDbe82G.js","./index-BtxxK29d.js","./asciidoc-CY89DR7y.js","./index-D9307TXO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as ee}from"./index-BuNudOlE.js";const Wl=1024;let Hl=0,yt=class{constructor(t,e){this.from=t,this.to=e}};class R{constructor(t={}){this.id=Hl++,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]}}}R.closedBy=new R({deserialize:s=>s.split(" ")});R.openedBy=new R({deserialize:s=>s.split(" ")});R.group=new R({deserialize:s=>s.split(" ")});R.isolate=new R({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class we{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[R.mounted.id]}}const Fl=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):Fl,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(R.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(R.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 rs{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 rs(e)}}const ri=new WeakMap,Os=new WeakMap;var V;(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"})(V||(V={}));class q{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=we.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 Pi(this.topNode,t)}cursorAt(t,e=0,i=0){let n=ri.get(this)||this.topNode,r=new Pi(n);return r.moveTo(t,e),ri.set(this,r._tree),r}get topNode(){return new st(this,0,0,null)}resolve(t,e=0){let i=_e(ri.get(this)||this.topNode,t,e,!1);return ri.set(this,i),i}resolveInner(t,e=0){let i=_e(Os.get(this)||this.topNode,t,e,!0);return Os.set(this,i),i}resolveStack(t,e=0){return Kl(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:r=this.length}=t,o=t.mode||0,l=(o&V.IncludeAnonymous)>0;for(let a=this.cursor(o|V.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:as(at.none,this.children,this.positions,0,this.children.length,0,this.length,(e,i,n)=>new q(this.type,e,i,n,this.propValues),t.makeTree||((e,i,n)=>new q(at.none,e,i,n)))}static build(t){return ql(t)}}q.empty=new q(at.none,[],[],0);class os{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 os(this.buffer,this.index)}}class Gt{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&&!(Kr(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 Gt(r,o,this.set)}}function Kr(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 _e(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 st&&s.index<0?null:s.parent;if(!o)return s;s=o}let r=i?0:V.IgnoreOverlays;if(i)for(let o=s,l=o.parent;l;o=l,l=o.parent)o instanceof st&&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 qr{cursor(t=0){return new Pi(this,t)}getChild(t,e=null,i=null){let n=Ds(this,t,e,i);return n.length?n[0]:null}getChildren(t,e=null,i=null){return Ds(this,t,e,i)}resolve(t,e=0){return _e(this,t,e,!1)}resolveInner(t,e=0){return _e(this,t,e,!0)}matchContext(t){return xn(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 st extends qr{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&V.EnterBracketed&&f instanceof q&&(u=we.get(f))&&!u.overlay&&u.bracketed&&i>=c&&i<=c+f.length)&&!Kr(n,i,c,c+f.length))){if(f instanceof Gt){if(r&V.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,e,i-c,n);if(d>-1)return new Rt(new Vl(o,f,t,c),null,d)}else if(r&V.IncludeAnonymous||!f.type.isAnonymous||ls(f)){let d;if(!(r&V.IgnoreMounts)&&(d=we.get(f))&&!d.overlay)return new st(d.tree,c,t,o);let p=new st(f,c,t,o);return r&V.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(e<0?f.children.length-1:0,e,i,n,r)}}}if(r&V.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&V.IgnoreOverlays)&&(n=we.get(this._tree))&&n.overlay){let r=t-this.from,o=i&V.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 st(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 Ds(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 xn(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 Vl{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class Rt extends qr{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&V.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 q(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function jr(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 st&&e.index<0?null:e.parent,n=s.slice();return i?n[t]=i:n.splice(t,1),new zl(n,e)}class zl{constructor(t,e){this.heads=t,this.node=e}get next(){return jr(this.heads)}}function Kl(s,t,e){let i=s.resolveInner(t,e),n=null;for(let r=i instanceof st?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=we.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new st(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(_e(l,t,e,!1))}}return n?jr(n):i}class Pi{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&~V.EnterBracketed,t instanceof st)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 st?(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&V.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&V.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&V.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&V.IncludeAnonymous||l instanceof Gt||!l.type.isAnonymous||ls(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 xn(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 xn(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 ls(s){return s.children.some(t=>t instanceof Gt||!t.type.isAnonymous||ls(t))}function ql(s){var t;let{buffer:e,nodeSet:i,maxBufferLength:n=Wl,reused:r=[],minRepeatType:o=i.types.length}=s,l=Array.isArray(e)?new os(e,e.length):e,a=i.types,h=0,f=0;function c(C,A,v,I,E,z){let{id:P,start:O,end:F,size:N}=l,j=f,rt=h;if(N<0)if(l.next(),N==-1){let Nt=r[P];v.push(Nt),I.push(O-C);return}else if(N==-3){h=P;return}else if(N==-4){f=P;return}else throw new RangeError(`Unrecognized record size: ${N}`);let ct=a[P],At,Q,pt=O-C;if(F-O<=n&&(Q=m(l.pos-A,E))){let Nt=new Uint16Array(Q.size-Q.skip),gt=l.pos-Q.size,Mt=Nt.length;for(;l.pos>gt;)Mt=y(Q.start,Nt,Mt);At=new Gt(Nt,F-Q.start,i),pt=Q.start-C}else{let Nt=l.pos-N;l.next();let gt=[],Mt=[],te=P>=o?P:-1,de=0,si=F;for(;l.pos>Nt;)te>=0&&l.id==te&&l.size>=0?(l.end<=si-n&&(p(gt,Mt,O,de,l.end,si,te,j,rt),de=gt.length,si=l.end),l.next()):z>2500?u(O,Nt,gt,Mt):c(O,Nt,gt,Mt,te,z+1);if(te>=0&&de>0&&de<gt.length&&p(gt,Mt,O,de,O,si,te,j,rt),gt.reverse(),Mt.reverse(),te>-1&&de>0){let Ts=d(ct,rt);At=as(ct,gt,Mt,0,gt.length,0,F-O,Ts,Ts)}else At=g(ct,gt,Mt,F-O,j-F,rt)}v.push(At),I.push(pt)}function u(C,A,v,I){let E=[],z=0,P=-1;for(;l.pos>A;){let{id:O,start:F,end:N,size:j}=l;if(j>4)l.next();else{if(P>-1&&F<P)break;P<0&&(P=N-n),E.push(O,F,N),z++,l.next()}}if(z){let O=new Uint16Array(z*4),F=E[E.length-2];for(let N=E.length-3,j=0;N>=0;N-=3)O[j++]=E[N],O[j++]=E[N+1]-F,O[j++]=E[N+2]-F,O[j++]=j;v.push(new Gt(O,E[2]-F,i)),I.push(F-C)}}function d(C,A){return(v,I,E)=>{let z=0,P=v.length-1,O,F;if(P>=0&&(O=v[P])instanceof q){if(!P&&O.type==C&&O.length==E)return O;(F=O.prop(R.lookAhead))&&(z=I[P]+O.length+F)}return g(C,v,I,E,z,A)}}function p(C,A,v,I,E,z,P,O,F){let N=[],j=[];for(;C.length>I;)N.push(C.pop()),j.push(A.pop()+v-E);C.push(g(i.types[P],N,j,z-E,O-z,F)),A.push(E-v)}function g(C,A,v,I,E,z,P){if(z){let O=[R.contextHash,z];P=P?[O].concat(P):[O]}if(E>25){let O=[R.lookAhead,E];P=P?[O].concat(P):[O]}return new q(C,A,v,I,P)}function m(C,A){let v=l.fork(),I=0,E=0,z=0,P=v.end-n,O={size:0,start:0,skip:0};t:for(let F=v.pos-C;v.pos>F;){let N=v.size;if(v.id==A&&N>=0){O.size=I,O.start=E,O.skip=z,z+=4,I+=4,v.next();continue}let j=v.pos-N;if(N<0||j<F||v.start<P)break;let rt=v.id>=o?4:0,ct=v.start;for(v.next();v.pos>j;){if(v.size<0)if(v.size==-3||v.size==-4)rt+=4;else break t;else v.id>=o&&(rt+=4);v.next()}E=ct,I+=N,z+=rt}return(A<0||I==C)&&(O.size=I,O.start=E,O.skip=z),O.size>4?O:void 0}function y(C,A,v){let{id:I,start:E,end:z,size:P}=l;if(l.next(),P>=0&&I<o){let O=v;if(P>4){let F=l.pos-(P-4);for(;l.pos>F;)v=y(C,A,v)}A[--v]=O,A[--v]=z-C,A[--v]=E-C,A[--v]=I}else P==-3?h=I:P==-4&&(f=I);return v}let k=[],w=[];for(;l.pos>0;)c(s.start||0,s.bufferStart||0,k,w,-1,0);let B=(t=s.length)!==null&&t!==void 0?t:k.length?w[0]+k[0].length:0;return new q(a[s.topID],k.reverse(),w.reverse(),B)}const Bs=new WeakMap;function vi(s,t){if(!s.isAnonymous||t instanceof Gt||t.type!=s)return 1;let e=Bs.get(t);if(e==null){e=1;for(let i of t.children){if(i.type!=s||!(i instanceof q)){e=1;break}e+=vi(s,i)}Bs.set(t,e)}return e}function as(s,t,e,i,n,r,o,l,a){let h=0;for(let p=i;p<n;p++)h+=vi(s,t[p]);let f=Math.ceil(h*1.5/8),c=[],u=[];function d(p,g,m,y,k){for(let w=m;w<y;){let B=w,C=g[w],A=vi(s,p[w]);for(w++;w<y;w++){let v=vi(s,p[w]);if(A+v>=f)break;A+=v}if(w==B+1){if(A>f){let v=p[B];d(v.children,v.positions,0,v.children.length,g[B]+k);continue}c.push(p[B])}else{let v=g[w-1]+p[w-1].length-C;c.push(as(s,p,g,B,w,C,v,null,a))}u.push(C+k-r)}}return d(t,e,i,n,0),(l||a)(c,u,o)}class Ac{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 st&&this.map.set(t.tree,e)}get(t){return t instanceof Rt?this.getBuffer(t.context.buffer,t.index):t instanceof st?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 Ft{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 Ft(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 Ft(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 _r{startParse(t,e,i){return typeof t=="string"&&(t=new jl(t)),i=i?i.length?i.map(n=>new yt(n.from,n.to)):[new yt(0,0)]:[new yt(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 jl{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)}}function Mc(s){return(t,e,i,n)=>new $l(t,s,e,i,n)}class Ps{constructor(t,e,i,n,r,o){this.parser=t,this.parse=e,this.overlay=i,this.bracketed=n,this.target=r,this.from=o}}function Es(s){if(!s.length||s.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}class _l{constructor(t,e,i,n,r,o,l,a){this.parser=t,this.predicate=e,this.mounts=i,this.index=n,this.start=r,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const kn=new R({perNode:!0});class $l{constructor(t,e,i,n,r){this.nest=e,this.input=i,this.fragments=n,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new q(i.type,i.children,i.positions,i.length,i.propValues.concat([[kn,this.stoppedAt]]))),i}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let i=Object.assign(Object.create(null),t.target.props);i[R.mounted.id]=new we(e,t.overlay,t.parser,t.bracketed),t.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].from<t&&(t=Math.min(t,this.inner[e].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let e=this.innerDone;e<this.inner.length;e++)this.inner[e].parse.stopAt(t)}startInner(){let t=new Yl(this.fragments),e=null,i=null,n=new Pi(new st(this.baseTree,this.ranges[0].from,0,null),V.IncludeAnonymous|V.IgnoreMounts);t:for(let r,o;;){let l=!0,a;if(this.stoppedAt!=null&&n.from>=this.stoppedAt)l=!1;else if(t.hasNode(n)){if(e){let h=e.mounts.find(f=>f.frag.from<=n.from&&f.frag.to>=n.to&&f.mount.overlay);if(h)for(let f of h.mount.overlay){let c=f.from+h.pos,u=f.to+h.pos;c>=n.from&&u<=n.to&&!e.ranges.some(d=>d.from<u&&d.to>c)&&e.ranges.push({from:c,to:u})}}l=!1}else if(i&&(o=Ul(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.from<n.to||!r.overlay)){n.tree||(Gl(n),e&&e.depth++,i&&i.depth++);let h=t.findMounts(n.from,r.parser);if(typeof r.overlay=="function")e=new _l(r.parser,r.overlay,h,this.inner.length,n.from,!!r.bracketed,n.tree,e);else{let f=Is(this.ranges,r.overlay||(n.from<n.to?[new yt(n.from,n.to)]:[]));f.length&&Es(f),(f.length||!r.overlay)&&this.inner.push(new Ps(r.parser,f.length?r.parser.startParse(this.input,Ns(h,f),f):r.parser.startParse(""),r.overlay?r.overlay.map(c=>new yt(c.from-n.from,c.to-n.from)):null,!!r.bracketed,n.tree,f.length?f[0].from:n.from)),r.overlay?f.length&&(i={ranges:f,depth:0,prev:i}):l=!1}}else if(e&&(a=e.predicate(n))&&(a===!0&&(a=new yt(n.from,n.to)),a.from<a.to)){let h=e.ranges.length-1;h>=0&&e.ranges[h].to==a.from?e.ranges[h]={from:e.ranges[h].from,to:a.to}:e.ranges.push(a)}if(l&&n.firstChild())e&&e.depth++,i&&i.depth++;else for(;!n.nextSibling();){if(!n.parent())break t;if(e&&!--e.depth){let h=Is(this.ranges,e.ranges);h.length&&(Es(h),this.inner.splice(e.index,0,new Ps(e.parser,e.parser.startParse(this.input,Ns(e.mounts,h),h),e.ranges.map(f=>new yt(f.from-e.start,f.to-e.start)),e.bracketed,e.target,h[0].from))),e=e.prev}i&&!--i.depth&&(i=i.prev)}}}}function Ul(s,t,e){for(let i of s){if(i.from>=e)break;if(i.to>t)return i.from<=t&&i.to>=e?2:1}return 0}function Rs(s,t,e,i,n,r){if(t<e){let o=s.buffer[t+1];i.push(s.slice(t,e,o)),n.push(o-r)}}function Gl(s){let{node:t}=s,e=[],i=t.context.buffer;do e.push(s.index),s.parent();while(!s.tree);let n=s.tree,r=n.children.indexOf(i),o=n.children[r],l=o.buffer,a=[r];function h(f,c,u,d,p,g){let m=e[g],y=[],k=[];Rs(o,f,m,y,k,d);let w=l[m+1],B=l[m+2];a.push(y.length);let C=g?h(m+4,l[m+3],o.set.types[l[m]],w,B-w,g-1):t.toTree();return y.push(C),k.push(w-d),Rs(o,l[m+3],c,y,k,d),new q(u,y,k,p)}n.children[r]=h(0,l.length,at.none,0,o.length,e.length-1);for(let f of a){let c=s.tree.children[f],u=s.tree.positions[f];s.yield(new st(c,u+s.from,f,s._tree))}}class Ls{constructor(t,e){this.offset=e,this.done=!1,this.cursor=t.cursor(V.IncludeAnonymous|V.IgnoreMounts|V.ExcludeBuffers)}moveTo(t){let{cursor:e}=this,i=t-this.offset;for(;!this.done&&e.from<i;)if(!(e.to>=i&&e.enter(i,1,V.IncludeAnonymous|V.IgnoreOverlays|V.ExcludeBuffers)))if(e.to<=i)e.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(e.children.length&&e.positions[0]==0&&e.children[0]instanceof q)e=e.children[0];else break}return!1}}class Yl{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let i=this.curFrag=t[0];this.curTo=(e=i.tree.prop(kn))!==null&&e!==void 0?e:i.to,this.inner=new Ls(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=(t=e.tree.prop(kn))!==null&&t!==void 0?t:e.to,this.inner=new Ls(e.tree,-e.offset)}}findMounts(t,e){var i;let n=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==e)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=r.to)break;a.tree==this.curFrag.tree&&n.push({frag:a,pos:r.from-a.offset,mount:o})}}}return n}}function Is(s,t){let e=null,i=t;for(let n=1,r=0;n<s.length;n++){let o=s[n-1].to,l=s[n].from;for(;r<i.length;r++){let a=i[r];if(a.from>=l)break;a.to<=o||(e||(i=e=t.slice()),a.from<o?(e[r]=new yt(a.from,o),a.to>l&&e.splice(r+1,0,new yt(l,a.to))):a.to>l?e[r--]=new yt(l,a.to):e.splice(r--,1))}}return i}function Xl(s,t,e,i){let n=0,r=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let f=n==s.length?1e9:o?s[n].to:s[n].from,c=r==t.length?1e9:l?t[r].to:t[r].from;if(o!=l){let u=Math.max(a,e),d=Math.min(f,c,i);u<d&&h.push(new yt(u,d))}if(a=Math.min(f,c),a==1e9)break;f==a&&(o?(o=!1,n++):o=!0),c==a&&(l?(l=!1,r++):l=!0)}return h}function Ns(s,t){let e=[];for(let{pos:i,mount:n,frag:r}of s){let o=i+(n.overlay?n.overlay[0].from:0),l=o+n.tree.length,a=Math.max(r.from,o),h=Math.min(r.to,l);if(n.overlay){let f=n.overlay.map(u=>new yt(u.from+i,u.to+i)),c=Xl(t,f,a,h);for(let u=0,d=a;;u++){let p=u==c.length,g=p?h:c[u].from;if(g>d&&e.push(new Ft(d,g,n.tree,-o,r.from>=d||r.openStart,r.to<=g||r.openEnd)),p)break;d=c[u].to}}else e.push(new Ft(a,h,n.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return e}let vn=[],$r=[];(()=>{let s="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<s.length;t++)(t%2?$r:vn).push(e=e+s[t])})();function Jl(s){if(s<768)return!1;for(let t=0,e=vn.length;;){let i=t+e>>1;if(s<vn[i])e=i;else if(s>=$r[i])t=i+1;else return!0;if(t==e)return!1}}function Ws(s){return s>=127462&&s<=127487}const Hs=8205;function Ql(s,t,e=!0,i=!0){return(e?Ur:Zl)(s,t,i)}function Ur(s,t,e){if(t==s.length)return t;t&&Gr(s.charCodeAt(t))&&Yr(s.charCodeAt(t-1))&&t--;let i=en(s,t);for(t+=Fs(i);t<s.length;){let n=en(s,t);if(i==Hs||n==Hs||e&&Jl(n))t+=Fs(n),i=n;else if(Ws(n)){let r=0,o=t-2;for(;o>=0&&Ws(en(s,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function Zl(s,t,e){for(;t>1;){let i=Ur(s,t-2,e);if(i<t)return i;t--}return 0}function en(s,t){let e=s.charCodeAt(t);if(!Yr(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return Gr(i)?(e-55296<<10)+(i-56320)+65536:e}function Gr(s){return s>=56320&&s<57344}function Yr(s){return s>=55296&&s<56320}function Fs(s){return s<65536?1:2}class W{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=Ae(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),Pt.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Ae(this,t,e);let i=[];return this.decompose(t,e,i,0),Pt.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new Ve(this),r=new Ve(t);for(let o=e,l=e;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(t=1){return new Ve(this,t)}iterRange(t,e=this.length){return new Xr(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Jr(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?W.empty:t.length<=32?new X(t):Pt.from(X.split(t,[]))}}class X extends W{constructor(t,e=ta(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.text[r],l=n+o.length;if((e?i:l)>=t)return new ea(n,l,i,o);n=l+1,i++}}decompose(t,e,i,n){let r=t<=0&&e>=this.length?this:new X(Vs(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=i.pop(),l=Si(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new X(l,o.length+r.length));else{let a=l.length>>1;i.push(new X(l.slice(0,a)),new X(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof X))return super.replace(t,e,i);[t,e]=Ae(this,t,e);let n=Si(this.text,Si(i.text,Vs(this.text,0,t)),e),r=this.length+i.length-(e-t);return n.length<=32?new X(n,r):Pt.from(X.split(n,[]),r)}sliceString(t,e=this.length,i=`
|
|
3
|
+
`){[t,e]=Ae(this,t,e);let n="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>t&&o&&(n+=i),t<a&&e>r&&(n+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let r of t)i.push(r),n+=r.length+1,i.length==32&&(e.push(new X(i,n)),i=[],n=-1);return n>-1&&e.push(new X(i,n)),e}}class Pt extends W{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.children[r],l=n+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,n);n=l+1,i=a+1}}decompose(t,e,i,n){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(t<=a&&e>=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if([t,e]=Ae(this,t,e),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],l=r+o.length;if(t>=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new Pt(f,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
|
|
4
|
+
`){[t,e]=Ae(this,t,e);let n="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let l=this.children[r],a=o+l.length;o>t&&r&&(n+=i),t<a&&e>o&&(n+=l.sliceString(t-o,e-o,i)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof Pt))return 0;let i=0,[n,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,r+=e){if(n==o||r==l)return i;let a=this.children[n],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of t)i+=d.lines;if(i<32){let d=[];for(let p of t)p.flatten(d);return new X(d,e)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let p;if(d.lines>r&&d instanceof Pt)for(let g of d.children)c(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof X&&a&&(p=f[f.length-1])instanceof X&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new X(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:Pt.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new Pt(l,e)}}W.empty=new X([""],0);function ta(s){let t=-1;for(let e of s)t+=e.length+1;return t}function Si(s,t,e=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let l=s[r],a=n+l.length;a>=e&&(a>i&&(l=l.slice(0,i-n)),n<e&&(l=l.slice(e-n)),o?(t[t.length-1]+=l,o=!1):t.push(l)),n=a+1}return t}function Vs(s,t,e){return Si(s,[""],t,e)}class Ve{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof X?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof X?n.text.length:n.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
|
|
5
|
+
`,this;t--}else if(n instanceof X){let a=n.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof X?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Xr{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new Ve(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Jr{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(W.prototype[Symbol.iterator]=function(){return this.iter()},Ve.prototype[Symbol.iterator]=Xr.prototype[Symbol.iterator]=Jr.prototype[Symbol.iterator]=function(){return this});class ea{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}function Ae(s,t,e){return t=Math.max(0,Math.min(s.length,t)),[t,Math.max(t,Math.min(s.length,e))]}function vt(s,t,e=!0,i=!0){return Ql(s,t,e,i)}function ia(s){return s>=56320&&s<57344}function na(s){return s>=55296&&s<56320}function sa(s,t){let e=s.charCodeAt(t);if(!na(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return ia(i)?(e-55296<<10)+(i-56320)+65536:e}function Tc(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function ra(s){return s<65536?1:2}const Sn=/\r\n?|\n/;var dt=(function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s})(dt||(dt={}));class Vt{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let r=this.sections[e++],o=this.sections[e++];o<0?(t(i,n,r),n+=r):n+=o,i+=r}}iterChangedRanges(t,e=!1){Cn(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new Vt(t)}composeDesc(t){return this.empty?t:t.empty?this:Qr(this,t)}mapDesc(t,e=!1){return t.empty?this:An(this,t,e)}mapPos(t,e=-1,i=dt.Simple){let n=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>t)return r+(t-n);r+=l}else{if(i!=dt.Simple&&h>=t&&(i==dt.TrackDel&&n<t&&h>t||i==dt.TrackBefore&&n<t||i==dt.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?r:r+a;r+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i<this.sections.length&&n<=e;){let r=this.sections[i++],o=this.sections[i++],l=n+r;if(o>=0&&n<=e&&l>=t)return n<t&&l>e?"cover":!0;n=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Vt(t)}static create(t){return new Vt(t)}}class J extends Vt{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return Cn(this,(e,i,n,r,o)=>t=t.replace(n,n+(i-e),o),!1),t}mapDesc(t,e=!1){return An(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,r=0;n<e.length;n+=2){let o=e[n],l=e[n+1];if(l>=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(W.empty);i.push(o?t.slice(r,r+o):W.empty)}r+=o}return new J(e,i)}compose(t){return this.empty?t:t.empty?this:Qr(this,t,!0)}map(t,e=!1){return t.empty?this:An(this,t,e,!0)}iterChanges(t,e=!1){Cn(this,t,e)}get desc(){return Vt.create(this.sections)}filter(t){let e=[],i=[],n=[],r=new $e(this);t:for(let o=0,l=0;;){let a=o==t.length?1e9:t[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break t;let f=Math.min(r.len,a-l);it(n,f,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;it(e,f,c),c>0&&Ut(i,e,r.text),r.forward(f),l+=f}let h=t[o++];for(;l<h;){if(r.done)break t;let f=Math.min(r.len,h-l);it(e,f,-1),it(n,f,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(f),l+=f}}return{changes:new J(e,i),filtered:Vt.create(n)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):n==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let n=[],r=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;o<e&&it(n,e-o,-1);let c=new J(n,r);l=l?l.compose(c.map(l)):c,n=[],r=[],o=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof J){if(f.length!=e)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${e})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:c,to:u=c,insert:d}=f;if(c>u||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let p=d?typeof d=="string"?W.of(d.split(i||Sn)):d:W.empty,g=p.length;if(c==u&&g==0)return;c<o&&a(),c>o&&it(n,c-o,-1),it(n,u-c,g),Ut(r,n,p),o=u}}return h(t),a(!l),l}static empty(t){return new J(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="number")e.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)e.push(r[0],0);else{for(;i.length<n;)i.push(W.empty);i[n]=W.of(r.slice(1)),e.push(r[0],i[n].length)}}}return new J(e,i)}static createSet(t,e){return new J(t,e)}}function it(s,t,e,i=!1){if(t==0&&e<=0)return;let n=s.length-2;n>=0&&e<=0&&e==s[n+1]?s[n]+=t:n>=0&&t==0&&s[n]==0?s[n+1]+=e:i?(s[n]+=t,s[n+1]+=e):s.push(t,e)}function Ut(s,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<s.length)s[s.length-1]=s[s.length-1].append(e);else{for(;s.length<i;)s.push(W.empty);s.push(e)}}function Cn(s,t,e){let i=s.inserted;for(let n=0,r=0,o=0;o<s.sections.length;){let l=s.sections[o++],a=s.sections[o++];if(a<0)n+=l,r+=l;else{let h=n,f=r,c=W.empty;for(;h+=l,f+=a,a&&i&&(c=c.append(i[o-2>>1])),!(e||o==s.sections.length||s.sections[o+1]<0);)l=s.sections[o++],a=s.sections[o++];t(n,h,r,f,c),n=h,r=f}}}function An(s,t,e,i=!1){let n=[],r=i?[]:null,o=new $e(s),l=new $e(t);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);it(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!e))){let h=l.len;for(it(n,l.ins,-1);h;){let f=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=f&&(it(n,0,o.ins),r&&Ut(r,n,o.text),a=o.i),o.forward(f),h-=f}l.next()}else if(o.ins>=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;it(n,h,a<o.i?o.ins:0),r&&a<o.i&&Ut(r,n,o.text),a=o.i,o.forward(o.len-f)}else{if(o.done&&l.done)return r?J.createSet(n,r):Vt.create(n);throw new Error("Mismatched change set lengths")}}}function Qr(s,t,e=!1){let i=[],n=e?[]:null,r=new $e(s),o=new $e(t);for(let l=!1;;){if(r.done&&o.done)return n?J.createSet(i,n):Vt.create(i);if(r.ins==0)it(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)it(i,0,o.ins,l),n&&Ut(n,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;it(i,a,f,l),n&&f&&Ut(n,i,o.text)}else o.ins==-1?(it(i,r.off?0:r.len,a,l),n&&Ut(n,i,r.textBit(a))):(it(i,r.off?0:r.len,o.off?0:o.ins,l),n&&!o.off&&Ut(n,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class $e{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?W.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?W.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class _t{constructor(t,e,i,n){this.from=t,this.to=e,this.flags=i,this.goalColumn=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new _t(i,n,this.flags,this.goalColumn)}extend(t,e=t,i=0){if(t<=this.anchor&&e>=this.anchor)return x.range(t,e,void 0,void 0,i);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return x.range(this.anchor,n,void 0,void 0,i)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return x.range(t.anchor,t.head)}static create(t,e,i,n){return new _t(t,e,i,n)}}class x{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:x.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(t.ranges[i],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new x([this.main],0)}addRange(t,e=!0){return x.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,x.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new x(t.ranges.map(e=>_t.fromJSON(e)),t.main)}static single(t,e=t){return new x([x.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<t.length;n++){let r=t[n];if(r.empty?r.from<=i:r.from<i)return x.normalized(t.slice(),e);i=r.to}return new x(t,e)}static cursor(t,e=0,i,n){return _t.create(t,t,(e==0?0:e<0?8:16)|(i==null?7:Math.min(6,i)),n)}static range(t,e,i,n,r){let o=n==null?7:Math.min(6,n);return!r&&t!=e&&(r=e<t?1:-1),r&&(o|=r<0?8:16),e<t?_t.create(e,t,o|32,i):_t.create(t,e,o,i)}static undirectionalRange(t,e){return _t.create(t,e,64,void 0)}static normalized(t,e=0){let i=t[e];t.sort((n,r)=>n.from-r.from),e=t.indexOf(i);for(let n=1;n<t.length;n++){let r=t[n],o=t[n-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);n<=e&&e--,t.splice(--n,2,r.anchor>r.head?x.range(a,l):x.range(l,a))}}return new x(t,e)}}function Zr(s,t){for(let e of s.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let hs=0;class T{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=hs++,this.default=t([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(t={}){return new T(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:fs),!!t.static,t.enables)}of(t){return new Ci([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}}function fs(s,t){return s==t||s.length==t.length&&s.every((e,i)=>e===t[i])}class Ci{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=hs++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,o=t[r]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?h=!0:(((e=t[c.id])!==null&&e!==void 0?e:1)&1)==0&&f.push(t[c.id]);return{create(c){return c.values[o]=i(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Mn(c,f)){let d=i(c);if(l?!zs(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,p=u.config.address[r];if(p!=null){let g=Ri(u,p);if(this.dependencies.every(m=>m instanceof T?u.facet(m)===c.facet(m):m instanceof Zt?u.field(m,!1)==c.field(m,!1):!0)||(l?zs(d=i(c),g,n):n(d=i(c),g)))return c.values[o]=g,0}else d=i(c);return c.values[o]=d,1}}}get extension(){return this}}function zs(s,t,e){if(s.length!=t.length)return!1;for(let i=0;i<s.length;i++)if(!e(s[i],t[i]))return!1;return!0}function Mn(s,t){let e=!1;for(let i of t)ze(s,i)&1&&(e=!0);return e}function oa(s,t,e){let i=e.map(a=>s[a.id]),n=e.map(a=>a.type),r=i.filter(a=>!(a&1)),o=s[t.id]>>1;function l(a){let h=[];for(let f=0;f<i.length;f++){let c=Ri(a,i[f]);if(n[f]==2)for(let u of c)h.push(u);else h.push(c)}return t.combine(h)}return{create(a){for(let h of i)ze(a,h);return a.values[o]=l(a),1},update(a,h){if(!Mn(a,r))return 0;let f=l(a);return t.compare(f,a.values[o])?0:(a.values[o]=f,1)},reconfigure(a,h){let f=Mn(a,i),c=h.config.facets[t.id],u=h.facet(t);if(c&&!f&&fs(e,c))return a.values[o]=u,0;let d=l(a);return t.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const oi=T.define({static:!0});class Zt{constructor(t,e,i,n,r){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=r,this.provides=void 0}static define(t){let e=new Zt(hs++,t.create,t.update,t.compare||((i,n)=>i===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(oi).find(i=>i.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:i=>(i.values[e]=this.create(i),1),update:(i,n)=>{let r=i.values[e],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[e]=o,1)},reconfigure:(i,n)=>{let r=i.facet(oi),o=n.facet(oi),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[e]=l.create(i),1):n.config.address[this.id]!=null?(i.values[e]=n.field(this),0):(i.values[e]=this.create(i),1)}}}init(t){return[this,oi.of({field:this,create:t})]}get extension(){return this}}const se={lowest:4,low:3,default:2,high:1,highest:0};function Le(s){return t=>new to(t,s)}const $i={highest:Le(se.highest),high:Le(se.high),default:Le(se.default),low:Le(se.low),lowest:Le(se.lowest)};class to{constructor(t,e){this.inner=t,this.prec=e}get extension(){return this}}class Ui{of(t){return new Tn(this,t)}reconfigure(t){return Ui.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Tn{constructor(t,e){this.compartment=t,this.inner=e}get extension(){return this}}class Ei{constructor(t,e,i,n,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let n=[],r=Object.create(null),o=new Map;for(let u of la(t,e,o))u instanceof Zt?n.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,g=f&&f[u]||[];if(d.every(m=>m.type==0))if(l[p.id]=a.length<<1|1,fs(g,d))a.push(i.facet(p));else{let m=p.combine(d.map(y=>y.value));a.push(i&&p.compare(m,i.facet(p))?i.facet(p):m)}else{for(let m of d)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(y=>m.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(m=>oa(m,p,d))}}let c=h.map(u=>u(l));return new Ei(t,o,c,l,a,r)}}function la(s,t,e){let i=[[],[],[],[],[]],n=new Map;function r(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Tn&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Tn){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),r(h,l)}else if(o instanceof to)r(o.inner,o.prec);else if(o instanceof Zt)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Ci)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,se.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(s,se.default),i.reduce((o,l)=>o.concat(l))}function ze(s,t){if(t&1)return 2;let e=t>>1,i=s.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[e]=4;let n=s.computeSlot(s,s.config.dynamicSlots[e]);return s.status[e]=2|n}function Ri(s,t){return t&1?s.config.staticValues[t>>1]:s.values[t>>1]}const eo=T.define(),On=T.define({combine:s=>s.some(t=>t),static:!0}),io=T.define({combine:s=>s.length?s[0]:void 0,static:!0}),no=T.define(),so=T.define(),ro=T.define(),oo=T.define({combine:s=>s.length?s[0]:!1});class Re{constructor(t,e){this.type=t,this.value=e}static define(){return new aa}}class aa{of(t){return new Re(this,t)}}class ha{constructor(t){this.map=t}of(t){return new G(this,t)}}class G{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new G(this.type,e)}is(t){return this.type==t}static define(t={}){return new ha(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let r=n.map(e);r&&i.push(r)}return i}}G.reconfigure=G.define();G.appendConfig=G.define();class nt{constructor(t,e,i,n,r,o){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Zr(i,e.newLength),r.some(l=>l.type==nt.time)||(this.annotations=r.concat(nt.time.of(Date.now())))}static create(t,e,i,n,r,o){return new nt(t,e,i,n,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(nt.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}nt.time=Re.define();nt.userEvent=Re.define();nt.addToHistory=Re.define();nt.remote=Re.define();function fa(s,t){let e=[];for(let i=0,n=0;;){let r,o;if(i<s.length&&(n==t.length||t[n]>=s[i]))r=s[i++],o=s[i++];else if(n<t.length)r=t[n++],o=t[n++];else return e;!e.length||e[e.length-1]<r?e.push(r,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function lo(s,t,e){var i;let n,r,o;return e?(n=t.changes,r=J.empty(t.changes.length),o=s.changes.compose(t.changes)):(n=t.changes.map(s.changes),r=s.changes.mapDesc(t.changes,!0),o=s.changes.compose(n)),{changes:o,selection:t.selection?t.selection.map(r):(i=s.selection)===null||i===void 0?void 0:i.map(n),effects:G.mapEffects(s.effects,n).concat(G.mapEffects(t.effects,r)),annotations:s.annotations.length?s.annotations.concat(t.annotations):t.annotations,scrollIntoView:s.scrollIntoView||t.scrollIntoView}}function Dn(s,t,e){let i=t.selection,n=xe(t.annotations);return t.userEvent&&(n=n.concat(nt.userEvent.of(t.userEvent))),{changes:t.changes instanceof J?t.changes:J.of(t.changes||[],e,s.facet(io)),selection:i&&(i instanceof x?i:x.single(i.anchor,i.head)),effects:xe(t.effects),annotations:n,scrollIntoView:!!t.scrollIntoView}}function ao(s,t,e){let i=Dn(s,t.length?t[0]:{},s.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let r=1;r<t.length;r++){t[r].filter===!1&&(e=!1);let o=!!t[r].sequential;i=lo(i,Dn(s,t[r],o?i.changes.newLength:s.doc.length),o)}let n=nt.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return ua(e?ca(n):n)}function ca(s){let t=s.startState,e=!0;for(let n of t.facet(no)){let r=n(s);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:fa(e,r))}if(e!==!0){let n,r;if(e===!1)r=s.changes.invertedDesc,n=J.empty(t.doc.length);else{let o=s.changes.filter(e);n=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}s=nt.create(t,n,s.selection&&s.selection.map(r),G.mapEffects(s.effects,r),s.annotations,s.scrollIntoView)}let i=t.facet(so);for(let n=i.length-1;n>=0;n--){let r=i[n](s);r instanceof nt?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof nt?s=r[0]:s=ao(t,xe(r),!1)}return s}function ua(s){let t=s.startState,e=t.facet(ro),i=s;for(let n=e.length-1;n>=0;n--){let r=e[n](s);r&&Object.keys(r).length&&(i=lo(i,Dn(t,r,s.changes.newLength),!0))}return i==s?s:nt.create(t,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}const da=[];function xe(s){return s==null?da:Array.isArray(s)?s:[s]}var Ht=(function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s})(Ht||(Ht={}));const pa=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Bn;try{Bn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ga(s){if(Bn)return Bn.test(s);for(let t=0;t<s.length;t++){let e=s[t];if(/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||pa.test(e)))return!0}return!1}function ma(s){return t=>{if(!/\S/.test(t))return Ht.Space;if(ga(t))return Ht.Word;for(let e=0;e<s.length;e++)if(t.indexOf(s[e])>-1)return Ht.Word;return Ht.Other}}class H{constructor(t,e,i,n,r,o){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)ze(this,l<<1);this.computeSlot=null}field(t,e=!0){let i=this.config.address[t.id];if(i==null){if(e)throw new RangeError("Field is not present in this state");return}return ze(this,i),Ri(this,i)}update(...t){return ao(this,t,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:n}=e;for(let l of t.effects)l.is(Ui.reconfigure)?(e&&(n=new Map,e.compartments.forEach((a,h)=>n.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(G.reconfigure)?(e=null,i=l.value):l.is(G.appendConfig)&&(e=null,i=xe(i).concat(l.value));let r;e?r=t.startState.values.slice():(e=Ei.resolve(i,n,this),r=new H(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(On)?t.newSelection:t.newSelection.asSingle();new H(e,t.newDoc,o,r,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:x.cursor(e.from+t.length,-1)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),r=[i.range],o=xe(i.effects);for(let l=1;l<e.ranges.length;l++){let a=t(e.ranges[l]),h=this.changes(a.changes),f=h.map(n);for(let u=0;u<l;u++)r[u]=r[u].map(f);let c=n.mapDesc(h,!0);r.push(a.range.map(c)),n=n.compose(f),o=G.mapEffects(o,f).concat(G.mapEffects(xe(a.effects),c))}return{changes:n,selection:x.create(r,e.mainIndex),effects:o}}changes(t=[]){return t instanceof J?t:J.of(t,this.doc.length,this.facet(H.lineSeparator))}toText(t){return W.of(t.split(this.facet(H.lineSeparator)||Sn))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(ze(this,e),Ri(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let n=t[i];n instanceof Zt&&this.config.address[n.id]!=null&&(e[i]=n.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t,e={},i){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(t,r)){let o=i[r],l=t[r];n.push(o.init(a=>o.spec.fromJSON(l,a)))}}return H.create({doc:t.doc,selection:x.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=Ei.resolve(t.extensions||[],new Map),i=t.doc instanceof W?t.doc:W.of((t.doc||"").split(e.staticFacet(H.lineSeparator)||Sn)),n=t.selection?t.selection instanceof x?t.selection:x.single(t.selection.anchor,t.selection.head):x.single(0);return Zr(n,i.length),e.staticFacet(On)||(n=n.asSingle()),new H(e,i,n,e.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(H.tabSize)}get lineBreak(){return this.facet(H.lineSeparator)||`
|
|
6
|
+
`}get readOnly(){return this.facet(oo)}phrase(t,...e){for(let i of this.facet(H.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>e.length?i:e[r-1]})),t}languageDataAt(t,e,i=-1){let n=[];for(let r of this.facet(eo))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){let e=this.languageDataAt("wordChars",t);return ma(e.length?e[0]:"")}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=vt(e,o,!1);if(r(e.slice(a,o))!=Ht.Word)break;o=a}for(;l<n;){let a=vt(e,l);if(r(e.slice(l,a))!=Ht.Word)break;l=a}return o==l?null:x.range(o+i,l+i)}}H.allowMultipleSelections=On;H.tabSize=T.define({combine:s=>s.length?s[0]:4});H.lineSeparator=io;H.readOnly=oo;H.phrases=T.define({compare(s,t){let e=Object.keys(s),i=Object.keys(t);return e.length==i.length&&e.every(n=>s[n]==t[n])}});H.languageData=eo;H.changeFilter=no;H.transactionFilter=so;H.transactionExtender=ro;Ui.reconfigure=G.define();function cs(s,t,e={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let n in t)i[n]===void 0&&(i[n]=t[n]);return i}class ae{eq(t){return this==t}range(t,e=t){return Ue.create(t,e,this)}}ae.prototype.startSide=ae.prototype.endSide=0;ae.prototype.point=!1;ae.prototype.mapMode=dt.TrackDel;function us(s,t){return s==t||s.constructor==t.constructor&&s.eq(t)}class Ue{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new Ue(t,e,i)}}function Pn(s,t){return s.from-t.from||s.value.startSide-t.value.startSide}class ds{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return ge(this.to)}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(n(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e,i,n,r){let o=[],l=[],a=[],h=-1,f=-1;t:for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+t,p=this.to[c]+t,g,m;if(d==p){let y=e.mapPos(d,u.startSide,u.mapMode);if(y==null||(g=m=y,u.startSide!=u.endSide&&(m=e.mapPos(d,u.endSide),m<g)))continue}else if(g=e.mapPos(d,u.startSide),m=e.mapPos(p,u.endSide),g>m||g==m&&u.startSide>0&&u.endSide<=0)continue;if(!((m-g||u.endSide-u.startSide)<0))if(h<0&&(h=g),u.point&&(f=Math.max(f,m-g)),(g-i||u.startSide-n)>=0)o.push(u),l.push(g-h),a.push(m-h),i=m,n=u.endSide;else{if(g==m)for(let y=o.length;y>0;y--){if((g-(a[y-1]+h)||u.startSide-o[y-1].endSide)>=0){o.splice(y,0,u),l.splice(y,0,g-h),a.splice(y,0,m-h);continue t}if((g-(l[y-1]+h)||u.endSide-o[y-1].startSide)>0)break}r(g,m,u)}}return{mapped:o.length?new ds(l,a,o,f):null,pos:h}}}class L{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new L(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(Pn)),this.isEmpty)return e.length?L.of(e):this;let l=new ho(this,null,-1).goto(0),a=0,h=[],f=new ke;for(;l.value||a<e.length;)if(a<e.length&&(l.from-e[a].from||l.startSide-e[a].value.startSide)>=0){let c=e[a++];f.addInner(c.from,c.to,c.value,!1)||h.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==e.length||this.chunkEnd(l.chunkIndex)<e[a].from)&&(!o||n>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||n>l.to||r<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value,!1)||h.push(Ue.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?L.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],i=[],n=-1,r,o=(a,h,f)=>{r||(r=new ke),r.addRange(a,h,f,!1)};for(let a=0;a<this.chunk.length;a++){let h=this.chunkPos[a],f=this.chunk[a],c=t.touchesRange(h,h+f.length);if(c===!1)n=Math.max(n,f.maxPoint),e.push(f),i.push(t.mapPos(h));else if(c===!0){let[u,d]=e.length?[ge(i)+ge(e).length,ge(ge(e).value).endSide]:[-1,-1],{mapped:p,pos:g}=f.map(h,t,u,d,o);p&&(n=Math.max(n,p.maxPoint),e.push(p),i.push(g))}}let l=this.nextLayer.map(t);return r&&(l=r.finishInner(l)),e.length==0?l:new L(i,e,l||L.empty,n)}between(t,e,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let r=this.chunkPos[n],o=this.chunk[n];if(e>=r&&t<=r+o.length&&o.between(r,t-r,e-r,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return Ge.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Ge.from(t).goto(e)}static compare(t,e,i,n,r=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),a=Ks(o,l,i),h=new Ie(o,a,r),f=new Ie(l,a,r);i.iterGaps((c,u,d)=>qs(h,c,f,u,d,n)),i.empty&&i.length==0&&qs(h,0,f,0,0,n)}static eq(t,e,i=0,n){n==null&&(n=999999999);let r=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Ks(r,o),a=new Ie(r,l,0).goto(i),h=new Ie(o,l,0).goto(i);for(;;){if(a.to!=h.to||!En(a.active,h.active)||a.point&&(!h.point||!us(a.point,h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,i,n,r=-1){let o=new Ie(t,null,r).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFrom<e?f.length+1:o.point.startSide<0?f.length:Math.min(f.length,a);n.point(l,h,o.point,f,c,o.pointRank),a=Math.min(o.openEnd(h),f.length)}else h>l&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,e=!1){let i=new ke;for(let n of t instanceof Ue?[t]:e?ya(t):t)i.add(n.from,n.to,n.value);return i.finish()}static join(t){if(!t.length)return L.empty;let e=ge(t);for(let i=t.length-2;i>=0;i--)for(let n=t[i];n!=L.empty;n=n.nextLayer)e=new L(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}}L.empty=new L([],[],null,-1);function ge(s){return s[s.length-1]}function ya(s){if(s.length>1)for(let t=s[0],e=1;e<s.length;e++){let i=s[e];if(Pn(t,i)>0)return s.slice().sort(Pn);t=i}return s}L.empty.nextLayer=L.empty;class ke{finishChunk(t){this.chunks.push(new ds(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addRange(t,e,i,!0)}addRange(t,e,i,n){this.addInner(t,e,i,n)||(this.nextLayer||(this.nextLayer=new ke)).addRange(t,e,i,n)}addInner(t,e,i,n){let r=t-this.lastTo||i.startSide-this.last.endSide;if(n&&r<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(L.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=L.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Ks(s,t,e){let i=new Map;for(let r of s)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let n=new Set;for(let r of t)for(let o=0;o<r.chunk.length;o++){let l=i.get(r.chunk[o]);l!=null&&(e?e.mapPos(l):l)==r.chunkPos[o]&&!e?.touchesRange(l,l+r.chunk[o].length)&&n.add(r.chunk[o])}return n}class ho{constructor(t,e,i,n=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<t||n.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class Ge{constructor(t){this.heap=t}static from(t,e=null,i=-1){let n=[];for(let r=0;r<t.length;r++)for(let o=t[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&n.push(new ho(o,e,i,r));return n.length==1?n[0]:new Ge(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)nn(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)nn(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),nn(this.heap,0)}}}function nn(s,t){for(let e=s[t];;){let i=(t<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1<s.length&&n.compare(s[i+1])>=0&&(n=s[i+1],i++),e.compare(n)<0)break;s[i]=e,s[t]=n,t=i}}class Ie{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ge.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){li(this.active,t),li(this.activeTo,t),li(this.activeRank,t),this.minActive=js(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||n-this.activeTo[e])>0;)e++;ai(this.active,e,i),ai(this.activeTo,e,n),ai(this.activeRank,e,r),t&&ai(t,e,this.cursor.from),this.minActive=js(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&li(i,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let n=i.length-1;n>=0&&i[n]<t;n--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function qs(s,t,e,i,n,r){s.goto(t),e.goto(i);let o=i+n,l=i,a=i-t,h=!!r.boundChange;for(let f=!1;;){let c=s.to+a-e.to,u=c||s.endSide-e.endSide,d=u<0?s.to+a:e.to,p=Math.min(d,o);if(s.point||e.point?(s.point&&e.point&&us(s.point,e.point)&&En(s.activeForPoint(s.to),e.activeForPoint(e.to))||r.comparePoint(l,p,s.point,e.point),f=!1):(f&&(r.boundChange(l),f=!1),p>l&&!En(s.active,e.active)&&r.compareRange(l,p,s.active,e.active),h&&p<o&&(c||s.openEnd(d)!=e.openEnd(d))&&(f=!0)),d>o)break;l=d,u<=0&&s.next(),u>=0&&e.next()}}function En(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!=t[e]&&!us(s[e],t[e]))return!1;return!0}function li(s,t){for(let e=t,i=s.length-1;e<i;e++)s[e]=s[e+1];s.pop()}function ai(s,t,e){for(let i=s.length-1;i>=t;i--)s[i+1]=s[i];s[t]=e}function js(s,t){let e=-1,i=1e9;for(let n=0;n<t.length;n++)(t[n]-i||s[n].endSide-s[e].endSide)<0&&(e=n,i=t[n]);return e}function ba(s,t,e=s.length){let i=0;for(let n=0;n<e&&n<s.length;)s.charCodeAt(n)==9?(i+=t-i%t,n++):(i++,n=vt(s,n));return i}function wa(s,t,e,i){for(let n=0,r=0;;){if(r>=t)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?e-r%e:1,n=vt(s,n)}return s.length}const Rn="ͼ",_s=typeof Symbol>"u"?"__"+Rn:Symbol.for(Rn),Ln=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Yt{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let f=[],c=/^@(\w+)\b/.exec(o[0]),u=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(g=>o.map(m=>g.replace(/&/,m))).reduce((g,m)=>g.concat(m)),p,a);else if(p&&typeof p=="object"){if(!c)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(n(d),p,f,u)}else p!=null&&f.push(d.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(f.length||u)&&a.push((i&&!c&&!h?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in t)r(n(o),t[o],this.rules)}getRules(){return this.rules.join(`
|
|
7
|
+
`)}static newName(){let t=$s[_s]||1;return $s[_s]=t+1,Rn+t.toString(36)}static mount(t,e,i){let n=t[Ln],r=i&&i.nonce;n?r&&n.setNonce(r):n=new xa(t,r),n.mount(Array.isArray(e)?e:[e],t)}}let Us=new Map;class xa{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let r=Us.get(i);if(r)return t[Ln]=r;this.sheet=new n.CSSStyleSheet,Us.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ln]=this}mount(t,e){let i=this.sheet,n=0,r=0,o=!1;for(let l=0;l<t.length;l++){let a=t[l],h=this.modules.indexOf(a);if(h<r&&h>-1&&(this.modules.splice(h,1),o=!0,r--,h=-1),h==-1){if(this.modules.splice(r++,0,a),o=!0,i)for(let f=0;f<a.rules.length;f++)i.insertRule(a.rules[f],n++)}else{for(;r<h;)n+=this.modules[r++].rules.length;n+=a.rules.length,r++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{if(o){let a="";for(let h=0;h<this.modules.length;h++)a+=this.modules[h].getRules()+`
|
|
8
|
+
`;this.styleTag.textContent=a}let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var Xt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ye={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ka=typeof navigator<"u"&&/Mac/.test(navigator.platform),va=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var tt=0;tt<10;tt++)Xt[48+tt]=Xt[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Xt[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Xt[tt]=String.fromCharCode(tt+32),Ye[tt]=String.fromCharCode(tt);for(var sn in Xt)Ye.hasOwnProperty(sn)||(Ye[sn]=Xt[sn]);function Sa(s){var t=ka&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||va&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",e=!t&&s.key||(s.shiftKey?Ye:Xt)[s.keyCode]||s.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function pe(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var t=1,e=arguments[1];if(e&&typeof e=="object"&&e.nodeType==null&&!Array.isArray(e)){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}t++}for(;t<arguments.length;t++)fo(s,arguments[t]);return s}function fo(s,t){if(typeof t=="string")s.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)s.appendChild(t);else if(Array.isArray(t))for(var e=0;e<t.length;e++)fo(s,t[e]);else throw new RangeError("Unsupported child node: "+t)}let ot=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},In=typeof document<"u"?document:{documentElement:{style:{}}};const Nn=/Edge\/(\d+)/.exec(ot.userAgent),co=/MSIE \d/.test(ot.userAgent),Wn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ot.userAgent),Gi=!!(co||Wn||Nn),Gs=!Gi&&/gecko\/(\d+)/i.test(ot.userAgent),rn=!Gi&&/Chrome\/(\d+)/.exec(ot.userAgent),Ys="webkitFontSmoothing"in In.documentElement.style,Hn=!Gi&&/Apple Computer/.test(ot.vendor),Xs=Hn&&(/Mobile\/\w+/.test(ot.userAgent)||ot.maxTouchPoints>2);var S={mac:Xs||/Mac/.test(ot.platform),windows:/Win/.test(ot.platform),linux:/Linux|X11/.test(ot.platform),ie:Gi,ie_version:co?In.documentMode||6:Wn?+Wn[1]:Nn?+Nn[1]:0,gecko:Gs,gecko_version:Gs?+(/Firefox\/(\d+)/.exec(ot.userAgent)||[0,0])[1]:0,chrome:!!rn,chrome_version:rn?+rn[1]:0,ios:Xs,android:/Android\b/.test(ot.userAgent),webkit:Ys,webkit_version:Ys?+(/\bAppleWebKit\/(\d+)/.exec(ot.userAgent)||[0,0])[1]:0,safari:Hn,safari_version:Hn?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ot.userAgent)||[0,0])[1]:0,tabSize:In.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ps(s,t){for(let e in s)e=="class"&&t.class?t.class+=" "+s.class:e=="style"&&t.style?t.style+=";"+s.style:t[e]=s[e];return t}const Li=Object.create(null);function gs(s,t,e){if(s==t)return!0;s||(s=Li),t||(t=Li);let i=Object.keys(s),n=Object.keys(t);if(i.length-0!=n.length-0)return!1;for(let r of i)if(r!=e&&(n.indexOf(r)==-1||s[r]!==t[r]))return!1;return!0}function Ca(s,t){for(let e=s.attributes.length-1;e>=0;e--){let i=s.attributes[e].name;t[i]==null&&s.removeAttribute(i)}for(let e in t){let i=t[e];e=="style"?s.style.cssText=i:s.getAttribute(e)!=i&&s.setAttribute(e,i)}}function Js(s,t,e){let i=!1;if(t)for(let n in t)e&&n in e||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(i=!0,n=="style"?s.style.cssText=e[n]:s.setAttribute(n,e[n]));return i}function Aa(s){let t=Object.create(null);for(let e=0;e<s.attributes.length;e++){let i=s.attributes[e];t[i.name]=i.value}return t}class Yi{eq(t){return!1}updateDOM(t,e,i){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var et=(function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s})(et||(et={}));class U extends ae{constructor(t,e,i,n){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(t){return new ei(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new he(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,n;if(t.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=uo(t,e);i=(r?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new he(t,i,n,e,t.widget||null,!0)}static line(t){return new ii(t)}static set(t,e=!1){return L.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}U.none=L.empty;class ei extends U{constructor(t){let{start:e,end:i}=uo(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?ps(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Li}eq(t){return this==t||t instanceof ei&&this.tagName==t.tagName&&gs(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}ei.prototype.point=!1;class ii extends U{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof ii&&this.spec.class==t.spec.class&&gs(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}ii.prototype.mapMode=dt.TrackBefore;ii.prototype.point=!0;class he extends U{constructor(t,e,i,n,r,o){super(e,i,r,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?dt.TrackBefore:dt.TrackAfter:dt.TrackDel}get type(){return this.startSide!=this.endSide?et.WidgetRange:this.startSide<=0?et.WidgetBefore:et.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof he&&Ma(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}he.prototype.point=!0;function uo(s,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=s;return e==null&&(e=s.inclusive),i==null&&(i=s.inclusive),{start:e??t,end:i??t}}function Ma(s,t){return s==t||!!(s&&t&&s.compare(t))}function ve(s,t,e,i=0){let n=e.length-1;n>=0&&e[n]+i>=s?e[n]=Math.max(e[n],t):e.push(s,t)}class Xe extends ae{constructor(t,e,i){super(),this.tagName=t,this.attributes=e,this.rank=i}eq(t){return t==this||t instanceof Xe&&this.tagName==t.tagName&&gs(this.attributes,t.attributes)}static create(t){return new Xe(t.tagName,t.attributes||Li,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,e=!1){return L.of(t,e)}}Xe.prototype.startSide=Xe.prototype.endSide=-1;function Je(s){let t;return s.nodeType==11?t=s.getSelection?s:s.ownerDocument:t=s,t.getSelection()}function Fn(s,t){return t?s==t||s.contains(t.nodeType!=1?t.parentNode:t):!1}function Ke(s,t){if(!t.anchorNode)return!1;try{return Fn(s,t.anchorNode)}catch{return!1}}function Ai(s){return s.nodeType==3?Qe(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function qe(s,t,e,i){return e?Qs(s,t,e,i,-1)||Qs(s,t,e,i,1):!1}function Jt(s){for(var t=0;;t++)if(s=s.previousSibling,!s)return t}function Ii(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}function Qs(s,t,e,i,n){for(;;){if(s==e&&t==i)return!0;if(t==(n<0?0:Kt(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;t=Jt(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[t+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;t=n<0?Kt(s):0}else return!1}}function Kt(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function Ni(s,t){let{left:e,right:i}=s;if(e==i)return s;let n=t?e:i;return{left:n,right:n,top:s.top,bottom:s.bottom}}function Ta(s){let t=s.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function po(s,t){let e=t.width/s.offsetWidth,i=t.height/s.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-s.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-s.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Oa(s,t,e,i,n,r,o,l){let a=s.ownerDocument,h=a.defaultView||window;for(let f=s,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,p=1,g=1;if(d)u=Ta(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let k=f.getBoundingClientRect();({scaleX:p,scaleY:g}=po(f,k)),u={left:k.left,right:k.left+f.clientWidth*p,top:k.top,bottom:k.top+f.clientHeight*g}}let m=0,y=0;if(n=="nearest")t.top<u.top+o?(y=t.top-(u.top+o),e>0&&t.bottom>u.bottom+y&&(y=t.bottom-u.bottom+o)):t.bottom>u.bottom-o&&(y=t.bottom-u.bottom+o,e<0&&t.top-y<u.top&&(y=t.top-(u.top+o)));else{let k=t.bottom-t.top,w=u.bottom-u.top;y=(n=="center"&&k<=w?t.top+k/2-w/2:n=="start"||n=="center"&&e<0?t.top-o:t.bottom-w+o)-u.top}if(i=="nearest"?t.left<u.left+r?(m=t.left-(u.left+r),e>0&&t.right>u.right+m&&(m=t.right-u.right+r)):t.right>u.right-r&&(m=t.right-u.right+r,e<0&&t.left<u.left+m&&(m=t.left-(u.left+r))):m=(i=="center"?t.left+(t.right-t.left)/2-(u.right-u.left)/2:i=="start"==l?t.left-r:t.right-(u.right-u.left)+r)-u.left,m||y)if(d)h.scrollBy(m,y);else{let k=0,w=0;if(y){let B=f.scrollTop;f.scrollTop+=y/g,w=(f.scrollTop-B)*g}if(m){let B=f.scrollLeft;f.scrollLeft+=m/p,k=(f.scrollLeft-B)*p}t={left:t.left-k,top:t.top-w,right:t.right-k,bottom:t.bottom-w},k&&Math.abs(k-m)<1&&(i="nearest"),w&&Math.abs(w-y)<1&&(n="nearest")}if(d)break;(t.top<u.top||t.bottom>u.bottom||t.left<u.left||t.right>u.right)&&(t={left:Math.max(t.left,u.left),right:Math.min(t.right,u.right),top:Math.max(t.top,u.top),bottom:Math.min(t.bottom,u.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function go(s,t=!0){let e=s.ownerDocument,i=null,n=null;for(let r=s.parentNode;r&&!(r==e.body||(!t||i)&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),t&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:n}}class Da{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?Kt(e):0),i,Math.min(t.focusOffset,i?Kt(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}function mo(s){let t=[];for(let e=s;e;e=e.nodeType==11?e.host:e.parentNode)e.nodeType==1&&t.push({node:e,left:e.scrollLeft,top:e.scrollTop});return t}function yo(s,t=!0){for(let{node:e,left:i,top:n}of s)t&&e.scrollTop!=n&&(e.scrollTop=n),e.scrollLeft!=i&&(e.scrollLeft=i)}let ne=null;S.safari&&S.safari_version>=26&&(ne=!1);function bo(s){if(s.setActive)return s.setActive();if(ne)return s.focus(ne);let t=mo(s);s.focus(ne==null?{get preventScroll(){return ne={preventScroll:!0},!0}}:void 0),ne||(ne=!1,yo(t))}let Zs;function Qe(s,t,e=t){let i=Zs||(Zs=document.createRange());return i.setEnd(s,e),i.setStart(s,t),i}function Se(s,t,e,i){let n={key:t,code:t,keyCode:e,which:e,cancelable:!0};i&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=i);let r=new KeyboardEvent("keydown",n);r.synthetic=!0,s.dispatchEvent(r);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,s.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function Ba(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function Pa(s,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(i=Math.min(i,Kt(e));;)if(i){if(e.nodeType!=1)return!1;let n=e.childNodes[i-1];n.contentEditable=="false"?i--:(e=n,i=Kt(e))}else{if(e==s)return!0;i=Jt(e),e=e.parentNode}}function wo(s){return s instanceof Window?s.pageYOffset>Math.max(0,s.document.documentElement.scrollHeight-s.innerHeight-4):s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}function xo(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i>0)return{node:e,offset:i};if(e.nodeType==1&&i>0){if(e.contentEditable=="false")return null;e=e.childNodes[i-1],i=Kt(e)}else if(e.parentNode&&!Ii(e))i=Jt(e),e=e.parentNode;else return null}}function ko(s,t){for(let e=s,i=t;;){if(e.nodeType==3&&i<e.nodeValue.length)return{node:e,offset:i};if(e.nodeType==1&&i<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[i],i=0}else if(e.parentNode&&!Ii(e))i=Jt(e)+1,e=e.parentNode;else return null}}class St{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new St(t.parentNode,Jt(t),e)}static after(t,e){return new St(t.parentNode,Jt(t)+1,e)}}var $=(function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s})($||($={}));const fe=$.LTR,ms=$.RTL;function vo(s){let t=[];for(let e=0;e<s.length;e++)t.push(1<<+s[e]);return t}const Ea=vo("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ra=vo("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Vn=Object.create(null),Tt=[];for(let s of["()","[]","{}"]){let t=s.charCodeAt(0),e=s.charCodeAt(1);Vn[t]=e,Vn[e]=-t}function So(s){return s<=247?Ea[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?Ra[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8204?256:64336<=s&&s<=65023?4:1}const La=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Lt{get dir(){return this.level%2?ms:fe}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,n){let r=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==i)return o;(r<0||(n!=0?n<0?l.from<e:l.to>e:t[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Co(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++){let i=s[e],n=t[e];if(i.from!=n.from||i.to!=n.to||i.direction!=n.direction||!Co(i.inner,n.inner))return!1}return!0}const K=[];function Ia(s,t,e,i,n){for(let r=0;r<=i.length;r++){let o=r?i[r-1].to:t,l=r<i.length?i[r].from:e,a=r?256:n;for(let h=o,f=a,c=a;h<l;h++){let u=So(s.charCodeAt(h));u==512?u=f:u==8&&c==4&&(u=16),K[h]=u==4?2:u,u&7&&(c=u),f=u}for(let h=o,f=a,c=a;h<l;h++){let u=K[h];if(u==128)h<l-1&&f==K[h+1]&&f&24?u=K[h]=f:K[h]=256;else if(u==64){let d=h+1;for(;d<l&&K[d]==64;)d++;let p=h&&f==8||d<e&&K[d]==8?c==1?1:8:256;for(let g=h;g<d;g++)K[g]=p;h=d-1}else u==8&&c==1&&(K[h]=1);f=u,u&7&&(c=u)}}}function Na(s,t,e,i,n){let r=n==1?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let h=o?i[o-1].to:t,f=o<i.length?i[o].from:e;for(let c=h,u,d,p;c<f;c++)if(d=Vn[u=s.charCodeAt(c)])if(d<0){for(let g=l-3;g>=0;g-=3)if(Tt[g+1]==-d){let m=Tt[g+2],y=m&2?n:m&4?m&1?r:n:0;y&&(K[c]=K[Tt[g]]=y),l=g;break}}else{if(Tt.length==189)break;Tt[l++]=c,Tt[l++]=u,Tt[l++]=a}else if((p=K[c])==2||p==1){let g=p==n;a=g?0:1;for(let m=l-3;m>=0;m-=3){let y=Tt[m+2];if(y&2)break;if(g)Tt[m+2]|=2;else{if(y&4)break;Tt[m+2]|=4}}}}}function Wa(s,t,e,i){for(let n=0,r=i;n<=e.length;n++){let o=n?e[n-1].to:s,l=n<e.length?e[n].from:t;for(let a=o;a<l;){let h=K[a];if(h==256){let f=a+1;for(;;)if(f==l){if(n==e.length)break;f=e[n++].to,l=n<e.length?e[n].from:t}else if(K[f]==256)f++;else break;let c=r==1,u=(f<t?K[f]:i)==1,d=c==u?c?1:2:i;for(let p=f,g=n,m=g?e[g-1].to:s;p>a;)p==m&&(p=e[--g].from,m=g?e[g-1].to:s),K[--p]=d;a=f}else r=h,a++}}}function zn(s,t,e,i,n,r,o){let l=i%2?2:1;if(i%2==n%2)for(let a=t,h=0;a<e;){let f=!0,c=!1;if(h==r.length||a<r[h].from){let g=K[a];g!=l&&(f=!1,c=g==16)}let u=!f&&l==1?[]:null,d=f?i:i+1,p=a;t:for(;;)if(h<r.length&&p==r[h].from){if(c)break t;let g=r[h];if(!f)for(let m=g.to,y=h+1;;){if(m==e)break t;if(y<r.length&&r[y].from==m)m=r[y++].to;else{if(K[m]==l)break t;break}}if(h++,u)u.push(g);else{g.from>a&&o.push(new Lt(a,g.from,d));let m=g.direction==fe!=!(d%2);Kn(s,m?i+1:i,n,g.inner,g.from,g.to,o),a=g.to}p=g.to}else{if(p==e||(f?K[p]!=l:K[p]==l))break;p++}u?zn(s,a,p,i+1,n,u,o):a<p&&o.push(new Lt(a,p,d)),a=p}else for(let a=e,h=r.length;a>t;){let f=!0,c=!1;if(!h||a>r[h-1].to){let g=K[a-1];g!=l&&(f=!1,c=g==16)}let u=!f&&l==1?[]:null,d=f?i:i+1,p=a;t:for(;;)if(h&&p==r[h-1].to){if(c)break t;let g=r[--h];if(!f)for(let m=g.from,y=h;;){if(m==t)break t;if(y&&r[y-1].to==m)m=r[--y].from;else{if(K[m-1]==l)break t;break}}if(u)u.push(g);else{g.to<a&&o.push(new Lt(g.to,a,d));let m=g.direction==fe!=!(d%2);Kn(s,m?i+1:i,n,g.inner,g.from,g.to,o),a=g.from}p=g.from}else{if(p==t||(f?K[p-1]!=l:K[p-1]==l))break;p--}u?zn(s,p,a,i+1,n,u,o):p<a&&o.push(new Lt(p,a,d)),a=p}}function Kn(s,t,e,i,n,r,o){let l=t%2?2:1;Ia(s,n,r,i,l),Na(s,n,r,i,l),Wa(n,r,i,l),zn(s,n,r,t,e,i,o)}function Ha(s,t,e){if(!s)return[new Lt(0,0,t==ms?1:0)];if(t==fe&&!e.length&&!La.test(s))return Ao(s.length);if(e.length)for(;s.length>K.length;)K[K.length]=256;let i=[],n=t==fe?0:1;return Kn(s,n,n,e,0,s.length,i),i}function Ao(s){return[new Lt(0,s,0)]}let Mo="";function Fa(s,t,e,i,n){var r;if(!s.length)return null;let o=i.head-s.from,l;if(i.head==s.from&&i.assoc<0){if(!n)return null;o=t[l=0].side(!1,e)}else if(i.head==s.to&&i.assoc>0){if(n)return null;o=t[l=t.length-1].side(!0,e)}else l=Lt.find(t,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc);let a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=vt(s.text,o,a.forward(n,e));(f<a.from||f>a.to)&&(f=h),Mo=s.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];if(f==h){if(!c)return n?x.cursor(s.to,1):x.cursor(s.from,-1);if(c.level+(n?0:1)<a.level)return x.cursor(c.side(!n,e)+s.from,c.forward(n,e)?1:-1,c.level)}return x.cursor(f+s.from,a.forward(n,e)?-1:1,a.level)}function Va(s,t,e){for(let i=t;i<e;i++){let n=So(s.charCodeAt(i));if(n==1)return fe;if(n==2||n==4)return ms}return fe}const To=T.define(),Oo=T.define(),Do=T.define(),Bo=T.define(),qn=T.define(),Po=T.define(),Eo=T.define(),ys=T.define(),bs=T.define(),Ro=T.define({combine:s=>s.some(t=>t)}),Lo=T.define({combine:s=>s.some(t=>t)}),Io=T.define();class Ce{constructor(t,e,i,n,r,o=!1){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new Ce(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ce(x.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const hi=G.define({map:(s,t)=>s.map(t)}),No=G.define();function It(s,t,e){let i=s.facet(Bo);i.length?i[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}const Wt=T.define({combine:s=>s.length?s[0]:!0});let za=0;const ye=T.define({combine(s){return s.filter((t,e)=>{for(let i=0;i<e;i++)if(s[i].plugin==t.plugin)return!1;return!0})}});class xt{constructor(t,e,i,n,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(ye.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(ye.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:i,eventObservers:n,provide:r,decorations:o}=e||{};return new xt(za++,t,i,n,l=>{let a=[];return o&&a.push(Xi.of(h=>{let f=h.plugin(l);return f?o(f):U.none})),r&&a.push(r(l)),a})}static fromClass(t,e){return xt.define((i,n)=>new t(i,n),e)}}class on{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(It(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){It(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(i){It(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Wo=T.define(),ws=T.define(),Xi=T.define(),Ho=T.define(),xs=T.define(),ni=T.define(),Fo=T.define();function tr(s,t){let e=s.state.facet(Fo);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(s):r),n=[];return L.spans(i,t.from,t.to,{point(){},span(r,o,l,a){let h=r-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Va(t.text,h,f)),a>0&&c.length&&(p=c[c.length-1]).to==h&&p.direction==d)p.to=f,c=p.inner;else{let g={from:h,to:f,direction:d,inner:[]};c.push(g),c=g.inner}}}}),n}const Vo=T.define();function zo(s){let t=0,e=0,i=0,n=0;for(let r of s.state.facet(Vo)){let o=r(s);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:i,bottom:n}}const He=T.define();class bt{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new bt(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(e.length==0)return t;let i=[];for(let n=0,r=0,o=0;;){let l=n<t.length?t[n].fromB:1e9,a=r<e.length?e[r]:1e9,h=Math.min(l,a);if(h==1e9)break;let f=h+o,c=h,u=f;for(;;)if(r<e.length&&e[r]<=c){let d=e[r+1];r+=2,c=Math.max(c,d);for(let p=n;p<t.length&&t[p].fromB<=c;p++)o=t[p].toA-t[p].toB;u=Math.max(u,d+o)}else if(n<t.length&&t[n].fromB<=c){let d=t[n++];c=Math.max(c,d.toB),u=Math.max(u,d.toA),o=d.toA-d.toB}else break;i.push(new bt(f,u,h,c))}return i}}class Wi{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=J.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,l,a)=>n.push(new bt(r,o,l,a))),this.changedRanges=n}static create(t,e,i){return new Wi(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ka=[];class Y{constructor(t,e,i=0){this.dom=t,this.length=e,this.flags=i,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ka}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&Ca(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let i=e;for(let n of this.children){if(n==t)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e,i){return null}domPosFor(t,e){let i=Jt(this.dom),n=this.length?t>0:e>0;return new St(this.parent.dom,i+(n?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof Qi)return t;return null}static get(t){return t.cmTile}}class Ji extends Y{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,i=null,n,r=t?.node==e?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,n=i?i.nextSibling:e.firstChild,r&&n!=l.dom&&(r.written=!0),l.dom.parentNode==e)for(;n&&n!=l.dom;)n=er(n);else e.insertBefore(l.dom,n);i=l.dom}for(n=i?i.nextSibling:e.firstChild,r&&n&&(r.written=!0);n;)n=er(n);this.length=o}}function er(s){let t=s.nextSibling;return s.parentNode.removeChild(s),t}class Qi extends Ji{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=Y.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],i=this,n=0,r=0;;)if(n==i.children.length){if(!e.length)return;i=i.parent,i.breakAfter&&r++,n=e.pop()}else{let o=i.children[n++];if(o instanceof zt)e.push(n),i=o,n=0;else{let l=r+o.length,a=t(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(t,e){let i,n=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(t>=a&&t<=h){if(l.isWidget()&&e>=-1&&e<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(a<t||t==h&&(e<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,n=t-a),(h>t||t==a&&(e>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=t-a)}}),!i&&!r)throw new Error("No tile at position "+t);return i&&e<0||!r?{tile:i,offset:n}:{tile:r,offset:o}}}class zt extends Ji{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let i=new zt(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}}class Me extends Ji{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,i){let n=new Me(e||document.createElement("div"),t);return(!e||!i)&&(n.flags|=4),n}get domAttrs(){return this.attrs}resolveInline(t,e,i){let n=null,r=-1,o=null,l=-1;function a(f,c){for(let u=0,d=0;u<f.children.length&&d<=c;u++){let p=f.children[u],g=d+p.length;g>=c&&(p.isComposite()?a(p,c-d):(!o||o.isHidden&&(e>0&&!(o.flags&32)||i&&ja(o,p)))&&(g>c||p.flags&32&&e<=1)?(o=p,l=c-d):(d<c||p.flags&16&&!p.isHidden&&e>=-1)&&(n=p,r=c-d)),d=g}}a(this,t);let h=(e<0?n:o)||n||o;return h?{tile:h,offset:h==n?r:l}:null}coordsIn(t,e,i){let n=this.resolveInline(t,e,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),e,i):qa(this)}domIn(t,e){let i=this.resolveInline(t,e);if(i){let{tile:n,offset:r}=i;if(this.dom.contains(n.dom))return n.isText()?new St(n.dom,Math.min(n.dom.nodeValue.length,r)):n.domPosFor(r,n.flags&16?1:n.flags&32?-1:e);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new St(a.dom,0);a==i.tile&&(l=!0)}}return new St(this.dom,0)}}function qa(s){let t=s.dom.lastChild;if(!t)return s.dom.getBoundingClientRect();let e=Ai(t);return e[e.length-1]||null}function ja(s,t){let e=s.coordsIn(0,1),i=t.coordsIn(0,1);return e&&i&&i.top<e.bottom}class ft extends Ji{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let i=new ft(e||document.createElement(t.tagName),t);return e||(i.flags|=4),i}}class re extends Y{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e,i){let n=this.dom.nodeValue.length;t>n&&(t=n);let r=t,o=t,l=0;t==0&&e<0||t==n&&e>=0?S.chrome||S.gecko||(t?(r--,l=1):o<n&&(o++,l=-1)):e<0?r--:o<n&&o++;let a=Qe(this.dom,r,o).getClientRects();if(!a.length)return null;let h=a[(l?l<0:e>=0)?0:a.length-1];return S.safari&&!l&&h.width==0&&(h=Array.prototype.find.call(a,f=>f.width)||h),i==null?h:Ni(h,(l?l>0:e<0)==i)}static of(t,e){let i=new re(e||document.createTextNode(t),t);return e||(i.flags|=2),i}}class ce extends Y{constructor(t,e,i,n){super(t,e,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,i){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;if(i)return Ni(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let a=l?r.length-1:0;o=r[a],!(t>0?a==0:a==r.length-1||o.top<o.bottom);a+=l?-1:1);return Ni(o,!l)}}get overrideDOMText(){if(!this.length)return W.empty;let{root:t}=this;if(!t)return W.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,i,n,r){return r||(r=t.toDOM(e),t.editable||(r.contentEditable="false")),new ce(r,i,t,n)}}class Hi extends Y{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return W.empty}coordsIn(t,e,i){let n=this.dom.getBoundingClientRect();return i==null?n:Ni(n,e>0==i)}}class _a{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,i){let{tile:n,index:r,beforeBreak:o,parents:l}=this;for(;t||e>0;)if(n.isComposite())if(o){if(!t)break;i&&i.break(),t--,o=!1}else if(r==n.children.length){if(!t&&!l.length)break;i&&i.leave(n),o=!!n.breakAfter,{tile:n,index:r}=l.pop(),r++}else{let a=n.children[r],h=a.breakAfter;(e>0?a.length<=t:a.length<t)&&(!i||i.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!h,r++,t-=a.length):(l.push({tile:n,index:r}),n=a,r=0,i&&a.isComposite()&&i.enter(a))}else{let a=n.length;if(r<a&&t){let h=Math.min(t,a-r);i&&i.skip(n,r,r+h),t-=h,r+=h}if(r==a)o=!!n.breakAfter,{tile:n,index:r}=l.pop(),r++;else if(!t)break}return this.tile=n,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class $a{constructor(t,e,i,n){this.from=t,this.to=e,this.wrapper=i,this.rank=n}}class Ua{constructor(t,e,i){this.cache=t,this.root=e,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,i,n){var r;this.flushBuffer();let o=this.ensureMarks(e,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+t.length<512){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new re(l.dom,l.text+t);a.parent=o}else o.append(n||re.of(t,(r=this.cache.find(re))===null||r===void 0?void 0:r.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let i=this.curLine;i.dom!=e.line.dom&&(i.setDOM(this.cache.reused.has(e.line)?ln(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let n=i;for(let l=e.marks.length-1;l>=0;l--){let a=e.marks[l],h=n.lastChild;if(h instanceof ft&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(ln(a.dom)),n=h;else{let{dom:f}=a;this.cache.reused.get(a)&&Y.get(a.dom)&&(f=ln(a.dom));let c=ft.of(a.mark,f);n.append(c),n=c}this.cache.reused.set(a,2)}let r=Y.get(t.text);r&&this.cache.reused.set(r,2);let o=new re(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,n.append(o)}addInlineWidget(t,e,i){let n=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);n||this.flushBuffer();let r=this.ensureMarks(e,i);!n&&!(t.flags&16)&&r.append(this.getBuffer(1)),r.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,i){this.flushBuffer(),this.ensureMarks(e,i).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var i;t||(t=Ko);let n=Me.start(t,e||((i=this.cache.find(Me))===null||i===void 0?void 0:i.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var i;let n=this.curLine;for(let r=t.length-1;r>=0;r--){let o=t[r],l;if(e>0&&(l=n.lastChild)&&l instanceof ft&&l.mark.eq(o))n=l,e--;else{let a=ft.of(o,(i=this.cache.find(ft,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);n.append(a),n=a,e=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!ir(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(S.ios&&ir(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(an,0,32)||new ce(an.toDOM(),0,an,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=t.rank*102+t.value.rank,i=new $a(t.from,t.to,t.value,e),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-i.rank||this.wrappers[n-1].to-i.to)<0;)n--;this.wrappers.splice(n,0,i)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let i of this.wrappers){let n=e.lastChild;if(i.from<this.pos&&n instanceof zt&&n.wrapper.eq(i.wrapper))e=n;else{let r=zt.of(i.wrapper,(t=this.cache.find(zt,o=>o.wrapper.eq(i.wrapper)))===null||t===void 0?void 0:t.dom);e.append(r),e=r}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),i=this.cache.find(Hi,void 0,1);return i&&(i.flags=e),i||new Hi(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Ga{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:n,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=n;let l=this.textOff=Math.min(t,n.length);return r?null:n.slice(0,l)}let e=Math.min(this.text.length,this.textOff+t),i=this.text.slice(this.textOff,e);return this.textOff=e,i}}const Fi=[ce,Me,re,ft,Hi,zt,Qi];for(let s=0;s<Fi.length;s++)Fi[s].bucket=s;class Ya{constructor(t){this.view=t,this.buckets=Fi.map(()=>[]),this.index=Fi.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,i=this.buckets[e];i.length<6?i.push(t):i[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,i=2){let n=t.bucket,r=this.buckets[n],o=this.index[n];for(let l=0;l<r.length;l++){let a=(l+o)%r.length,h=r[a];if((!e||e(h))&&!this.reused.has(h))return r.splice(a,1),a<o&&this.index[n]--,this.reused.set(h,i),h}return null}findWidget(t,e,i){let n=this.buckets[0];if(n.length)for(let r=0,o=0;;r++){if(r==n.length){if(o)return null;o=1,r=0}let l=n[r];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view,l.widget)))return n.splice(r,1),r<this.index[0]&&this.index[0]--,l.widget==t&&l.length==e&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new ce(l.dom,e,t,l.flags&-498|i))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class Xa{constructor(t,e,i,n,r){this.view=t,this.decorations=n,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new Ya(t),this.text=new Ga(t.state.doc),this.builder=new Ua(this.cache,new Qi(t,t.contentDOM),L.iter(i)),this.cache.reused.set(e,2),this.old=new _a(e),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let n=0,r=0,o=0;;){let l=o<t.length?t[o++]:null,a=l?l.fromA:this.old.root.length;if(a>n){let h=a-n;this.preserve(h,!o,!l),n=a,r+=h}if(!l)break;e&&l.fromA<=e.range.fromA&&l.toA>=e.range.toA?(this.forward(l.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(r,e.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(e,i),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,l.toA),this.emit(e.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(r,l.toB)),r=l.toB,n=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,i){let n=Za(this.old),r=this.openMarks;this.old.advance(t,i?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l<o.length?ce.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,n,r),r=n.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,n,r,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),n,r)),r=n.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Hi)this.cache.add(o);else if(o instanceof ft)this.builder.ensureLine(null),this.builder.addMark(o,n,r),this.cache.reused.set(o,1),r=n.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ft&&n.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?n.length&&(n.length=r=0):o instanceof ft&&(n.shift(),r=Math.min(r,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let i=null,n=this.builder,r=-1,o=L.spans(this.decorations,t,e,{point:(l,a,h,f,c,u)=>{if(h instanceof he){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=f.length,c>f.length)n.continueWidget(a-l);else{let d=h.widget||(h.block?Te.block:Te.inline),p=Ja(h),g=this.cache.findWidget(d,a-l,p)||ce.of(d,this.view,a-l,p);h.block?(h.startSide>0&&n.addLineStartIfNotCovered(i),n.addBlockWidget(g)):(n.ensureLine(i),n.addInlineWidget(g,f,c))}i=null}else i=Qa(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,f)=>{for(let c=l;c<a;){let u=this.text.next(Math.min(512,a-c));u==null?(n.addLineStartIfNotCovered(i),n.addBreak(),c++):(n.ensureLine(i),n.addText(u,h,c==l?f:h.length),c+=u.length),i=null}r=h.length}});r>-1&&(this.openWidget=o>r),this.openWidget||n.addLineStartIfNotCovered(i),this.openMarks=o}forward(t,e,i=1){e-t<=10?this.old.advance(e-t,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(t){let e=[],i=null;for(let n=t.parentNode;;n=n.parentNode){let r=Y.get(n);if(n==this.view.contentDOM)break;r instanceof ft?e.push(r):r?.isLine()?i=r:r instanceof zt||(n.nodeName=="DIV"&&!i?i=new Me(n,Ko):i||e.push(ft.of(new ei({tagName:n.nodeName.toLowerCase(),attributes:Aa(n)}),n)))}return i?{line:i,marks:e}:null}}function ir(s,t){let e=i=>{for(let n of i.children)if((t?n.isText():n.length)||e(n))return!0;return!1};return e(s)}function Ja(s){let t=s.isReplace?(s.startSide<0?64:0)|(s.endSide>0?128:0):s.startSide>0?32:16;return s.block&&(t|=256),t}const Ko={class:"cm-line"};function Qa(s,t){let e=t.spec.attributes,i=t.spec.class;return!e&&!i||(s||(s={class:"cm-line"}),e&&ps(e,s),i&&(s.class+=" "+i)),s}function Za(s){let t=[];for(let e=s.parents.length;e>1;e--){let i=e==s.parents.length?s.tile:s.parents[e].tile;i instanceof ft&&t.push(i.mark)}return t}function ln(s){let t=Y.get(s);return t&&t.setDOM(s.cloneNode()),s}class Te extends Yi{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Te.inline=new Te("span");Te.block=new Te("div");const an=new class extends Yi{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class nr{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=U.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Qi(t,t.contentDOM),this.updateInner([new bt(0,0,0,t.state.doc.length)],null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:f,toA:c})=>c<this.minWidthFrom||f>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!ah(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let r=n>-1?eh(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:f,to:c}=this.hasComposition;i=new bt(f,c,t.changes.mapPos(f,-1),t.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(S.ie||S.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=sh(o,this.decorations,t.changes);a.length&&(i=bt.extendWithRanges(i,a));let h=oh(l,this.blockWrappers,t.changes);return h.length&&(i=bt.extendWithRanges(i,h)),r&&!i.some(f=>f.fromA<=r.range.fromA&&f.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(e||t.length){let o=this.tile,l=new Xa(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);e&&Y.get(e.text)&&l.cache.reused.set(Y.get(e.text),2),this.tile=l.run(t,e),jn(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=S.chrome||S.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.tile.children)r.isWidget()&&r.widget instanceof hn&&n.push(r.dom);i.updateGaps(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(No)&&(this.editContextFormatting=i.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,n=this.view.root.activeElement,r=n==i,o=!r&&!(this.view.state.facet(Wt)||i.tabIndex>-1)&&Ke(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(r||e||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,f;if(a.empty?f=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(f=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),S.gecko&&a.empty&&!this.hasComposition&&th(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=f=new St(u,0),l=!0}let c=this.view.observer.selectionRange;(l||!c.focusNode||(!qe(h.node,h.offset,c.anchorNode,c.anchorOffset)||!qe(f.node,f.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,a))&&(this.view.observer.ignore(()=>{S.android&&S.chrome&&i.contains(c.focusNode)&&lh(c.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=Je(this.view.root);if(u)if(a.empty){if(S.gecko){let d=ih(h.node,h.offset);if(d&&d!=3){let p=(d==1?xo:ko)(h.node,h.offset);p&&(h=new St(p.node,p.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(f.node,f.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,f]=[f,h]),d.setEnd(f.node,f.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(h,f)),this.impreciseAnchor=h.precise?null:new St(c.anchorNode,c.anchorOffset),this.impreciseHead=f.precise?null:new St(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&qe(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Je(t.root),{anchorNode:n,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc,e.assoc);i.collapse(f.node,f.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,r)}posFromDOM(t,e){let i=this.tile.nearest(t);if(!i)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let n=i.posAtStart;if(i.isComposite()){let r;if(t==i.dom)r=i.dom.childNodes[e];else{let o=Kt(t)==0?0:e==0?-1:1;for(;;){let l=t.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?r=t:r=t.nextSibling}if(r==i.dom.firstChild)return n;for(;r&&!Y.get(r);)r=r.nextSibling;if(!r)return n+i.length;for(let o=0,l=n;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?t==i.dom?n+e:n+(e?i.length:0):n}domAtPos(t,e){let{tile:i,offset:n}=this.tile.resolveBlock(t,e);return i.isWidget()?i.domPosFor(n,e):i.domIn(n,e)}inlineDOMNearPos(t,e){let i,n=-1,r=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,f)=>{if(h.isWidget()){if(h.flags&32&&f>=t)return!0;h.flags&16&&(r=!0)}else{let c=f+h.length;if(f<=t&&(i=h,n=t-f,r=c<t),c>=t&&!o&&(o=h,l=t-f,a=f>t),f>t&&o)return!0}}),!i&&!o?this.domAtPos(t,e):(r&&o?i=null:a&&i&&(o=null),i&&e<0||!o?i.domIn(n,e):o.domIn(l,e))}coordsAt(t,e,i){let{tile:n,offset:r}=this.tile.resolveBlock(t,e);return n.isWidget()?n.widget instanceof hn?null:n.coordsInWidget(r,e,!0):n.coordsIn(r,e,i)}lineAt(t,e){let{tile:i}=this.tile.resolveBlock(t,e);return i.isLine()?i:null}coordsForChar(t){let{tile:e,offset:i}=this.tile.resolveBlock(t,1);if(!e.isLine())return null;function n(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let a=n(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(r.isText()&&o<r.length){let l=vt(r.text,o);if(l==o)return null;let a=Qe(r.dom,o,l).getClientRects();for(let h=0;h<a.length;h++){let f=a[h];if(h==a.length-1||f.top<f.bottom&&f.left<f.right)return f}}return null}return n(e,i)}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==$.LTR,h=0,f=(c,u,d)=>{for(let p=0;p<c.children.length&&!(u>n);p++){let g=c.children[p],m=u+g.length,y=g.dom.getBoundingClientRect(),{height:k}=y;if(d&&!p&&(h+=y.top-d.top),g instanceof zt)m>i&&f(g,u,y);else if(u>=i&&(h>0&&e.push(-h),e.push(k+h),h=0,o)){let w=g.dom.lastChild,B=w?Ai(w):[];if(B.length){let C=B[B.length-1],A=a?C.right-y.left:y.right-C.left;A>l&&(l=A,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=m)}}d&&p==c.children.length-1&&(h+=d.bottom-y.bottom),u=m+g.breakAfter}};return f(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return getComputedStyle(e.dom).direction=="rtl"?$.RTL:$.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let f=Ai(h.dom);if(f.length!=1)return;l+=f[0].width,a=f[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(t)return t;let e=document.createElement("div"),i,n,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(e);let o=Ai(e.firstChild)[0];i=e.getBoundingClientRect().height,n=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,e.remove()}),{lineHeight:i,charWidth:n,textHeight:r}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let r=n==e.viewports.length?null:e.viewports[n],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(U.replace({widget:new hn(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return U.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Xi).map(r=>(this.dynamicDecorationMap[t++]=typeof r=="function")?r(this.view):r),i=!1,n=this.view.state.facet(xs).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(n.length&&(this.dynamicDecorationMap[t++]=i,e.push(L.join(n))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(Ho).map(r=>typeof r=="function"?r(this.view):r)}scrollIntoView(t){if(t.isSnapshot){let h=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=h.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let h of this.view.state.facet(Io))try{if(h(this.view,t.range,t))return!0}catch(f){It(this.view.state,f,"scroll handler")}let{range:e}=t,i=this.coordsAt(e.head,e.assoc||(e.head>e.anchor?-1:1)),n;if(!i)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let r=zo(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(Oa(this.view.scrollDOM,o,e.head<e.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,a),-a),this.view.textDirection==$.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(e.head,1);if(h){let f=mo(h.dom);h.dom.scrollIntoView({block:"nearest"}),yo(f,!1)}}}lineHasWidget(t){let e=i=>i.isWidget()||i.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){jn(this.tile)}}function jn(s,t){let e=t?.get(s);if(e!=1){e==null&&s.destroy();for(let i of s.children)jn(i,t)}}function th(s){return s.node.nodeType==1&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}function qo(s,t){let e=s.observer.selectionRange;if(!e.focusNode)return null;let i=xo(e.focusNode,e.focusOffset),n=ko(e.focusNode,e.focusOffset),r=i||n;if(n&&i&&n.node!=i.node){let l=Y.get(n.node);if(!l||l.isText()&&l.text!=n.node.nodeValue)r=n;else if(s.docView.lastCompositionAfterCursor){let a=Y.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(r=n)}}if(s.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=t-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function eh(s,t,e){let i=qo(s,e);if(!i)return null;let{node:n,from:r,to:o}=i,l=n.nodeValue;if(/[\n\r]/.test(l)||s.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new bt(a.mapPos(r),a.mapPos(o),r,o),text:n}}function ih(s,t){return s.nodeType!=1?0:(t&&s.childNodes[t-1].contentEditable=="false"?1:0)|(t<s.childNodes.length&&s.childNodes[t].contentEditable=="false"?2:0)}let nh=class{constructor(){this.changes=[]}compareRange(t,e){ve(t,e,this.changes)}comparePoint(t,e){ve(t,e,this.changes)}boundChange(t){ve(t,t,this.changes)}};function sh(s,t,e){let i=new nh;return L.compare(s,t,e,i),i.changes}class rh{constructor(){this.changes=[]}compareRange(t,e){ve(t,e,this.changes)}comparePoint(){}boundChange(t){ve(t,t,this.changes)}}function oh(s,t,e){let i=new rh;return L.compare(s,t,e,i),i.changes}function lh(s,t){for(let e=s;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function ah(s,t){let e=!1;return t&&s.iterChangedRanges((i,n)=>{i<t.to&&n>t.from&&(e=!0)}),e}class hn extends Yi{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function hh(s,t,e=1){let i=s.charCategorizer(t),n=s.doc.lineAt(t),r=t-n.from;if(n.length==0)return x.cursor(t);r==0?e=1:r==n.length&&(e=-1);let o=r,l=r;e<0?o=vt(n.text,r,!1):l=vt(n.text,r);let a=i(n.text.slice(o,l));for(;o>0;){let h=vt(n.text,o,!1);if(i(n.text.slice(h,o))!=a)break;o=h}for(;l<n.length;){let h=vt(n.text,l);if(i(n.text.slice(l,h))!=a)break;l=h}return x.undirectionalRange(o+n.from,l+n.from)}function fh(s,t,e,i,n){let r=Math.round((i-t.left)*s.defaultCharacterWidth);if(s.lineWrapping&&e.height>s.defaultLineHeight*1.5){let l=s.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(s.defaultLineHeight-l)*.5)/l);r+=a*s.viewState.heightOracle.lineLength}let o=s.state.sliceDoc(e.from,e.to);return e.from+wa(o,r,s.state.tabSize)}function _n(s,t,e){let i=s.lineBlockAt(t);if(Array.isArray(i.type)){let n;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;(!n||r.type==et.Text&&(n.type!=r.type||(e<0?r.from<t:r.to>t)))&&(n=r)}}return n||i}return i}function ch(s,t,e,i){let n=_n(s,t.head,t.assoc||-1),r=!i||n.type!=et.Text||!(s.lineWrapping||n.widgetLineBreaks)?null:s.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(r){let o=s.dom.getBoundingClientRect(),l=s.textDirectionAt(n.from),a=s.posAtCoords({x:e==(l==$.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return x.cursor(a,e?-1:1)}return x.cursor(e?n.to:n.from,e?-1:1)}function sr(s,t,e,i){let n=s.state.doc.lineAt(t.head),r=s.bidiSpans(n),o=s.textDirectionAt(n.from);for(let l=t,a=null;;){let h=Fa(n,r,o,l,e),f=Mo;if(!h){if(n.number==(e?s.state.doc.lines:1))return l;f=`
|
|
9
|
+
`,n=s.state.doc.line(n.number+(e?1:-1)),r=s.bidiSpans(n),h=e?x.cursor(n.from,-1):x.cursor(n.to,1)}if(a){if(!a(f))return l}else{if(!i)return h;a=i(f)}l=h}}function uh(s,t,e){let i=s.state.charCategorizer(t),n=i(e);return r=>{let o=i(r);return n==Ht.Space&&(n=o),n==o}}function dh(s,t,e,i){let n=t.head,r=e?1:-1;if(n==(e?s.state.doc.length:0))return x.cursor(n,t.assoc);let o=t.goalColumn,l,a=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n,t.assoc||((t.empty?e:t.head==t.from)?1:-1)),f=s.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,s.defaultCharacterWidth*(n-p.from))),l=(r<0?p.top:p.bottom)+f}let c=a.left+o,u=s.viewState.heightOracle.textHeight>>1,d=i??u;for(let p=0;;p+=u){let g=l+(d+p)*r,m=$n(s,{x:c,y:g},!1,r);if(e?g>a.bottom:g<a.top)return x.cursor(m.pos,m.assoc);let y=s.coordsAtPos(m.pos,m.assoc),k=y?(y.top+y.bottom)/2:0;if(!y||(e?k>l:k<l))return x.cursor(m.pos,m.assoc,void 0,o)}}function je(s,t,e){for(;;){let i=0;for(let n of s)n.between(t-1,t+1,(r,o,l)=>{if(t>r&&t<o){let a=i||e||(t-r<o-t?-1:1);t=a<0?r:o,i=a}});if(!i)return t}}function jo(s,t){let e=null;for(let i=0;i<t.ranges.length;i++){let n=t.ranges[i],r=null;if(n.empty){let o=je(s,n.from,0);o!=n.from&&(r=x.cursor(o,-1))}else{let o=je(s,n.from,-1),l=je(s,n.to,1);(o!=n.from||l!=n.to)&&(n.undirectional?r=x.undirectionalRange(n.from,n.to):r=x.range(n.from==n.anchor?o:l,n.from==n.head?o:l))}r&&(e||(e=t.ranges.slice()),e[i]=r)}return e?x.create(e,t.mainIndex):t}function fn(s,t,e){let i=je(s.state.facet(ni).map(n=>n(s)),e.from,t.head>e.from?-1:1);return i==e.from?e:x.cursor(i,i<e.from?1:-1)}class Et{constructor(t,e){this.pos=t,this.assoc=e}}function $n(s,t,e,i){let n=s.contentDOM.getBoundingClientRect(),r=n.top+s.viewState.paddingTop,{x:o,y:l}=t,a=l-r,h;for(;;){if(a<0)return new Et(0,1);if(a>s.viewState.docHeight)return new Et(s.state.doc.length,-1);if(h=s.elementAtHeight(a),i==null)break;if(h.type==et.Text){if(i<0?h.to<s.viewport.from:h.from>s.viewport.to)break;let u=s.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let c=s.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+c:h.top-c}if(s.viewport.from>=h.to||s.viewport.to<=h.from){if(e)return null;if(h.type==et.Text){let c=fh(s,n,h,o,l);return new Et(c,c==h.from?1:-1)}}if(h.type!=et.Text)return a<(h.top+h.bottom)/2?new Et(h.from,1):new Et(h.to,-1);let f=s.docView.lineAt(h.from,2);return(!f||f.length!=h.length)&&(f=s.docView.lineAt(h.from,-2)),new ph(s,o,l,s.textDirectionAt(h.from)).scanTile(f,h.from)}class ph{constructor(t,e,i,n){this.view=t,this.x=e,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[Lt.find(n,t-i.from,-1,e)].level==this.baseDir}dirAt(t,e){let{line:i,spans:n}=this.bidiSpansAt(t);return n[Lt.find(n,t-i.from,-1,e)].dir}bidiIn(t,e){let{spans:i,line:n}=this.bidiSpansAt(t);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<e)}scan(t,e,i=!1){let n=0,r=t.length-1,o=new Set,l=this.bidiIn(t[0],t[r]),a,h,f=-1,c=1e9,u;t:for(;n<r;){let p=r-n,g=n+r>>1;e:if(o.has(g)){for(let k=1;k<p;k++){let w=g+k;if(w>=r&&(w-=p),!o.has(w)){g=w;break e}}break t}o.add(g);let m=e(g),y=0;if(m)for(let k=0;k<m.length;k++){let w=m[k];if(!(w.width==0&&m.length>1))if(w.bottom<this.y)(!a||a.bottom<w.bottom)&&(a=w),y=1;else if(w.top>this.y)(!h||h.top>w.top)&&(h=w),y=-1;else{let B=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,C=Math.abs(B);C<c&&(f=g,c=C,u=w),B&&(y=B<0==(this.baseDir==$.LTR)?-1:1)}}y==-1&&(!l||this.baseDirAt(t[g],1))?r=g:y==1&&(!l||this.baseDirAt(t[g+1],-1))&&(n=g+1)}if(!u){if(!h&&!a)return{i:0,after:!1};let p=a&&(!h||this.y-a.bottom<h.top-this.y)?a:h;return this.y=(p.top+p.bottom)/2,this.scan(t,e,!0)}if(c&&!i){let{top:p,bottom:g}=u;if(a&&a.bottom>(p+p+g)/3)return this.y=a.bottom-1,this.scan(t,e,!0);if(h&&h.top<(p+g+g)/3)return this.y=h.top+1,this.scan(t,e,!0)}let d=(l?this.dirAt(t[f],1):this.baseDir)==$.LTR;return{i:f,after:this.x>(u.left+u.right)/2==d}}scanText(t,e){let i=[];for(let r=0;r<t.length;r=vt(t.text,r))i.push(e+r);i.push(e+t.length);let n=this.scan(i,r=>{let o=i[r]-e,l=i[r+1]-e;return Qe(t.dom,o,l).getClientRects()});return n.after?new Et(i[n.i+1],-1):new Et(i[n.i],1)}scanTile(t,e){if(!t.length)return new Et(e,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,e);if(l.isComposite())return this.scanTile(l,e)}let i=[e];for(let l=0,a=e;l<t.children.length;l++)i.push(a+=t.children[l].length);let n=this.scan(i,l=>{let a=t.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Qe(a.dom,0,a.length)).getClientRects()}),r=t.children[n.i],o=i[n.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):n.after?new Et(i[n.i+1],-1):new Et(o,1)}}const me="";class gh{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(H.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=me}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let r=this.text.length;this.readNode(n);let o=Y.get(n),l=n.nextSibling;if(l==e){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=Y.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Ii(n))||Ii(l)&&(n.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!yh(l,e)&&this.lineBreak(),n=l}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=n.exec(e))&&(r=l.index,o=l[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(t){let e=Y.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(t.nodeType==3?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(mh(t,i.node,i.offset)?e:0))}}function mh(s,t,e){for(;;){if(!t||e<Kt(t))return!1;if(t==s)return!0;e=Jt(t)+1,t=t.parentNode}}function yh(s,t){let e;for(;!(s==t||!s);s=s.nextSibling){let i=Y.get(s);if(!i?.isWidget())return!1;i&&(e||(e=[])).push(i)}if(e)for(let i of e){let n=i.overrideDOMText;if(n?.length)return!1}return!0}class rr{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class bh{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView,l=t.state.selection;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=_o(t.docView.tile,e,i,0))){let a=r||o?[]:xh(t),h=new gh(a,t);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=kh(a,this.bounds.from)}else{let a=t.observer.selectionRange,h=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!Fn(t.contentDOM,a.focusNode)?l.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),f=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Fn(t.contentDOM,a.anchorNode)?l.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset),c=t.viewport;if((S.ios||S.chrome)&&h!=f&&Math.min(h,f)<=l.main.from&&Math.max(h,f)>=l.main.to&&(c.from>0||c.to<t.state.doc.length)){let u=Math.min(h,f),d=Math.max(h,f),p=c.from-u,g=c.to-d;(p==0||p==1||u==0)&&(g==0||g==-1||d==t.state.doc.length)&&(h=0,f=t.state.doc.length)}if(t.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(x.range(f,h));else if(t.lineWrapping&&f==h&&!(l.main.empty&&l.main.head==h)&&t.inputState.lastTouchTime>Date.now()-100){let u=t.coordsAtPos(h,-1),d=0;u&&(d=t.inputState.lastTouchY<=u.bottom?-1:1),this.newSel=x.create([x.cursor(h,d)])}else this.newSel=x.single(f,h)}}}function _o(s,t,e,i){if(s.isComposite()){let n=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,f=i;a<s.children.length;a++){let c=s.children[a],u=h+c.length;if(h<t&&u>e)return _o(c,t,e,h);if(u>=t&&n==-1&&(n=a,r=h),h>e&&c.dom.parentNode==s.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:r,to:l<0?i+s.length:l,startDOM:(n?s.children[n-1].dom.nextSibling:null)||s.dom.firstChild,endDOM:o<s.children.length&&o>=0?s.children[o].dom:null}}else return s.isText()?{from:i,to:i+s.length,startDOM:s.dom,endDOM:s.dom.nextSibling}:null}function $o(s,t){let e,{newSel:i}=t,{state:n}=s,r=n.selection.main,o=s.inputState.lastKeyTime>Date.now()-100?s.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:a}=t.bounds,h=r.from,f=null;(o===8||S.android&&t.text.length<a-l)&&(h=r.to,f="end");let c=n.doc.sliceString(l,a,me),u,d;!r.empty&&r.from>=l&&r.to<=a&&(t.typeOver||c!=t.text)&&c.slice(0,r.from-l)==t.text.slice(0,r.from-l)&&c.slice(r.to-l)==t.text.slice(u=t.text.length-(c.length-(r.to-l)))?e={from:r.from,to:r.to,insert:W.of(t.text.slice(r.from-l,u).split(me))}:(d=Uo(c,t.text,h-l,f))&&(S.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==me+me&&d.toB--,e={from:l+d.from,to:l+d.toA,insert:W.of(t.text.slice(d.from,d.toB).split(me))})}else i&&(!s.hasFocus&&n.facet(Wt)||Vi(i,r))&&(i=null);if(!e&&!i)return!1;if((S.mac||S.android)&&e&&e.from==e.to&&e.from==r.head-1&&/^\. ?$/.test(e.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=x.single(i.main.anchor-1,i.main.head-1)),e={from:e.from,to:e.to,insert:W.of([e.insert.toString().replace("."," ")])}):n.doc.lineAt(r.from).to<r.to&&s.docView.lineHasWidget(r.to)&&s.inputState.insertingTextAt>Date.now()-50?e={from:r.from,to:r.to,insert:n.toText(s.inputState.insertingText)}:S.chrome&&e&&e.from==e.to&&e.from==r.head&&e.insert.toString()==`
|
|
10
|
+
`&&s.lineWrapping&&(i&&(i=x.single(i.main.anchor-1,i.main.head-1)),e={from:r.from,to:r.to,insert:W.of([" "])}),e)return ks(s,e,i,o);if(i&&!Vi(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=jo(n.facet(ni).map(h=>h(s)),i))),s.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function ks(s,t,e,i=-1){if(S.ios&&s.inputState.flushIOSKey(t))return!0;let n=s.state.selection.main;if(S.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&&Se(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)&&Se(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&Se(s.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let o,l=()=>o||(o=wh(s,t,e));return s.state.facet(Po).some(a=>a(s,t.from,t.to,r,l))||s.dispatch(l()),!0}function wh(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=je(n.facet(ni).map(c=>c(s)),h,a);t.from==f&&(o=f)}if(o>-1)i={changes:t,selection:x.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&&qo(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 y=n.changes({from:m,to:g,insert:t.insert}),k=p.to-r.to;return{changes:y,range:h?x.range(Math.max(0,h.anchor+k),Math.max(0,h.head+k)):p.map(y)}})}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 Uo(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 xh(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 rr(e,i)),(n!=e||r!=i)&&t.push(new rr(n,r))),t}function kh(s,t){if(s.length==0)return null;let e=s[0].pos,i=s.length==2?s[1].pos:e;return e<0||i<0?null:e==i?x.create([x.cursor(i+t,-1)]):x.single(e+t,i+t)}function Vi(s,t){return t.head==s.main.head&&t.anchor==s.main.anchor}class vh{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,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.lastIOSMomentumScroll=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,S.safari&&t.contentDOM.addEventListener("input",()=>null),S.gecko&&Hh(t.contentDOM.ownerDocument)}handleEvent(t){!Ph(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=Ch(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&&Yo.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),S.android&&S.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(S.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(Go.some(e=>e.keyCode==t.keyCode)&&!t.ctrlKey||Ah.indexOf(t.key)>-1&&t.ctrlKey)){let e={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};e.shiftKey&&S.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Sh(this.view.win)&&(e.shiftKey=!1);let i=this.pendingIOSKey={key:t.key,keyCode:t.keyCode,mods:e};return setTimeout(()=>{this.pendingIOSKey==i&&this.flushIOSKey()},50),!0}return t.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(t){let e=this.pendingIOSKey;return!e||this.view.observer.pendingRecords().length||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,Se(this.view.contentDOM,e.key,e.keyCode,e.mods))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:S.safari&&!S.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 Sh(s){return s.visualViewport?s.visualViewport.height*s.visualViewport.scale/s.document.documentElement.clientHeight<.85:!1}function or(s,t){return(e,i)=>{try{return t.call(s,i,e)}catch(n){It(e.state,n)}}}function Ch(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(or(i.value,a))}if(o)for(let l in o){let a=o[l];a&&e(l).observers.push(or(i.value,a))}}for(let i in Ct)e(i).handlers.push(Ct[i]);for(let i in ht)e(i).observers.push(ht[i]);return t}const Go=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ah="dthko",Yo=[16,17,18,20,91,92,224,225],fi=6;function ci(s){return Math.max(0,s)*.7+8}function Mh(s,t){return Math.max(Math.abs(s.clientX-t.clientX),Math.abs(s.clientY-t.clientY))}class Th{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=go(t.contentDOM),this.atoms=t.state.facet(ni).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(H.allowMultipleSelections)&&Oh(t,e),this.dragging=Bh(t,e)&&Qo(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&&Mh(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=zo(this.view);t.clientX-a.left<=n+fi?e=-ci(n-t.clientX):t.clientX+a.right>=o-fi&&(e=ci(t.clientX-o)),t.clientY-a.top<=r+fi?i=-ci(r-t.clientY):t.clientY+a.bottom>=l-fi&&(i=ci(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=jo(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 Oh(s,t){let e=s.state.facet(To);return e.length?e[0](t):S.mac?t.metaKey:t.ctrlKey}function Dh(s,t){let e=s.state.facet(Oo);return e.length?e[0](t):S.mac?!t.altKey:!t.ctrlKey}function Bh(s,t){let{main:e}=s.state.selection;if(e.empty)return!1;let i=Je(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 Ph(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=Y.get(e))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}const Ct=Object.create(null),ht=Object.create(null),Xo=S.ie&&S.ie_version<15||S.ios&&S.webkit_version<604;function Eh(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(),Jo(s,e.value)},50)}function Zi(s,t,e){for(let i of s.facet(t))e=i(e,s);return e}function Jo(s,t){t=Zi(s.state,ys,t);let{state:e}=s,i,n=1,r=e.toText(t),o=r.lines==e.selection.ranges.length;if(Un!=null&&e.selection.ranges.every(a=>a.empty)&&Un==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:x.cursor(h.from+c.length,-1)}})}else o?i=e.changeByRange(a=>{let h=r.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:x.cursor(a.from+h.length,-1)}}):i=e.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ht.scroll=s=>{let t=s.inputState;t.lastScrollTop=s.scrollDOM.scrollTop,t.lastScrollLeft=s.scrollDOM.scrollLeft,S.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};ht.wheel=ht.mousewheel=s=>{s.inputState.lastWheelEvent=Date.now()};Ct.keydown=(s,t)=>(s.inputState.setSelectionOrigin("select"),t.keyCode==27&&s.inputState.tabFocusMode!=0&&(s.inputState.tabFocusMode=Date.now()+2e3),!1);ht.touchstart=(s,t)=>{let e=s.inputState,i=t.targetTouches[0];e.touchActive=!0,e.lastTouchTime=Date.now(),i&&(e.lastTouchX=i.clientX,e.lastTouchY=i.clientY),e.setSelectionOrigin("select.pointer")};ht.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};ht.touchend=(s,t)=>{s.inputState.touchActive=!1};Ct.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(Do))if(e=i(s,t),e)break;if(!e&&t.button==0&&(e=Lh(s,t)),e){let i=!s.hasFocus;s.inputState.startMouseSelection(new Th(s,t,e,i)),i&&s.observer.ignore(()=>{bo(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 lr(s,t,e,i){if(i==1)return x.cursor(t,e);if(i==2)return hh(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++,x.undirectionalRange(o,l)}}const Rh=S.ie&&S.ie_version<=11;let ar=null,hr=0,fr=0;function Qo(s){if(!Rh)return s.detail;let t=ar,e=fr;return ar=s,fr=Date.now(),hr=!t||e>Date.now()-400&&Math.abs(t.clientX-s.clientX)<2&&Math.abs(t.clientY-s.clientY)<2?(hr+1)%3:1}function Lh(s,t){let e=s.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=Qo(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=lr(s,a.pos,a.assoc,i);if(e.pos!=a.pos&&!o){let c=lr(s,e.pos,e.assoc,i),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u<f.from?x.range(u,d,f.assoc):x.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=Ih(n,a.pos))?h:l?n.addRange(f):x.create([f])}}}function Ih(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 x.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}Ct.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=x.undirectionalRange(r,o))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",Zi(s.state,bs,s.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ct.dragend=s=>(s.inputState.draggedContent=null,!1);function cr(s,t,e,i){if(e=Zi(s.state,ys,e),!e)return;let n=s.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=s.inputState,o=i&&r&&Dh(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}Ct.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&&cr(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 cr(s,t,i,!0),!0}return!1};Ct.paste=(s,t)=>{if(s.state.readOnly)return!0;s.observer.flush();let e=Xo?null:t.clipboardData;return e?(Jo(s,e.getData("text/plain")||e.getData("text/uri-list")),!0):(Eh(s),!1)};function Nh(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 Wh(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:Zi(s,bs,t.join(s.lineBreak)),ranges:e,linewise:i}}let Un=null;Ct.copy=Ct.cut=(s,t)=>{if(!Ke(s.contentDOM,s.observer.selectionRange))return!1;let{text:e,ranges:i,linewise:n}=Wh(s.state);if(!e&&!n)return!1;Un=n?e:null,t.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Xo?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(Nh(s,e),!1)};const Zo=Re.define();function tl(s,t){let e=[];for(let i of s.facet(Eo)){let n=i(s,t);n&&e.push(n)}return e.length?s.update({effects:e,annotations:Zo.of(!0)}):null}function el(s){setTimeout(()=>{let t=s.hasFocus;if(t!=s.inputState.notifiedFocused){let e=tl(s.state,t);e?s.dispatch(e):s.update([])}},10)}ht.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),el(s)};ht.blur=s=>{s.observer.clearSelectionRange(),el(s)};ht.compositionstart=ht.compositionupdate=s=>{if(!s.observer.editContext&&(s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0)){let{main:t}=s.state.selection;!t.empty&&s.lineBlockAt(t.from).from!=s.lineBlockAt(t.to).from&&s.dispatch({changes:s.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:"input"}),s.inputState.composing=0}};ht.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,S.chrome&&S.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50))};ht.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};Ct.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 ks(s,{from:a,to:h,insert:s.state.toText(r)},null),!0}}let n;if(S.chrome&&S.android&&(n=Go.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 S.ios&&t.inputType=="deleteContentForward"&&s.observer.flushSoon(),S.safari&&t.inputType=="insertText"&&s.inputState.composing>=0&&setTimeout(()=>ht.compositionend(s,t),20),!1};const ur=new Set;function Hh(s){ur.has(s)||(ur.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const dr=["pre-wrap","normal","pre-line","break-spaces"];let Oe=!1;function pr(){Oe=!1}class Fh{constructor(t){this.lineWrapping=t,this.doc=W.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 dr.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=dr.indexOf(t)>-1,a=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=l;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 Vh{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class kt{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"?et.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 he?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 kt(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var _=(function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s})(_||(_={}));const Mi=.001;class lt{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)>Mi&&(Oe=!0),this.height=t)}replace(t,e,i){return lt.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,_.ByPosNoHeight,i.setDoc(e),0,0),d=u.to>=h?u:r.lineAt(h,_.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,_.ByPosNoHeight,i,0,0));f+=u.from-a,a=u.from;let p=vs.build(i.setDoc(o),t,f,c);r=zi(r,r.replace(a,h,p))}return r.updateHeight(i,0)}static empty(){return new ut(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=!1;return t[e-1]==null?(o=!0,e--):t[e]==null&&(o=!0,i++),new Kh(lt.of(t.slice(0,e)),o,lt.of(t.slice(i)))}}function zi(s,t){return s==t?s:(s.constructor!=t.constructor&&(Oe=!0),t)}lt.prototype.size=1;const zh=U.replace({});class il extends lt{constructor(t,e,i){super(t,e),this.deco=i,this.spaceAbove=0}mainBlock(t,e){return new kt(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 kt(n,0,i,this.spaceAbove,zh):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,_.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 ut extends il{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 kt(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 ut||n instanceof Z&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Z?n=new ut(n.length,this.height,this.spaceAbove):n.height=this.height,this.outdated||(n.outdated=!1),n):lt.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 Z extends lt{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 kt(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 kt(f,c,i+l*h,l,0)}}lineAt(t,e,i,n,r){if(e==_.ByHeight)return this.blockAt(t,i,n,r);if(e==_.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(t);return new kt(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 kt(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 kt(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 Z?i[i.length-1]=new Z(r.length+n):i.push(null,new Z(n-1))}if(t>0){let r=i[0];r instanceof Z?i[0]=new Z(t+r.length):i.unshift(new Z(t-1),null)}return lt.of(i)}decomposeLeft(t,e){e.push(new Z(t-1),null)}decomposeRight(t,e){e.push(null,new Z(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 Z(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)>=Mi&&(a=-2);let d=new ut(f,c,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new Z(r-l).updateHeight(t,l));let h=lt.of(o);return(a<0||Math.abs(h.height-this.height)>=Mi||Math.abs(a-this.heightMetrics(t,e).perLine)>=Mi)&&(Oe=!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 Kh extends lt{constructor(t,e,i){super(t.length+(e?1:0)+i.length,t.height+i.height,(e?1:0)|(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==_.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==_.ByPosNoHeight?_.ByPosNoHeight:_.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,_.ByPos,i,n,r);t<h.from&&this.left.forEachLine(t,Math.min(e,h.from-1),i,n,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(Math.max(t,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&&gr(r,o-1),e<this.length){let l=r.length;this.decomposeRight(e,r),gr(r,l)}return lt.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?lt.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 gr(s,t){let e,i;s[t]==null&&(e=s[t-1])instanceof Z&&(i=s[t+1])instanceof Z&&s.splice(t-1,3,new Z(e.length+1+i.length))}const qh=5;class vs{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 ut?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ut(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 il(o,n,i)):(o||r||n>=qh)&&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 ut(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let i=new Z(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 ut)return t;let e=new ut(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 ut)&&!this.isCovered?this.nodes.push(new ut(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 ut&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(t,e,i,n){let r=new vs(i,t);return L.spans(e,i,n,r,0),r.finish(i)}}function jh(s,t,e){let i=new _h;return L.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)&&ve(t,e,this.changes,5)}}function $h(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 Uh(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 Gh(s,t){let e=s.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class cn{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 U.replace({widget:new Yh(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class Yh extends Yi{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 mr{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=yr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=$.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(ws).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Fh(i),this.stateDeco=br(e),this.heightMap=lt.empty().applyChanges(this.stateDeco,W.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=U.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 ui(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?yr:new Ss(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(Fe(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=br(this.state);let n=t.changedRanges,r=bt.extendWithRanges(n,jh(i,this.stateDeco,t?t.changes:J.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);pr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Oe)&&(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(Lo)&&(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"?$.RTL:$.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:A}=po(e,l);(C>.005&&Math.abs(this.scaleX-C)>.005||A>.005&&Math.abs(this.scaleY-A)>.005)&&(this.scaleX=C,this.scaleY=A,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=go(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=wo(this.scrollParent||t.win);let g=(this.printing?Gh:$h)(e,this.paddingTop),m=g.top-this.pixelViewport.top,y=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(a=!0)),!this.inView&&!this.scrollTarget&&!Uh(t.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||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(w-this.contentDOMWidth)>n.charWidth){let{lineHeight:A,charWidth:v,textHeight:I}=t.docView.measureTextSize();o=A>0&&n.refresh(r,A,v,I,Math.max(5,w/v),C),o&&(t.docView.minWidth=0,h|=16)}m>0&&y>0?f=Math.max(m,y):m<0&&y<0&&(f=Math.min(m,y)),pr();for(let A of this.viewports){let v=A.from==this.viewport.from?C:t.docView.measureVisibleLineHeights(A);this.heightMap=(o?lt.empty().applyChanges(this.stateDeco,W.empty,this.heightOracle,[new bt(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Vh(A.from,v))}Oe&&(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 ui(n.lineAt(o-i*1e3,_.ByHeight,r,0,0).from,n.lineAt(l+(1-i)*1e3,_.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,_.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 ui(n.lineAt(u-1e3/2,_.ByHeight,r,0,0).from,n.lineAt(u+f+1e3/2,_.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 ui(this.heightMap.lineAt(i,_.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,_.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,_.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,_.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 cn(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!=$.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 y of g)if(y>f&&y<c){a(f,y-10,u,d),a(y+10,c,u,d);return}let m=Jh(t,y=>y.from>=u.from&&y.to<=u.to&&Math.abs(y.from-f)<r&&Math.abs(y.to-c)<r&&!g.some(k=>y.from<k&&y.to>k));if(!m){if(c<u.to&&e&&i&&e.visibleRanges.some(w=>w.from<=c&&w.to>=c)){let w=e.moveToLineBoundary(x.cursor(c),!1,!0).head;w>f&&(c=w)}let y=this.gapSize(u,f,c,d),k=i||y<2e6?y:2e6;m=new cn(f,c,y,k)}l.push(m)},h=f=>{if(f.length<o||f.type!=et.Text)return;let c=Xh(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,y;if(u!=null){let k=pi(c,u),w=((this.visibleBottom-this.visibleTop)/2+g)/f.height;m=k-w,y=k+w}else m=(this.visibleTop-f.top-g)/f.height,y=(this.visibleBottom-f.top+g)/f.height;d=di(c,m),p=di(c,y)}else{let g=c.total*this.heightOracle.charWidth,m=n*this.heightOracle.charWidth,y=0;if(g>2e6)for(let A of t)A.from>=f.from&&A.from<f.to&&A.size!=A.displaySize&&A.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=A.size-A.displaySize);let k=this.pixelViewport.left+y,w=this.pixelViewport.right+y,B,C;if(u!=null){let A=pi(c,u),v=((w-k)/2+m)/g;B=A-v,C=A+v}else B=(k-m)/g,C=(w+m)/g;d=di(c,B),p=di(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=pi(n,i)-pi(n,e);return this.heightOracle.lineWrapping?t.height*r:n.total*this.heightOracle.charWidth*r}updateLineGaps(t){cn.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=U.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=[];L.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)||Fe(this.heightMap.lineAt(t,_.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)||Fe(this.heightMap.lineAt(this.scaler.fromDOM(t),_.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}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 Fe(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 ui{constructor(t,e){this.from=t,this.to=e}}function Xh(s,t,e){let i=[],n=s,r=0;return L.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 di({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 pi(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 Jh(s,t){for(let e of s)if(t(e))return e}const yr={toDOM(s){return s},fromDOM(s){return s},scale:1,eq(s){return s==this}};function br(s){let t=s.facet(Xi).filter(i=>typeof i!="function"),e=s.facet(xs).filter(i=>typeof i!="function");return e.length&&t.push(L.join(e)),t}class Ss{constructor(t,e,i){let n=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=e.lineAt(l,_.ByPos,t,0,0).top,f=e.lineAt(a,_.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 Ss?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 Fe(s,t){if(t.scale==1)return s;let e=t.toDOM(s.top),i=t.toDOM(s.bottom);return new kt(s.from,s.length,e,i-e,Array.isArray(s._content)?s._content.map(n=>Fe(n,t)):s._content)}const gi=T.define({combine:s=>s.join(" ")}),Gn=T.define({combine:s=>s.indexOf(!0)>-1}),Yn=Yt.newName(),nl=Yt.newName(),sl=Yt.newName(),rl={"&light":"."+nl,"&dark":"."+sl};function Xn(s,t,e){return new Yt(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 Qh=Xn("."+Yn,{"&":{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":{userSelect:"none",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"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&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":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) 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"}},rl),Zh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},un=S.ie&&S.ie_version<=11;class tf{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Da,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);(S.ie&&S.ie_version<=11||S.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&&S.android&&t.constructor.EDIT_CONTEXT!==!1&&!(S.chrome&&S.chrome_version<126)&&(this.editContext=new nf(t),t.state.facet(Wt)&&(t.contentDOM.editContext=this.editContext.editContext)),un&&(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(Wt)?i.root.activeElement!=this.dom:!Ke(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}(S.ie&&S.ie_version<=11||S.android&&S.chrome)&&!i.state.selection.main.empty&&n.focusNode&&qe(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Je(t.root);if(!e)return!1;let i=S.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&ef(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let n=Ke(this.dom,i);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Pa(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,Zh),un&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),un&&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&&Se(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&&Ke(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 bh(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=$o(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!Vi(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=wr(e,t.previousSibling||t.target.previousSibling,-1),n=wr(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(Wt)!=t.state.facet(Wt)&&(t.view.contentDOM.editContext=t.state.facet(Wt)?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 wr(s,t,e){for(;t;){let i=Y.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 xr(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 qe(o.node,o.offset,n,r)&&([e,i,n,r]=[n,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:n,focusOffset:r}}function ef(s,t){if(t.getComposedRanges){let n=t.getComposedRanges(s.root)[0];if(n)return xr(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?xr(s,e):null}class nf{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=Uo(t.state.sliceDoc(l,a),i.text,(h?n.from:n.to)-l,h?"end":null);if(!f){let u=x.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Vi(u,n)||t.dispatch({selection:u,userEvent:"select"});return}let c={from:f.from+l,to:f.toA+l,insert:W.of(i.text.slice(f.from,f.toB).split(`
|
|
11
|
+
`))};if((S.mac||S.android)&&c.from==o-1&&/^\. ?$/.test(i.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:W.of([i.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);ks(t,c,x.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(U.mark({attributes:{style:f}}).range(a,h))}}}t.dispatch({effects:No.of(U.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=>{let n=Je(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 D{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.clearAnnouncement=-1,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||Ba(t.parent)||document,this.viewState=new mr(this,t.state||H.create(t)),t.scrollTo&&t.scrollTo.is(hi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ye).map(n=>new on(n));for(let n of this.plugins)n.update(this);this.observer=new tf(this),this.inputState=new vh(this),this.inputState.ensureHandlers(this.plugins),this.docView=new nr(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 nt?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(Zo))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=tl(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(H.phrases)!=this.state.facet(H.phrases))return this.setState(r);n=Wi.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(D.cursorScrollMargin);c=new Ce(d.empty?d:x.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",g,p)}for(let d of u.effects)d.is(hi)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Ki.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(He)!=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(gi)!=n.state.facet(gi)&&(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(qn))try{u(n)}catch(d){It(this.state,d,"update listener")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!$o(this,f)&&h.force&&Se(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 mr(this,t),this.plugins=t.facet(ye).map(i=>new on(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new nr(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(ye),i=t.state.facet(ye);if(e!=i){let n=[];for(let r of i){let o=e.indexOf(r);if(o<0)n.push(new on(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){It(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,scaleY:l}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0){if(wo(i||this.win))r=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let p=this.viewState.scrollAnchorAt(n);r=p.from,o=p.top}l=this.viewState.scaleY}this.updateState=1;let h=this.viewState.measure();if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];h&4||([this.measureRequests,f]=[f,this.measureRequests]);let c=f.map(p=>{try{return p.read(this)}catch(g){return It(this.state,g),kr}}),u=Wi.create(this,this.state,[]),d=!1;u.flags|=h,e?e.flags|=h:e=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let p=0;p<f.length;p++)if(c[p]!=kr)try{let g=f[p];g.write&&g.write(c[p],this)}catch(g){It(this.state,g)}if(d&&this.docView.updateSelection(!0),!u.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 g=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)/this.viewState.scaleY-o/l;if((g>1||g<-1)&&!(S.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n=n+g,i?r<0?i.scrollTop=i.scrollHeight:i.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let a of this.state.facet(qn))a(e)}get themeClasses(){return Yn+" "+(this.state.facet(Gn)?sl:nl)+" "+this.state.facet(gi)}updateAttrs(){let t=vr(this,Wo,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Wt)?"true":"false",class:"cm-content",style:`${S.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),vr(this,ws,e);let i=this.observer.ignore(()=>{let n=Js(this.contentDOM,this.contentAttrs,e),r=Js(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(D.announce)){e&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),e=!1);let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(He);let t=this.state.facet(D.cspNonce);Yt.mount(this.root,this.styleModules.concat(Qh).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 fn(this,t,sr(this,t,e,i))}moveByGroup(t,e){return fn(this,t,sr(this,t,e,i=>uh(this,t.head,i)))}visualLineSide(t,e){return e?x.cursor(t.to,1):x.cursor(t.from,-1)}moveToLineBoundary(t,e,i=!0){return ch(this,t,e,i)}moveVertically(t,e,i){return fn(this,t,dh(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=$n(this,t,e);return i&&i.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),$n(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.state.doc.lineAt(t),n=this.bidiSpans(i),r=n[Lt.find(n,t-i.from,-1,e)];return i.length&&(t==i.from&&e<0||t==i.to&&e>0)&&r.dir!=this.textDirectionAt(i.from)&&(t==i.to?(t=i.from+r.from,e=1):(t=i.from+r.to,e=-1)),this.docView.coordsAt(t,e,r.dir==$.RTL)}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(Ro)||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>sf)return Ao(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||Co(r.isolates,i=tr(this,t))))return r.order;i||(i=tr(this,t));let n=Ha(t.text,e,i);return this.bidiCache.push(new Ki(t.from,t.to,e,i,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||S.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{bo(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.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){var i,n,r,o;return hi.of(new Ce(typeof t=="number"?x.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 hi.of(new Ce(x.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 xt.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return xt.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=Yt.newName(),n=[gi.of(i),He.of(Xn(`.${i}`,t))];return e&&e.dark&&n.push(Gn.of(!0)),n}static baseTheme(t){return $i.lowest(He.of(Xn("."+Yn,t,rl)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&Y.get(i)||Y.get(t);return((e=n?.root)===null||e===void 0?void 0:e.view)||null}}D.styleModule=He;D.inputHandler=Po;D.clipboardInputFilter=ys;D.clipboardOutputFilter=bs;D.scrollHandler=Io;D.focusChangeEffect=Eo;D.perLineTextDirection=Ro;D.exceptionSink=Bo;D.updateListener=qn;D.editable=Wt;D.mouseSelectionStyle=Do;D.dragMovesSelection=Oo;D.clickAddsSelectionRange=To;D.decorations=Xi;D.blockWrappers=Ho;D.outerDecorations=xs;D.atomicRanges=ni;D.bidiIsolatedRanges=Fo;D.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}}});D.scrollMargins=Vo;D.darkTheme=Gn;D.cspNonce=T.define({combine:s=>s.length?s[0]:""});D.contentAttributes=ws;D.editorAttributes=Wo;D.lineWrapping=D.contentAttributes.of({class:"cm-lineWrapping"});D.announce=G.define();const sf=4096,kr={};class Ki{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:$.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 Ki(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function vr(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&&ps(o,e)}return e}const rf=S.mac?"mac":S.windows?"win":S.linux?"linux":"key";function of(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 mi(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 lf=$i.default(D.domEventHandlers({keydown(s,t){return ll(ol(t.state),s,t,"editor")}})),af=T.define({enables:lf}),Sr=new WeakMap;function ol(s){let t=s.facet(af),e=Sr.get(t);return e||Sr.set(t,e=ff(t.reduce((i,n)=>i.concat(n),[]))),e}function Dc(s,t,e){return ll(ol(s.state),t,s,e)}let $t=null;const hf=4e3;function ff(s,t=rf){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(y=>of(y,t));for(let y=1;y<p.length;y++){let k=p.slice(0,y).join(" ");n(k,!0),d[k]||(d[k]={preventDefault:!0,stopPropagation:!1,run:[w=>{let B=$t={view:w,prefix:k,scope:o};return setTimeout(()=>{$t==B&&($t=null)},hf),!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,Jn))}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 Jn=null;function ll(s,t,e,i){Jn=t;let n=Sa(t),r=sa(n,0),o=ra(r)==n.length&&n!=" ",l="",a=!1,h=!1,f=!1;$t&&$t.view==e&&$t.scope==i&&(l=$t.prefix+" ",Yo.indexOf(t.keyCode)<0&&(h=!0,$t=null));let c=new Set,u=m=>{if(m){for(let y of m.run)if(!c.has(y)&&(c.add(y),y(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+mi(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(S.windows&&t.ctrlKey&&t.altKey)&&!(S.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Xt[t.keyCode])&&p!=n?(u(d[l+mi(p,t,!0)])||t.shiftKey&&(g=Ye[t.keyCode])!=n&&g!=p&&u(d[l+mi(g,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+mi(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),Jn=null,a}class le{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=al(t);return[new le(e,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return cf(t,e,i)}}function al(s){let t=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==$.LTR?t.left:t.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:t.top-s.scrollDOM.scrollTop*s.scaleY}}function Cr(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 cf(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==$.LTR,o=s.contentDOM,l=o.getBoundingClientRect(),a=al(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=_n(s,i,1),p=_n(s,n,-1),g=d.type==et.Text?d:null,m=p.type==et.Text?p:null;if(g&&(s.lineWrapping||d.widgetLineBreaks)&&(g=Cr(s,i,1,g)),m&&(s.lineWrapping||p.widgetLineBreaks)&&(m=Cr(s,n,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return k(w(e.from,e.to,g));{let C=g?w(e.from,null,g):B(d,!1),A=m?w(null,e.to,m):B(p,!0),v=[];return(g||d).to<(m||p).from-(g&&m?1:0)||d.widgetLineBreaks>1&&C.bottom+s.defaultLineHeight/2<A.top?v.push(y(c,C.bottom,u,A.top)):C.bottom<A.top&&s.elementAtHeight((C.bottom+A.top)/2).type==et.Text&&(C.bottom=A.top=(C.bottom+A.top)/2),k(C).concat(v).concat(k(A))}function y(C,A,v,I){return new le(t,C-a.left,A-a.top,Math.max(0,v-C),I-A)}function k({top:C,bottom:A,horizontal:v}){let I=[];for(let E=0;E<v.length;E+=2)I.push(y(v[E],C,v[E+1],A));return I}function w(C,A,v){let I=1e9,E=-1e9,z=[];function P(N,j,rt,ct,At){let Q=s.coordsAtPos(N,N==v.to?-2:2),pt=s.coordsAtPos(rt,rt==v.from?2:-2);!Q||!pt||(I=Math.min(Q.top,pt.top,I),E=Math.max(Q.bottom,pt.bottom,E),At==$.LTR?z.push(r&&j?c:Q.left,r&&ct?u:pt.right):z.push(!r&&ct?c:pt.left,!r&&j?u:Q.right))}let O=C??v.from,F=A??v.to;for(let N of s.visibleRanges)if(N.to>O&&N.from<F)for(let j=Math.max(N.from,O),rt=Math.min(N.to,F);;){let ct=s.state.doc.lineAt(j);for(let At of s.bidiSpans(ct)){let Q=At.from+ct.from,pt=At.to+ct.from;if(Q>=rt)break;pt>j&&P(Math.max(Q,j),C==null&&Q<=O,Math.min(pt,rt),A==null&&pt>=F,At.dir)}if(j=ct.to+1,j>=rt)break}return z.length==0&&P(O,C==null,F,A==null,s.textDirection),{top:I,bottom:E,horizontal:z}}function B(C,A){let v=l.top+(A?C.top:C.bottom);return{top:v,bottom:v,horizontal:[]}}}function uf(s,t){return s.constructor==t.constructor&&s.eq(t)}class df{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(Ti)!=t.state.facet(Ti)&&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(Ti);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)=>!uf(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,S.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ti=T.define();function hl(s){return[xt.define(t=>new df(t,s)),Ti.of(s)]}const De=T.define({combine(s){return cs(s,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Bc(s={}){return[De.of(s),pf,gf,yf,Lo.of(!0)]}function fl(s){return s.startState.facet(De)!=s.state.facet(De)}const pf=hl({above:!0,markers(s){let{state:t}=s,e=t.facet(De),i=[];for(let n of t.selection.ranges){let r=n==t.selection.main;if(n.empty||e.drawRangeCursor&&!(r&&S.ios&&e.iosSelectionHandles)){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=n.empty?n:x.cursor(n.head,n.assoc);for(let a of le.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=fl(s);return e&&Ar(s.state,t),s.docChanged||s.selectionSet||e},mount(s,t){Ar(t.state,s)},class:"cm-cursorLayer"});function Ar(s,t){t.style.animationDuration=s.facet(De).cursorBlinkRate+"ms"}const gf=hl({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 le.forRange(s,"cm-selectionBackground",n))t.push(r);if(S.ios&&!e.empty&&s.state.facet(De).iosSelectionHandles){for(let n of le.forRange(s,"cm-selectionHandle cm-selectionHandle-start",x.cursor(e.from,1)))t.push(n);for(let n of le.forRange(s,"cm-selectionHandle cm-selectionHandle-end",x.cursor(e.to,1)))t.push(n)}return t},update(s,t){return s.docChanged||s.selectionSet||s.viewportChanged||fl(s)},class:"cm-selectionLayer"}),mf=S.gecko&&S.gecko_version==153?"#ffffff01":"transparent",yf=$i.highest(D.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${mf} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function Pc(){return wf}const bf=U.line({class:"cm-activeLine"}),wf=xt.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(bf.range(n.from)),t=n.from)}return U.set(e)}},{decorations:s=>s.decorations}),Mr=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 xf(s,t){let e=s.plugin(cl),i=e?e.specs.indexOf(t):-1;return i>-1?e.panels[i]:null}const cl=xt.fromClass(class{constructor(s){this.input=s.state.facet(Qn),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(s));let t=s.state.facet(Mr);this.top=new yi(s,!0,t.topContainer),this.bottom=new yi(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(Mr);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new yi(s.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new yi(s.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=s.state.facet(Qn);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=>D.scrollMargins.of(t=>{let e=t.plugin(s);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})});class yi{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";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=Tr(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Tr(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 Tr(s){let t=s.nextSibling;return s.remove(),t}const Qn=T.define({enables:cl});function Ec(s,t){let e,i=new Promise(o=>e=o),n=o=>kf(o,t,e);s.state.field(Oi,!1)?s.dispatch({effects:ul.of(n)}):s.dispatch({effects:G.appendConfig.of(Oi.init(()=>[n]))});let r=dl.of(n);return{close:r,result:i.then(o=>((s.win.queueMicrotask||(a=>s.win.setTimeout(a,10)))(()=>{s.state.field(Oi).indexOf(n)>-1&&s.dispatch({effects:r})}),o))}}function Rc(s,t){let e=s.state.field(Oi,!1)||[];for(let i of e){let n=xf(s,i);if(n&&n.dom.classList.contains(t))return n}return null}const Oi=Zt.define({create(){return[]},update(s,t){for(let e of t.effects)e.is(ul)?s=[e.value].concat(s):e.is(dl)&&(s=s.filter(i=>i!=e.value));return s},provide:s=>Qn.computeN([s],t=>t.field(s))}),ul=G.define(),dl=G.define();function kf(s,t,e){let i=t.content?t.content(s,()=>o(null)):null;if(!i){if(i=pe("form"),t.input){let l=pe("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(pe("label",(t.label||"")+": ",l))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(pe("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=pe("div",i,pe("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 Qt extends ae{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Qt.prototype.elementClass="";Qt.prototype.toDOM=void 0;Qt.prototype.mapMode=dt.TrackBefore;Qt.prototype.startSide=Qt.prototype.endSide=-1;Qt.prototype.point=!0;const Di=T.define(),vf=T.define(),Bi=T.define(),Or=T.define({combine:s=>s.some(t=>t)});function Sf(s){return[Cf]}const Cf=xt.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(Bi).map(t=>new Br(s,t)),this.fixed=!s.state.facet(Or);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(Or)!=!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=L.iter(this.view.state.facet(Di),this.view.viewport.from),i=[],n=this.gutters.map(r=>new Af(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==et.Text&&o){Zn(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==et.Text){Zn(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(Bi),e=s.state.facet(Bi),i=s.docChanged||s.heightChanged||s.viewportChanged||!L.eq(s.startState.facet(Di),s.state.facet(Di),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 Br(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=>D.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==$.LTR?{left:i,right:n}:{right:i,left:n}})});function Dr(s){return Array.isArray(s)?s:[s]}function Zn(s,t,e){for(;s.value&&s.from<=e;)s.from==e&&t.push(s.value),s.next()}class Af{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=L.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 pl(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=[];Zn(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(vf)){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 Br{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=Dr(e.markers(t)),e.initialSpacer&&(this.spacer=new pl(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=Dr(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!L.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 pl{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":""),Mf(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 Mf(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 Tf=T.define(),Of=T.define(),be=T.define({combine(s){return cs(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 dn extends Qt{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function pn(s,t){return s.state.facet(be).formatNumber(t,s.state)}const Df=Bi.compute([be],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Tf)},lineMarker(t,e,i){return i.some(n=>n.toDOM)?null:new dn(pn(t,t.state.doc.lineAt(e.from).number))},widgetMarker:(t,e,i)=>{for(let n of t.state.facet(Of)){let r=n(t,e,i);if(r)return r}return null},lineMarkerChange:t=>t.startState.facet(be)!=t.state.facet(be),initialSpacer(t){return new dn(pn(t,Pr(t.state.doc.lines)))},updateSpacer(t,e){let i=pn(e.view,Pr(e.view.state.doc.lines));return i==t.number?t:new dn(i)},domEventHandlers:s.facet(be).domEventHandlers,side:"before"}));function Lc(s={}){return[be.of(s),Sf(),Df]}function Pr(s){let t=9;for(;t<s;)t=t*10+9;return t}const Bf=new class extends Qt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Pf=Di.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(Bf.range(n)))}return L.of(t)});function Ic(){return Pf}let Ef=0;class mt{constructor(t,e,i,n){this.name=t,this.set=e,this.base=i,this.modified=n,this.id=Ef++}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 mt&&(e=t),e?.base)throw new Error("Can not derive from a modified tag");let n=new mt(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 qi(t);return i=>i.modified.indexOf(e)>-1?i:qi.get(i.base||i,i.modified.concat(e).sort((n,r)=>n.id-r.id))}}let Rf=0;class qi{constructor(t){this.name=t,this.instances=[],this.id=Rf++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find(l=>l.base==t&&Lf(e,l.modified));if(i)return i;let n=[],r=new mt(t.name,n,t,e);for(let l of e)l.instances.push(r);let o=If(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(qi.get(l,a));return r}}function Lf(s,t){return s.length==t.length&&s.every((e,i)=>e==t[i])}function If(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 Nf(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 gl.add(t)}const gl=new R({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 ml(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 Wf(s,t){let e=null;for(let i of s){let n=i.style(t);n&&(e=e?e+" "+n:n)}return e}function yl(s,t,e,i=0,n=s.length){let r=new Ff(i,Array.isArray(t)?t:[t],e);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}function Hf(s,t,e,i,n,r=0,o=s.length){let l=r;function a(h,f){if(!(h<=l)){for(let c=s.slice(l,h),u=0;;){let d=c.indexOf(`
|
|
12
|
+
`,u),p=d<0?c.length:d;if(p>u&&i(c.slice(u,p),f),d<0)break;n(),u=d+1}l=h}}yl(t,e,(h,f,c)=>{a(h,""),a(f,c)},r,o),a(o,"")}class Ff{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=Vf(t)||Ze.empty,c=Wf(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(R.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,y=l;;m++){let k=m<u.overlay.length?u.overlay[m]:null,w=k?k.from+l:a,B=Math.max(e,y),C=Math.min(i,w);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>=w||!t.nextSibling())););if(!k||w>i)break;y=k.to+l,y>e&&(this.highlightRange(d.cursor(),Math.max(e,k.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),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 Vf(s){let t=s.type.prop(gl);for(;t&&t.context&&!s.matchContext(t.context);)t=t.next;return t||null}const b=mt.define,bi=b(),qt=b(),Er=b(qt),Rr=b(qt),jt=b(),wi=b(jt),gn=b(jt),Bt=b(),ie=b(Bt),Ot=b(),Dt=b(),ts=b(),Ne=b(ts),xi=b(),M={comment:bi,lineComment:b(bi),blockComment:b(bi),docComment:b(bi),name:qt,variableName:b(qt),typeName:Er,tagName:b(Er),propertyName:Rr,attributeName:b(Rr),className:b(qt),labelName:b(qt),namespace:b(qt),macroName:b(qt),literal:jt,string:wi,docString:b(wi),character:b(wi),attributeValue:b(wi),number:gn,integer:b(gn),float:b(gn),bool:b(jt),regexp:b(jt),escape:b(jt),color:b(jt),url:b(jt),keyword:Ot,self:b(Ot),null:b(Ot),atom:b(Ot),unit:b(Ot),modifier:b(Ot),operatorKeyword:b(Ot),controlKeyword:b(Ot),definitionKeyword:b(Ot),moduleKeyword:b(Ot),operator:Dt,derefOperator:b(Dt),arithmeticOperator:b(Dt),logicOperator:b(Dt),bitwiseOperator:b(Dt),compareOperator:b(Dt),updateOperator:b(Dt),definitionOperator:b(Dt),typeOperator:b(Dt),controlOperator:b(Dt),punctuation:ts,separator:b(ts),bracket:Ne,angleBracket:b(Ne),squareBracket:b(Ne),paren:b(Ne),brace:b(Ne),content:Bt,heading:ie,heading1:b(ie),heading2:b(ie),heading3:b(ie),heading4:b(ie),heading5:b(ie),heading6:b(ie),contentSeparator:b(Bt),list:b(Bt),quote:b(Bt),emphasis:b(Bt),strong:b(Bt),link:b(Bt),monospace:b(Bt),strikethrough:b(Bt),inserted:b(),deleted:b(),changed:b(),invalid:b(),meta:xi,documentMeta:b(xi),annotation:b(xi),processingInstruction:b(xi),definition:mt.defineModifier("definition"),constant:mt.defineModifier("constant"),function:mt.defineModifier("function"),standard:mt.defineModifier("standard"),local:mt.defineModifier("local"),special:mt.defineModifier("special")};for(let s in M){let t=M[s];t instanceof mt&&(t.name=s)}ml([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]);var mn;const oe=new R;function bl(s){return T.define({combine:s?t=>t.concat(s):void 0})}const zf=new R;class wt{constructor(t,e,i=[],n=""){this.data=t,this.name=n,H.prototype.hasOwnProperty("tree")||Object.defineProperty(H.prototype,"tree",{get(){return ue(this)}}),this.parser=e,this.extension=[Ee.of(this),H.languageData.of((r,o,l)=>{let a=Lr(r,o,l),h=a.type.prop(oe);if(!h)return[];let f=r.facet(h),c=a.type.prop(zf);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 Lr(t,e,i).type.prop(oe)==this.data}findRegions(t){let e=t.facet(Ee);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(oe)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(oe)==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 q&&n(h,r.positions[a]+o)}};return n(ue(t),0),i}get allowsNesting(){return!0}}wt.setState=G.define();function Lr(s,t,e){let i=s.facet(Ee),n=ue(s).topNode;if(!i||i.allowsNesting)for(let r=n;r;r=r.enter(t,e,V.ExcludeBuffers|V.EnterBracketed))r.type.isTop&&(n=r);return n}class es extends wt{constructor(t,e,i){super(t,e,[],i),this.parser=e}static define(t){let e=bl(t.languageData);return new es(e,t.parser.configure({props:[oe.add(i=>i.isTop?e:void 0)]}),t.name)}configure(t,e){return new es(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ue(s){let t=s.field(wt.state,!1);return t?t.tree:q.empty}class Kf{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 We=null;class Be{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 Be(t,e,[],q.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Kf(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=q.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(Ft.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(Ft.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=We;We=this;try{return t()}finally{We=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Ir(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=Ft.applyChanges(i,a),n=q.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 Be(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=Ir(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 _r{createParse(e,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let a=We;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 q(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 We}}function Ir(s,t,e){return Ft.applyChanges(s,[{fromA:t,toA:e,fromB:t,toB:e}])}class Pe{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 Pe(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Be.create(t.facet(Ee).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Pe(i)}}wt.state=Zt.define({create:Pe.init,update(s,t){for(let e of t.effects)if(e.is(wt.setState))return e.value;return t.startState.facet(Ee)!=t.state.facet(Ee)?Pe.init(t.state):s.apply(t)}});let wl=s=>{let t=setTimeout(()=>s(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(wl=s=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(s,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const yn=typeof navigator<"u"&&(!((mn=navigator.scheduling)===null||mn===void 0)&&mn.isInputPending)?()=>navigator.scheduling.isInputPending():null,qf=xt.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(wt.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(wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=wl(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(wt.state);if(r.tree==r.context.tree&&r.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!yn?Math.max(25,t.timeRemaining()-5):1e9),l=r.context.treeLen<n&&i.doc.length>n+1e3,a=r.context.work(()=>yn&&yn()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:wt.setState.of(new Pe(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=>It(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()}}}),Ee=T.define({combine(s){return s.length?s[0]:null},enables:s=>[wt.state,qf,D.contentAttributes.compute([s],t=>{let e=t.facet(s);return e&&e.name?{"data-language":e.name}:{}})]});class Wc{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}class xl{constructor(t,e,i,n,r,o=void 0){this.name=t,this.alias=e,this.extensions=i,this.filename=n,this.loadFunc=r,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:e,support:i}=t;if(!e){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=()=>Promise.resolve(i)}return new xl(t.name,(t.alias||[]).concat(t.name).map(n=>n.toLowerCase()),t.extensions||[],t.filename,e,i)}static matchFilename(t,e){for(let n of t)if(n.filename&&n.filename.test(e))return n;let i=/\.([^.]+)$/.exec(e);if(i){for(let n of t)if(n.extensions.indexOf(i[1])>-1)return n}return null}static matchLanguageName(t,e,i=!0){e=e.toLowerCase();for(let n of t)if(n.alias.some(r=>r==e))return n;if(i)for(let n of t)for(let r of n.alias){let o=e.indexOf(r);if(o>-1&&(r.length>2||!/\w/.test(e[o-1])&&!/\w/.test(e[o+r.length])))return n}return null}}const jf=T.define(),kl=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 ji(s){let t=s.facet(kl);return t.charCodeAt(0)==9?s.tabSize*t.length:t.length}function _f(s,t){let e="",i=s.tabSize,n=s.facet(kl)[0];if(n==" "){for(;t>=i;)e+=" ",t-=i;n=" "}for(let r=0;r<t;r++)e+=n;return e}function $f(s,t){s instanceof H&&(s=new vl(s));for(let i of s.state.facet(jf)){let n=i(s,t);if(n!==void 0)return n}let e=ue(s.state);return e.length>=t?Uf(s,e,t):null}class vl{constructor(t,e={}){this.state=t,this.options=e,this.unit=ji(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 ba(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 Sl=new R;function Uf(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 Cl(i,s,e)}function Cl(s,t,e){for(let i=s;i;i=i.next){let n=Yf(i.node);if(n)return n(Cs.create(t,e,i))}return 0}function Gf(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function Yf(s){let t=s.type.prop(Sl);if(t)return t;let e=s.firstChild,i;if(e&&(i=e.type.prop(R.closedBy))){let n=s.lastChild,r=n&&i.indexOf(n.name)>-1;return o=>Al(o,!0,1,void 0,r&&!Gf(o)?n.from:void 0)}return s.parent==null?Xf:null}function Xf(){return 0}class Cs extends vl{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 Cs(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(Jf(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return Cl(this.context.next,this.base,this.pos)}}function Jf(s,t){for(let e=t;e;e=e.parent)if(s==e)return!0;return!1}function Qf(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 Hc({closing:s,align:t=!0,units:e=1}){return i=>Al(i,t,e,s)}function Al(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?Qf(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 Vc({except:s,units:t=1}={}){return e=>{let i=s&&s.test(e.textAfter);return e.baseIndent+(i?0:t*e.unit)}}const Zf=200;function zc(){return H.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+Zf)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=$f(o,f.from);if(c==null)continue;let u=/^\s*/.exec(f.text)[0],d=_f(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 Kc=T.define(),qc=new R;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}class tn{constructor(t,e){this.specs=t;let i;function n(l){let a=Yt.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 wt?l=>l.prop(oe)==o.data:o?l=>l==o:void 0,this.style=ml(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Yt(i):null,this.themeType=e.themeType}static define(t,e){return new tn(t,e||{})}}const is=T.define(),tc=T.define({combine(s){return s.length?[s[0]]:null}});function bn(s){let t=s.facet(is);return t.length?t:s.facet(tc)}function _c(s,t){let e=[ic],i;return s instanceof tn&&(s.module&&e.push(D.styleModule.of(s.module)),i=s.themeType),i?e.push(is.computeN([D.darkTheme],n=>n.facet(D.darkTheme)==(i=="dark")?[s]:[])):e.push(is.of(s)),e}class ec{constructor(t){this.markCache=Object.create(null),this.tree=ue(t.state),this.decorations=this.buildDeco(t,bn(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=ue(t.state),i=bn(t.state),n=i!=bn(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 U.none;let i=new ke;for(let{from:n,to:r}of t.visibleRanges)yl(this.tree,e,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=U.mark({class:a})))},n,r);return i.finish()}}const ic=$i.high(xt.fromClass(ec,{decorations:s=>s.decorations})),nc=D.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ml=1e4,Tl="()[]{}",Ol=T.define({combine(s){return cs(s,{afterCursor:!0,brackets:Tl,maxScanDistance:Ml,renderMatch:oc})}}),sc=U.mark({class:"cm-matchingBracket"}),rc=U.mark({class:"cm-nonmatchingBracket"});function oc(s){let t=[],e=s.matched?sc:rc;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 Nr(s){let t=[],e=s.facet(Ol);for(let i of s.selection.ranges){if(!i.empty)continue;let n=ki(s,i.head,-1,e)||i.head>0&&ki(s,i.head-1,1,e)||e.afterCursor&&(ki(s,i.head,1,e)||i.head<s.doc.length&&ki(s,i.head+1,-1,e));n&&(t=t.concat(e.renderMatch(n,s)))}return U.set(t,!0)}const lc=xt.fromClass(class{constructor(s){this.paused=!1,this.decorations=Nr(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=Nr(s.state),this.paused=!1))}},{decorations:s=>s.decorations}),ac=[lc,nc];function $c(s={}){return[Ol.of(s),ac]}const hc=new R;function ns(s,t,e){let i=s.prop(t<0?R.openedBy:R.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 ss(s){let t=s.type.prop(hc);return t?t(s.node):s}function ki(s,t,e,i={}){let n=i.maxScanDistance||Ml,r=i.brackets||Tl,o=ue(s),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=ns(a.type,e,r);if(h&&a.from<a.to){let f=ss(a);if(f&&(e>0?t>=f.from&&t<f.to:t>f.from&&t<=f.to))return fc(s,t,e,a,f,h,r)}}return cc(s,t,e,o,l.type,n,r)}function fc(s,t,e,i,n,r,o){let l=i.parent,a={from:n.from,to:n.to},h=0,f=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=ss(f);return{start:a,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}else if(ns(f.type,e,o))h++;else if(ns(f.type,-e,o)){if(h==0){let c=ss(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 cc(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 y=o.indexOf(d[g]);if(!(y<0||i.resolveInner(p+g,1).type!=n))if(y%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:p+g,to:p+g+1},matched:y>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}function Wr(s,t,e,i=0,n=0){t==null&&(t=s.search(/[^\s\u00a0]/),t==-1&&(t=s.length));let r=n;for(let o=i;o<t;o++)s.charCodeAt(o)==9?r+=e-r%e:r++;return r}class Dl{constructor(t,e,i,n){this.string=t,this.tabSize=e,this.indentUnit=i,this.overrideIndent=n,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(t){let e=this.string.charAt(this.pos),i;if(typeof t=="string"?i=e==t:i=e&&(t instanceof RegExp?t.test(e):t(e)),i)return++this.pos,e}eatWhile(t){let e=this.pos;for(;this.eat(t););return this.pos>e}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Wr(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var t;return(t=this.overrideIndent)!==null&&t!==void 0?t:Wr(this.string,null,this.tabSize)}match(t,e,i){if(typeof t=="string"){let n=o=>i?o.toLowerCase():o,r=this.string.substr(this.pos,t.length);return n(r)==n(t)?(e!==!1&&(this.pos+=t.length),!0):null}else{let n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function uc(s){return{name:s.name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||dc,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||Ms,mergeTokens:s.mergeTokens!==!1}}function dc(s){if(typeof s!="object")return s;let t={};for(let e in s){let i=s[e];t[e]=i instanceof Array?i.slice():i}return t}const Hr=new WeakMap;class Bl extends wt{constructor(t){let e=bl(t.languageData),i=uc(t),n,r=new class extends _r{createParse(o,l,a){return new gc(n,o,l,a)}};super(e,r,[],t.name),this.topNode=bc(e,this),n=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=t.tokenTable?new Ll(i.tokenTable):yc}static define(t){return new Bl(t)}getIndent(t){let e,{overrideIndentation:i}=t.options;i&&(e=Hr.get(t.state),e!=null&&e<t.pos-1e4&&(e=void 0));let n=As(this,t.node.tree,t.node.from,t.node.from,e??t.pos),r,o;if(n?(o=n.state,r=n.pos+1):(o=this.streamParser.startState(t.unit),r=t.node.from),t.pos-r>1e4)return null;for(;r<t.pos;){let a=t.state.doc.lineAt(r),h=Math.min(t.pos,a.to);if(a.length){let f=i?i(a.from):-1,c=new Dl(a.text,t.state.tabSize,t.unit,f<0?void 0:f);for(;c.pos<h-a.from;)El(this.streamParser.token,c,o)}else this.streamParser.blankLine(o,t.unit);if(h==t.pos)break;r=a.to+1}let l=t.lineAt(t.pos);return i&&e==null&&Hr.set(t.state,l.from),this.streamParser.indent(o,/^\s*(.*)/.exec(l.text)[1],t)}get allowsNesting(){return!1}}function As(s,t,e,i,n){let r=e>=i&&e+t.length<=n&&t.prop(s.stateAfter);if(r)return{state:s.streamParser.copyState(r),pos:e+t.length};for(let o=t.children.length-1;o>=0;o--){let l=t.children[o],a=e+t.positions[o],h=l instanceof q&&a<n&&As(s,l,a,i,n);if(h)return h}return null}function Pl(s,t,e,i,n){if(n&&e<=0&&i>=t.length)return t;!n&&e==0&&t.type==s.topNode&&(n=!0);for(let r=t.children.length-1;r>=0;r--){let o=t.positions[r],l=t.children[r],a;if(o<i&&l instanceof q){if(!(a=Pl(s,l,e-o,i-o,n)))break;return n?new q(t.type,t.children.slice(0,r).concat(a),t.positions.slice(0,r+1),o+a.length):a}}return null}function pc(s,t,e,i,n){for(let r of t){let o=r.from+(r.openStart?25:0),l=r.to-(r.openEnd?25:0),a=o<=e&&l>e&&As(s,r.tree,0-r.offset,e,l),h;if(a&&a.pos<=i&&(h=Pl(s,r.tree,e+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:s.streamParser.startState(n?ji(n):4),tree:q.empty}}class gc{constructor(t,e,i,n){this.lang=t,this.input=e,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let r=Be.get(),o=n[0].from,{state:l,tree:a}=pc(t,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;h<a.children.length;h++)this.chunks.push(a.children[h]),this.chunkPos.push(a.positions[h]);r&&this.parsedPos<r.viewport.from-1e5&&n.some(h=>h.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(ji(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let t=Be.get(),e=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(e,this.chunkStart+512);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos<i;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)e==`
|
|
13
|
+
`&&(e="");else{let i=e.indexOf(`
|
|
14
|
+
`);i>-1&&(e=e.slice(0,i))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let n=this.rangeIndex;;){let r=this.ranges[n].to;if(r>=i||(e=e.slice(0,r-(i-e.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,l=this.lineAfter(o);e+=l,i=o+l.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?n>r:n>=r)break;let o=this.ranges[++this.rangeIndex].from;e+=o-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,e,i,n){let r=4;if(this.ranges.length>1){n=this.skipGapsTo(e,n,1),e+=n;let l=this.chunk.length;n=this.skipGapsTo(i,n,-1),i+=n,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==t&&this.chunk[o+2]==e?this.chunk[o+2]=i:this.chunk.push(t,e,i,r),n}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,o=new Dl(e,t?t.state.tabSize:4,t?ji(t.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=El(r.token,o,this.state);if(l&&(n=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=q.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:mc,topID:0,maxBufferLength:512,reused:this.chunkReused});t=new q(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new q(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function El(s,t,e){t.start=t.pos;for(let i=0;i<10;i++){let n=s(t,e);if(t.pos>t.start)return n}throw new Error("Stream parser failed to advance stream.")}const Ms=Object.create(null),ti=[at.none],mc=new rs(ti),Fr=[],Vr=Object.create(null),Rl=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"]])Rl[s]=Il(Ms,t);class Ll{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Rl)}resolve(t){return t?this.table[t]||(this.table[t]=Il(this.extra,t)):0}}const yc=new Ll(Ms);function wn(s,t){Fr.indexOf(s)>-1||(Fr.push(s),console.warn(t))}function Il(s,t){let e=[];for(let l of t.split(" ")){let a=[];for(let h of l.split(".")){let f=s[h]||M[h];f?typeof f=="function"?a.length?a=a.map(f):wn(h,`Modifier ${h} used at start of tag`):a.length?wn(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:wn(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=Vr[n];if(r)return r.id;let o=Vr[n]=at.define({id:ti.length,name:i,props:[Nf({[i]:e})]});return ti.push(o),o.id}function bc(s,t){let e=at.define({id:ti.length,name:"Document",props:[oe.add(()=>s),Sl.add(()=>i=>t.getIndent(i))],top:!0});return ti.push(e),e}$.RTL,$.LTR;const _i=tn.define([{tag:[M.keyword,M.operatorKeyword,M.modifier],color:"var(--harvestgold)"},{tag:[M.string,M.special(M.string)],color:"var(--honey)"},{tag:[M.number,M.bool,M.null,M.atom],color:"var(--daybreak)"},{tag:[M.propertyName,M.attributeName,M.definition(M.variableName)],color:"var(--orange)"},{tag:[M.comment,M.lineComment,M.blockComment],color:"var(--pumpkin-pie)",fontStyle:"italic"},{tag:[M.heading,M.strong],color:"var(--butter)",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.link,color:"var(--harvestgold)",textDecoration:"underline"},{tag:M.monospace,color:"var(--honey)"},{tag:[M.meta,M.processingInstruction],color:"var(--pumpkin-pie)"},{tag:M.list,color:"var(--orange)"},{tag:M.invalid,color:"var(--state-error)"}]),wc=512*1024;async function Nl(s){switch(s.toLowerCase()){case".json":return(await ee(async()=>{const{json:t}=await import("./index-CH0i1dT3.js");return{json:t}},__vite__mapDeps([0,1,2,3]),import.meta.url)).json();case".yaml":case".yml":return(await ee(async()=>{const{yaml:t}=await import("./index-BQPxeCl8.js");return{yaml:t}},__vite__mapDeps([4,1,2,3]),import.meta.url)).yaml();case".md":case".markdown":return(await ee(async()=>{const{markdown:t}=await import("./index-DAPJ1asE.js");return{markdown:t}},__vite__mapDeps([5,6,1,7,2,3]),import.meta.url)).markdown();case".adoc":case".asciidoc":case".asc":return(await ee(async()=>{const{asciidoc:t}=await import("./asciidoc-CY89DR7y.js");return{asciidoc:t}},__vite__mapDeps([8,2,3]),import.meta.url)).asciidoc;case".py":return(await ee(async()=>{const{python:t}=await import("./index-D9307TXO.js");return{python:t}},__vite__mapDeps([9,1,6,2,3]),import.meta.url)).python();case".js":case".mjs":case".cjs":return(await ee(async()=>{const{javascript:t}=await import("./index-BtxxK29d.js");return{javascript:t}},__vite__mapDeps([7,1,6,2,3]),import.meta.url)).javascript();case".ts":case".mts":return(await ee(async()=>{const{javascript:t}=await import("./index-BtxxK29d.js");return{javascript:t}},__vite__mapDeps([7,1,6,2,3]),import.meta.url)).javascript({typescript:!0});default:return null}}async function xc(s){return await Nl(s)??[]}let zr=!1;function kc(){if(zr||_i.module===null)return;const s=document.createElement("style");s.dataset.syntax="colours",s.textContent=_i.module.getRules(),document.head.appendChild(s),zr=!0}async function vc(s,t){if(s.length>wc)return null;const e=await Nl(t);if(e===null)return null;const i="language"in e?e.language:e;kc();const n=document.createDocumentFragment();return Hf(s,i.parser.parse(s),_i,(r,o)=>{if(o===""){n.append(r);return}const l=document.createElement("span");l.className=o,l.textContent=r,n.append(l)},()=>{n.append(`
|
|
15
|
+
`)}),n}const Uc=Object.freeze(Object.defineProperty({__proto__:null,HIGHLIGHT:_i,language_resolve:xc,sourceSpans_build:vc},Symbol.toStringTag,{value:"Module"}));export{qc as $,Re as A,Lc as B,J as C,$ as D,D as E,T as F,Ic as G,Bc as H,vl as I,zc as J,$c as K,Pc as L,_c as M,R as N,af as O,$i as P,_i as Q,ke as R,Zt as S,nt as T,Nf as U,xt as V,M as W,Wc as X,es as Y,Sl as Z,Vc as _,x as a,jc as a0,Hc as a1,_r as a2,at as a3,mt as a4,rs as a5,q as a6,Mc as a7,Ac as a8,V as a9,hc as aa,Kc as ab,wt as ac,bl as ad,oe as ae,xl as af,Be as ag,Bl as ah,zf as ai,Fc as aj,dt as ak,Yi as al,ae as am,Wl as an,Uc as ao,G as b,cs as c,Vt as d,ba as e,W as f,$f as g,vt as h,_f as i,ji as j,kl as k,xf as l,ki as m,Rc as n,Ec as o,U as p,Qn as q,sa as r,ue as s,ra as t,Ht as u,H as v,Tc as w,pe as x,Dc as y,xc as z};
|