PageSourceSearch

https://finding-calculang-foc.netlify.app/_node/@codemirror/[email protected]/index.fae6cbd7.js

js finding-calculang-foc.netlify.app collected 2026-10-03 10:45:11 UTC 185,979 bytes, 5 lines download raw bytes

vendor: 45,566 bytes, line 1
1import{RangeSet as N,MapMode as vt,Facet as C,StateEffect as bt,EditorSelection as k,Annotation as Ho,Prec as Ae,codePointAt as Ci,codePointSize as Vo,combineConfig as De,StateField as Mi,RangeValue as ki,ChangeSet as Ai,EditorState as Bt,Transaction as No,RangeSetBuilder as Fo,countColumn as Di,findClusterBreak as yt,findColumn as Oe,Text as X,CharCategory as Wo}from"../[email protected]/index.66d24d9c.js";import{StyleModule as xt}from"../../[email protected]/index.988d93ad.js";import{keyName as zo,base as Io,shift as qo}from"../../[email protected]/index.91f4ec3f.js";function Lt(o){let t;return o.nodeType==11?t=o.getSelection?o:o.ownerDocument:t=o,t.getSelection()}function Te(o,t){return t?o==t||o.contains(t.nodeType!=1?t.parentNode:t):!1}function Ko(o){let t=o.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function _t(o,t){if(!t.anchorNode)return!1;try{return Te(o,t.anchorNode)}catch{return!1}}function St(o){return o.nodeType==3?ft(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function Pt(o,t,e,i){return e?Oi(o,t,e,i,-1)||Oi(o,t,e,i,1):!1}function ut(o){for(var t=0;;t++)if(o=o.previousSibling,!o)return t}function te(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function Oi(o,t,e,i,s){for(;;){if(o==e&&t==i)return!0;if(t==(s<0?0:_(o))){if(o.nodeName=="DIV")return!1;let r=o.parentNode;if(!r||r.nodeType!=1)return!1;t=ut(o)+(s<0?0:1),o=r}else if(o.nodeType==1){if(o=o.childNodes[t+(s<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;t=s<0?_(o):0}else return!1}}function _(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Ht(o,t){let e=t?o.left:o.right;return{left:e,right:e,top:o.top,bottom:o.bottom}}function Yo(o){let t=o.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function Ti(o,t){let e=t.width/o.offsetWidth,i=t.height/o.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-o.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-o.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Xo(o,t,e,i,s,r,n,l){let h=o.ownerDocument,c=h.defaultView||window;for(let a=o,d=!1;a&&!d;)if(a.nodeType==1){let u,f=a==h.body,p=1,g=1;if(f)u=Yo(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(a).position)&&(d=!0),a.scrollHeight<=a.clientHeight&&a.scrollWidth<=a.clientWidth){a=a.assignedSlot||a.parentNode;continue}let b=a.getBoundingClientRect();({scaleX:p,scaleY:g}=Ti(a,b)),u={left:b.left,right:b.left+a.clientWidth*p,top:b.top,bottom:b.top+a.clientHeight*g}}let w=0,m=0;if(s=="nearest")t.top<u.top?(m=-(u.top-t.top+n),e>0&&t.bottom>u.bottom+m&&(m=t.bottom-u.bottom+m+n)):t.bottom>u.bottom&&(m=t.bottom-u.bottom+n,e<0&&t.top-m<u.top&&(m=-(u.top+m-t.top+n)));else{let b=t.bottom-t.top,x=u.bottom-u.top;m=(s=="center"&&b<=x?t.top+b/2-x/2:s=="start"||s=="center"&&e<0?t.top-n:t.bottom-x+n)-u.top}if(i=="nearest"?t.left<u.left?(w=-(u.left-t.left+r),e>0&&t.right>u.right+w&&(w=t.right-u.right+w+r)):t.right>u.right&&(w=t.right-u.right+r,e<0&&t.left<u.left+w&&(w=-(u.left+w-t.left+r))):w=(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,w||m)if(f)c.scrollBy(w,m);else{let b=0,x=0;if(m){let y=a.scrollTop;a.scrollTop+=m/g,x=(a.scrollTop-y)*g}if(w){let y=a.scrollLeft;a.scrollLeft+=w/p,b=(a.scrollLeft-y)*p}t={left:t.left-b,top:t.top-x,right:t.right-b,bottom:t.bottom-x},b&&Math.abs(b-w)<1&&(i="nearest"),x&&Math.abs(x-m)<1&&(s="nearest")}if(f)break;a=a.assignedSlot||a.parentNode}else if(a.nodeType==11)a=a.host;else break}function Go(o){let t=o.ownerDocument,e,i;for(let s=o.parentNode;s&&!(s==t.body||e&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!e&&s.scrollWidth>s.clientWidth&&(e=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:e,y:i}}class jo{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?_(e):0),i,Math.min(t.focusOffset,i?_(i):0))}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let Ct=null;function Ei(o){if(o.setActive)return o.setActive();if(Ct)return o.focus(Ct);let t=[];for(let e=o;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(o.focus(Ct==null?{get preventScroll(){return Ct={preventScroll:!0},!0}}:void 0),!Ct){Ct=!1;for(let e=0;e<t.length;){let i=t[e++],s=t[e++],r=t[e++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let Ri;function ft(o,t,e=t){let i=Ri||(Ri=document.createRange());return i.setEnd(o,e),i.setStart(o,t),i}function Mt(o,t,e,i){let s={key:t,code:t,keyCode:e,which:e,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,o.dispatchEvent(r);let n=new KeyboardEvent("keyup",s);return n.synthetic=!0,o.dispatchEvent(n),r.defaultPrevented||n.defaultPrevented}function Uo(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function Bi(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function $o(o,t){let e=t.focusNode,i=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=i)return!1;for(i=Math.min(i,_(e));;)if(i){if(e.nodeType!=1)return!1;let s=e.childNodes[i-1];s.contentEditable=="false"?i--:(e=s,i=_(e))}else{if(e==o)return!0;i=ut(e),e=e.parentNode}}function Li(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Pi(o,t){for(let e=o,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=_(e)}else if(e.parentNode&&!te(e))i=ut(e),e=e.parentNode;else return null}}function Hi(o,t){for(let e=o,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&&!te(e))i=ut(e)+1,e=e.parentNode;else return null}}class W{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new W(t.parentNode,ut(t),e)}static after(t,e){return new W(t.parentNode,ut(t)+1,e)}}const Ee=[];class O{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let i=this.dom,s=null,r;for(let n of this.children){if(n.flags&7){if(!n.dom&&(r=s?s.nextSibling:i.firstChild)){let l=O.get(r);(!l||!l.parent&&l.canReuseDOM(n))&&n.reuseDOM(r)}n.sync(t,e),n.flags&=-8}if(r=s?s.nextSibling:i.firstChild,e&&!e.written&&e.node==i&&r!=n.dom&&(e.written=!0),n.dom.parentNode==i)for(;r&&r!=n.dom;)r=Vi(r);else i.insertBefore(n.dom,r);s=n.dom}for(r=s?s.nextSibling:i.firstChild,r&&e&&e.node==i&&(e.written=!0);r;)r=Vi(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let s=_(t)==0?0:e==0?-1:1;for(;;){let r=t.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(t==r.firstChild?s=-1:s=1),t=r}s<0?i=t:i=t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!O.get(i);)i=i.nextSibling;if(!i)return this.length;for(let s=0,r=0;;s++){let n=this.children[s];if(n.dom==i)return r;r+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let s=-1,r=-1,n=-1,l=-1;for(let h=0,c=i,a=i;h<this.children.length;h++){let d=this.children[h],u=c+d.length;if(c<t&&u>e)return d.domBoundsAround(t,e,c);if(u>=t&&s==-1&&(s=h,r=c),c>e&&d.dom.parentNode==this.dom){n=h,l=a;break}a=u,c=u+d.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=Ee){this.markDirty();for(let s=t;s<e;s++){let r=this.children[s];r.parent==this&&i.indexOf(r)<0&&r.destroy()}this.children.splice(t,e-t,...i);for(let s=0;s<i.length;s++)i[s].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new Ni(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+(t=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,i,s,r,n){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor&&!((this.flags|t.flags)&8)}getSide(){return 0}destroy(){for(let t of this.children)t.parent==this&&t.destroy();this.parent=null}}O.prototype.breakAfter=0;function Vi(o){let t=o.nextSibling;return o.parentNode.removeChild(o),t}class Ni{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Fi(o,t,e,i,s,r,n,l,h){let{children:c}=o,a=c.length?c[t]:null,d=r.length?r[r.length-1]:null,u=d?d.breakAfter:n;if(!(t==i&&a&&!n&&!u&&r.length<2&&a.merge(e,s,r.length?d:null,e==0,l,h))){if(i<c.length){let f=c[i];f&&(s<f.length||f.breakAfter&&d?.breakAfter)?(t==i&&(f=f.split(s),s=0),!u&&d&&f.merge(0,s,d,!0,0,h)?r[r.length-1]=f:((s||f.children.length&&!f.children[0].length)&&f.merge(0,s,null,!1,0,h),r.push(f))):f?.breakAfter&&(d?d.breakAfter=1:n=1),i++}for(a&&(a.breakAfter=n,e>0&&(!n&&r.length&&a.merge(e,a.length,r[0],!1,l,0)?a.breakAfter=r.shift().breakAfter:(e<a.length||a.children.length&&a.children[a.children.length-1].length==0)&&a.merge(e,a.length,null,!1,l,0),t++));t<i&&r.length;)if(c[i-1].become(r[r.length-1]))i--,r.pop(),h=r.length?0:l;else if(c[t].become(r[0]))t++,r.shift(),l=r.length?0:h;else break;!r.length&&t&&i<c.length&&!c[t-1].breakAfter&&c[i].merge(0,0,c[t-1],!1,l,h)&&t--,(t<i||r.length)&&o.replaceChildren(t,i,r)}}function Wi(o,t,e,i,s,r){let n=o.childCursor(),{i:l,off:h}=n.findPos(e,1),{i:c,off:a}=n.findPos(t,-1),d=t-e;for(let u of i)d+=u.length;o.length+=d,Fi(o,c,a,l,h,i,0,s,r)}let I=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Re=typeof document<"u"?document:{documentElement:{style:{}}};const Be=/Edge\/(\d+)/.exec(I.userAgent),zi=/MSIE \d/.test(I.userAgent),Le=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(I.userAgent),ee=!!(zi||Le||Be),Ii=!ee&&/gecko\/(\d+)/i.test(I.userAgent),Pe=!ee&&/Chrome\/(\d+)/.exec(I.userAgent),qi="webkitFontSmoothing"in Re.documentElement.style,Ki=!ee&&/Apple Computer/.test(I.vendor),Yi=Ki&&(/Mobile\/\w+/.test(I.userAgent)||I.maxTouchPoints>2);var v={mac:Yi||/Mac/.test(I.platform),windows:/Win/.test(I.platform),linux:/Linux|X11/.test(I.platform),ie:ee,ie_version:zi?Re.documentMode||6:Le?+Le[1]:Be?+Be[1]:0,gecko:Ii,gecko_version:Ii?+(/Firefox\/(\d+)/.exec(I.userAgent)||[0,0])[1]:0,chrome:!!Pe,chrome_version:Pe?+Pe[1]:0,ios:Yi,android:/Android\b/.test(I.userAgent),webkit:qi,safari:Ki,webkit_version:qi?+(/\bAppleWebKit\/(\d+)/.exec(I.userAgent)||[0,0])[1]:0,tabSize:Re.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Qo=256;class $ extends O{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,i){return this.flags&8||i&&(!(i instanceof $)||this.length-(e-t)+i.length>Qo||i.flags&8)?!1:(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new $(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new W(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return Jo(this.dom,t,e)}}class it extends O{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let s of e)s.setParent(this)}setAttrs(t){if(Bi(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,s,r,n){return i&&(!(i instanceof it&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&n<=0)?!1:(Wi(this,t,e,i?i.children.slice():[],r-1,n-1),this.markDirty(),!0)}split(t){let e=[],i=0,s=-1,r=0;for(let l of this.children){let h=i+l.length;h>t&&e.push(i<t?l.split(t-i):l),s<0&&i>=t&&(s=r),i=h,r++}let n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new it(this.mark,e,n)}domAtPos(t){return Xi(this,t)}coordsAt(t,e){return ji(this,t,e)}}function Jo(o,t,e){let i=o.nodeValue.length;t>i&&(t=i);let s=t,r=t,n=0;t==0&&e<0||t==i&&e>=0?v.chrome||v.gecko||(t?(s--,n=1):r<i&&(r++,n=-1)):e<0?s--:r<i&&r++;let l=ft(o,s,r).getClientRects();if(!l.length)return null;let h=l[(n?n<0:e>=0)?0:l.length-1];return v.safari&&!n&&h.width==0&&(h=Array.prototype.find.call(l,c=>c.width)||h),n?Ht(h,n<0):h||null}class at extends O{static create(t,e,i){return new at(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=at.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,i,s,r,n){return i&&(!(i instanceof at)||!this.widget.compare(i.widget)||t>0&&r<=0||e<this.length&&n<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}become(t){return t instanceof at&&t.side==this.side&&this.widget.constructor==t.widget.constructor?(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(this.length==0)return X.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,i=e&&e.state.doc,s=this.posAtStart;return i?i.slice(s,s+this.length):X.empty}domAtPos(t){return(this.length?t==0:this.side>0)?W.before(this.dom):W.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let n=this.side?this.side<0:t>0;for(let l=n?s.length-1:0;r=s[l],!(t>0?l==0:l==s.length-1||r.top<r.bottom);l+=n?-1:1);return Ht(r,!n)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Tt extends O{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof Tt&&t.side==this.side}split(){return new Tt(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?W.before(this.dom):W.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}}$.prototype.children=at.prototype.children=Tt.prototype.children=Ee;function Xi(o,t){let e=o.dom,{children:i}=o,s=0;for(let r=0;s<i.length;s++){let n=i[s],l=r+n.length;if(!(l==r&&n.getSide()<=0)){if(t>r&&t<l&&n.dom.parentNode==e)return n.domAtPos(t-r);if(t<=r)break;r=l}}for(let r=s;r>0;r--){let n=i[r-1];if(n.dom.parentNode==e)return n.domAtPos(n.length)}for(let r=s;r<i.length;r++){let n=i[r];if(n.dom.parentNode==e)return n.domAtPos(0)}return new W(e,0)}function Gi(o,t,e){let i,{children:s}=o;e>0&&t instanceof it&&s.length&&(i=s[s.length-1])instanceof it&&i.mark.eq(t.mark)?Gi(i,t.children[0],e-1):(s.push(t),t.setParent(o)),o.length+=t.length}function ji(o,t,e){let i=null,s=-1,r=null,n=-1;function l(c,a){for(let d=0,u=0;d<c.children.length&&u<=a;d++){let f=c.children[d],p=u+f.length;p>=a&&(f.children.length?l(f,a-u):(!r||r.isHidden&&e>0)&&(p>a||u==p&&f.getSide()>0)?(r=f,n=a-u):(u<a||u==p&&f.getSide()<0&&!f.isHidden)&&(i=f,s=a-u)),u=p}}l(o,t);let h=(e<0?i:r)||i||r;return h?h.coordsAt(Math.max(0,h==i?s:n),e):Zo(o)}function Zo(o){let t=o.dom.lastChild;if(!t)return o.dom.getBoundingClientRect();let e=St(t);return e[e.length-1]||null}function He(o,t){for(let e in o)e=="class"&&t.class?t.class+=" "+o.class:e=="style"&&t.style?t.style+=";"+o.style:t[e]=o[e];return t}const Ui=Object.create(null);function ie(o,t,e){if(o==t)return!0;o||(o=Ui),t||(t=Ui);let i=Object.keys(o),s=Object.keys(t);if(i.length-(e&&i.indexOf(e)>-1?1:0)!=s.length-(e&&s.indexOf(e)>-1?1:0))return!1;for(let r of i)if(r!=e&&(s.indexOf(r)==-1||o[r]!==t[r]))return!1;return!0}function Ve(o,t,e){let i=!1;if(t)for(let s in t)e&&s in e||(i=!0,s=="style"?o.style.cssText="":o.removeAttribute(s));if(e)for(let s in e)t&&t[s]==e[s]||(i=!0,s=="style"?o.style.cssText=e[s]:o.setAttribute(s,e[s]));return i}function _o(o){let t=Object.create(null);for(let e=0;e<o.attributes.length;e++){let i=o.attributes[e];t[i.name]=i.value}return t}class pt{eq(t){return!1}updateDOM(t,e){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 F=function(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(F||(F={}));class E extends ki{constructor(t,e,i,s){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new Gt(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 ht(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,s;if(t.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:n}=$i(t,e);i=(r?e?-3e8:-1:5e8)-1,s=(n?e?2e8:1:-6e8)+1}return new ht(t,i,s,e,t.widget||null,!0)}static line(t){return new jt(t)}static set(t,e=!1){return N.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}E.none=N.empty;class Gt extends E{constructor(t){let{start:e,end:i}=$i(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Gt&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((i=t.attrs)===null||i===void 0?void 0:i.class))&&ie(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Gt.prototype.point=!1;class jt extends E{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof jt&&this.spec.class==t.spec.class&&ie(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)}}jt.prototype.mapMode=vt.TrackBefore,jt.prototype.point=!0;class ht extends E{constructor(t,e,i,s,r,n){super(e,i,r,t),this.block=s,this.isReplace=n,this.mapMode=s?e<=0?vt.TrackBefore:vt.TrackAfter:vt.TrackDel}get type(){return this.startSide!=this.endSide?F.WidgetRange:this.startSide<=0?F.WidgetBefore:F.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof ht&&tr(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)}}ht.prototype.point=!0;function $i(o,t=!1){let{inclusiveStart:e,inclusiveEnd:i}=o;return e==null&&(e=o.inclusive),i==null&&(i=o.inclusive),{start:e??t,end:i??t}}function tr(o,t){return o==t||!!(o&&t&&o.compare(t))}function Ne(o,t,e,i=0){let s=e.length-1;s>=0&&e[s]+i>=o?e[s]=Math.max(e[s],t):e.push(o,t)}class L extends O{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,r,n){if(i){if(!(i instanceof L))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),Wi(this,t,e,i?i.children.slice():[],r,n),!0}split(t){let e=new L;if(e.breakAfter=this.breakAfter,this.length==0)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r<this.children.length;r++)e.append(this.children[r],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){ie(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Gi(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=He(e,this.attrs||{})),i&&(this.attrs=He({class:i},this.attrs||{}))}domAtPos(t){return Xi(this,t)}reuseDOM(t){t.nodeName=="DIV"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?this.flags&4&&(Bi(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Ve(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let s=this.dom.lastChild;for(;s&&O.get(s)instanceof it;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=O.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!v.ios||!this.children.some(r=>r instanceof $))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let i of this.children){if(!(i instanceof $)||/[^ -~]/.test(i.text))return null;let s=St(i.dom);if(s.length!=1)return null;t+=s[0].width,e=s[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let i=ji(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight<r){let n=(r-s.textHeight)/2;return{top:i.top+n,bottom:i.bottom-n,left:i.left,right:i.left}}}return i}become(t){return t instanceof L&&this.children.length==0&&t.children.length==0&&ie(this.attrs,t.attrs)&&this.breakAfter==t.breakAfter}covers(){return!0}static find(t,e){for(let i=0,s=0;i<t.children.length;i++){let r=t.children[i],n=s+r.length;if(n>=e){if(r instanceof L)return r;if(n>e)break}s=n+r.breakAfter}return null}}class st extends O{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,s,r,n){return i&&(!(i instanceof st)||!this.widget.compare(i.widget)||t>0&&r<=0||e<this.length&&n<=0)?!1:(this.length=t+(i?i.length:0)+(this.length-e),!0)}domAtPos(t){return t==0?W.before(this.dom):W.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new st(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return Ee}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):X.empty}domBoundsAround(){return null}become(t){return t instanceof st&&t.widget.constructor==this.widget.constructor?(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e)||(this.widget instanceof Fe?null:Ht(this.dom.getBoundingClientRect(),this.length?t==0:e<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(t){let{startSide:e,endSide:i}=this.deco;return e==i?!1:t<0?e<0:i>0}}class Fe extends pt{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}}class Ut{constructor(t,e,i,s){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof st&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new L),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(se(new Tt(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof st)&&this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:n,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(se(new $(this.text.slice(this.textOff,this.textOff+s)),e),i),this.atCursorPos=!0,this.textOff+=s,t-=s,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,r,n){if(this.disallowBlockEffectsFor[n]&&i instanceof ht){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=e-t;if(i instanceof ht)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new st(i.widget||kt.block,l,i));else{let h=at.create(i.widget||kt.inline,l,l?0:i.startSide),c=this.atCursorPos&&!h.isEditable&&r<=s.length&&(t<e||i.startSide>0),a=!h.isEditable&&(t<e||r>s.length||i.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!c&&!h.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(d.append(se(new Tt(1),s),r),r=s.length+Math.max(0,r-s.length)),d.append(se(h,s),r),this.atCursorPos=a,this.pendingBuffer=a?t<e||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,i,s,r){let n=new Ut(t,e,i,r);return n.openEnd=N.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}function se(o,t){for(let e of t)o=new it(e,[o],o.length);return o}class kt extends pt{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}}kt.inline=new kt("span"),kt.block=new kt("div");var R=function(o){return o[o.LTR=0]="LTR",o[o.RTL=1]="RTL",o}(R||(R={}));const gt=R.LTR,We=R.RTL;function Qi(o){let t=[];for(let e=0;e<o.length;e++)t.push(1<<+o[e]);return t}const er=Qi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ir=Qi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ze=Object.create(null),Q=[];for(let o of["()","[]","{}"]){let t=o.charCodeAt(0),e=o.charCodeAt(1);ze[t]=e,ze[e]=-t}function Ji(o){return o<=247?er[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?ir[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const sr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class tt{get dir(){return this.level%2?We:gt}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,s){let r=-1;for(let n=0;n<t.length;n++){let l=t[n];if(l.from<=e&&l.to>=e){if(l.level==i)return n;(r<0||(s!=0?s<0?l.from<e:l.to>e:t[r].level>l.level))&&(r=n)}}if(r<0)throw new RangeError("Index out of range");return r}}function Zi(o,t){if(o.length!=t.length)return!1;for(let e=0;e<o.length;e++){let i=o[e],s=t[e];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!Zi(i.inner,s.inner))return!1}return!0}const D=[];function or(o,t,e,i,s){for(let r=0;r<=i.length;r++){let n=r?i[r-1].to:t,l=r<i.length?i[r].from:e,h=r?256:s;for(let c=n,a=h,d=h;c<l;c++){let u=Ji(o.charCodeAt(c));u==512?u=a:u==8&&d==4&&(u=16),D[c]=u==4?2:u,u&7&&(d=u),a=u}for(let c=n,a=h,d=h;c<l;c++){let u=D[c];if(u==128)c<l-1&&a==D[c+1]&&a&24?u=D[c]=a:D[c]=256;else if(u==64){let f=c+1;for(;f<l&&D[f]==64;)f++;let p=c&&a==8||f<e&&D[f]==8?d==1?1:8:256;for(let g=c;g<f;g++)D[g]=p;c=f-1}else u==8&&d==1&&(D[c]=1);a=u,u&7&&(d=u)}}}function rr(o,t,e,i,s){let r=s==1?2:1;for(let n=0,l=0,h=0;n<=i.length;n++){let c=n?i[n-1].to:t,a=n<i.length?i[n].from:e;for(let d=c,u,f,p;d<a;d++)if(f=ze[u=o.charCodeAt(d)])if(f<0){for(let g=l-3;g>=0;g-=3)if(Q[g+1]==-f){let w=Q[g+2],m=w&2?s:w&4?w&1?r:s:0;m&&(D[d]=D[Q[g]]=m),l=g;break}}else{if(Q.length==189)break;Q[l++]=d,Q[l++]=u,Q[l++]=h}else if((p=D[d])==2||p==1){let g=p==s;h=g?0:1;for(let w=l-3;w>=0;w-=3){let m=Q[w+2];if(m&2)break;if(g)Q[w+2]|=2;else{if(m&4)break;Q[w+2]|=4}}}}}function nr(o,t,e,i){for(let s=0,r=i;s<=e.length;s++){let n=s?e[s-1].to:o,l=s<e.length?e[s].from:t;for(let h=n;h<l;){let c=D[h];if(c==256){let a=h+1;for(;;)if(a==l){if(s==e.length)break;a=e[s++].to,l=s<e.length?e[s].from:t}else if(D[a]==256)a++;else break;let d=r==1,u=(a<t?D[a]:i)==1,f=d==u?d?1:2:i;for(let p=a,g=s,w=g?e[g-1].to:o;p>h;)p==w&&(p=e[--g].from,w=g?e[g-1].to:o),D[--p]=f;h=a}else r=c,h++}}}function Ie(o,t,e,i,s,r,n){let l=i%2?2:1;if(i%2==s%2)for(let h=t,c=0;h<e;){let a=!0,d=!1;if(c==r.length||h<r[c].from){let g=D[h];g!=l&&(a=!1,d=g==16)}let u=!a&&l==1?[]:null,f=a?i:i+1,p=h;t:for(;;)if(c<r.length&&p==r[c].from){if(d)break t;let g=r[c];if(!a)for(let w=g.to,m=c+1;;){if(w==e)break t;if(m<r.length&&r[m].from==w)w=r[m++].to;else{if(D[w]==l)break t;break}}if(c++,u)u.push(g);else{g.from>h&&n.push(new tt(h,g.from,f));let w=g.direction==gt!=!(f%2);qe(o,w?i+1:i,s,g.inner,g.from,g.to,n),h=g.to}p=g.to}else{if(p==e||(a?D[p]!=l:D[p]==l))break;p++}u?Ie(o,h,p,i+1,s,u,n):h<p&&n.push(new tt(h,p,f)),h=p}else for(let h=e,c=r.length;h>t;){let a=!0,d=!1;if(!c||h>r[c-1].to){let g=D[h-1];g!=l&&(a=!1,d=g==16)}let u=!a&&l==1?[]:null,f=a?i:i+1,p=h;t:for(;;)if(c&&p==r[c-1].to){if(d)break t;let g=r[--c];if(!a)for(let w=g.from,m=c;;){if(w==t)break t;if(m&&r[m-1].to==w)w=r[--m].from;else{if(D[w-1]==l)break t;break}}if(u)u.push(g);else{g.to<h&&n.push(new tt(g.to,h,f));let w=g.direction==gt!=!(f%2);qe(o,w?i+1:i,s,g.inner,g.from,g.to,n),h=g.from}p=g.from}else{if(p==t||(a?D[p-1]!=l:D[p-1]==l))break;p--}u?Ie(o,p,h,i+1,s,u,n):p<h&&n.push(new tt(p,h,f)),h=p}}function qe(o,t,e,i,s,r,n){let l=t%2?2:1;or(o,s,r,i,l),rr(o,s,r,i,l),nr(s,r,i,l),Ie(o,s,r,t,e,i,n)}function _i(o,t,e){if(!o)return[new tt(0,0,t==We?1:0)];if(t==gt&&!e.length&&!sr.test(o))return ts(o.length);if(e.length)for(;o.length>D.length;)D[D.length]=256;let i=[],s=t==gt?0:1;return qe(o,s,s,e,0,o.length,i),i}function ts(o){return[new tt(0,o,0)]}let es="";function is(o,t,e,i,s){var r;let n=i.head-o.from,l=tt.find(t,n,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),h=t[l],c=h.side(s,e);if(n==c){let u=l+=s?1:-1;if(u<0||u>=t.length)return null;h=t[l=u],n=h.side(!s,e),c=h.side(s,e)}let a=yt(o.text,n,h.forward(s,e));(a<h.from||a>h.to)&&(a=c),es=o.text.slice(Math.min(n,a),Math.max(n,a));let d=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return d&&a==c&&d.level+(s?0:1)<h.level?k.cursor(d.side(!s,e)+o.from,d.forward(s,e)?1:-1,d.level):k.cursor(a+o.from,h.forward(s,e)?-1:1,h.level)}function lr(o,t,e){for(let i=t;i<e;i++){let s=Ji(o.charCodeAt(i));if(s==1)return gt;if(s==2||s==4)return We}return gt}const ss=C.define(),os=C.define(),rs=C.define(),ns=C.define(),Ke=C.define(),ls=C.define(),hs=C.define(),Ye=C.define(),Xe=C.define(),as=C.define({combine:o=>o.some(t=>t)}),cs=C.define({combine:o=>o.some(t=>t)}),ds=C.define();class Et{constructor(t,e="nearest",i="nearest",s=5,r=5,n=!1){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=n}map(t){return t.empty?this:new Et(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 Et(k.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const oe=bt.define({map:(o,t)=>o.map(t)}),us=bt.define();function G(o,t,e){let i=o.facet(ns);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 nt=C.define({combine:o=>o.length?o[0]:!0});let hr=0;const Vt=C.define();class P{constructor(t,e,i,s,r){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this)}static define(t,e){const{eventHandlers:i,eventObservers:s,provide:r,decorations:n}=e||{};return new P(hr++,t,i,s,l=>{let h=[Vt.of(l)];return n&&h.push(Nt.of(c=>{let a=c.plugin(l);return a?n(a):E.none})),r&&h.push(r(l)),h})}static fromClass(t,e){return P.define(i=>new t(i),e)}}class Ge{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}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(G(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.create(t)}catch(e){G(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){G(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const fs=C.define(),re=C.define(),Nt=C.define(),ps=C.define(),je=C.define(),gs=C.define();function ms(o,t){let e=o.state.facet(gs);if(!e.length)return e;let i=e.map(r=>r instanceof Function?r(o):r),s=[];return N.spans(i,t.from,t.to,{point(){},span(r,n,l,h){let c=r-t.from,a=n-t.from,d=s;for(let u=l.length-1;u>=0;u--,h--){let f=l[u].spec.bidiIsolate,p;if(f==null&&(f=lr(t.text,c,a)),h>0&&d.length&&(p=d[d.length-1]).to==c&&p.direction==f)p.to=a,d=p.inner;else{let g={from:c,to:a,direction:f,inner:[]};d.push(g),d=g.inner}}}}),s}const ws=C.define();function vs(o){let t=0,e=0,i=0,s=0;for(let r of o.state.facet(ws)){let n=r(o);n&&(n.left!=null&&(t=Math.max(t,n.left)),n.right!=null&&(e=Math.max(e,n.right)),n.top!=null&&(i=Math.max(i,n.top)),n.bottom!=null&&(s=Math.max(s,n.bottom)))}return{left:t,right:e,top:i,bottom:s}}const Ft=C.define();class K{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new K(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 s=t[e-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),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 s=0,r=0,n=0,l=0;;s++){let h=s==t.length?null:t[s],c=n-l,a=h?h.fromB:1e9;for(;r<e.length&&e[r]<a;){let d=e[r],u=e[r+1],f=Math.max(l,d),p=Math.min(a,u);if(f<=p&&new K(f+c,p+c,f,p).addToSet(i),u>a)break;r+=2}if(!h)return i;new K(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),n=h.toA,l=h.toB}}}class $t{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=Ai.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,n,l,h)=>s.push(new K(r,n,l,h))),this.changedRanges=s}static create(t,e,i){return new $t(t,e,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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}}class bs extends O{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=E.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.setDOM(t.contentDOM),this.children=[new L],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new K(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:a})=>a<this.minWidthFrom||c>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?s=this.domChanged.newSel.head:!gr(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let r=s>-1?cr(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:a}=this.hasComposition;i=new K(c,a,t.changes.mapPos(c,-1),t.changes.mapPos(a,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(v.ie||v.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let n=this.decorations,l=this.updateDeco(),h=fr(n,l,t.changes);return i=K.extendWithRanges(i,h),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=v.chrome||v.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,n),this.flags&=-8,n&&(n.written||s.selectionRange.focusNode!=n.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(n=>n.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let n of this.children)n instanceof st&&n.widget instanceof Fe&&r.push(n.dom);s.updateGaps(r)}updateChildren(t,e,i){let s=i?i.range.addToSet(t.slice()):t,r=this.childCursor(e);for(let n=s.length-1;;n--){let l=n>=0?s[n]:null;if(!l)break;let{fromA:h,toA:c,fromB:a,toB:d}=l,u,f,p,g;if(i&&i.range.fromB<d&&i.range.toB>a){let y=Ut.build(this.view.state.doc,a,i.range.fromB,this.decorations,this.dynamicDecorationMap),S=Ut.build(this.view.state.doc,i.range.toB,d,this.decorations,this.dynamicDecorationMap);f=y.breakAtStart,p=y.openStart,g=S.openEnd;let M=this.compositionView(i);S.breakAtStart?M.breakAfter=1:S.content.length&&M.merge(M.length,M.length,S.content[0],!1,S.openStart,0)&&(M.breakAfter=S.content[0].breakAfter,S.content.shift()),y.content.length&&M.merge(0,0,y.content[y.content.length-1],!0,0,y.openEnd)&&y.content.pop(),u=y.content.concat(M).concat(S.content)}else({content:u,breakAtStart:f,openStart:p,openEnd:g}=Ut.build(this.view.state.doc,a,d,this.decorations,this.dynamicDecorationMap));let{i:w,off:m}=r.findPos(c,1),{i:b,off:x}=r.findPos(h,-1);Fi(this,b,x,w,m,u,f,p,g)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let i of e.effects)i.is(us)&&(this.editContextFormatting=i.value)}compositionView(t){let e=new $(t.text.nodeValue);e.flags|=8;for(let{deco:s}of t.marks)e=new it(s,[e],e.length);let i=new L;return i.append(e,0),i}fixCompositionDOM(t){let e=(r,n)=>{n.flags|=8|(n.children.some(h=>h.flags&7)?1:0),this.markedForComposition.add(n);let l=O.get(r);l&&l!=n&&(l.dom=null),n.setDOM(r)},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(let r=t.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],e(r>=0?t.marks[r].node:t.text,s)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&_t(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;let n=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,h=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?h:this.moveToLine(this.domAtPos(l.head));if(v.gecko&&l.empty&&!this.hasComposition&&ar(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=c=new W(d,0),n=!0}let a=this.view.observer.selectionRange;(n||!a.focusNode||(!Pt(h.node,h.offset,a.anchorNode,a.anchorOffset)||!Pt(c.node,c.offset,a.focusNode,a.focusOffset))&&!this.suppressWidgetCursorChange(a,l))&&(this.view.observer.ignore(()=>{v.android&&v.chrome&&this.dom.contains(a.focusNode)&&pr(a.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=Lt(this.view.root);if(d)if(l.empty){if(v.gecko){let u=dr(h.node,h.offset);if(u&&u!=3){let f=(u==1?Pi:Hi)(h.node,h.offset);f&&(h=new W(f.node,f.offset))}}d.collapse(h.node,h.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(c.node,c.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([h,c]=[c,h]),u.setEnd(c.node,c.offset),u.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new W(a.anchorNode,a.anchorOffset),this.impreciseHead=c.precise?null:new W(a.focusNode,a.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Pt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}
vendor: 4,514 bytes, line 1
1=this,e=t.state.selection.main,i=Lt(t.root),{anchorNode:s,anchorOffset:r}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let n=L.find(this,e.head);if(!n)return;let l=n.posAtStart;if(e.head==l||e.head==l+n.length)return;let h=this.coordsAt(e.head,-1),c=this.coordsAt(e.head,1);if(!h||!c||h.bottom>c.top)return;let a=this.domAtPos(e.head+e.assoc);i.collapse(a.node,a.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=e.from&&i.collapse(s,r)}moveToLine(t){let e=this.dom,i;if(t.node!=e)return t;for(let s=t.offset;!i&&s<e.childNodes.length;s++){let r=O.get(e.childNodes[s]);r instanceof L&&(i=r.domAtPos(0))}for(let s=t.offset-1;!i&&s>=0;s--){let r=O.get(e.childNodes[s]);r instanceof L&&(i=r.domAtPos(r.length))}return i?new W(i.node,i.offset,!0):t}nearest(t){for(let e=t;e;){let i=O.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let s=this.children[e];if(i<s.length||s instanceof L)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){let i=null,s=0;for(let r=this.length,n=this.children.length-1;n>=0;n--){let l=this.children[n],h=r-l.breakAfter,c=h-l.length;if(h<t)break;if(c<=t&&(c<t||l.covers(-1))&&(h>t||l.covers(1))&&(!i||l instanceof L&&!(i instanceof L&&e>=0)))i=l,s=c;else if(i&&c==t&&h==t&&l instanceof st&&Math.abs(e)<2){if(l.deco.startSide<0)break;n&&(i=null)}r=c}return i?i.coordsAt(t-s,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),s=this.children[e];if(!(s instanceof L))return null;for(;s.children.length;){let{i:l,off:h}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=h}if(!(s instanceof $))return null;let r=yt(s.text,i);if(r==i)return null;let n=ft(s.dom,i,r).getClientRects();for(let l=0;l<n.length;l++){let h=n[l];if(l==n.length-1||h.top<h.bottom&&h.left<h.right)return h}return null}measureVisibleLineHeights(t){let e=[],{from:i,to:s}=t,r=this.view.contentDOM.clientWidth,n=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==R.LTR;for(let c=0,a=0;a<this.children.length;a++){let d=this.children[a],u=c+d.length;if(u>s)break;if(c>=i){let f=d.dom.getBoundingClientRect();if(e.push(f.height),n){let p=d.dom.lastChild,g=p?St(p):[];if(g.length){let w=g[g.length-1],m=h?w.right-f.left:f.right-w.left;m>l&&(l=m,this.minWidth=r,this.minWidthFrom=c,this.minWidthTo=u)}}}c=u+d.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction=="rtl"?R.RTL:R.LTR}measureTextSize(){for(let r of this.children)if(r instanceof L){let n=r.measureTextSize();if(n)return n}let t=document.createElement("div"),e,i,s;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(t);let r=St(t.firstChild)[0];e=t.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:e,t.remove()}),{lineHeight:e,charWidth:i,textHeight:s}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new Ni(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let r=s==e.viewports.length?null:e.viewports[s],n=r?r.from-1:this.length;if(n>i){let l=(e.lineBlockAt(n).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(E.replace({widget:new Fe(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,n))}if(!r)break;i=r.to+1}return E.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Nt).map(r=>(this.dynamicDecorationMap[t++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(ps).map((r,n)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(N.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations}scrollIntoView(t){if(t.isSnapshot){let c=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=c.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}
vendor: 11,885 bytes, lines 1-2
1for(let c of this.view.state.facet(ds))try{if(c(this.view,t.range,t))return!0}catch(a){G(this.view.state,a,"scroll handler")}let{range:e}=t,i=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=vs(this.view),n={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:h}=this.view.scrollDOM;Xo(this.view.scrollDOM,n,e.head<e.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,h),-h),this.view.textDirection==R.LTR)}}function ar(o){return o.node.nodeType==1&&o.node.firstChild&&(o.offset==0||o.node.childNodes[o.offset-1].contentEditable=="false")&&(o.offset==o.node.childNodes.length||o.node.childNodes[o.offset].contentEditable=="false")}function ys(o,t){let e=o.observer.selectionRange;if(!e.focusNode)return null;let i=Pi(e.focusNode,e.focusOffset),s=Hi(e.focusNode,e.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=O.get(s.node);if(!l||l instanceof $&&l.text!=s.node.nodeValue)r=s;else if(o.docView.lastCompositionAfterCursor){let h=O.get(i.node);!h||h instanceof $&&h.text!=i.node.nodeValue||(r=s)}}if(o.docView.lastCompositionAfterCursor=r!=i,!r)return null;let n=t-r.offset;return{from:n,to:n+r.node.nodeValue.length,node:r.node}}function cr(o,t,e){let i=ys(o,e);if(!i)return null;let{node:s,from:r,to:n}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||o.state.doc.sliceString(i.from,i.to)!=l)return null;let h=t.invertedDesc,c=new K(h.mapPos(r),h.mapPos(n),r,n),a=[];for(let d=s.parentNode;;d=d.parentNode){let u=O.get(d);if(u instanceof it)a.push({node:d,deco:u.mark});else{if(u instanceof L||d.nodeName=="DIV"&&d.parentNode==o.contentDOM)return{range:c,text:s,marks:a,line:d};if(d!=o.contentDOM)a.push({node:d,deco:new Gt({inclusive:!0,attributes:_o(d),tagName:d.tagName.toLowerCase()})});else return null}}}function dr(o,t){return o.nodeType!=1?0:(t&&o.childNodes[t-1].contentEditable=="false"?1:0)|(t<o.childNodes.length&&o.childNodes[t].contentEditable=="false"?2:0)}let ur=class{constructor(){this.changes=[]}compareRange(o,t){Ne(o,t,this.changes)}comparePoint(o,t){Ne(o,t,this.changes)}};function fr(o,t,e){let i=new ur;return N.compare(o,t,e,i),i.changes}function pr(o,t){for(let e=o;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function gr(o,t){let e=!1;return t&&o.iterChangedRanges((i,s)=>{i<t.to&&s>t.from&&(e=!0)}),e}function mr(o,t,e=1){let i=o.charCategorizer(t),s=o.doc.lineAt(t),r=t-s.from;if(s.length==0)return k.cursor(t);r==0?e=1:r==s.length&&(e=-1);let n=r,l=r;e<0?n=yt(s.text,r,!1):l=yt(s.text,r);let h=i(s.text.slice(n,l));for(;n>0;){let c=yt(s.text,n,!1);if(i(s.text.slice(c,n))!=h)break;n=c}for(;l<s.length;){let c=yt(s.text,l);if(i(s.text.slice(l,c))!=h)break;l=c}return k.range(n+s.from,l+s.from)}function wr(o,t){return t.left>o?t.left-o:Math.max(0,o-t.right)}function vr(o,t){return t.top>o?t.top-o:Math.max(0,o-t.bottom)}function Ue(o,t){return o.top<t.bottom-1&&o.bottom>t.top+1}function xs(o,t){return t<o.top?{top:t,left:o.left,right:o.right,bottom:o.bottom}:o}function Ss(o,t){return t>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:t}:o}function $e(o,t,e){let i,s,r,n,l=!1,h,c,a,d;for(let p=o.firstChild;p;p=p.nextSibling){let g=St(p);for(let w=0;w<g.length;w++){let m=g[w];s&&Ue(s,m)&&(m=xs(Ss(m,s.bottom),s.top));let b=wr(t,m),x=vr(e,m);if(b==0&&x==0)return p.nodeType==3?Cs(p,t,e):$e(p,t,e);if(!i||n>x||n==x&&r>b){i=p,s=m,r=b,n=x;let y=x?e<m.top?-1:1:b?t<m.left?-1:1:0;l=!y||(y>0?w<g.length-1:w>0)}b==0?e>m.bottom&&(!a||a.bottom<m.bottom)?(h=p,a=m):e<m.top&&(!d||d.top>m.top)&&(c=p,d=m):a&&Ue(a,m)?a=Ss(a,m.bottom):d&&Ue(d,m)&&(d=xs(d,m.top))}}if(a&&a.bottom>=e?(i=h,s=a):d&&d.top<=e&&(i=c,s=d),!i)return{node:o,offset:0};let u=Math.max(s.left,Math.min(s.right,t));if(i.nodeType==3)return Cs(i,u,e);if(l&&i.contentEditable!="false")return $e(i,u,e);let f=Array.prototype.indexOf.call(o.childNodes,i)+(t>=(s.left+s.right)/2?1:0);return{node:o,offset:f}}function Cs(o,t,e){let i=o.nodeValue.length,s=-1,r=1e9,n=0;for(let l=0;l<i;l++){let h=ft(o,l,l+1).getClientRects();for(let c=0;c<h.length;c++){let a=h[c];if(a.top==a.bottom)continue;n||(n=t-a.left);let d=(a.top>e?a.top-e:e-a.bottom)-1;if(a.left-1<=t&&a.right+1>=t&&d<r){let u=t>=(a.left+a.right)/2,f=u;if((v.chrome||v.gecko)&&ft(o,l).getBoundingClientRect().left==a.right&&(f=!u),d<=0)return{node:o,offset:l+(f?1:0)};s=l+(f?1:0),r=d}}}return{node:o,offset:s>-1?s:n>0?o.nodeValue.length:0}}function Ms(o,t,e,i=-1){var s,r;let n=o.contentDOM.getBoundingClientRect(),l=n.top+o.viewState.paddingTop,h,{docHeight:c}=o.viewState,{x:a,y:d}=t,u=d-l;if(u<0)return 0;if(u>c)return o.state.doc.length;for(let y=o.viewState.heightOracle.textHeight/2,S=!1;h=o.elementAtHeight(u),h.type!=F.Text;)for(;u=i>0?h.bottom+y:h.top-y,!(u>=0&&u<=c);){if(S)return e?null:0;S=!0,i=-i}d=l+u;let f=h.from;if(f<o.viewport.from)return o.viewport.from==0?0:e?null:ks(o,n,h,a,d);if(f>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:e?null:ks(o,n,h,a,d);let p=o.dom.ownerDocument,g=o.root.elementFromPoint?o.root:p,w=g.elementFromPoint(a,d);w&&!o.contentDOM.contains(w)&&(w=null),w||(a=Math.max(n.left+1,Math.min(n.right-1,a)),w=g.elementFromPoint(a,d),w&&!o.contentDOM.contains(w)&&(w=null));let m,b=-1;if(w&&((s=o.docView.nearest(w))===null||s===void 0?void 0:s.isEditable)!=!1){if(p.caretPositionFromPoint){let y=p.caretPositionFromPoint(a,d);y&&({offsetNode:m,offset:b}=y)}else if(p.caretRangeFromPoint){let y=p.caretRangeFromPoint(a,d);y&&({startContainer:m,startOffset:b}=y,(!o.contentDOM.contains(m)||v.safari&&br(m,b,a)||v.chrome&&yr(m,b,a))&&(m=void 0))}}if(!m||!o.docView.dom.contains(m)){let y=L.find(o.docView,f);if(!y)return u>h.top+h.height/2?h.to:h.from;({node:m,offset:b}=$e(y.dom,a,d))}let x=o.docView.nearest(m);if(!x)return null;if(x.isWidget&&((r=x.dom)===null||r===void 0?void 0:r.nodeType)==1){let y=x.dom.getBoundingClientRect();return t.y<y.top||t.y<=y.bottom&&t.x<=(y.left+y.right)/2?x.posAtStart:x.posAtEnd}else return x.localPosFromDOM(m,b)+x.posAtStart}function ks(o,t,e,i,s){let r=Math.round((i-t.left)*o.defaultCharacterWidth);if(o.lineWrapping&&e.height>o.defaultLineHeight*1.5){let l=o.viewState.heightOracle.textHeight,h=Math.floor((s-e.top-(o.defaultLineHeight-l)*.5)/l);r+=h*o.viewState.heightOracle.lineLength}let n=o.state.sliceDoc(e.from,e.to);return e.from+Oe(n,r,o.state.tabSize)}function br(o,t,e){let i;if(o.nodeType!=3||t!=(i=o.nodeValue.length))return!1;for(let s=o.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return ft(o,i-1,i).getBoundingClientRect().left>e}function yr(o,t,e){if(t!=0)return!1;for(let s=o;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=o.nodeType==1?o.getBoundingClientRect():ft(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return e-i.left>5}function Qe(o,t){let e=o.lineBlockAt(t);if(Array.isArray(e.type)){for(let i of e.type)if(i.to>t||i.to==t&&(i.to==e.to||i.type==F.Text))return i}return e}function xr(o,t,e,i){let s=Qe(o,t.head),r=!i||s.type!=F.Text||!(o.lineWrapping||s.widgetLineBreaks)?null:o.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(r){let n=o.dom.getBoundingClientRect(),l=o.textDirectionAt(s.from),h=o.posAtCoords({x:e==(l==R.LTR)?n.right-1:n.left+1,y:(r.top+r.bottom)/2});if(h!=null)return k.cursor(h,e?-1:1)}return k.cursor(e?s.to:s.from,e?-1:1)}function As(o,t,e,i){let s=o.state.doc.lineAt(t.head),r=o.bidiSpans(s),n=o.textDirectionAt(s.from);for(let l=t,h=null;;){let c=is(s,r,n,l,e),a=es;if(!c){if(s.number==(e?o.state.doc.lines:1))return l;a=`
2`,s=o.state.doc.line(s.number+(e?1:-1)),r=o.bidiSpans(s),c=o.visualLineSide(s,!e)}if(h){if(!h(a))return l}else{if(!i)return c;h=i(a)}l=c}}function Sr(o,t,e){let i=o.state.charCategorizer(t),s=i(e);return r=>{let n=i(r);return s==Wo.Space&&(s=n),s==n}}function Cr(o,t,e,i){let s=t.head,r=e?1:-1;if(s==(e?o.state.doc.length:0))return k.cursor(s,t.assoc);let n=t.goalColumn,l,h=o.contentDOM.getBoundingClientRect(),c=o.coordsAtPos(s,t.assoc||-1),a=o.documentTop;if(c)n==null&&(n=c.left-h.left),l=r<0?c.top:c.bottom;else{let f=o.viewState.lineBlockAt(s);n==null&&(n=Math.min(h.right-h.left,o.defaultCharacterWidth*(s-f.from))),l=(r<0?f.top:f.bottom)+a}let d=h.left+n,u=i??o.viewState.heightOracle.textHeight>>1;for(let f=0;;f+=10){let p=l+(u+f)*r,g=Ms(o,{x:d,y:p},!1,r);if(p<h.top||p>h.bottom||(r<0?g<s:g>s)){let w=o.docView.coordsForChar(g),m=!w||p<w.top?-1:1;return k.cursor(g,m,void 0,n)}}}function ne(o,t,e){for(;;){let i=0;for(let s of o)s.between(t-1,t+1,(r,n,l)=>{if(t>r&&t<n){let h=i||e||(t-r<n-t?-1:1);t=h<0?r:n,i=h}});if(!i)return t}}function Je(o,t,e){let i=ne(o.state.facet(je).map(s=>s(o)),e.from,t.head>e.from?-1:1);return i==e.from?e:k.cursor(i,i<e.from?1:-1)}const Wt="\uFFFF";class Mr{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(Bt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Wt}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let n=s.nextSibling;if(n==e)break;let l=O.get(s),h=O.get(n);(l&&h?l.breakAfter:(l?l.breakAfter:te(s))||te(n)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)&&this.lineBreak(),s=n}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,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,n=1,l;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),n=this.lineSeparator.length):(l=s.exec(e))&&(r=l.index,n=l[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),n>1)for(let h of this.points)h.node==t&&h.pos>this.text.length&&(h.pos-=n-1);i=r+n}}readNode(t){if(t.cmIgnore)return;let e=O.get(t),i=e&&e.overrideDOMText;if(i!=null){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.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+(kr(t,i.node,i.offset)?e:0))}}function kr(o,t,e){for(;;){if(!t||e<_(t))return!1;if(t==o)return!0;e=ut(t)+1,t=t.parentNode}}class Ds{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class Ar{constructor(t,e,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:r,impreciseAnchor:n}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let l=r||n?[]:Tr(t),h=new Mr(l,t.state);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=Er(l,this.bounds.from)}else{let l=t.observer.selectionRange,h=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Te(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),c=n&&n.node==l.anchorNode&&n.offset==l.anchorOffset||!Te(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),a=t.viewport;if((v.ios||v.chrome)&&t.state.selection.main.empty&&h!=c&&(a.from>0||a.to<t.state.doc.length)){let d=Math.min(h,c),u=Math.max(h,c),f=a.from-d,p=a.to-u;(f==0||f==1||d==0)&&(p==0||p==-1||u==t.state.doc.length)&&(h=0,c=t.state.doc.length)}this.newSel=k.single(c,h)}}}function Os(o,t){let e,{newSel:i}=t,s=o.state.selection.main,r=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;
vendor: 2,356 bytes, lines 2-3
2if(t.bounds){let{from:n,to:l}=t.bounds,h=s.from,c=null;(r===8||v.android&&t.text.length<l-n)&&(h=s.to,c="end");let a=Or(o.state.doc.sliceString(n,l,Wt),t.text,h-n,c);a&&(v.chrome&&r==13&&a.toB==a.from+2&&t.text.slice(a.from,a.toB)==Wt+Wt&&a.toB--,e={from:n+a.from,to:n+a.toA,insert:X.of(t.text.slice(a.from,a.toB).split(Wt))})}else i&&(!o.hasFocus&&o.state.facet(nt)||i.main.eq(s))&&(i=null);if(!e&&!i)return!1;if(!e&&t.typeOver&&!s.empty&&i&&i.main.empty?e={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,s.to)}:e&&e.from>=s.from&&e.to<=s.to&&(e.from!=s.from||e.to!=s.to)&&s.to-s.from-(e.to-e.from)<=4?e={from:s.from,to:s.to,insert:o.state.doc.slice(s.from,e.from).append(e.insert).append(o.state.doc.slice(e.to,s.to))}:(v.mac||v.android)&&e&&e.from==e.to&&e.from==s.head-1&&/^\. ?$/.test(e.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&e.insert.length==2&&(i=k.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:X.of([" "])}):v.chrome&&e&&e.from==e.to&&e.from==s.head&&e.insert.toString()==`
3 `&&o.lineWrapping&&(i&&(i=k.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:X.of([" "])}),e)return Ze(o,e,i,r);if(i&&!i.main.eq(s)){let n=!1,l="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(n=!0),l=o.inputState.lastSelectionOrigin),o.dispatch({selection:i,scrollIntoView:n,userEvent:l}),!0}else return!1}function Ze(o,t,e,i=-1){if(v.ios&&o.inputState.flushIOSKey(t))return!0;let s=o.state.selection.main;if(v.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&o.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Mt(o.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&Mt(o.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&Mt(o.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let n,l=()=>n||(n=Dr(o,t,e));return o.state.facet(ls).some(h=>h(o,t.from,t.to,r,l))||o.dispatch(l()),!0}function Dr(o,t,e){let i,s=o.state,r=s.selection.main;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)&&o.inputState.composing<0){let l=r.from<t.from?s.sliceDoc(r.from,t.from):"",h=r.to>
vendor: 34,188 bytes, line 3
3t.to?s.sliceDoc(t.to,r.to):"";i=s.replaceSelection(o.state.toText(l+t.insert.sliceString(0,void 0,o.state.lineBreak)+h))}else{let l=s.changes(t),h=e&&e.main.to<=l.newLength?e.main:void 0;if(s.selection.ranges.length>1&&o.inputState.composing>=0&&t.to<=r.to&&t.to>=r.to-10){let c=o.state.sliceDoc(t.from,t.to),a,d=e&&ys(o,e.main.head);if(d){let p=t.insert.length-(t.to-t.from);a={from:d.from,to:d.to-p}}else a=o.state.doc.lineAt(r.head);let u=r.to-t.to,f=r.to-r.from;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:h||p.map(l)};let g=p.to-u,w=g-c.length;if(p.to-p.from!=f||o.state.sliceDoc(w,g)!=c||p.to>=a.from&&p.from<=a.to)return{range:p};let m=s.changes({from:w,to:g,insert:t.insert}),b=p.to-r.to;return{changes:m,range:h?k.range(Math.max(0,h.anchor+b),Math.max(0,h.head+b)):p.map(m)}})}else i={changes:l,selection:h&&s.selection.replaceRange(h)}}let n="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,n+=".compose",o.inputState.compositionFirstChange&&(n+=".start",o.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:n,scrollIntoView:!0})}function Or(o,t,e,i){let s=Math.min(o.length,t.length),r=0;for(;r<s&&o.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==s&&o.length==t.length)return null;let n=o.length,l=t.length;for(;n>0&&l>0&&o.charCodeAt(n-1)==t.charCodeAt(l-1);)n--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(n,l));e-=n+h-r}if(n<r&&o.length<t.length){let h=e<=r&&e>=n?r-e:0;r-=h,l=r+(l-n),n=r}else if(l<r){let h=e<=r&&e>=l?r-e:0;r-=h,n=r+(n-l),l=r}return{from:r,toA:n,toB:l}}function Tr(o){let t=[];if(o.root.activeElement!=o.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}=o.observer.selectionRange;return e&&(t.push(new Ds(e,i)),(s!=e||r!=i)&&t.push(new Ds(s,r))),t}function Er(o,t){if(o.length==0)return null;let e=o[0].pos,i=o.length==2?o[1].pos:e;return e>-1&&i>-1?k.single(e+t,i+t):null}class Rr{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,v.safari&&t.contentDOM.addEventListener("input",()=>null),v.gecko&&jr(t.contentDOM.ownerDocument)}handleEvent(t){!Wr(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let i=this.handlers[t];if(i){for(let s of i.observers)s(this.view,e);for(let s of i.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Br(t),i=this.handlers,s=this.view.contentDOM;for(let r in e)if(r!="scroll"){let n=!e[r].handlers.length,l=i[r];l&&n!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:n})}for(let r in i)r!="scroll"&&!e[r]&&s.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&&Rs.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),v.android&&v.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return v.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=Es.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||Lr.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:v.safari&&!v.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!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 Ts(o,t){return(e,i)=>{try{return t.call(o,i,e)}catch(s){G(e.state,s)}}}function Br(o){let t=Object.create(null);function e(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of o){let s=i.spec;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let n=s.domEventHandlers[r];n&&e(r).handlers.push(Ts(i.value,n))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let n=s.domEventObservers[r];n&&e(r).observers.push(Ts(i.value,n))}}for(let i in j)e(i).handlers.push(j[i]);for(let i in Y)e(i).observers.push(Y[i]);return t}const Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lr="dthko",Rs=[16,17,18,20,91,92,224,225],le=6;function he(o){return Math.max(0,o)*.7+8}function Pr(o,t){return Math.max(Math.abs(o.clientX-t.clientX),Math.abs(o.clientY-t.clientY))}class Hr{constructor(t,e,i,s){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=Go(t.contentDOM),this.atoms=t.state.facet(je).map(n=>n(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(Bt.allowMultipleSelections)&&Vr(t,e),this.dragging=Fr(t,e)&&zs(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&&Pr(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,i=0,s=0,r=0,n=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:n}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let h=vs(this.view);t.clientX-h.left<=s+le?e=-he(s-t.clientX):t.clientX+h.right>=n-le&&(e=he(t.clientX-n)),t.clientY-h.top<=r+le?i=-he(r-t.clientY):t.clientY+h.bottom>=l-le&&(i=he(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)}skipAtoms(t){let e=null;for(let i=0;i<t.ranges.length;i++){let s=t.ranges[i],r=null;if(s.empty){let n=ne(this.atoms,s.from,0);n!=s.from&&(r=k.cursor(n,-1))}else{let n=ne(this.atoms,s.from,-1),l=ne(this.atoms,s.to,1);(n!=s.from||l!=s.to)&&(r=k.range(s.from==s.anchor?n:l,s.from==s.head?n:l))}r&&(e||(e=t.ranges.slice()),e[i]=r)}return e?k.create(e,t.mainIndex):t}select(t){let{view:e}=this,i=this.skipAtoms(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 Vr(o,t){let e=o.state.facet(ss);return e.length?e[0](t):v.mac?t.metaKey:t.ctrlKey}function Nr(o,t){let e=o.state.facet(os);return e.length?e[0](t):v.mac?!t.altKey:!t.ctrlKey}function Fr(o,t){let{main:e}=o.state.selection;if(e.empty)return!1;let i=Lt(o.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let n=s[r];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function Wr(o,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,i;e!=o.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(i=O.get(e))&&i.ignoreEvent(t))return!1;return!0}const j=Object.create(null),Y=Object.create(null),Bs=v.ie&&v.ie_version<15||v.ios&&v.webkit_version<604;function zr(o){let t=o.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{o.focus(),e.remove(),Ls(o,e.value)},50)}function ae(o,t,e){for(let i of o.facet(t))e=i(e,o);return e}function Ls(o,t){t=ae(o.state,Ye,t);let{state:e}=o,i,s=1,r=e.toText(t),n=r.lines==e.selection.ranges.length;if(_e!=null&&e.selection.ranges.every(l=>l.empty)&&_e==r.toString()){let l=-1;i=e.changeByRange(h=>{let c=e.doc.lineAt(h.from);if(c.from==l)return{range:h};l=c.from;let a=e.toText((n?r.line(s++).text:t)+e.lineBreak);return{changes:{from:c.from,insert:a},range:k.cursor(h.from+a.length)}})}else n?i=e.changeByRange(l=>{let h=r.line(s++);return{changes:{from:l.from,to:l.to,insert:h.text},range:k.cursor(l.from+h.length)}}):i=e.replaceSelection(r);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Y.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},j.keydown=(o,t)=>(o.inputState.setSelectionOrigin("select"),t.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Y.touchstart=(o,t)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Y.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},j.mousedown=(o,t)=>{if(o.observer.flush(),o.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let i of o.state.facet(rs))if(e=i(o,t),e)break;if(!e&&t.button==0&&(e=Kr(o,t)),e){let i=!o.hasFocus;o.inputState.startMouseSelection(new Hr(o,t,e,i)),i&&o.observer.ignore(()=>{Ei(o.contentDOM);let r=o.root.activeElement;r&&!r.contains(o.contentDOM)&&r.blur()});let s=o.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}return!1};function Ps(o,t,e,i){if(i==1)return k.cursor(t,e);if(i==2)return mr(o.state,t,e);{let s=L.find(o.docView,t),r=o.state.doc.lineAt(s?s.posAtEnd:t),n=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return l<o.state.doc.length&&l==r.to&&l++,k.range(n,l)}}let Hs=(o,t,e)=>t>=e.top&&t<=e.bottom&&o>=e.left&&o<=e.right;function Ir(o,t,e,i){let s=L.find(o.docView,t);if(!s)return 1;let r=t-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let n=s.coordsAt(r,-1);if(n&&Hs(e,i,n))return-1;let l=s.coordsAt(r,1);return l&&Hs(e,i,l)?1:n&&n.bottom>=i?-1:1}function Vs(o,t){let e=o.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:Ir(o,e,t.clientX,t.clientY)}}const qr=v.ie&&v.ie_version<=11;let Ns=null,Fs=0,Ws=0;function zs(o){if(!qr)return o.detail;let t=Ns,e=Ws;return Ns=o,Ws=Date.now(),Fs=!t||e>Date.now()-400&&Math.abs(t.clientX-o.clientX)<2&&Math.abs(t.clientY-o.clientY)<2?(Fs+1)%3:1}function Kr(o,t){let e=Vs(o,t),i=zs(t),s=o.state.selection;return{update(r){r.docChanged&&(e.pos=r.changes.mapPos(e.pos),s=s.map(r.changes))},get(r,n,l){let h=Vs(o,r),c,a=Ps(o,h.pos,h.bias,i);if(e.pos!=h.pos&&!n){let d=Ps(o,e.pos,e.bias,i),u=Math.min(d.from,a.from),f=Math.max(d.to,a.to);a=u<a.from?k.range(u,f):k.range(f,u)}return n?s.replaceRange(s.main.extend(a.from,a.to)):l&&i==1&&s.ranges.length>1&&(c=Yr(s,h.pos))?c:l?s.addRange(a):k.create([a])}}}function Yr(o,t){for(let e=0;e<o.ranges.length;e++){let{from:i,to:s}=o.ranges[e];if(i<=t&&s>=t)return k.create(o.ranges.slice(0,e).concat(o.ranges.slice(e+1)),o.mainIndex==e?0:o.mainIndex-(o.mainIndex>e?1:0))}return null}j.dragstart=(o,t)=>{let{selection:{main:e}}=o.state;if(t.target.draggable){let s=o.docView.nearest(t.target);if(s&&s.isWidget){let r=s.posAtStart,n=r+s.length;(r>=e.to||n<=e.from)&&(e=k.range(r,n))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",ae(o.state,Xe,o.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1},j.dragend=o=>(o.inputState.draggedContent=null,!1);function Is(o,t,e,i){if(e=ae(o.state,Ye,e),!e)return;let s=o.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=o.inputState,n=i&&r&&Nr(o,t)?{from:r.from,to:r.to}:null,l={from:s,insert:e},h=o.state.changes(n?[n,l]:l);o.focus(),o.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:n?"move.drop":"input.drop"}),o.inputState.draggedContent=null}j.drop=(o,t)=>{if(!t.dataTransfer)return!1;if(o.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let i=Array(e.length),s=0,r=()=>{++s==e.length&&Is(o,t,i.filter(n=>n!=null).join(o.state.lineBreak),!1)};for(let n=0;n<e.length;n++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[n]=l.result),r()},l.readAsText(e[n])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return Is(o,t,i,!0),!0}return!1},j.paste=(o,t)=>{if(o.state.readOnly)return!0;o.observer.flush();let e=Bs?null:t.clipboardData;return e?(Ls(o,e.getData("text/plain")||e.getData("text/uri-list")),!0):(zr(o),!1)};function Xr(o,t){let e=o.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(),o.focus()},50)}function Gr(o){let t=[],e=[],i=!1;for(let s of o.selection.ranges)s.empty||(t.push(o.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:r}of o.selection.ranges){let n=o.doc.lineAt(r);n.number>s&&(t.push(n.text),e.push({from:n.from,to:Math.min(o.doc.length,n.to+1)})),s=n.number}i=!0}return{text:ae(o,Xe,t.join(o.lineBreak)),ranges:e,linewise:i}}let _e=null;j.copy=j.cut=(o,t)=>{let{text:e,ranges:i,linewise:s}=Gr(o.state);if(!e&&!s)return!1;_e=s?e:null,t.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Bs?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",e),!0):(Xr(o,e),!1)};const qs=Ho.define();function Ks(o,t){let e=[];for(let i of o.facet(hs)){let s=i(o,t);s&&e.push(s)}return e?o.update({effects:e,annotations:qs.of(!0)}):null}function Ys(o){setTimeout(()=>{let t=o.hasFocus;if(t!=o.inputState.notifiedFocused){let e=Ks(o.state,t);e?o.dispatch(e):o.update([])}},10)}Y.focus=o=>{o.inputState.lastFocusTime=Date.now(),!o.scrollDOM.scrollTop&&(o.inputState.lastScrollTop||o.inputState.lastScrollLeft)&&(o.scrollDOM.scrollTop=o.inputState.lastScrollTop,o.scrollDOM.scrollLeft=o.inputState.lastScrollLeft),Ys(o)},Y.blur=o=>{o.observer.clearSelectionRange(),Ys(o)},Y.compositionstart=Y.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Y.compositionend=o=>{o.observer.editContext||(o.inputState.composing=-1,o.inputState.compositionEndedAt=Date.now(),o.inputState.compositionPendingKey=!0,o.inputState.compositionPendingChange=o.observer.pendingRecords().length>0,o.inputState.compositionFirstChange=null,v.chrome&&v.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Y.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},j.beforeinput=(o,t)=>{var e,i;if(t.inputType=="insertReplacementText"&&o.observer.editContext){let r=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),n=t.getTargetRanges();if(r&&n.length){let l=n[0],h=o.posAtDOM(l.startContainer,l.startOffset),c=o.posAtDOM(l.endContainer,l.endOffset);return Ze(o,{from:h,to:c,insert:o.state.toText(r)},null),!0}}let s;if(v.chrome&&v.android&&(s=Es.find(r=>r.inputType==t.inputType))&&(o.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var n;(((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0)>r+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return v.ios&&t.inputType=="deleteContentForward"&&o.observer.flushSoon(),v.safari&&t.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Y.compositionend(o,t),20),!1};const Xs=new Set;function jr(o){Xs.has(o)||(Xs.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Gs=["pre-wrap","normal","pre-line","break-spaces"];let mt=!1;function ti(){mt=!1}class js{constructor(t){this.lineWrapping=t,this.doc=X.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)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Gs.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let s=t[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(e=!0,this.heightSamples[Math.floor(s*10)]=!0)}return e}refresh(t,e,i,s,r,n){let l=Gs.indexOf(t)>-1,h=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,h){this.heightSamples={};for(let c=0;c<n.length;c++){let a=n[c];a<0?c++:this.heightSamples[Math.floor(a*10)]=!0}}return h}}class Us{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class U{constructor(t,e,i,s,r){this.from=t,this.length=e,this.top=i,this.height=s,this._content=r}get type(){return typeof this._content=="number"?F.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 ht?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 U(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var T=function(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(T||(T={}));const ce=.001;class z{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)>ce&&(mt=!0),this.height=t)}replace(t,e,i){return z.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let r=this,n=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:h,toA:c,fromB:a,toB:d}=s[l],u=r.lineAt(h,T.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=c?u:r.lineAt(c,T.ByPosNoHeight,i,0,0);for(d+=f.to-c,c=f.to;l>0&&u.from<=s[l-1].toA;)h=s[l-1].fromA,a=s[l-1].fromB,l--,h<u.from&&(u=r.lineAt(h,T.ByPosNoHeight,i,0,0));a+=u.from-h,h=u.from;let p=yi.build(i.setDoc(n),t,a,d);r=de(r,r.replace(h,c,p))}return r.updateHeight(i,0)}static empty(){return new q(0,0)}static of(t){if(t.length==1)return t[0];let e=0,i=t.length,s=0,r=0;for(;;)if(e==i)if(s>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,s-=l.size}else if(r>s*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(s<r){let l=t[e++];l&&(s+=l.size)}else{let l=t[--i];l&&(r+=l.size)}let n=0;return t[e-1]==null?(n=1,e--):t[e]==null&&(n=1,i++),new Ur(z.of(t.slice(0,e)),n,z.of(t.slice(i)))}}function de(o,t){return o==t?o:(o.constructor!=t.constructor&&(mt=!0),t)}z.prototype.size=1;class $s extends z{constructor(t,e,i){super(t,e),this.deco=i}blockAt(t,e,i,s){return new U(s,this.length,i,this.height,this.deco||0)}lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r)}forEachLine(t,e,i,s,r,n){t<=r+this.length&&e>=r&&n(this.blockAt(0,i,s,r))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class q extends $s{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,s){return new U(s,this.length,i,this.height,this.breaks)}replace(t,e,i){let s=i[0];return i.length==1&&(s instanceof q||s instanceof V&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof V?s=new q(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):z.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&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 V extends z{constructor(t){super(t,0)}heightMetrics(t,e){let i=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-i+1,n,l=0;if(t.lineWrapping){let h=Math.min(this.height,t.lineHeight*r);n=h/r,this.length>r+1&&(l=(this.height-h)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:s,perLine:n,perChar:l}}blockAt(t,e,i,s){let{firstLine:r,lastLine:n,perLine:l,perChar:h}=this.heightMetrics(e,s);if(e.lineWrapping){let c=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),a=e.doc.lineAt(c),d=l+a.length*h,u=Math.max(i,t-d/2);return new U(a.from,a.length,u,d,0)}else{let c=Math.max(0,Math.min(n-r,Math.floor((t-i)/l))),{from:a,length:d}=e.doc.line(r+c);return new U(a,d,i+l*c,l,0)}}lineAt(t,e,i,s,r){if(e==T.ByHeight)return this.blockAt(t,i,s,r);if(e==T.ByPosNoHeight){let{from:f,to:p}=i.doc.lineAt(t);return new U(f,p-f,0,0,0)}let{firstLine:n,perLine:l,perChar:h}=this.heightMetrics(i,r),c=i.doc.lineAt(t),a=l+c.length*h,d=c.number-n,u=s+l*d+h*(c.from-r-d);return new U(c.from,c.length,Math.max(s,Math.min(u,s+this.height-a)),a,0)}forEachLine(t,e,i,s,r,n){t=Math.max(t,r),e=Math.min(e,r+this.length);let{firstLine:l,perLine:h,perChar:c}=this.heightMetrics(i,r);for(let a=t,d=s;a<=e;){let u=i.doc.lineAt(a);if(a==t){let p=u.number-l;d+=h*p+c*(t-r-p)}let f=h+c*u.length;n(new U(u.from,u.length,d,f,0)),d+=f,a=u.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let r=i[i.length-1];r instanceof V?i[i.length-1]=new V(r.length+s):i.push(null,new V(s-1))}if(t>0){let r=i[0];r instanceof V?i[0]=new V(t+r.length):i.unshift(new V(t-1),null)}return z.of(i)}decomposeLeft(t,e){e.push(new V(t-1),null)}decomposeRight(t,e){e.push(null,new V(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let r=e+this.length;if(s&&s.from<=e+this.length&&s.more){let n=[],l=Math.max(e,s.from),h=-1;for(s.from>e&&n.push(new V(s.from-e-1).updateHeight(t,e));l<=r&&s.more;){let a=t.doc.lineAt(l).length;n.length&&n.push(null);let d=s.heights[s.index++];h==-1?h=d:Math.abs(d-h)>=ce&&(h=-2);let u=new q(a,d);u.outdated=!1,n.push(u),l+=a+1}l<=r&&n.push(null,new V(r-l).updateHeight(t,l));let c=z.of(n);return(h<0||Math.abs(c.height-this.height)>=ce||Math.abs(h-this.heightMetrics(t,e).perLine)>=ce)&&(mt=!0),de(this,c)}else(i||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ur extends z{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return this.flags&1}blockAt(t,e,i,s){let r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this.break)}lineAt(t,e,i,s,r){let n=s+this.left.height,l=r+this.left.length+this.break,h=e==T.ByHeight?t<n:t<l,c=h?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,n,l);if(this.break||(h?c.to<l:c.from>l))return c;let a=e==T.ByPosNoHeight?T.ByPosNoHeight:T.ByPos;return h?c.join(this.right.lineAt(l,a,i,n,l)):this.left.lineAt(l,a,i,s,r).join(c)}forEachLine(t,e,i,s,r,n){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)t<h&&this.left.forEachLine(t,e,i,s,r,n),e>=h&&this.right.forEachLine(t,e,i,l,h,n);else{let c=this.lineAt(h,T.ByPos,i,s,r);t<c.from&&this.left.forEachLine(t,c.from-1,i,s,r,n),c.to>=t&&c.from<=e&&n(c),e>c.to&&this.right.forEachLine(c.to+1,e,i,l,h,n)}}replace(t,e,i){let s=this.left.length+this.break;if(e<s)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-s,e-s,i));let r=[];t>0&&this.decomposeLeft(t,r);let n=r.length;for(let l of i)r.push(l);if(t>0&&Qs(r,n-1),e<this.length){let l=r.length;this.decomposeRight(e,r),Qs(r,l)}return z.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,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?z.of(this.break?[t,null,e]:[t,e]):(this.left=de(this.left,t),this.right=de(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,s){let{left:r,right:n}=this,l=e+r.length+this.break,h=null;return s&&s.from<=e+r.length&&s.more?h=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=l+n.length&&s.more?h=n=n.updateHeight(t,l,i,s):n.updateHeight(t,l,i),h?this.balanced(r,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Qs(o,t){let e,i;o[t]==null&&(e=o[t-1])instanceof V&&(i=o[t+1])instanceof V&&o.splice(t-1,3,new V(e.length+1+i.length))}const $r=5;class yi{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),s=this.nodes[this.nodes.length-1];s instanceof q?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new q(i-this.pos,-1)),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 s=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let n=e-t;i.block?this.addBlock(new $s(n,s,i)):(n||r||s>=$r)&&this.addLineDeco(s,r,n)}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 q(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new V(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 q)return t;let e=new q(0,-1);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 s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.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 q)&&!this.isCovered?this.nodes.push(new q(0,-1)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=t;for(let s of this.nodes)s instanceof q&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(t,e,i,s){let r=new yi(i,t);return N.spans(e,i,s,r,0),r.finish(i)}}function Qr(o,t,e){let i=new Jr;return N.compare(o,t,e,i,0),i.changes}class Jr{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&Ne(t,e,this.changes,5)}}function Zr(o,t){let e=o.getBoundingClientRect(),i=o.ownerDocument,s=i.defaultView||window,r=Math.max(0,e.left),n=Math.min(s.innerWidth,e.right),l=Math.max(0,e.top),h=Math.min(s.innerHeight,e.bottom);for(let c=o.parentNode;c&&c!=i.body;)if(c.nodeType==1){let a=c,d=window.getComputedStyle(a);if((a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth)&&d.overflow!="visible"){let u=a.getBoundingClientRect();r=Math.max(r,u.left),n=Math.min(n,u.right),l=Math.max(l,u.top),h=Math.min(c==o.parentNode?s.innerHeight:h,u.bottom)}c=d.position=="absolute"||d.position=="fixed"?a.offsetParent:a.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:r-e.left,right:Math.max(r,n)-e.left,top:l-(e.top+t),bottom:Math.max(l,h)-(e.top+t)}}function _r(o,t){let e=o.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class ei{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let s=t[i],r=e[i];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(t,e){return E.replace({widget:new tn(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class tn extends pt{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 Js{constructor(t){this.state=t,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.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Zs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=R.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(re).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new js(e),this.stateDeco=t.facet(Nt).filter(i=>typeof i!="function"),this.heightMap=z.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(t.doc),[new K(0,0,0,t.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=E.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:r,to:n})=>s>=r&&s<=n)){let{from:r,to:n}=this.lineBlockAt(s);t.push(new ue(r,n))}}return this.viewports=t.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Zs:new xi(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(zt(t,this.scaler))})}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Nt).filter(a=>typeof a!="function");let s=t.changedRanges,r=K.extendWithRanges(s,Qr(i,this.stateDeco,t?t.changes:Ai.empty(this.state.doc.length))),n=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ti(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=n||mt)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let h=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<h.from||e.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,e));let c=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,t.flags|=this.updateForViewport(),(c||!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(),e&&(this.scrollTarget=e),!this.mustEnfor
vendor: 1,380 bytes, line 3
3ceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cs)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?R.RTL:R.LTR;let n=this.heightOracle.mustRefreshForWrapping(r),l=e.getBoundingClientRect(),h=n||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,a=0;if(l.width&&l.height){let{scaleX:y,scaleY:S}=Ti(e,l);(y>.005&&Math.abs(this.scaleX-y)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=y,this.scaleY=S,c|=8,n=h=!0)}let d=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=u)&&(this.paddingTop=d,this.paddingBottom=u,c|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=8);let f=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=Li(t.scrollDOM);let p=(this.printing?_r:Zr)(e,this.paddingTop),g=p.top-this.pixelViewport.top,w=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;
vendor: 19,049 bytes, line 3
3if(m!=this.inView&&(this.inView=m,m&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;let b=l.width;if((this.contentDOMWidth!=b||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,c|=8),h){let y=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(y)&&(n=!0),n||s.lineWrapping&&Math.abs(b-this.contentDOMWidth)>s.charWidth){let{lineHeight:S,charWidth:M,textHeight:B}=t.docView.measureTextSize();n=S>0&&s.refresh(r,S,M,B,b/M,y),n&&(t.docView.minWidth=0,c|=8)}g>0&&w>0?a=Math.max(g,w):g<0&&w<0&&(a=Math.min(g,w)),ti();for(let S of this.viewports){let M=S.from==this.viewport.from?y:t.docView.measureVisibleLineHeights(S);this.heightMap=(n?z.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new K(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,n,new Us(S.from,M))}mt&&(c|=2)}let x=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(a,this.scrollTarget),c|=this.updateForViewport()),(c&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(n?[]:this.lineGaps,t)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),c}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)),s=this.heightMap,r=this.heightOracle,{visibleTop:n,visibleBottom:l}=this,h=new ue(s.lineAt(n-i*1e3,T.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,T.ByHeight,r,0,0).to);if(e){let{head:c}=e.range;if(c<h.from||c>h.to){let a=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=s.lineAt(c,T.ByPos,r,0,0),u;e.y=="center"?u=(d.top+d.bottom)/2-a/2:e.y=="start"||e.y=="nearest"&&c<h.from?u=d.top:u=d.bottom-a,h=new ue(s.lineAt(u-1e3/2,T.ByHeight,r,0,0).from,s.lineAt(u+a+1e3/2,T.ByHeight,r,0,0).to)}}return h}mapViewport(t,e){let i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new ue(this.heightMap.lineAt(i,T.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,T.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,T.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(e,T.ByPos,this.heightOracle,0,0),{visibleTop:n,visibleBottom:l}=this;return(t==0||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&s>n-2*1e3&&r<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let s of t)e.touchesRange(s.from,s.to)||i.push(new ei(e.mapPos(s.from),e.mapPos(s.to),s.size));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,n=s<<1;if(this.defaultTextDirection!=R.LTR&&!i)return[];let l=[],h=(a,d,u,f)=>{if(d-a<r)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let m of g)if(m>a&&m<d){h(a,m-10,u,f),h(m+10,d,u,f);return}let w=sn(t,m=>m.from>=u.from&&m.to<=u.to&&Math.abs(m.from-a)<r&&Math.abs(m.to-d)<r&&!g.some(b=>m.from<b&&m.to>b));if(!w){if(d<u.to&&e&&i&&e.visibleRanges.some(m=>m.from<=d&&m.to>=d)){let m=e.moveToLineBoundary(k.cursor(d),!1,!0).head;m>a&&(d=m)}w=new ei(a,d,this.gapSize(u,a,d,f))}l.push(w)},c=a=>{if(a.length<n||a.type!=F.Text)return;let d=en(a.from,a.to,this.stateDeco);if(d.total<n)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(i){let g=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,m;if(u!=null){let b=pe(d,u),x=((this.visibleBottom-this.visibleTop)/2+g)/a.height;w=b-x,m=b+x}else w=(this.visibleTop-a.top-g)/a.height,m=(this.visibleBottom-a.top+g)/a.height;f=fe(d,w),p=fe(d,m)}else{let g=d.total*this.heightOracle.charWidth,w=s*this.heightOracle.charWidth,m,b;if(u!=null){let x=pe(d,u),y=((this.pixelViewport.right-this.pixelViewport.left)/2+w)/g;m=x-y,b=x+y}else m=(this.pixelViewport.left-w)/g,b=(this.pixelViewport.right+w)/g;f=fe(d,m),p=fe(d,b)}f>a.from&&h(a.from,f,a,d),p<a.to&&h(p,a.to,a,d)};for(let a of this.viewportLines)Array.isArray(a.type)?a.type.forEach(c):c(a);return l}gapSize(t,e,i,s){let r=pe(s,i)-pe(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(t){ei.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=E.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];N.spans(t,this.viewport.from,this.viewport.to,{span(s,r){e.push({from:s,to:r})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=e[r].from||s.to!=e[r].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||zt(this.heightMap.lineAt(t,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)||zt(this.heightMap.lineAt(this.scaler.fromDOM(t),T.ByHeight,this.heightOracle,0,0),this.scaler)}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 zt(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 ue{constructor(t,e){this.from=t,this.to=e}}function en(o,t,e){let i=[],s=o,r=0;return N.spans(e,o,t,{span(){},point(n,l){n>s&&(i.push({from:s,to:n}),r+=n-s),s=l}},20),s<t&&(i.push({from:s,to:t}),r+=t-s),{total:r,ranges:i}}function fe({total:o,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let i=Math.floor(o*e);for(let s=0;;s++){let{from:r,to:n}=t[s],l=n-r;if(i<=l)return r+i;i-=l}}function pe(o,t){let e=0;for(let{from:i,to:s}of o.ranges){if(t<=s){e+=t-i;break}e+=s-i}return e/o.total}function sn(o,t){for(let e of o)if(t(e))return e}const Zs={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class xi{constructor(t,e,i){let s=0,r=0,n=0;this.viewports=i.map(({from:l,to:h})=>{let c=e.lineAt(l,T.ByPos,t,0,0).top,a=e.lineAt(h,T.ByPos,t,0,0).bottom;return s+=a-c,{from:l,to:h,top:c,bottom:a,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=n+(l.top-r)*this.scale,n=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return s+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,s=r.domBottom}}fromDOM(t){for(let e=0,i=0,s=0;;e++){let r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-s)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,s=r.domBottom}}eq(t){return t instanceof xi?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 zt(o,t){if(t.scale==1)return o;let e=t.toDOM(o.top),i=t.toDOM(o.bottom);return new U(o.from,o.length,e,i-e,Array.isArray(o._content)?o._content.map(s=>zt(s,t)):o._content)}const ge=C.define({combine:o=>o.join(" ")}),ii=C.define({combine:o=>o.indexOf(!0)>-1}),si=xt.newName(),_s=xt.newName(),to=xt.newName(),eo={"&light":"."+_s,"&dark":"."+to};function oi(o,t,e){return new xt(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return o;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):o+" "+i}})}const on=oi("."+si,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},eo),rn={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ri=v.ie&&v.ie_version<=11;class nn{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new jo,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);(v.ie&&v.ie_version<=11||v.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&&t.constructor.EDIT_CONTEXT!==!1&&!(v.chrome&&v.chrome_version<126)&&(this.editContext=new hn(t),t.state.facet(nt)&&(t.contentDOM.editContext=this.editContext.editContext)),ri&&(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,s=this.selectionRange;if(i.state.facet(nt)?i.root.activeElement!=this.dom:!_t(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(v.ie&&v.ie_version<=11||v.android&&v.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Pt(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Lt(t.root);if(!e)return!1;let i=v.safari&&t.root.nodeType==11&&Ko(this.dom.ownerDocument)==this.dom&&ln(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let s=_t(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&$o(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(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,rn),ri&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ri&&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 s=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Mt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!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,s=!1;for(let r of t){let n=this.readMutation(r);n&&(n.typeOver&&(s=!0),e==-1?{from:e,to:i}=n:(e=Math.min(n.from,e),i=Math.max(n.to,i)))}return{from:e,to:i,typeOver:s}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&_t(this.dom,this.selectionRange);
3if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Ar(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,s=Os(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type=="attributes"),t.type=="attributes"&&(e.flags|=4),t.type=="childList"){let i=io(e,t.previousSibling||t.target.previousSibling,-1),s=io(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):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(nt)!=t.state.facet(nt)&&(t.view.contentDOM.editContext=t.state.facet(nt)?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 s of this.scrollTargets)s.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 io(o,t,e){for(;t;){let i=O.get(t);if(i&&i.parent==o)return i;let s=t.parentNode;t=s!=o.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function so(o,t){let e=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,n=o.docView.domAtPos(o.state.selection.main.anchor);return Pt(n.node,n.offset,s,r)&&([e,i,s,r]=[s,r,e,i]),{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}}function ln(o,t){if(t.getComposedRanges){let s=t.getComposedRanges(o.root)[0];if(s)return so(o,s)}let e=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),e=s.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),e?so(o,e):null}class hn{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(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{anchor:s}=t.state.selection.main,r={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
4`))};r.from==this.from&&s<this.from?r.from=s:r.to==this.to&&s>this.to&&(r.to=s),!(r.from==r.to&&!r.insert.length)&&(this.pendingContextChange=r,t.state.readOnly||Ze(t,r,k.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)))}
vendor: 26,727 bytes, line 4
4,this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let n=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);n<l;n++){let h=t.coordsForChar(n);r=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||r||new DOMRect,s.push(r)}e.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let r of i.getTextFormats()){let n=r.underlineStyle,l=r.underlineThickness;if(n!="None"&&l!="None"){let h=`text-decoration: underline ${n=="Dashed"?"dashed ":n=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;s.push(E.mark({attributes:{style:h}}).range(this.toEditorPos(r.rangeStart),this.toEditorPos(r.rangeEnd)))}}t.dispatch({effects:us.of(E.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{t.inputState.composing=-1,t.inputState.compositionFirstChange=null};for(let i in this.handlers)e.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Lt(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,s=this.pendingContextChange;return t.changes.iterChanges((r,n,l,h,c)=>{if(i)return;let a=c.length-(n-r);if(s&&n>=s.to)if(s.from==r&&s.to==n&&s.insert.eq(c)){s=this.pendingContextChange=null,e+=a,this.to+=a;return}else s=null,this.revertPending(t.state);if(r+=e,n+=e,n<=this.from)this.from+=a,this.to+=a;else if(r<this.to){if(r<this.from||n>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(n),c.toString()),this.to+=a}e+=a}),s&&!i&&this.revertPending(t.state),!i}update(t){let e=this.pendingContextChange;!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.resetRange(t.state),this.editContext.updateText(0,this.editContext.text.length,t.state.doc.sliceString(this.from,this.to)),this.setSelection(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)}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))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}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){return t+this.from}toContextPos(t){return t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class A{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.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:i}=t;this.dispatchTransactions=t.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||Uo(t.parent)||document,this.viewState=new Js(t.state||Bt.create(t)),t.scrollTo&&t.scrollTo.is(oe)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Vt).map(s=>new Ge(s));for(let s of this.plugins)s.update(this);this.observer=new nn(this),this.inputState=new Rr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new bs(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let e=t.length==1&&t[0]instanceof No?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,s,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 n=this.hasFocus,l=0,h=null;t.some(u=>u.annotation(qs))?(this.inputState.notifiedFocused=n,l=1):n!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=n,h=Ks(r,n),h||(l=1));let c=this.observer.delayedAndroidKey,a=null;if(c?(this.observer.clearDelayedAndroidKey(),a=this.observer.readChange(),(a&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(a=null)):this.observer.clear(),r.facet(Bt.phrases)!=this.state.facet(Bt.phrases))return this.setState(r);s=$t.create(this,r,t),s.flags|=l;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(d&&(d=d.map(u.changes)),u.scrollIntoView){let{main:f}=u.state.selection;d=new Et(f.empty?f:k.cursor(f.head,f.head>f.anchor?-1:1))}for(let f of u.effects)f.is(oe)&&(d=f.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=Me.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(Ft)!=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(s.startState.facet(ge)!=s.state.facet(ge)&&(this.viewState.mustMeasureContent=!0),(e||i||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Ke))try{u(s)}catch(f){G(this.state,f,"update listener")}(h||a)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),a&&!Os(this,a)&&c.force&&Mt(this.contentDOM,c.key,c.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 Js(t),this.plugins=t.facet(Vt).map(i=>new Ge(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new bs(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(Vt),i=t.state.facet(Vt);if(e!=i){let s=[];for(let r of i){let n=e.indexOf(r);if(n<0)s.push(new Ge(r));else{let l=this.plugins[n];l.mustUpdate=t,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=t&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].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){G(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.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:n}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(n<0)if(Li(i))r=-1,n=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(s);r=f.from,n=f.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];h&4||([this.measureRequests,c]=[c,this.measureRequests]);let a=c.map(f=>{try{return f.read(this)}catch(p){return G(this.state,p),oo}}),d=$t.create(this,this.state,[]),u=!1;d.flags|=h,e?e.flags|=h:e=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),u=this.docView.update(d),u&&this.docViewUpdate());for(let f=0;f<c.length;f++)if(a[f]!=oo)try{let p=c[f];p.write&&p.write(a[f],this)}catch(p){G(this.state,p)}if(u&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue}else{let f=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-n;if(f>1||f<-1){s=s+f,i.scrollTop=s/this.scaleY,n=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(Ke))l(e)}get themeClasses(){return si+" "+(this.state.facet(ii)?to:_s)+" "+this.state.facet(ge)}updateAttrs(){let t=ro(this,fs,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(nt)?"true":"false",class:"cm-content",style:`${v.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),ro(this,re,e);let i=this.observer.ignore(()=>{let s=Ve(this.contentDOM,this.contentAttrs,e),r=Ve(this.dom,this.editorAttrs,t);return s||r});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)if(s.is(A.announce)){e&&(this.announceDOM.textContent=""),e=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ft);let t=this.state.facet(A.cspNonce);xt.mount(this.root,this.styleModules.concat(on).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.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(i=>i.spec==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 Je(this,t,As(this,t,e,i))}moveByGroup(t,e){return Je(this,t,As(this,t,e,i=>Sr(this,t.head,i)))}visualLineSide(t,e){let i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return k.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,i=!0){return xr(this,t,e,i)}moveVertically(t,e,i){return Je(this,t,Cr(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),Ms(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),r=this.bidiSpans(s),n=r[tt.find(r,t-s.from,-1,e)];return Ht(i,n.dir==R.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(as)||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>an)return ts(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||Zi(r.isolates,i=ms(this,t))))return r.order;i||(i=ms(this,t));let s=_i(t.text,e,i);return this.bidiCache.push(new Me(t.from,t.to,e,i,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||v.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ei(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return oe.of(new Et(typeof t=="number"?k.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return oe.of(new Et(k.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return P.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return P.define(()=>({}),{eventObservers:t})}static theme(t,e){let i=xt.newName(),s=[ge.of(i),Ft.of(oi(`.${i}`,t))];return e&&e.dark&&s.push(ii.of(!0)),s}static baseTheme(t){return Ae.lowest(Ft.of(oi("."+si,t,eo)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content");return((e=(i&&O.get(i)||O.get(t))?.rootView)===null||e===void 0?void 0:e.view)||null}}A.styleModule=Ft,A.inputHandler=ls,A.clipboardInputFilter=Ye,A.clipboardOutputFilter=Xe,A.scrollHandler=ds,A.focusChangeEffect=hs,A.perLineTextDirection=as,A.exceptionSink=ns,A.updateListener=Ke,A.editable=nt,A.mouseSelectionStyle=rs,A.dragMovesSelection=os,A.clickAddsSelectionRange=ss,A.decorations=Nt,A.outerDecorations=ps,A.atomicRanges=je,A.bidiIsolatedRanges=gs,A.scrollMargins=ws,A.darkTheme=ii,A.cspNonce=C.define({combine:o=>o.length?o[0]:""}),A.contentAttributes=re,A.editorAttributes=fs,A.lineWrapping=A.contentAttributes.of({class:"cm-lineWrapping"}),A.announce=bt.define();const an=4096,oo={};class Me{constructor(t,e,i,s,r,n){this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=n}static update(t,e){if(e.empty&&!t.some(r=>r.fresh))return t;let i=[],s=t.length?t[t.length-1].dir:R.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let n=t[r];n.dir==s&&!e.touchesRange(n.from,n.to)&&i.push(new Me(e.mapPos(n.from,1),e.mapPos(n.to,-1),n.dir,n.isolates,!1,n.order))}return i}}function ro(o,t,e){for(let i=o.state.facet(t),s=i.length-1;s>=0;s--){let r=i[s],n=typeof r=="function"?r(o):r;n&&He(n,e)}return e}const cn=v.mac?"mac":v.windows?"win":v.linux?"linux":"key";function dn(o,t){const e=o.split(/-(?!$)/);let i=e[e.length-1];i=="Space"&&(i=" ");let s,r,n,l;for(let h=0;h<e.length-1;++h){const c=e[h];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))s=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))n=!0;else if(/^mod$/i.test(c))t=="mac"?l=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return s&&(i="Alt-"+i),r&&(i="Ctrl-"+i),l&&(i="Meta-"+i),n&&(i="Shift-"+i),i}function me(o,t,e){return t.altKey&&(o="Alt-"+o),t.ctrlKey&&(o="Ctrl-"+o),t.metaKey&&(o="Meta-"+o),e!==!1&&t.shiftKey&&(o="Shift-"+o),o}const un=Ae.default(A.domEventHandlers({keydown(o,t){return ao(ho(t.state),o,t,"editor")}})),no=C.define({enables:un}),lo=new WeakMap;function ho(o){let t=o.facet(no),e=lo.get(t);return e||lo.set(t,e=gn(t.reduce((i,s)=>i.concat(s),[]))),e}function fn(o,t,e){return ao(ho(o.state),t,o,e)}let lt=null;const pn=4e3;function gn(o,t=cn){let e=Object.create(null),i=Object.create(null),s=(n,l)=>{let h=i[n];if(h==null)i[n]=l;else if(h!=l)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},r=(n,l,h,c,a)=>{var d,u;let f=e[n]||(e[n]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>dn(m,t));for(let m=1;m<p.length;m++){let b=p.slice(0,m).join(" ");s(b,!0),f[b]||(f[b]={preventDefault:!0,stopPropagation:!1,run:[x=>{let y=lt={view:x,prefix:b,scope:n};return setTimeout(()=>{lt==y&&(lt=null)},pn),!0}]})}let g=p.join(" ");s(g,!1);let w=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((u=(d=f._any)===null||d===void 0?void 0:d.run)===null||u===void 0?void 0:u.slice())||[]});h&&w.run.push(h),c&&(w.preventDefault=!0),a&&(w.stopPropagation=!0)};for(let n of o){let l=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let c of l){let a=e[c]||(e[c]=Object.create(null));a._any||(a._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=n;for(let u in a)a[u].run.push(f=>d(f,ni))}let h=n[t]||n.key;if(h)for(let c of l)r(c,h,n.run,n.preventDefault,n.stopPropagation),n.shift&&r(c,"Shift-"+h,n.shift,n.preventDefault,n.stopPropagation)}return e}let ni=null;function ao(o,t,e,i){ni=t;let s=zo(t),r=Ci(s,0),n=Vo(r)==s.length&&s!=" ",l="",h=!1,c=!1,a=!1;lt&&lt.view==e&&lt.scope==i&&(l=lt.prefix+" ",Rs.indexOf(t.keyCode)<0&&(c=!0,lt=null));let d=new Set,u=w=>{if(w){for(let m of w.run)if(!d.has(m)&&(d.add(m),m(e)))return w.stopPropagation&&(a=!0),!0;w.preventDefault&&(w.stopPropagation&&(a=!0),c=!0)}return!1},f=o[i],p,g;return f&&(u(f[l+me(s,t,!n)])?h=!0:n&&(t.altKey||t.metaKey||t.ctrlKey)&&!(v.windows&&t.ctrlKey&&t.altKey)&&(p=Io[t.keyCode])&&p!=s?(u(f[l+me(p,t,!0)])||t.shiftKey&&(g=qo[t.keyCode])!=s&&g!=p&&u(f[l+me(g,t,!1)]))&&(h=!0):n&&t.shiftKey&&u(f[l+me(s,t,!0)])&&(h=!0),!h&&u(f._any)&&(h=!0)),c&&(h=!0),h&&a&&t.stopPropagation(),ni=null,h}class Ot{constructor(t,e,i,s,r){this.className=t,this.left=e,this.top=i,this.width=s,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 s=t.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=co(t);return[new Ot(e,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return mn(t,e,i)}}function co(o){let t=o.scrollDOM.getBoundingClientRect();return{left:(o.textDirection==R.LTR?t.left:t.right-o.scrollDOM.clientWidth*o.scaleX)-o.scrollDOM.scrollLeft*o.scaleX,top:t.top-o.scrollDOM.scrollTop*o.scaleY}}function uo(o,t,e,i){let s=o.coordsAtPos(t,e*2);if(!s)return i;let r=o.dom.getBoundingClientRect(),n=(s.top+s.bottom)/2,l=o.posAtCoords({x:r.left+1,y:n}),h=o.posAtCoords({x:r.right-1,y:n});return l==null||h==null?i:{from:Math.max(i.from,Math.min(l,h)),to:Math.min(i.to,Math.max(l,h))}}function mn(o,t,e){if(e.to<=o.viewport.from||e.from>=o.viewport.to)return[];let i=Math.max(e.from,o.viewport.from),s=Math.min(e.to,o.viewport.to),r=o.textDirection==R.LTR,n=o.contentDOM,l=n.getBoundingClientRect(),h=co(o),c=n.querySelector(".cm-line"),a=c&&window.getComputedStyle(c),d=l.left+(a?parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)):0),u=l.right-(a?parseInt(a.paddingRight):0),f=Qe(o,i),p=Qe(o,s),g=f.type==F.Text?f:null,w=p.type==F.Text?p:null;if(g&&(o.lineWrapping||f.widgetLineBreaks)&&(g=uo(o,i,1,g)),w&&(o.lineWrapping||p.widgetLineBreaks)&&(w=uo(o,s,-1,w)),g&&w&&g.from==w.from&&g.to==w.to)return b(x(e.from,e.to,g));{let S=g?x(e.from,null,g):y(f,!1),M=w?x(null,e.to,w):y(p,!0),B=[];return(g||f).to<(w||p).from-(g&&w?1:0)||f.widgetLineBreaks>1&&S.bottom+o.defaultLineHeight/2<M.top?B.push(m(d,S.bottom,u,M.top)):S.bottom<M.top&&o.elementAtHeight((S.bottom+M.top)/2).type==F.Text&&(S.bottom=M.top=(S.bottom+M.top)/2),b(S).concat(B).concat(b(M))}function m(S,M,B,H){return new Ot(t,S-h.left,M-h.top-.01,B-S,H-M+.01)}function b({top:S,bottom:M,horizontal:B}){let H=[];for(let ot=0;ot<B.length;ot+=2)H.push(m(B[ot],S,B[ot+1],M));return H}function x(S,M,B){let H=1e9,ot=-1e9,Qt=[];function Si(ct,rt,wt,dt,Rt){let J=o.coordsAtPos(ct,ct==B.to?-2:2),Z=o.coordsAtPos(wt,wt==B.from?2:-2);!J||!Z||(H=Math.min(J.top,Z.top,H),ot=Math.max(J.bottom,Z.bottom,ot),Rt==R.LTR?Qt.push(r&&rt?d:J.left,r&&dt?u:Z.right):Qt.push(!r&&dt?d:Z.left,!r&&rt?u:J.right))}let Jt=S??B.from,Zt=M??B.to;for(let ct of o.visibleRanges)if(ct.to>Jt&&ct.from<Zt)for(let rt=Math.max(ct.from,Jt),wt=Math.min(ct.to,Zt);;){let dt=o.state.doc.lineAt(rt);for(let Rt of o.bidiSpans(dt)){let J=Rt.from+dt.from,Z=Rt.to+dt.from;if(J>=wt)break;Z>rt&&Si(Math.max(J,rt),S==null&&J<=Jt,Math.min(Z,wt),M==null&&Z>=Zt,Rt.dir)}if(rt=dt.to+1,rt>=wt)break}return Qt.length==0&&Si(Jt,S==null,Zt,M==null,o.textDirection),{top:H,bottom:ot,horizontal:Qt}}function y(S,M){let B=l.top+(M?S.top:S.bottom);return{top:B,bottom:B,horizontal:[]}}}function wn(o,t){return o.constructor==t.constructor&&o.eq(t)}class vn{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(we)!=t.state.facet(we)&&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(we);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)=>!wn(e,this.drawn[i]))){let e=this.dom.firstChild,i=0;for(let s of t)s.update&&e&&s.constructor&&this.drawn[i].constructor&&s.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(s.draw(),e);for(;e;){let s=e.nextSibling;e.remove(),e=s}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const we=C.define();function li(o){return[P.define(t=>new vn(t,o)),we.of(o)]}const fo=!v.ios,At=C.define({combine(o){return De(o,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function bn(o={}){return[At.of(o),xn,Sn,Cn,cs.of(!0)]}function yn(o){return o.facet(At)}function po(o){return o.startState.facet(At)!=o.state.facet(At)}const xn=li({above:!0,markers(o){let{state:t}=o,e=t.facet(At),i=[];for(let s of t.selection.ranges){let r=s==t.selection.main;if(s.empty?!r||fo:e.drawRangeCursor){let n=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:k.cursor(s.head,s.head>s.anchor?-1:1);for(let h of Ot.forRange(o,n,l))i.push(h)}}return i},update(o,t){o.transactions.some(i=>i.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let e=po(o);return e&&go(o.state,t),o.docChanged||o.selectionSet||e},mount(o,t){go(t.state,o)},class:"cm-cursorLayer"});function go(o,t){t.style.animationDuration=o.facet(At).cursorBlinkRate+"ms"}const Sn=li({above:!1,markers(o){return o.state.selection.ranges.map(t=>t.empty?[]:Ot.forRange(o,"cm-selectionBackground",t)).reduce((t,e)=>t.concat(e))},update(o,t){return o.docChanged||o.selectionSet||o.viewportChanged||po(o)},class:"cm-selectionLayer"}),hi={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};fo&&(hi[".cm-line"].caretColor=hi[".cm-content"].caretColor="transparent !important");const Cn=Ae.highest(A.theme(hi)),mo=bt.define({map(o,t){return o==null?null:t.mapPos(o)}}),It=Mi.define({create(){return null},update(o,t){return o!=null&&(o=t.changes.mapPos(o)),t.effects.reduce((e,i)=>i.is(mo)?i.value:e,o)}}),Mn=P.fromClass(class{constructor(o){this.view=o,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(o){var t;let e=o.state.field(It);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="
4cm-dropCursor"),(o.startState.field(It)!=e||o.docChanged||o.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:o}=this,t=o.state.field(It),e=t!=null&&o.coordsAtPos(t);if(!e)return null;let i=o.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+o.scrollDOM.scrollLeft*o.scaleX,top:e.top-i.top+o.scrollDOM.scrollTop*o.scaleY,height:e.bottom-e.top}}drawCursor(o){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;o?(this.cursor.style.left=o.left/t+"px",this.cursor.style.top=o.top/e+"px",this.cursor.style.height=o.height/e+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(o){this.view.state.field(It)!=o&&this.view.dispatch({effects:mo.of(o)})}},{eventObservers:{dragover(o){this.setDropPos(this.view.posAtCoords({x:o.clientX,y:o.clientY}))},dragleave(o){(o.target==this.view.contentDOM||!this.view.contentDOM.contains(o.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function kn(){return[It,Mn]}function wo(o,t,e,i,s){t.lastIndex=0;for(let r=o.iterRange(e,i),n=e,l;!r.next().done;n+=r.value.length)if(!r.lineBreak)for(;l=t.exec(r.value);)s(n+l.index,l)}function An(o,t){let e=o.visibleRanges;if(e.length==1&&e[0].from==o.viewport.from&&e[0].to==o.viewport.to)return e;let i=[];for(let{from:s,to:r}of e)s=Math.max(o.state.doc.lineAt(s).from,s-t),r=Math.min(o.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class ve{constructor(t){const{regexp:e,decoration:i,decorate:s,boundary:r,maxLength:n=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,s)this.addMatch=(l,h,c,a)=>s(a,c,c+l[0].length,l,h);else if(typeof i=="function")this.addMatch=(l,h,c,a)=>{let d=i(l,h,c);d&&a(c,c+l[0].length,d)};else if(i)this.addMatch=(l,h,c,a)=>a(c,c+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=n}createDeco(t){let e=new Fo,i=e.add.bind(e);for(let{from:s,to:r}of An(t,this.maxLength))wo(t.state.doc,this.regexp,s,r,(n,l)=>this.addMatch(l,t,n,i));return e.finish()}updateDeco(t,e){let i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((r,n,l,h)=>{h>t.view.viewport.from&&l<t.view.viewport.to&&(i=Math.min(l,i),s=Math.max(h,s))}),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e}updateRange(t,e,i,s){for(let r of t.visibleRanges){let n=Math.max(r.from,i),l=Math.min(r.to,s);if(l>n){let h=t.state.doc.lineAt(n),c=h.to<l?t.state.doc.lineAt(l):h,a=Math.max(r.from,h.from),d=Math.min(r.to,c.to);if(this.boundary){for(;n>h.from;n--)if(this.boundary.test(h.text[n-1-h.from])){a=n;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){d=l;break}}let u=[],f,p=(g,w,m)=>u.push(m.range(g,w));if(h==c)for(this.regexp.lastIndex=a-h.from;(f=this.regexp.exec(h.text))&&f.index<d-h.from;)this.addMatch(f,t,f.index+h.from,p);else wo(t.state.doc,this.regexp,a,d,(g,w)=>this.addMatch(w,t,g,p));e=e.update({filterFrom:a,filterTo:d,filter:(g,w)=>g<a||w>d,add:u})}}return e}}const ai=/x/.unicode!=null?"gu":"g",Dn=new RegExp(`[\0-\b
5-�\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,ai),On={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ci=null;function Tn(){var o;if(ci==null&&typeof document<"u"&&document.body){let t=document.body.style;ci=((o=t.tabSize)!==null&&o!==void 0?o:t.MozTabSize)!=null}return ci||!1}const be=C.define({combine(o){let t=De(o,{render:null,specialChars:Dn,addSpecialChars:null});return(t.replaceTabs=!Tn())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,ai)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,ai)),t}});function En(o={}){return[be.of(o),Rn()]}let vo=null;function Rn(){return vo||(vo=P.fromClass(class{constructor(o){this.view=o,this.decorations=E.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(o.state.facet(be)),this.decorations=this.decorator.createDeco(o)}makeDecorator(o){return new ve({regexp:o.specialChars,decoration:(t,e,i)=>{let{doc:s}=e.state,r=Ci(t[0],0);if(r==9){let n=s.lineAt(i),l=e.state.tabSize,h=Di(n.text,l,i-n.from);return E.replace({widget:new Hn((l-h%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=E.replace({widget:new Pn(o,r)}))},boundary:o.replaceTabs?void 0:/[^]/})}
5update(o){let t=o.state.facet(be);o.startState.facet(be)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(o.view)):this.decorations=this.decorator.updateDeco(o,this.decorations)}},{decorations:o=>o.decorations}))}const Bn="\u2022";function Ln(o){return o>=32?Bn:o==10?"\u2424":String.fromCharCode(9216+o)}class Pn extends pt{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=Ln(this.code),i=t.state.phrase("Control character")+" "+(On[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Hn extends pt{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="	",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const bo=P.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(o){let{view:t}=o,e=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;e>=0&&e!=this.height&&(this.height=e,this.attrs={style:`padding-bottom: ${e}px`})}});function Vn(){return[bo,re.of(o=>{var t;return((t=o.plugin(bo))===null||t===void 0?void 0:t.attrs)||null})]}function Nn(){return Wn}const Fn=E.line({class:"cm-activeLine"}),Wn=P.fromClass(class{constructor(o){this.decorations=this.getDeco(o)}update(o){(o.docChanged||o.selectionSet)&&(this.decorations=this.getDeco(o.view))}getDeco(o){let t=-1,e=[];for(let i of o.state.selection.ranges){let s=o.lineBlockAt(i.head);s.from>t&&(e.push(Fn.range(s.from)),t=s.from)}return E.set(e)}},{decorations:o=>o.decorations});class zn extends pt{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(t){let e=t.firstChild?St(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),s=Ht(e[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function In(o){return P.fromClass(class{constructor(t){this.view=t,this.placeholder=o?E.set([E.widget({widget:new zn(o),side:1}).range(0)]):E.none}get decorations(){return this.view.state.doc.length?E.none:this.placeholder}},{decorations:t=>t.decorations})}const di=2e3;function qn(o,t,e){let i=Math.min(t.line,e.line),s=Math.max(t.line,e.line),r=[];if(t.off>di||e.off>di||t.col<0||e.col<0){let n=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let h=i;h<=s;h++){let c=o.doc.line(h);c.length<=l&&r.push(k.range(c.from+n,c.to+l))}}else{let n=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let h=i;h<=s;h++){let c=o.doc.line(h),a=Oe(c.text,n,o.tabSize,!0);if(a<0)r.push(k.cursor(c.to));else{let d=Oe(c.text,l,o.tabSize);r.push(k.range(c.from+a,c.from+d))}}}return r}function Kn(o,t){let e=o.coordsAtPos(o.viewport.from);return e?Math.round(Math.abs((e.left-t)/o.defaultCharacterWidth)):-1}function yo(o,t){let e=o.posAtCoords({x:t.clientX,y:t.clientY},!1),i=o.state.doc.lineAt(e),s=e-i.from,r=s>di?-1:s==i.length?Kn(o,t.clientX):Di(i.text,o.state.tabSize,e-i.from);return{line:i.number,col:r,off:s}}function Yn(o,t){let e=yo(o,t),i=o.state.selection;return e?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(e.line).from),n=s.state.doc.lineAt(r);e={line:n.number,col:e.col,off:Math.min(e.off,n.length)},i=i.map(s.changes)}},get(s,r,n){let l=yo(o,s);if(!l)return i;let h=qn(o.state,e,l);return h.length?n?k.create(h.concat(i.ranges)):k.create(h):i}}:null}
vendor: 23,044 bytes, line 5
5function Xn(o){let t=o?.eventFilter||(e=>e.altKey&&e.button==0);return A.mouseSelectionStyle.of((e,i)=>t(i)?Yn(e,i):null)}const Gn={Alt:[18,o=>!!o.altKey],Control:[17,o=>!!o.ctrlKey],Shift:[16,o=>!!o.shiftKey],Meta:[91,o=>!!o.metaKey]},jn={style:"cursor: crosshair"};function Un(o={}){let[t,e]=Gn[o.key||"Alt"],i=P.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==t||e(s))},keyup(s){(s.keyCode==t||!e(s))&&this.set(!1)},mousemove(s){this.set(e(s))}}});return[i,A.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?jn:null})]}const qt="-10000px";class xo{constructor(t,e,i,s){this.facet=e,this.createTooltipView=i,this.removeTooltipView=s,this.input=t.state.facet(e),this.tooltips=this.input.filter(n=>n);let r=null;this.tooltipViews=this.tooltips.map(n=>r=i(n,r))}update(t,e){var i;let s=t.state.facet(this.facet),r=s.filter(h=>h);if(s===this.input){for(let h of this.tooltipViews)h.update&&h.update(t);return!1}let n=[],l=e?[]:null;for(let h=0;h<r.length;h++){let c=r[h],a=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let u=this.tooltips[d];u&&u.create==c.create&&(a=d)}if(a<0)n[h]=this.createTooltipView(c,h?n[h-1]:null),l&&(l[h]=!!c.above);else{let d=n[h]=this.tooltipViews[a];l&&(l[h]=e[a]),d.update&&d.update(t)}}}for(let h of this.tooltipViews)n.indexOf(h)<0&&(this.removeTooltipView(h),(i=h.destroy)===null||i===void 0||i.call(h));return e&&(l.forEach((h,c)=>e[c]=h),e.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=n,!0}}function $n(o={}){return ye.of(o)}function Qn(o){let{win:t}=o;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const ye=C.define({combine:o=>{var t,e,i;return{position:v.ios?"absolute":((t=o.find(s=>s.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((e=o.find(s=>s.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((i=o.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Qn}}}),So=new WeakMap,xe=P.fromClass(class{constructor(o){this.view=o,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=o.state.facet(ye);this.position=t.position,this.parent=t.parent,this.classes=o.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new xo(o,ui,(e,i)=>this.createTooltip(e,i),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),o.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let o of this.manager.tooltipViews)this.intersectionObserver.observe(o.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(o){o.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(o,this.above);t&&this.observeIntersection();let e=t||o.geometryChanged,i=o.state.facet(ye);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;e=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(o,t){let e=o.create(this.view),i=t?t.dom:null;if(e.dom.classList.add("cm-tooltip"),o.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",e.dom.appendChild(s)}return e.dom.style.position=this.position,e.dom.style.top=qt,e.dom.style.left="0px",this.container.insertBefore(e.dom,i),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var o,t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(o=i.destroy)===null||o===void 0||o.call(i);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let o=this.view.dom.getBoundingClientRect(),t=1,e=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(v.gecko)i=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==qt&&s.style.left=="0px"){let r=s.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:o,parent:this.parent?this.container.getBoundingClientRect():o,pos:this.manager.tooltips.map((s,r)=>{let n=this.manager.tooltipViews[r];return n.getCoords?n.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(ye).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:i}}writeMeasure(o){var t;if(o.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:e,space:i,scaleX:s,scaleY:r}=o,n=[];for(let l=0;l<this.manager.tooltips.length;l++){let h=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:a}=c,d=o.pos[l],u=o.size[l];if(!d||d.bottom<=Math.max(e.top,i.top)||d.top>=Math.min(e.bottom,i.bottom)||d.right<Math.max(e.left,i.left)-.1||d.left>Math.min(e.right,i.right)+.1){a.style.top=qt;continue}let f=h.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=u.right-u.left,w=(t=So.get(c))!==null&&t!==void 0?t:u.bottom-u.top,m=c.offset||Zn,b=this.view.textDirection==R.LTR,x=u.width>i.right-i.left?b?i.left:i.right-u.width:b?Math.max(i.left,Math.min(d.left-(f?14:0)+m.x,i.right-g)):Math.min(Math.max(i.left,d.left-g+(f?14:0)-m.x),i.right-g),y=this.above[l];!h.strictSide&&(y?d.top-(u.bottom-u.top)-m.y<i.top:d.bottom+(u.bottom-u.top)+m.y>i.bottom)&&y==i.bottom-d.bottom>d.top-i.top&&(y=this.above[l]=!y);let S=(y?d.top-i.top:i.bottom-d.bottom)-p;if(S<w&&c.resize!==!1){if(S<this.view.defaultLineHeight){a.style.top=qt;continue}So.set(c,w),a.style.height=(w=S)/r+"px"}else a.style.height&&(a.style.height="");let M=y?d.top-w-p-m.y:d.bottom+p+m.y,B=x+g;if(c.overlap!==!0)for(let H of n)H.left<B&&H.right>x&&H.top<M+w&&H.bottom>M&&(M=y?H.top-w-2-p:H.bottom+p+2);if(this.position=="absolute"?(a.style.top=(M-o.parent.top)/r+"px",a.style.left=(x-o.parent.left)/s+"px"):(a.style.top=M/r+"px",a.style.left=x/s+"px"),f){let H=d.left+(b?m.x:-m.x)-(x+14-7);f.style.left=H/s+"px"}c.overlap!==!0&&n.push({left:x,top:M,right:B,bottom:M+w}),a.classList.toggle("cm-tooltip-above",y),a.classList.toggle("cm-tooltip-below",!y),c.positioned&&c.positioned(o.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let o of this.manager.tooltipViews)o.dom.style.top=qt}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Jn=A.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Zn={x:0,y:0},ui=C.define({enables:[xe,Jn]}),Kt=C.define({combine:o=>o.reduce((t,e)=>t.concat(e),[])});class ke{static create(t){return new ke(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new xo(t,Kt,(e,i)=>this.createHostedView(e,i),e=>e.dom.remove())}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let s=i[t];if(s!==void 0){if(e===void 0)e=s;else if(e!==s)return}}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const _n=ui.compute([Kt],o=>{let t=o.facet(Kt);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var i;return(i=e.end)!==null&&i!==void 0?i:e.pos})),create:ke.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class tl{constructor(t,e,i,s,r){this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,i=t.docView.nearest(e.target);if(!i)return;let s,r=1;if(i instanceof at)s=i.posAtStart;else{if(s=t.posAtCoords(e),s==null)return;let l=t.coordsAtPos(s);if(!l||e.y<l.top||e.y>l.bottom||e.x<l.left-t.defaultCharacterWidth||e.x>l.right+t.defaultCharacterWidth)return;let h=t.bidiSpans(t.state.doc.lineAt(s)).find(a=>a.from<=s&&a.to>=s),c=h&&h.dir==R.RTL?-1:1;r=e.x<l.left?-c:c}let n=this.source(t,s,r);if(n?.then){let l=this.pending={pos:s};n.then(h=>{this.pending==l&&(this.pending=null,h&&!(Array.isArray(h)&&!h.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(h)?h:[h])}))},h=>G(t.state,h,"hover tooltip"))}else n&&!(Array.isArray(n)&&!n.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])})}get tooltip(){let t=this.view.plugin(xe),e=t?t.manager.tooltips.findIndex(i=>i.create==ke.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!el(r.dom,t)||this.pending){let{pos:n}=s[0]||this.pending,l=(i=(e=s[0])===null||e===void 0?void 0:e.end)!==null&&i!==void 0?i:n;(n==l?this.view.posAtCoords(this.lastMove)!=n:!il(this.view,n,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:i}=this;i&&i.dom.contains(t.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Se=4;function el(o,t){let{left:e,right:i,top:s,bottom:r}=o.getBoundingClientRect(),n;if(n=o.querySelector(".cm-tooltip-arrow")){let l=n.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return t.clientX>=e-Se&&t.clientX<=i+Se&&t.clientY>=s-Se&&t.clientY<=r+Se}function il(o,t,e,i,s,r){let n=o.scrollDOM.getBoundingClientRect(),l=o.documentTop+o.documentPadding.top+o.contentHeight;if(n.left>i||n.right<i||n.top>s||Math.min(n.bottom,l)<s)return!1;let h=o.posAtCoords({x:i,y:s},!1);return h>=t&&h<=e}function sl(o,t={}){let e=bt.define(),i=Mi.define({create(){return[]},update(s,r){if(s.length&&(t.hideOnChange&&(r.docChanged||r.selection)?s=[]:t.hideOn&&(s=s.filter(n=>!t.hideOn(r,n))),r.docChanged)){let n=[];for(let l of s){let h=r.changes.mapPos(l.pos,-1,vt.TrackDel);if(h!=null){let c=Object.assign(Object.create(null),l);c.pos=h,c.end!=null&&(c.end=r.changes.mapPos(c.end)),n.push(c)}}s=n}for(let n of r.effects)n.is(e)&&(s=n.value),n.is(Co)&&(s=[]);return s},provide:s=>Kt.from(s)});return{active:i,extension:[i,P.define(s=>new tl(s,o,i,e,t.hoverTime||300)),_n]}}function ol(o,t){let e=o.plugin(xe);if(!e)return null;let i=e.manager.tooltips.indexOf(t);return i<0?null:e.manager.tooltipViews[i]}function rl(o){return o.facet(Kt).some(t=>t)}const Co=bt.define(),nl=Co.of(null);function ll(o){let t=o.plugin(xe);t&&t.maybeMeasure()}const fi=C.define({combine(o){let t,e;for(let i of o)t=t||i.topContainer,e=e||i.bottomContainer;return{topContainer:t,bottomContainer:e}}});function hl(o){return o?[fi.of(o)]:[]}function al(o,t){let e=o.plugin(Mo),i=e?e.specs.indexOf(t):-1;return i>-1?e.panels[i]:null}const Mo=P.fromClass(class{constructor(o){this.input=o.state.facet(pi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(o));let t=o.state.facet(fi);this.top=new Ce(o,!0,t.topContainer),this.bottom=new Ce(o,!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(o){let t=o.state.facet(fi);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ce(o.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ce(o.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=o.state.facet(pi);if(e!=this.input){let i=e.filter(h=>h),s=[],r=[],n=[],l=[];for(let h of i){let c=this.specs.indexOf(h),a;c<0?(a=h(o.view),l.push(a)):(a=this.panels[c],a.update&&a.update(o)),s.push(a),(a.top?r:n).push(a)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(n);for(let h of l)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let i of this.panels)i.update&&i.update(o)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:o=>A.scrollMargins.of(t=>{let e=t.plugin(o);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})});class Ce{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=ko(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=ko(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 ko(o){let t=o.nextSibling;return o.remove(),t}const pi=C.define({enables:Mo});class et extends ki{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}et.prototype.elementClass="",et.prototype.toDOM=void 0,et.prototype.mapMode=vt.TrackBefore,et.prototype.startSide=et.prototype.endSide=-1,et.prototype.point=!0;const Yt=C.define(),Ao=C.define(),cl={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>N.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Xt=C.define();function dl(o){return[mi(),Xt.of(Object.assign(Object.assign({},cl),o))]}const gi=C.define({combine:o=>o.some(t=>t)});function mi(o){let t=[ul];return o&&o.fixed===!1&&t.push(gi.of(!0)),t}const ul=P.fromClass(class{constructor(o){this.view=o,this.prevViewport=o.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=o.state.facet(Xt).map(t=>new Oo(o,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!o.state.facet(gi),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),o.scrollDOM.insertBefore(this.dom,o.contentDOM)}update(o){if(this.updateGutters(o)){let t=this.prevViewport,e=o.view.viewport,i=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(i<(e.to-e.from)*.8)}o.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(gi)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=o.view.viewport}syncGutters(o){let t=this.dom.nextSibling;o&&this.dom.remove();let e=N.iter(this.view.state.facet(Yt),this.view.viewport.from),i=[],s=this.gutters.map(r=>new fl(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let n=!0;for(let l of r.type)if(l.type==F.Text&&n){wi(e,i,l.from);for(let h of s)h.line(this.view,l,i);n=!1}else if(l.widget)for(let h of s)h.widget(this.view,l)}else if(r.type==F.Text){wi(e,i,r.from);for(let n of s)n.line(this.view,r,i)}else if(r.widget)for(let n of s)n.widget(this.view,r);for(let r of s)r.finish();o&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(o){let t=o.startState.facet(Xt),e=o.state.facet(Xt),i=o.docChanged||o.heightChanged||o.viewportChanged||!N.eq(o.startState.facet(Yt),o.state.facet(Yt),o.view.viewport.from,o.view.viewport.to);if(t==e)for(let s of this.gutters)s.update(o)&&(i=!0);else{i=!0;let s=[];for(let r of e){let n=t.indexOf(r);n<0?s.push(new Oo(this.view,r)):(this.gutters[n].update(o),s.push(this.gutters[n]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let o of this.gutters)o.destroy();this.dom.remove()}},{provide:o=>A.scrollMargins.of(t=>{let e=t.plugin(o);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==R.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Do(o){return Array.isArray(o)?o:[o]}function wi(o,t,e){for(;o.value&&o.from<=e;)o.from==e&&t.push(o.value),o.next()}class fl{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=N.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:s}=this,r=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==s.elements.length){let l=new To(t,n,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(t,n,r,i);this.height=e.bottom,this.i++}line(t,e,i){let s=[];wi(this.cursor,s,e.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(t,e,s);r&&s.unshift(r);let n=this.gutter;s.length==0&&!n.config.renderEmptyElements||this.addElement(t,e,s)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e),s=i?[i]:null;for(let r of t.state.facet(Ao)){let n=r(t,e.widget,e);n&&(s||(s=[])).push(n)}s&&this.addElement(t,e,s)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Oo{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,s=>{let r=s.target,n;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let h=r.getBoundingClientRect();n=(h.top+h.bottom)/2}else n=s.clientY;let l=t.lineBlockAtHeight(n-t.documentTop);e.domEventHandlers[i](t,l,s)&&s.preventDefault()});this.markers=Do(e.markers(t)),e.initialSpacer&&(this.spacer=new To(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=Do(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],t);s!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[s])}let i=t.view.viewport;return!N.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 To{constructor(t,e,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="
5cm-gutterElement",this.update(t,e,i,s)}update(t,e,i,s){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),pl(this.markers,s)||this.setMarkers(t,s)}setMarkers(t,e){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,n=0;;){let l=n,h=r<e.length?e[r++]:null,c=!1;if(h){let a=h.elementClass;a&&(i+=" "+a);for(let d=n;d<this.markers.length;d++)if(this.markers[d].compare(h)){l=d,c=!0;break}}else l=this.markers.length;for(;n<l;){let a=this.markers[n++];if(a.toDOM){a.destroy(s);let d=s.nextSibling;s.remove(),s=d}}if(!h)break;h.toDOM&&(c?s=s.nextSibling:this.dom.insertBefore(h.toDOM(t),s)),c&&n++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}}function pl(o,t){if(o.length!=t.length)return!1;for(let e=0;e<o.length;e++)if(!o[e].compare(t[e]))return!1;return!0}const Eo=C.define(),Ro=C.define(),Dt=C.define({combine(o){return De(o,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let s in e){let r=i[s],n=e[s];i[s]=r?(l,h,c)=>r(l,h,c)||n(l,h,c):n}return i}})}});class vi extends et{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function bi(o,t){return o.state.facet(Dt).formatNumber(t,o.state)}const gl=Xt.compute([Dt],o=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Eo)},lineMarker(t,e,i){return i.some(s=>s.toDOM)?null:new vi(bi(t,t.state.doc.lineAt(e.from).number))},widgetMarker:(t,e,i)=>
5{for(let s of t.state.facet(Ro)){let r=s(t,e,i);if(r)return r}return null},lineMarkerChange:t=>t.startState.facet(Dt)!=t.state.facet(Dt),initialSpacer(t){return new vi(bi(t,Bo(t.state.doc.lines)))},updateSpacer(t,e){let i=bi(e.view,Bo(e.view.state.doc.lines));return i==t.number?t:new vi(i)},domEventHandlers:o.facet(Dt).domEventHandlers}));function ml(o={}){return[Dt.of(o),mi(),gl]}function Bo(o){let t=9;for(;t<o;)t=t*10+9;return t}const wl=new class extends et{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},vl=Yt.compute(["selection"],o=>{let t=[],e=-1;for(let i of o.selection.ranges){let s=o.doc.lineAt(i.head).from;s>e&&(e=s,t.push(wl.range(s)))}return N.of(t)});function bl(){return vl}const Lo=new Map;function yl(o){let t=Lo.get(o);return t||Lo.set(o,t=E.mark({attributes:o==="	"?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":o.replace(/ /g,"\xB7")}})),t}function Po(o){return P.define(t=>({decorations:o.createDeco(t),update(e){this.decorations=o.updateDeco(e,this.decorations)}}),{decorations:t=>t.decorations})}const xl=Po(new ve({regexp:/\t| +/g,decoration:o=>yl(o[0]),boundary:/\S/}));function Sl(){return xl}const Cl=Po(new ve({regexp:/\s+$/g,decoration:E.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function Ml(){return Cl}const kl={HeightMap:z,HeightOracle:js,MeasuredHeights:Us,QueryType:T,ChangedRange:K,computeOrder:_i,moveVisually:is,clearHeightChangeFlag:ti,getHeightChangeFlag:()=>mt};export{tt as BidiSpan,U as BlockInfo,F as BlockType,E as Decoration,R as Direction,A as EditorView,et as GutterMarker,ve as MatchDecorator,Ot as RectangleMarker,P as ViewPlugin,$t as ViewUpdate,pt as WidgetType,kl as __test,nl as closeHoverTooltips,Un as crosshairCursor,bn as drawSelection,kn as dropCursor,yn as getDrawSelectionConfig,al as getPanel,ol as getTooltip,dl as gutter,Yt as gutterLineClass,Ao as gutterWidgetClass,mi as gutters,rl as hasHoverTooltips,Nn as highlightActiveLine,bl as highlightActiveLineGutter,En as highlightSpecialChars,Ml as highlightTrailingWhitespace,Sl as highlightWhitespace,sl as hoverTooltip,no as keymap,li as layer,Eo as lineNumberMarkers,Ro as lineNumberWidgetMarker,ml as lineNumbers,G as logException,hl as panels,In as placeholder,Xn as rectangularSelection,ll as repositionTooltips,fn as runScopeHandlers,Vn as scrollPastEnd,pi as showPanel,ui as showTooltip,$n as tooltips};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.