PageSourceSearch

https://www.maestro.io/static/js/app.cbf4677.js

js maestro.io collected 2026-09-24 18:23:22 UTC 413,532 bytes, 28 lines download raw bytes

1(function(){try{var xi=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Qt=new xi.Error().stack;Qt&&(xi._sentryDebugIds=xi._sentryDebugIds||{},xi._sentryDebugIds[Qt]="34bf2a31-3e6f-4c14-9e85-97bc2a935220",xi._sentryDebugIdIdentifier="sentry-dbid-34bf2a31-3e6f-4c14-9e85-97bc2a935220")}catch{}})();var _global=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};_global.SENTRY_RELEASE={id:"6b3b5bcd49ac3ca4e22832378da81add8169a867"},(self.webpackChunk_maestro_io_client=self.webpackChunk_maestro_io_client||[]).push([[930],{504452:(xi,Qt)=>{var Ke,v;/*!
2	Copyright (c) 2018 Jed Watson.
3	Licensed under the MIT License (MIT), see
4	http://jedwatson.github.io/classnames
5*/(function(){"use strict";var ie={}.hasOwnProperty;function z(){for(var Re="",Ie=0;Ie<arguments.length;Ie++){var it=arguments[Ie];it&&(Re=Je(Re,Oe(it)))}return Re}function Oe(Re){if(typeof Re=="string"||typeof Re=="number")return Re;if(typeof Re!="object")return"";if(Array.isArray(Re))return z.apply(null,Re);if(Re.toString!==Object.prototype.toString&&!Re.toString.toString().includes("[native code]"))return Re.toString();var Ie="";for(var it in Re)ie.call(Re,it)&&Re[it]&&(Ie=Je(Ie,it));return Ie}function Je(Re,Ie){return Ie?Re?Re+" "+Ie:Re+Ie:Re}xi.exports?(z.default=z,xi.exports=z):(Ke=[],v=function(){return z}.apply(Qt,Ke),v!==void 0&&(xi.exports=v))})()},309714:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{Ar:()=>zt,Bc:()=>o,Gw:()=>he,OO:()=>Fe,et:()=>Ie,wm:()=>ee,yU:()=>Ve});var v=Ke(924835),ie=Ke(896765),z=Ke(963960);class Oe{constructor(p,b,T,L){this.state=p,this.pos=b,this.explicit=T,this.view=L,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(p){let b=(0,z.mv)(this.state).resolveInner(this.pos,-1);for(;b&&p.indexOf(b.name)<0;)b=b.parent;return b?{from:b.from,to:this.pos,text:this.state.sliceDoc(b.from,this.pos),type:b.type}:null}matchBefore(p){let b=this.state.doc.lineAt(this.pos),T=Math.max(b.from,this.pos-250),L=b.text.slice(T-b.from,this.pos-b.from),K=L.search(jt(p,!1));return K<0?null:{from:T+K,to:this.pos,text:L.slice(K)}}get aborted(){return this.abortListeners==null}addEventListener(p,b,T){p=="abort"&&this.abortListeners&&(this.abortListeners.push(b),T&&T.onDocChange&&(this.abortOnDocChange=!0))}}function Je(A){let p=Object.keys(A).join(""),b=/\w/.test(p);return b&&(p=p.replace(/\w/g,"")),`[${b?"\\w":""}${p.replace(/[^\w\s]/g,"\\$&")}]`}function Re(A){let p=Object.create(null),b=Object.create(null);for(let{label:L}of A){p[L[0]]=!0;for(let K=1;K<L.length;K++)b[L[K]]=!0}let T=Je(p)+Je(b)+"*$";return[new RegExp("^"+T),new RegExp(T)]}function Ie(A){let p=A.map(L=>typeof L=="string"?{label:L}:L),[b,T]=p.every(L=>/^\w+$/.test(L.label))?[/\w*$/,/\w+$/]:Re(p);return L=>{let K=L.matchBefore(T);return K||L.explicit?{from:K?K.from:L.pos,options:p,validFor:b}:null}}function it(A,p){return b=>{for(let T=syntaxTree(b.state).resolveInner(b.pos,-1);T;T=T.parent){if(A.indexOf(T.name)>-1)return p(b);if(T.type.isTop)break}return null}}function zt(A,p){return b=>{for(let T=(0,z.mv)(b.state).resolveInner(b.pos,-1);T;T=T.parent){if(A.indexOf(T.name)>-1)return null;if(T.type.isTop)break}return p(b)}}class bt{constructor(p,b,T,L){this.completion=p,this.source=b,this.match=T,this.score=L}}function nt(A){return A.selection.main.from}function jt(A,p){var b;let{source:T}=A,L=p&&T[0]!="^",K=T[T.length-1]!="$";return!L&&!K?A:new RegExp(`${L?"^":""}(?:${T})${K?"$":""}`,(b=A.flags)!==null&&b!==void 0?b:A.ignoreCase?"i":"")}const Ze=v.YH.define();function at(A,p,b,T){let{main:L}=A.selection,K=b-L.from,te=T-L.from;return Object.assign(Object.assign({},A.changeByRange(ae=>{if(ae!=L&&b!=T&&A.sliceDoc(ae.from+K,ae.from+te)!=A.sliceDoc(b,T))return{range:ae};let oe=A.toText(p);return{changes:{from:ae.from+K,to:T==L.from?ae.to:ae.from+te,insert:oe},range:v.OF.cursor(ae.from+K+oe.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const Dt=new WeakMap;function ei(A){if(!Array.isArray(A))return A;let p=Dt.get(A);return p||Dt.set(A,p=Ie(A)),p}const Ht=v.Pe.define(),pi=v.Pe.define();class ai{constructor(p){this.pattern=p,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let b=0;b<p.length;){let T=(0,v.vS)(p,b),L=(0,v.Fh)(T);this.chars.push(T);let K=p.slice(b,b+L),te=K.toUpperCase();this.folded.push((0,v.vS)(te==K?K.toLowerCase():te,0)),b+=L}
5this.astral=p.length!=this.chars.length}ret(p,b){return this.score=p,this.matched=b,this}match(p){if(this.pattern.length==0)return this.ret(-100,[]);if(p.length<this.pattern.length)return null;let{chars:b,folded:T,any:L,precise:K,byWord:te}=this;if(b.length==1){let Gt=(0,v.vS)(p,0),Bi=(0,v.Fh)(Gt),ki=Bi==p.length?0:-100;if(Gt!=b[0])if(Gt==T[0])ki+=-200;else return null;return this.ret(ki,[0,Bi])}let ae=p.indexOf(this.pattern);if(ae==0)return this.ret(p.length==this.pattern.length?0:-100,[0,this.pattern.length]);let oe=b.length,Se=0;if(ae<0){for(let Gt=0,Bi=Math.min(p.length,200);Gt<Bi&&Se<oe;){let ki=(0,v.vS)(p,Gt);(ki==b[Se]||ki==T[Se])&&(L[Se++]=Gt),Gt+=(0,v.Fh)(ki)}if(Se<oe)return null}let xe=0,He=0,ht=!1,Ot=0,ni=-1,ui=-1,wi=/[a-z]/.test(p),vi=!0;for(let Gt=0,Bi=Math.min(p.length,200),ki=0;Gt<Bi&&He<oe;){let Si=(0,v.vS)(p,Gt);ae<0&&(xe<oe&&Si==b[xe]&&(K[xe++]=Gt),Ot<oe&&(Si==b[Ot]||Si==T[Ot]?(Ot==0&&(ni=Gt),ui=Gt+1,Ot++):Ot=0));let _i,k=Si<255?Si>=48&&Si<=57||Si>=97&&Si<=122?2:Si>=65&&Si<=90?1:0:(_i=(0,v.MK)(Si))!=_i.toLowerCase()?1:_i!=_i.toUpperCase()?2:0;(!Gt||k==1&&wi||ki==0&&k!=0)&&(b[He]==Si||T[He]==Si&&(ht=!0)?te[He++]=Gt:te.length&&(vi=!1)),ki=k,Gt+=(0,v.Fh)(Si)}return He==oe&&te[0]==0&&vi?this.result(-100+(ht?-200:0),te,p):Ot==oe&&ni==0?this.ret(-200-p.length+(ui==p.length?0:-100),[0,ui]):ae>-1?this.ret(-700-p.length,[ae,ae+this.pattern.length]):Ot==oe?this.ret(-200+-700-p.length,[ni,ui]):He==oe?this.result(-100+(ht?-200:0)+-700+(vi?0:-1100),te,p):b.length==2?null:this.result((L[0]?-700:0)+-200+-1100,L,p)}result(p,b,T){let L=[],K=0;for(let te of b){let ae=te+(this.astral?(0,v.Fh)((0,v.vS)(T,te)):1);K&&L[K-1]==te?L[K-1]=ae:(L[K++]=te,L[K++]=ae)}return this.ret(p-T.length,L)}}class mt{constructor(p){this.pattern=p,this.matched=[],this.score=0,this.folded=p.toLowerCase()}match(p){if(p.length<this.pattern.length)return null;let b=p.slice(0,this.pattern.length),T=b==this.pattern?0:b.toLowerCase()==this.folded?-200:null;return T==null?null:(this.matched=[0,b.length],this.score=T+(p.length==this.pattern.length?0:-100),this)}}const st=v.sj.define({combine(A){return(0,v.QR)(A,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:ft,filterStrict:!1,compareCompletions:(p,b)=>p.label.localeCompare(b.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(p,b)=>p&&b,closeOnBlur:(p,b)=>p&&b,icons:(p,b)=>p&&b,tooltipClass:(p,b)=>T=>St(p(T),b(T)),optionClass:(p,b)=>T=>St(p(T),b(T)),addToOptions:(p,b)=>p.concat(b),filterStrict:(p,b)=>p||b})}});function St(A,p){return A?p?A+" "+p:A:p}function ft(A,p,b,T,L,K){let te=A.textDirection==ie.OP.RTL,ae=te,oe=!1,Se="top",xe,He,ht=p.left-L.left,Ot=L.right-p.right,ni=T.right-T.left,ui=T.bottom-T.top;if(ae&&ht<Math.min(ni,Ot)?ae=!1:!ae&&Ot<Math.min(ni,ht)&&(ae=!0),ni<=(ae?ht:Ot))xe=Math.max(L.top,Math.min(b.top,L.bottom-ui))-p.top,He=Math.min(400,ae?ht:Ot);else{oe=!0,He=Math.min(400,(te?p.right:L.right-p.left)-30);let Gt=L.bottom-p.bottom;Gt>=ui||Gt>p.top?xe=b.bottom-p.top:(Se="bottom",xe=p.bottom-b.top)}let wi=(p.bottom-p.top)/K.offsetHeight,vi=(p.right-p.left)/K.offsetWidth;return{style:`${Se}: ${xe/wi}px; max-width: ${He/vi}px`,class:"cm-completionInfo-"+(oe?te?"left-narrow":"right-narrow":ae?"left":"right")}}function Vt(A){let p=A.addToOptions.slice();return A.icons&&p.push({render(b){let T=document.createElement("div");return T.classList.add("cm-completionIcon"),b.type&&T.classList.add(...b.type.split(/\s+/g).map(L=>"cm-completionIcon-"+L)),T.setAttribute("aria-hidden","true"),T},position:20}),p.push({render(b,T,L,K){let te=document.createElement("span");te.className="cm-completionLabel";let ae=b.displayLabel||b.label,oe=0;for(let Se=0;Se<K.length;){let xe=K[Se++],He=K[Se++];xe>oe&&te.appendChild(document.createTextNode(ae.slice(oe,xe)));let ht=te.appendChild(document.createElement("span"));ht.appendChild(document.createTextNode(ae.slice(xe,He))),ht.className="cm-completionMatchedText",oe=He}return oe<ae.length&&te.appendChild(document.createTextNode(ae.slice(oe))),te},position:50},{render(b){if(!b.detail)return null;let T=document.createElement("span");
vendor: 6,412 bytes, line 5
5return T.className="cm-completionDetail",T.textContent=b.detail,T},position:80}),p.sort((b,T)=>b.position-T.position).map(b=>b.render)}function wt(A,p,b){if(A<=b)return{from:0,to:A};if(p<0&&(p=0),p<=A>>1){let L=Math.floor(p/b);return{from:L*b,to:(L+1)*b}}let T=Math.floor((A-p)/b);return{from:A-(T+1)*b,to:A-T*b}}class Ci{constructor(p,b,T){this.view=p,this.stateField=b,this.applyCompletion=T,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:oe=>this.placeInfo(oe),key:this},this.space=null,this.currentClass="";let L=p.state.field(b),{options:K,selected:te}=L.open,ae=p.state.facet(st);this.optionContent=Vt(ae),this.optionClass=ae.optionClass,this.tooltipClass=ae.tooltipClass,this.range=wt(K.length,te,ae.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(p.state),this.dom.addEventListener("mousedown",oe=>{let{options:Se}=p.state.field(b).open;for(let xe=oe.target,He;xe&&xe!=this.dom;xe=xe.parentNode)if(xe.nodeName=="LI"&&(He=/-(\d+)$/.exec(xe.id))&&+He[1]<Se.length){this.applyCompletion(p,Se[+He[1]]),oe.preventDefault();return}}),this.dom.addEventListener("focusout",oe=>{let Se=p.state.field(this.stateField,!1);Se&&Se.tooltip&&p.state.facet(st).closeOnBlur&&oe.relatedTarget!=p.contentDOM&&p.dispatch({effects:pi.of(null)})}),this.showOptions(K,L.id)}mount(){this.updateSel()}showOptions(p,b){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(p,b,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(p){var b;let T=p.state.field(this.stateField),L=p.startState.field(this.stateField);if(this.updateTooltipClass(p.state),T!=L){let{options:K,selected:te,disabled:ae}=T.open;(!L.open||L.open.options!=K)&&(this.range=wt(K.length,te,p.state.facet(st).maxRenderedOptions),this.showOptions(K,T.id)),this.updateSel(),ae!=((b=L.open)===null||b===void 0?void 0:b.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!ae)}}updateTooltipClass(p){let b=this.tooltipClass(p);if(b!=this.currentClass){for(let T of this.currentClass.split(" "))T&&this.dom.classList.remove(T);for(let T of b.split(" "))T&&this.dom.classList.add(T);this.currentClass=b}}positioned(p){this.space=p,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let p=this.view.state.field(this.stateField),b=p.open;if((b.selected>-1&&b.selected<this.range.from||b.selected>=this.range.to)&&(this.range=wt(b.options.length,b.selected,this.view.state.facet(st).maxRenderedOptions),this.showOptions(b.options,p.id)),this.updateSelectedOption(b.selected)){this.destroyInfo();let{completion:T}=b.options[b.selected],{info:L}=T;if(!L)return;let K=typeof L=="string"?document.createTextNode(L):L(T);if(!K)return;"then"in K?K.then(te=>{te&&this.view.state.field(this.stateField,!1)==p&&this.addInfoPane(te,T)}).catch(te=>(0,ie.c_)(this.view.state,te,"completion info")):this.addInfoPane(K,T)}}addInfoPane(p,b){this.destroyInfo();let T=this.info=document.createElement("div");if(T.className="cm-tooltip cm-completionInfo",p.nodeType!=null)T.appendChild(p),this.infoDestroy=null;else{let{dom:L,destroy:K}=p;T.appendChild(L),this.infoDestroy=K||null}this.dom.appendChild(T),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(p){let b=null;for(let T=this.list.firstChild,L=this.range.from;T;T=T.nextSibling,L++)T.nodeName!="LI"||!T.id?L--:L==p?T.hasAttribute("aria-selected")||(T.setAttribute("aria-selected","true"),b=T):T.hasAttribute("aria-selected")&&T.removeAttribute("aria-selected");return b&&mi(this.list,b),b}measureInfo(){let p=this.dom.querySelector("[aria-selected]");if(!p||!this.info)return null;let b=this.dom.getBoundingClientRect(),T=this.info.getBoundingClientRect(),L=p.getBoundingClientRect(),K=this.space;if(!K){let te=this.dom.ownerDocument.documentElement;K={left:0,top:0,right:te.clientWidth,bottom:te.clientHeight}}return L.top>Math.min(K.bottom,b.bottom)-10||L.bottom<Math.max(K.top,b.top)+10?null:this.view.state.facet(st).positionInfo(this.view,b,L,T,K,this.dom)}placeInfo(p){this.info&&(p?(p.style&&(this.info.style.cssText=p.style),this.info.className="cm-tooltip cm-completionInfo "+(p.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(p,b,T){const L=document.createElement("ul");L.id=b,L.setAttribute("role","listbox"),L.setAttribute("aria-expanded","true"),L.setAttribute("aria-label",this.view.state.phrase("Completions")),L.addEventListener("mousedown",te=>{te.target==L&&te.preventDefault()});let K=null;for(let te=T.from;te<T.to;te++){let{completion:ae,match:oe}=p[te],{section:Se}=ae;if(Se){let ht=typeof Se=="string"?Se:Se.name;if(ht!=K&&(te>T.from||T.from==0))if(K=ht,typeof Se!="string"&&Se.header)L.appendChild(Se.header(Se));else{let Ot=L.appendChild(document.createElement("completion-section"));Ot.textContent=ht}}const xe=L.appendChild(document.createElement("li"));xe.id=b+"-"+te,xe.setAttribute("role","option");let He=this.optionClass(ae);He&&(xe.className=He);for(let ht of this.optionContent){let Ot=ht(ae,this.view.state,this.view,oe);Ot&&xe.appendChild(Ot)}}return T.from&&L.classList.add("cm-completionListIncompleteTop"),T.to<p.length&&L.classList.add("cm-completionListIncompleteBottom"),L}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function oi(A,p){return b=>new Ci(b,A,p)}function mi(A,p){let b=A.getBoundingClientRect(),T=p.getBoundingClientRect(),L=b.height/A.offsetHeight;T.top<b.top?A.scrollTop-=(b.top-T.top)/L:T.bottom>b.bottom&&(A.scrollTop+=(T.bottom-b.bottom)/L)}function Yt(A){return(A.boost||0)*100+(A.apply?10:0)+(A.info?5:0)+(A.type?1:0)}function dt(A,p){let b=[],T=null,L=Se=>{b.push(Se);let{section:xe}=Se.completion;if(xe){T||(T=[]);let He=typeof xe=="string"?xe:xe.name;T.some(ht=>ht.name==He)||T.push(typeof xe=="string"?{name:He}:xe)}},K=p.facet(st);for(let Se of A)if(Se.hasResult()){let xe=Se.result.getMatch;if(Se.result.filter===!1)for(let He of Se.result.options)L(new bt(He,Se.source,xe?xe(He):[],1e9-b.length));else{let He=p.sliceDoc(Se.from,Se.to),ht,Ot=K.filterStrict?new mt(He):new ai(He);for(let ni of Se.result.options)if(ht=Ot.match(ni.label)){let ui=ni.displayLabel?xe?xe(ni,ht.matched):[]:ht.matched;L(new bt(ni,Se.source,ui,ht.score+(ni.boost||0)))}}}if(T){let Se=Object.create(null),xe=0,He=(ht,Ot)=>
5{var ni,ui;return((ni=ht.rank)!==null&&ni!==void 0?ni:1e9)-((ui=Ot.rank)!==null&&ui!==void 0?ui:1e9)||(ht.name<Ot.name?-1:1)};for(let ht of T.sort(He))xe-=1e5,Se[ht.name]=xe;for(let ht of b){let{section:Ot}=ht.completion;Ot&&(ht.score+=Se[typeof Ot=="string"?Ot:Ot.name])}}let te=[],ae=null,oe=K.compareCompletions;for(let Se of b.sort((xe,He)=>He.score-xe.score||oe(xe.completion,He.completion))){let xe=Se.completion;!ae||ae.label!=xe.label||ae.detail!=xe.detail||ae.type!=null&&xe.type!=null&&ae.type!=xe.type||ae.apply!=xe.apply||ae.boost!=xe.boost?te.push(Se):Yt(Se.completion)>Yt(ae)&&(te[te.length-1]=Se),ae=Se.completion}return te}class pt{constructor(p,b,T,L,K,te){this.options=p,this.attrs=b,this.tooltip=T,this.timestamp=L,this.selected=K,this.disabled=te}setSelected(p,b){return p==this.selected||p>=this.options.length?this:new pt(this.options,hi(b,p),this.tooltip,this.timestamp,p,this.disabled)}static build(p,b,T,L,K,te){if(L&&!te&&p.some(Se=>Se.isPending))return L.setDisabled();let ae=dt(p,b);if(!ae.length)return L&&p.some(Se=>Se.isPending)?L.setDisabled():null;let oe=b.facet(st).selectOnOpen?0:-1;if(L&&L.selected!=oe&&L.selected!=-1){let Se=L.options[L.selected].completion;for(let xe=0;xe<ae.length;xe++)if(ae[xe].completion==Se){oe=xe;break}}return new pt(ae,hi(T,oe),{pos:p.reduce((Se,xe)=>xe.hasResult()?Math.min(Se,xe.from):Se,1e8),create:Ai,above:K.aboveCursor},L?L.timestamp:Date.now(),oe,!1)}map(p){return new pt(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:p.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new pt(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Jt{constructor(p,b,T){this.active=p,this.id=b,this.open=T}static start(){return new Jt(gi,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(p){let{state:b}=p,T=b.facet(st),K=(T.override||b.languageDataAt("autocomplete",nt(b)).map(ei)).map(oe=>(this.active.find(xe=>xe.source==oe)||new Ct(oe,this.active.some(xe=>xe.state!=0)?1:0)).update(p,T));K.length==this.active.length&&K.every((oe,Se)=>oe==this.active[Se])&&(K=this.active);let te=this.open,ae=p.effects.some(oe=>oe.is(li));te&&p.docChanged&&(te=te.map(p.changes)),p.selection||K.some(oe=>oe.hasResult()&&p.changes.touchesRange(oe.from,oe.to))||!Ue(K,this.active)||ae?te=pt.build(K,b,this.id,te,T,ae):te&&te.disabled&&!K.some(oe=>oe.isPending)&&(te=null),!te&&K.every(oe=>!oe.isPending)&&K.some(oe=>oe.hasResult())&&(K=K.map(oe=>oe.hasResult()?new Ct(oe.source,0):oe));for(let oe of p.effects)oe.is(Kt)&&(te=te&&te.setSelected(oe.value,this.id));return K==this.active&&te==this.open?this:new Jt(K,this.id,te)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ti:kt}}function Ue(A,p){if(A==p)return!0;for(let b=0,T=0;;){for(;b<A.length&&!A[b].hasResult();)b++;for(;T<p.length&&!p[T].hasResult();)T++;let L=b==A.length,K=T==p.length;if(L||K)return L==K;if(A[b++].result!=p[T++].result)return!1}}const ti={"aria-autocomplete":"list"},kt={};function hi(A,p){let b={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":A};return p>-1&&(b["aria-activedescendant"]=A+"-"+p),b}const gi=[];function Mt(A,p){if(A.isUserEvent("input.complete")){let T=A.annotation(Ze);if(T&&p.activateOnCompletion(T))return 12}let b=A.isUserEvent("input.type");return b&&p.activateOnTyping?5:b?1:A.isUserEvent("delete.backward")?2:A.selection?8:A.docChanged?16:0}class Ct{constructor(p,b,T=!1){this.source=p,this.state=b,this.explicit=T}hasResult(){return!1}get isPending(){return this.state==1}update(p,b){let T=Mt(p,b),L=this;(T&8||T&16&&this.touches(p))&&(L=new Ct(L.source,0)),T&4&&L.state==0&&(L=new Ct(this.source,1)),L=L.updateFor(p,T);for(let K of p.effects)if(K.is(Ht))L=new Ct(L.source,1,K.value);else if(K.is(pi))L=new Ct(L.source,0);else if(K.is(li))for(let te of K.value)te.source==L.source&&(L=te);return L}updateFor(p,b){return this.map(p.changes)}map(p){return this}touches(p){return p.changes.touchesRange(nt(p.state))}}class vt extends Ct{constructor(p,b,T,L,K,te){super(p,3,b),this.limit=T,this.result=L,this.from=K,this.to=te}hasResult(){return!0}updateFor(p,b){var T;if(!(b&3))return this.map(p.changes);let L=this.result;L.map&&!p.changes.empty&&(L=L.map(L,p.changes));let K=p.changes.mapPos(this.from),te=p.changes.mapPos(this.to,1),ae=nt(p.state);if(ae>te||!L||b&2&&(nt(p.startState)==this.from||ae<this.limit))return new Ct(this.source,b&4?1:0);let oe=p.changes.mapPos(this.limit);return Ft(L.validFor,p.state,K,te)?new vt(this.source,this.explicit,oe,L,K,te):L.update&&(L=L.update(L,K,te,new Oe(p.state,ae,!1)))?new vt(this.source,this.explicit,oe,L,L.from,(T=L.to)!==null&&T!==void 0?T:nt(p.state)):new Ct(this.source,1,this.explicit)}map(p){return p.empty?this:(this.result.map?this.result.map(this.result,p):this.result)?new vt(this.source,this.explicit,p.mapPos(this.limit),this.result,p.mapPos(this.from),p.mapPos(this.to,1)):new Ct(this.source,0)}touches(p){return p.changes.touchesRange(this.from,this.to)}}function Ft(A,p,b,T){if(!A)return!1;let L=p.sliceDoc(b,T);return typeof A=="function"?A(L,b,T,p):jt(A,!0).test(L)}const li=v.Pe.define({map(A,p){return A.map(b=>b.map(p))}}),Kt=v.Pe.define(),xt=v.sU.define({create(){return Jt.start()},update(A,p){return A.update(p)},provide:A=>[ie.DK.from(A,p=>p.tooltip),ie.Lz.contentAttributes.from(A,p=>p.attrs)]});function Et(A,p){const b=p.completion.apply||p.completion.label;let T=A.state.field(xt).active.find(L=>
5L.source==p.source);return T instanceof vt?(typeof b=="string"?A.dispatch(Object.assign(Object.assign({},at(A.state,b,T.from,T.to)),{annotations:Ze.of(p.completion)})):b(A,p.completion,T.from,T.to),!0):!1}const Ai=oi(xt,Et);function Lt(A,p="option"){return b=>{let T=b.state.field(xt,!1);if(!T||!T.open||T.open.disabled||Date.now()-T.open.timestamp<b.state.facet(st).interactionDelay)return!1;let L=1,K;p=="page"&&(K=(0,ie.Eg)(b,T.open.tooltip))&&(L=Math.max(2,Math.floor(K.dom.offsetHeight/K.dom.querySelector("li").offsetHeight)-1));let{length:te}=T.open.options,ae=T.open.selected>-1?T.open.selected+L*(A?1:-1):A?0:te-1;return ae<0?ae=p=="page"?0:te-1:ae>=te&&(ae=p=="page"?te-1:0),b.dispatch({effects:Kt.of(ae)}),!0}}const bi=A=>{let p=A.state.field(xt,!1);return A.state.readOnly||!p||!p.open||p.open.selected<0||p.open.disabled||Date.now()-p.open.timestamp<A.state.facet(st).interactionDelay?!1:Et(A,p.open.options[p.open.selected])},Me=A=>A.state.field(xt,!1)?(A.dispatch({effects:Ht.of(!0)}),!0):!1,ii=A=>{let p=A.state.field(xt,!1);return!p||!p.active.some(b=>b.state!=0)?!1:(A.dispatch({effects:pi.of(null)}),!0)};class Q{constructor(p,b){this.active=p,this.context=b,this.time=Date.now(),this.updates=[],this.done=void 0}}const q=50,pe=1e3,re=ie.Z9.fromClass(class{constructor(A){this.view=A,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let p of A.state.field(xt).active)p.isPending&&this.startQuery(p)}update(A){let p=A.state.field(xt),b=A.state.facet(st);if(!A.selectionSet&&!A.docChanged&&A.startState.field(xt)==p)return;let T=A.transactions.some(K=>{let te=Mt(K,b);return te&8||(K.selection||K.docChanged)&&!(te&3)});for(let K=0;K<this.running.length;K++){let te=this.running[K];if(T||te.context.abortOnDocChange&&A.docChanged||te.updates.length+A.transactions.length>q&&Date.now()-te.time>pe){for(let ae of te.context.abortListeners)try{ae()}catch(oe){(0,ie.c_)(this.view.state,oe)}te.context.abortListeners=null,this.running.splice(K--,1)}else te.updates.push(...A.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),A.transactions.some(K=>K.effects.some(te=>te.is(Ht)))&&(this.pendingStart=!0);let L=this.pendingStart?50:b.activateOnTypingDelay;if(this.debounceUpdate=p.active.some(K=>K.isPending&&!this.running.some(te=>te.active.source==K.source))?setTimeout(()=>this.startUpdate(),L):-1,this.composing!=0)for(let K of A.transactions)K.isUserEvent("input.type")?this.composing=2:this.composing==2&&K.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:A}=this.view,p=A.field(xt);for(let b of p.active)b.isPending&&!this.running.some(T=>T.active.source==b.source)&&this.startQuery(b);this.running.length&&p.open&&p.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(st).updateSyncTime))}startQuery(A){let{state:p}=this.view,b=nt(p),T=new Oe(p,b,A.explicit,this.view),L=new Q(A,T);this.running.push(L),Promise.resolve(A.source(T)).then(K=>{L.context.aborted||(L.done=K||null,this.scheduleAccept())},K=>{this.view.dispatch({effects:pi.of(null)}),(0,ie.c_)(this.view.state,K)})}scheduleAccept(){this.running.every(A=>A.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(st).updateSyncTime))}accept(){var A;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let p=[],b=this.view.state.facet(st),T=this.view.state.field(xt);for(let L=0;L<this.running.length;L++){let K=this.running[L];if(K.done===void 0)continue;if(this.running.splice(L--,1),K.done){let ae=nt(K.updates.length?K.updates[0].startState:this.view.state),oe=Math.min(ae,K.done.from+(K.active.explicit?0:1)),Se=new vt(K.active.source,K.active.explicit,oe,K.done,K.done.from,(A=K.done.to)!==null&&A!==void 0?A:ae);for(let xe of K.updates)Se=Se.update(xe,b);if(Se.hasResult()){p.push(Se);continue}}let te=T.active.find(ae=>ae.source==K.active.source);if(te&&te.isPending)if(K.done==null){let ae=new Ct(K.active.source,0);for(let oe of K.updates)ae=ae.update(oe,b);ae.isPending||p.push(ae)}else this.startQuery(te)}(p.length||T.open&&T.open.disabled)&&this.view.dispatch({effects:li.of(p)})}},{eventHandlers:{blur(A){let p=this.view.state.field(xt,!1);if(p&&p.tooltip&&this.view.state.facet(st).closeOnBlur){let b=p.open&&(0,ie.Eg)(this.view,p.open.tooltip);(!b||!b.dom.contains(A.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:pi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ht.of(!1)}),20),this.composing=0}}}),ve=typeof navigator=="object"&&/Win/.test(navigator.platform),Le=v.Nb.highest(ie.Lz.domEventHandlers({ke
5ydown(A,p){let b=p.state.field(xt,!1);if(!b||!b.open||b.open.disabled||b.open.selected<0||A.key.length>1||A.ctrlKey&&!(ve&&A.altKey)||A.metaKey)return!1;let T=b.open.options[b.open.selected],L=b.active.find(te=>te.source==T.source),K=T.completion.commitCharacters||L.result.commitCharacters;return K&&K.indexOf(A.key)>-1&&Et(p,T),!1}})),Ne=ie.Lz.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Xe{constructor(p,b,T,L){this.field=p,this.line=b,this.from=T,this.to=L}}class ze{constructor(p,b,T){this.field=p,this.from=b,this.to=T}map(p){let b=p.mapPos(this.from,-1,v.iR.TrackDel),T=p.mapPos(this.to,1,v.iR.TrackDel);return b==null||T==null?null:new ze(this.field,b,T)}}class tt{constructor(p,b){this.lines=p,this.fieldPositions=b}instantiate(p,b){let T=[],L=[b],K=p.doc.lineAt(b),te=/^\s*/.exec(K.text)[0];for(let oe of this.lines){if(T.length){let Se=te,xe=/^\t*/.exec(oe)[0].length;for(let He=0;He<xe;He++)Se+=p.facet(z.Xt);L.push(b+Se.length-xe),oe=Se+oe.slice(xe)}T.push(oe),b+=oe.length+1}let ae=this.fieldPositions.map(oe=>new ze(oe.field,L[oe.line]+oe.from,L[oe.line]+oe.to));return{text:T,ranges:ae}}static parse(p){let b=[],T=[],L=[],K;for(let te of p.split(/\r\n?|\n/)){for(;K=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(te);){let ae=K[1]?+K[1]:null,oe=K[2]||K[3]||"",Se=-1,xe=oe.replace(/\\[{}]/g,He=>He[1]);for(let He=0;He<b.length;He++)(ae!=null?b[He].seq==ae:xe&&b[He].name==xe)&&(Se=He);if(Se<0){let He=0;for(;He<b.length&&(ae==null||b[He].seq!=null&&b[He].seq<ae);)He++;b.splice(He,0,{seq:ae,name:xe}),Se=He;for(let ht of L)ht.field>=Se&&ht.field++}L.push(new Xe(Se,T.length,K.index,K.index+xe.length)),te=te.slice(0,K.index)+oe+te.slice(K.index+K[0].length)}te=te.replace(/\\([{}])/g,(ae,oe,Se)=>{for(let xe of L)xe.line==T.length&&xe.from>Se&&(xe.from--,xe.to--);return oe}),T.push(te)}return new tt(T,L)}}let qe=ie.NZ.widget({widget:new class extends ie.xO{toDOM(){let A=document.createElement("span");
5return A.className="cm-snippetFieldPosition",A}ignoreEvent(){return!1}}}),we=ie.NZ.mark({class:"cm-snippetField"});class ut{constructor(p,b){this.ranges=p,this.active=b,this.deco=ie.NZ.set(p.map(T=>(T.from==T.to?qe:we).range(T.from,T.to)))}map(p){let b=[];for(let T of this.ranges){let L=T.map(p);if(!L)return null;b.push(L)}return new ut(b,this.active)}selectionInsideField(p){return p.ranges.every(b=>this.ranges.some(T=>T.field==this.active&&T.from<=b.from&&T.to>=b.to))}}const gt=v.Pe.define({map(A,p){return A&&A.map(p)}}),Nt=v.Pe.define(),yt=v.sU.define({create(){return null},update(A,p){for(let b of p.effects){if(b.is(gt))return b.value;if(b.is(Nt)&&A)return new ut(A.ranges,b.value)}return A&&p.docChanged&&(A=A.map(p.changes)),A&&p.selection&&!A.selectionInsideField(p.selection)&&(A=null),A},provide:A=>ie.Lz.decorations.from(A,p=>p?p.deco:ie.NZ.none)});function Pe(A,p){return v.OF.create(A.filter(b=>b.field==p).map(b=>v.OF.range(b.from,b.to)))}function Bt(A){let p=tt.parse(A);return(b,T,L,K)=>{let{text:te,ranges:ae}=p.instantiate(b.state,L),{main:oe}=b.state.selection,Se={changes:{from:L,to:K==oe.from?oe.to:K,insert:v.EY.of(te)},scrollIntoView:!0,annotations:T?[Ze.of(T),v.ZX.userEvent.of("input.complete")]:void 0};if(ae.length&&(Se.selection=Pe(ae,0)),ae.some(xe=>xe.field>0)){let xe=new ut(ae,0),He=Se.effects=[gt.of(xe)];b.state.field(yt,!1)===void 0&&He.push(v.Pe.appendConfig.of([yt,Y,Ae,Ne]))}b.dispatch(b.state.update(Se))}}function Xt(A){return({state:p,dispatch:b})=>{let T=p.field(yt,!1);if(!T||A<0&&T.active==0)return!1;let L=T.active+A,K=A>0&&!T.ranges.some(te=>te.field==L+A);return b(p.update({selection:Pe(T.ranges,L),effects:gt.of(K?null:new ut(T.ranges,L)),scrollIntoView:!0})),!0}}const $t=({state:A,dispatch:p})=>A.field(yt,!1)?(p(A.update({effects:gt.of(null)})),!0):!1,ci=Xt(1),Mi=Xt(-1);function _(A){let p=A.field(yt,!1);return!!(p&&p.ranges.some(b=>b.field==p.active+1))}function M(A){let p=A.field(yt,!1);return!!(p&&p.active>0)}const H=[{key:"Tab",run:ci,shift:Mi},{key:"Escape",run:$t}],V=v.sj.define({combine(A){return A.length?A[0]:H}}),Y=v.Nb.highest(ie.w4.compute([V],A=>A.facet(V)));function he(A,p){return Object.assign(Object.assign({},p),{apply:Bt(A)})}const Ae=ie.Lz.domEventHandlers({mousedown(A,p){let b=p.state.field(yt,!1),T;if(!b||(T=p.posAtCoords({x:A.clientX,y:A.clientY}))==null)return!1;let L=b.ranges.find(K=>K.from<=T&&K.to>=T);return!L||L.field==b.active?!1:(p.dispatch({selection:Pe(b.ranges,L.field),effects:gt.of(b.ranges.some(K=>K.field>L.field)?new ut(b.ranges,L.field):null),scrollIntoView:!0}),!0)}});function ke(A){let p=A.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${p}]+`,"ug")}catch{return new RegExp(`[w${p}]`,"g")}}function _e(A,p){return new RegExp(p(A.source),A.unicode?"u":"")}const Qe=null;function Wt(A){return Qe[A]||(Qe[A]=new WeakMap)}function Rt(A,p,b,T,L){for(let K=A.iterLines(),te=0;!K.next().done;){let{value:ae}=K,oe;for(p.lastIndex=0;oe=p.exec(ae);)if(!T[oe[0]]&&te+oe.index!=L&&(b.push({type:"text",label:oe[0]}),T[oe[0]]=!0,b.length>=2e3))return;te+=ae.length+1}}function fi(A,p,b,T,L){let K=A.length>=1e3,te=K&&p.get(A);if(te)return te;let ae=[],oe=Object.create(null);if(A.children){let Se=0;for(let xe of A.children){if(xe.length>=1e3)for(let He of fi(xe,p,b,T-Se,L-Se))oe[He.label]||(oe[He.label]=!0,ae.push(He));else Rt(xe,b,ae,oe,L-Se);Se+=xe.length+1}}else Rt(A,b,ae,oe,L);return K&&ae.length<2e3&&p.set(A,ae),ae}const Ut=A=>{let p=A.state.languageDataAt("wordChars",A.pos).join(""),b=ke(p),T=A.matchBefore(_e(b,te=>te+"$"));if(!T&&!A.explicit)return null;let L=T?T.from:A.pos,K=fi(A.state.doc,Wt(p),b,5e4,L);return{from:L,options:K,validFor:_e(b,te=>"^"+te)}},_t={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},P=v.Pe.define({map(A,p){let b=p.mapPos(A,-1,v.iR.TrackAfter);return b??void 0}}),ne=new class extends v.FB{};ne.startSide=1,ne.endSide=-1;const ce=v.sU.define({create(){return v.om.empty},update(A,p){if(A=A.map(p.changes),p.selection){let b=p.state.doc.lineAt(p.selection.main.head);A=A.update({filter:T=>T>=b.from&&T<=b.to})}for(let b of p.effects)b.is(P)&&(A=A.update({add:[ne.range(b.value,b.value+1)]}));return A}});function ee(){return[je,ce]}const J="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function Ee(A){for(let p=0;p<J.length;p+=2)if(J.charCodeAt(p)==A)return J.charAt(p+1);return(0,v.MK)(A<128?A:A+1)}function De(A,p){return A.languageDataAt("closeBrackets",p)[0]||_t}const Ye=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),je=ie.Lz.inputHandler.of((A,p,b,T)=>{if((Ye?A.composing:A.compositionStarted)||A.state.readOnly)return!1;let L=A.state.selection.main;if(T.length>2||T.length==2&&(0,v.Fh)((0,v.vS)(T,0))==1||p!=L.from||b!=L.to)return!1;let K=l(A.state,T);
5return K?(A.dispatch(K),!0):!1}),o=[{key:"Backspace",run:({state:A,dispatch:p})=>{if(A.readOnly)return!1;let T=De(A,A.selection.main.head).brackets||_t.brackets,L=null,K=A.changeByRange(te=>{if(te.empty){let ae=S(A.doc,te.head);for(let oe of T)if(oe==ae&&m(A.doc,te.head)==Ee((0,v.vS)(oe,0)))return{changes:{from:te.head-oe.length,to:te.head+oe.length},range:v.OF.cursor(te.head-oe.length)}}return{range:L=te}});return L||p(A.update(K,{scrollIntoView:!0,userEvent:"delete.backward"})),!L}}];function l(A,p){let b=De(A,A.selection.main.head),T=b.brackets||_t.brackets;for(let L of T){let K=Ee((0,v.vS)(L,0));if(p==L)return K==L?j(A,L,T.indexOf(L+L+L)>-1,b):C(A,L,K,b.before||_t.before);if(p==K&&f(A,A.selection.main.from))return R(A,L,K)}return null}function f(A,p){let b=!1;return A.field(ce).between(0,A.doc.length,T=>{T==p&&(b=!0)}),b}function m(A,p){let b=A.sliceString(p,p+2);return b.slice(0,(0,v.Fh)((0,v.vS)(b,0)))}function S(A,p){let b=A.sliceString(p-2,p);return(0,v.Fh)((0,v.vS)(b,0))==b.length?b:b.slice(1)}function C(A,p,b,T){let L=null,K=A.changeByRange(te=>{if(!te.empty)return{changes:[{insert:p,from:te.from},{insert:b,from:te.to}],effects:P.of(te.to+p.length),range:v.OF.range(te.anchor+p.length,te.head+p.length)};let ae=m(A.doc,te.head);return!ae||/\s/.test(ae)||T.indexOf(ae)>-1?{changes:{insert:p+b,from:te.head},effects:P.of(te.head+p.length),range:v.OF.cursor(te.head+p.length)}:{range:L=te}});return L?null:A.update(K,{scrollIntoView:!0,userEvent:"input.type"})}function R(A,p,b){let T=null,L=A.changeByRange(K=>K.empty&&m(A.doc,K.head)==b?{changes:{from:K.head,to:K.head+b.length,insert:b},range:v.OF.cursor(K.head+b.length)}:T={range:K});return T?null:A.update(L,{scrollIntoView:!0,userEvent:"input.type"})}function j(A,p,b,T){let L=T.stringPrefixes||_t.stringPrefixes,K=null,te=A.changeByRange(ae=>{if(!ae.empty)return{changes:[{insert:p,from:ae.from},{insert:p,from:ae.to}],effects:P.of(ae.to+p.length),range:v.OF.range(ae.anchor+p.length,ae.head+p.length)};let oe=ae.head,Se=m(A.doc,oe),xe;if(Se==p){if(le(A,oe))return{changes:{insert:p+p,from:oe},effects:P.of(oe+p.length),range:v.OF.cursor(oe+p.length)};if(f(A,oe)){let ht=b&&A.sliceDoc(oe,oe+p.length*3)==p+p+p?p+p+p:p;return{changes:{from:oe,to:oe+ht.length,insert:ht},range:v.OF.cursor(oe+ht.length)}}}else{if(b&&A.sliceDoc(oe-2*p.length,oe)==p+p&&(xe=Ce(A,oe-2*p.length,L))>-1&&le(A,xe))return{changes:{insert:p+p+p+p,from:oe},effects:P.of(oe+p.length),range:v.OF.cursor(oe+p.length)};if(A.charCategorizer(oe)(Se)!=v.Je.Word&&Ce(A,oe,L)>-1&&!ye(A,oe,p,L))return{changes:{insert:p+p,from:oe},effects:P.of(oe+p.length),range:v.OF.cursor(oe+p.length)}}return{range:K=ae}});return K?null:A.update(te,{scrollIntoView:!0,userEvent:"input.type"})}function le(A,p){let b=(0,z.mv)(A).resolveInner(p+1);return b.parent&&b.from==p}function ye(A,p,b,T){let L=(0,z.mv)(A).resolveInner(p,-1),K=T.reduce((te,ae)=>Math.max(te,ae.length),0);for(let te=0;te<5;te++){let ae=A.sliceDoc(L.from,Math.min(L.to,L.from+b.length+K)),oe=ae.indexOf(b);if(!oe||oe>-1&&T.indexOf(ae.slice(0,oe))>-1){let xe=L.firstChild;for(;xe&&xe.from==L.from&&xe.to-xe.from>b.length+oe;){if(A.sliceDoc(xe.to-b.length,xe.to)==b)return!1;xe=xe.firstChild}return!0}let Se=L.to==p&&L.parent;if(!Se)break;L=Se}return!1}function Ce(A,p,b){let T=A.charCategorizer(p);if(T(A.sliceDoc(p-1,p))!=v.Je.Word)return p;for(let L of b){let K=p-L.length;if(A.sliceDoc(K,p)==L&&T(A.sliceDoc(K-1,K))!=v.Je.Word)return K}return-1}function Ve(A={}){return[Le,xt,st.of(A),re,Tt,Ne]}const Fe=[{key:"Ctrl-Space",run:Me},{mac:"Alt-`",run:Me},{key:"Escape",run:ii},{key:"ArrowDown",run:Lt(!0)},{key:"ArrowUp",run:Lt(!1)},{key:"PageDown",run:Lt(!0,"page")},{key:"PageUp",run:Lt(!1,"page")},{key:"Enter",run:bi}],Tt=v.Nb.highest(ie.w4.computeN([st],A=>A.facet(st).defaultKeymap?[Fe]:[]));function Oi(A){let p=A.field(xt,!1);return p&&p.active.some(b=>b.isPending)?"pending":p&&p.active.some(b=>b.state!=0)?"active":null}const qt=new WeakMap;function Fi(A){var p;let b=(p=A.field(xt,!1))===null||p===void 0?void 0:p.open;if(!b||b.disabled)return[];let T=qt.get(b.options);return T||qt.set(b.options,T=b.options.map(L=>L.completion)),T}function Ri(A){var p;let b=(p=A.field(xt,!1))===null||p===void 0?void 0:p.open;return b&&!b.disabled&&b.selected>=0?b.options[b.selected].completion:null}function Ni(A){var p;let b=(p=A.field(xt,!1))===null||p===void 0?void 0:p.open;return b&&!b.disabled&&b.selected>=0?b.selected:null}function zi(A){return Kt.of(A)}},798720:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{Yc:()=>Un,b6:()=>wt,cL:()=>bi,pw:()=>Kn});var v=Ke(924835),ie=Ke(896765),z=Ke(963960),Oe=Ke(117203);const Je=u=>{let{state:w}=u,F=w.doc.lineAt(w.selection.main.from),I=at(u.state,F.from);return I.line?Ie(u):I.block?Ze(u):!1};function Re(u,w){return({state:F,dispatch:I})=>{if(F.readOnly)return!1;let U=u(w,F);return U?(I(F.update(U)),!0):!1}}
5const Ie=Re(ai,0),it=null,zt=null,bt=Re(pi,0),nt=null,jt=null,Ze=Re((u,w)=>pi(u,w,Ht(w)),0);function at(u,w){let F=u.languageDataAt("commentTokens",w);return F.length?F[0]:{}}const Dt=50;function ei(u,{open:w,close:F},I,U){let W=u.sliceDoc(I-Dt,I),Z=u.sliceDoc(U,U+Dt),be=/\s*$/.exec(W)[0].length,Be=/^\s*/.exec(Z)[0].length,ct=W.length-be;if(W.slice(ct-w.length,ct)==w&&Z.slice(Be,Be+F.length)==F)return{open:{pos:I-be,margin:be&&1},close:{pos:U+Be,margin:Be&&1}};let rt,Pt;U-I<=2*Dt?rt=Pt=u.sliceDoc(I,U):(rt=u.sliceDoc(I,I+Dt),Pt=u.sliceDoc(U-Dt,U));let Zt=/^\s*/.exec(rt)[0].length,yi=/\s*$/.exec(Pt)[0].length,si=Pt.length-yi-F.length;return rt.slice(Zt,Zt+w.length)==w&&Pt.slice(si,si+F.length)==F?{open:{pos:I+Zt+w.length,margin:/\s/.test(rt.charAt(Zt+w.length))?1:0},close:{pos:U-yi-F.length,margin:/\s/.test(Pt.charAt(si-1))?1:0}}:null}function Ht(u){let w=[];for(let F of u.selection.ranges){let I=u.doc.lineAt(F.from),U=F.to<=I.to?I:u.doc.lineAt(F.to);U.from>I.from&&U.from==F.to&&(U=F.to==I.to+1?I:u.doc.lineAt(F.to-1));let W=w.length-1;W>=0&&w[W].to>I.from?w[W].to=U.to:w.push({from:I.from+/^\s*/.exec(I.text)[0].length,to:U.to})}return w}function pi(u,w,F=w.selection.ranges){let I=F.map(W=>at(w,W.from).block);if(!I.every(W=>W))return null;let U=F.map((W,Z)=>ei(w,I[Z],W.from,W.to));if(u!=2&&!U.every(W=>W))return{changes:w.changes(F.map((W,Z)=>U[Z]?[]:[{from:W.from,insert:I[Z].open+" "},{from:W.to,insert:" "+I[Z].close}]))};if(u!=1&&U.some(W=>W)){let W=[];for(let Z=0,be;Z<U.length;Z++)if(be=U[Z]){let Be=I[Z],{open:ct,close:rt}=be;W.push({from:ct.pos-Be.open.length,to:ct.pos+ct.margin},{from:rt.pos-rt.margin,to:rt.pos+Be.close.length})}return{changes:W}}return null}function ai(u,w,F=w.selection.ranges){let I=[],U=-1;for(let{from:W,to:Z}of F){let be=I.length,Be=1e9,ct=at(w,W).line;if(ct){for(let rt=W;rt<=Z;){let Pt=w.doc.lineAt(rt);if(Pt.from>U&&(W==Z||Z>Pt.from)){U=Pt.from;let Zt=/^\s*/.exec(Pt.text)[0].length,yi=Zt==Pt.length,si=Pt.text.slice(Zt,Zt+ct.length)==ct?Zt:-1;Zt<Pt.text.length&&Zt<Be&&(Be=Zt),I.push({line:Pt,comment:si,token:ct,indent:Zt,empty:yi,single:!1})}rt=Pt.to+1}if(Be<1e9)for(let rt=be;rt<I.length;rt++)I[rt].indent<I[rt].line.text.length&&(I[rt].indent=Be);I.length==be+1&&(I[be].single=!0)}}if(u!=2&&I.some(W=>W.comment<0&&(!W.empty||W.single))){let W=[];for(let{line:be,token:Be,indent:ct,empty:rt,single:Pt}of I)(Pt||!rt)&&W.push({from:be.from+ct,insert:Be+" "});let Z=w.changes(W);return{changes:Z,selection:w.selection.map(Z,1)}}else if(u!=1&&I.some(W=>W.comment>=0)){let W=[];for(let{line:Z,comment:be,token:Be}of I)if(be>=0){let ct=Z.from+be,rt=ct+Be.length;Z.text[rt-Z.from]==" "&&rt++,W.push({from:ct,to:rt})}return{changes:W}}return null}const mt=v.YH.define(),st=v.YH.define(),St=v.sj.define(),ft=v.sj.define({combine(u){return(0,v.QR)(u,{minDepth:100,newGroupDelay:500,joinToEvent:(w,F)=>F},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(w,F)=>(I,U)=>w(I,U)||F(I,U)})}}),Vt=v.sU.define({create(){return Lt.empty},update(u,w){let F=w.state.facet(ft),I=w.annotation(mt);if(I){let Be=kt.fromTransaction(w,I.selection),ct=I.side,rt=ct==0?u.undone:u.done;return Be?rt=hi(rt,rt.length,F.minDepth,Be):rt=li(rt,w.startState.selection),new Lt(ct==0?I.rest:rt,ct==0?rt:I.rest)}let U=w.annotation(st);if((U=="full"||U=="before")&&(u=u.isolate()),w.annotation(v.ZX.addToHistory)===!1)return w.changes.empty?u:u.addMapping(w.changes.desc);let W=kt.fromTransaction(w),Z=w.annotation(v.ZX.time),be=w.annotation(v.ZX.userEvent);return W?u=u.addChanges(W,Z,be,F,w):w.selection&&(u=u.addSelection(w.startState.selection,Z,be,F.newGroupDelay)),(U=="full"||U=="after")&&(u=u.isolate()),u},toJSON(u){return{done:u.done.map(w=>w.toJSON()),undone:u.undone.map(w=>w.toJSON())}},fromJSON(u){return new Lt(u.done.map(kt.fromJSON),u.undone.map(kt.fromJSON))}});function wt(u={}){return[Vt,ft.of(u),ie.Lz.domEventHandlers({beforeinput(w,F){let I=w.inputType=="historyUndo"?mi:w.inputType=="historyRedo"?Yt:null;return I?(w.preventDefault(),I(F)):!1}})]}const Ci=null;function oi(u,w){return function({state:F,dispatch:I}){if(!w&&F.readOnly)return!1;let U=F.field(Vt,!1);if(!U)return!1;let W=U.pop(u,F,w);return W?(I(W),!0):!1}}const mi=oi(0,!1),Yt=oi(1,!1),dt=oi(0,!0),pt=oi(1,!0);function Jt(u){return function(w){let F=w.field(Vt,!1);if(!F)return 0;let I=u==0?F.done:F.undone;return I.length-(I.length&&!I[0].changes?1:0)}}const Ue=null,ti=null;class kt{constructor(w,F,I,U,W){this.changes=w,this.effects=F,this.mapped=I,this.startSelection=U,this.selectionsAfter=W}setSelAfter(w){return new kt(this.changes,this.effects,this.mapped,this.startSelection,w)}toJSON(){var w,F,I;return{changes:(w=this.changes)===null||w===void 0?void 0:w.toJSON(),mapped:(F=this.mapped)===null||F===void 0?void 0:F.toJSON(),startSelection:(I=this.startSelection)===null||I===void 0?void 0:I.toJSON(),selectionsAfter:this.selectionsAfter.map(U=>U.toJSON())}}static fromJSON(w){return new kt(w.changes&&v.VR.fromJSON(w.changes),[],w.mapped&&v.Gu.fromJSON(w.mapped),w.startSelection&&v.OF.fromJSON(w.startSelection),w.selectionsAfter.map(v.OF.fromJSON))}static fromTransaction(w,F){let I=vt;for(let U of w.startState.facet(St)){let W=U(w);W.length&&(I=I.concat(W))}return!I.length&&w.changes.empty?null:new kt(w.changes.invert(w.startState.doc),I,void 0,F||w.startState.selection,vt)}static selection(w){return new kt(void 0,vt,void 0,void 0,w)}}function hi(u,w,F,I){let U=w+1>F+20?w-F-1:0,W=u.slice(U,w);return W.push(I),W}function gi(u,w){let F=[],I=!1;return u.iterChangedRanges((U,W)=>F.push(U,W)),w.iterChangedRanges((U,W,Z,be)=>{for(let Be=0;Be<F.length;){let ct=F[Be++],rt=F[Be++];be>=ct&&Z<=rt&&(I=!0)}}),I}function Mt(u,w){return u.ranges.length==w.ranges.length&&u.ranges.filter((F,I)=>F.empty!=w.ranges[I].empty).length===0}function Ct(u,w){return u.length?w.length?u.concat(w):u:w}const vt=[],Ft=200;function li(u,w){if(u.length){let F=u[u.length-1],I=F.selectionsAfter.slice(Math.max(0,F.selectionsAfter.length-Ft));return I.length&&I[I.length-1].eq(w)?u:(I.push(w),hi(u,u.length-1,1e9,F.setSelAfter(
5I)))}else return[kt.selection([w])]}function Kt(u){let w=u[u.length-1],F=u.slice();return F[u.length-1]=w.setSelAfter(w.selectionsAfter.slice(0,w.selectionsAfter.length-1)),F}function xt(u,w){if(!u.length)return u;let F=u.length,I=vt;for(;F;){let U=Et(u[F-1],w,I);if(U.changes&&!U.changes.empty||U.effects.length){let W=u.slice(0,F);return W[F-1]=U,W}else w=U.mapped,F--,I=U.selectionsAfter}return I.length?[kt.selection(I)]:vt}function Et(u,w,F){let I=Ct(u.selectionsAfter.length?u.selectionsAfter.map(be=>be.map(w)):vt,F);if(!u.changes)return kt.selection(I);let U=u.changes.map(w),W=w.mapDesc(u.changes,!0),Z=u.mapped?u.mapped.composeDesc(W):W;return new kt(U,v.Pe.mapEffects(u.effects,w),Z,u.startSelection.map(W),I)}const Ai=/^(input\.type|delete)($|\.)/;class Lt{constructor(w,F,I=0,U=void 0){this.done=w,this.undone=F,this.prevTime=I,this.prevUserEvent=U}isolate(){return this.prevTime?new Lt(this.done,this.undone):this}addChanges(w,F,I,U,W){let Z=this.done,be=Z[Z.length-1];return be&&be.changes&&!be.changes.empty&&w.changes&&(!I||Ai.test(I))&&(!be.selectionsAfter.length&&F-this.prevTime<U.newGroupDelay&&U.joinToEvent(W,gi(be.changes,w.changes))||I=="input.type.compose")?Z=hi(Z,Z.length-1,U.minDepth,new kt(w.changes.compose(be.changes),Ct(v.Pe.mapEffects(w.effects,be.changes),be.effects),be.mapped,be.startSelection,vt)):Z=hi(Z,Z.length,U.minDepth,w),new Lt(Z,vt,F,I)}addSelection(w,F,I,U){let W=this.done.length?this.done[this.done.length-1].selectionsAfter:vt;return W.length>0&&F-this.prevTime<U&&I==this.prevUserEvent&&I&&/^select($|\.)/.test(I)&&Mt(W[W.length-1],w)?this:new Lt(li(this.done,w),this.undone,F,I)}addMapping(w){return new Lt(xt(this.done,w),xt(this.undone,w),this.prevTime,this.prevUserEvent)}pop(w,F,I){let U=w==0?this.done:this.undone;if(U.length==0)return null;let W=U[U.length-1],Z=W.selectionsAfter[0]||F.selection;if(I&&W.selectionsAfter.length)return F.update({selection:W.selectionsAfter[W.selectionsAfter.length-1],annotations:mt.of({side:w,rest:Kt(U),selection:Z}),userEvent:w==0?"select.undo":"select.redo",scrollIntoView:!0});if(W.changes){let be=U.length==1?vt:U.slice(0,U.length-1);return W.mapped&&(be=xt(be,W.mapped)),F.update({changes:W.changes,selection:W.startSelection,effects:W.effects,annotations:mt.of({side:w,rest:be,selection:Z}),filter:!1,userEvent:w==0?"undo":"redo",scrollIntoView:!0})}else return null}}Lt.empty=new Lt(vt,vt);const bi=[{key:"Mod-z",run:mi,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Yt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Yt,preventDefault:!0},{key:"Mod-u",run:dt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:pt,preventDefault:!0}];function Me(u,w){return v.OF.create(u.ranges.map(w),u.mainIndex)}function ii(u,w){return u.update({selection:w,scrollIntoView:!0,userEvent:"select"})}function Q({state:u,dispatch:w},F){let I=Me(u.selection,F);return I.eq(u.selection,!0)?!1:(w(ii(u,I)),!0)}function q(u,w){return v.OF.cursor(w?u.to:u.from)}function pe(u,w){return Q(u,F=>F.empty?u.moveByChar(F,w):q(F,w))}function re(u){return u.textDirectionAt(u.state.selection.main.head)==ie.OP.LTR}const ve=u=>pe(u,!re(u)),Le=u=>pe(u,re(u)),Ne=u=>pe(u,!0),Xe=u=>pe(u,!1);function ze(u,w,F){let I=w.head,U=u.doc.lineAt(I);return I==(F?U.to:U.from)?I=F?Math.min(u.doc.length,U.to+1):Math.max(0,U.from-1):I=U.from+findClusterBreak(U.text,I-U.from,F),EditorSelection.cursor(I,F?-1:1)}function tt(u,w){return Q(u,F=>F.empty?ze(u.state,F,w):q(F,w))}const qe=u=>tt(u,!0),we=u=>tt(u,!1);function ut(u,w){return Q(u,F=>F.empty?u.moveByGroup(F,w):q(F,w))}const gt=u=>ut(u,!re(u)),Nt=u=>ut(u,re(u)),yt=u=>ut(u,!0),Pe=u=>ut(u,!1);function Bt(u,w,F){let I=u.state.charCategorizer(w),U=I(F),W=U!=CharCategory.Space;return Z=>{let be=I(Z);return be!=CharCategory.Space?W&&be==U:(W=!1,!0)}}const Xt=u=>Q(u,w=>w.empty?u.moveByChar(w,!0,F=>Bt(u,w.head,F)):q(w,!0)),$t=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ci(u,w,F){let I=u.state.charCategorizer(w.from),U=CharCategory.Space,W=w.from,Z=0,be=!1,Be=!1,ct=!1,rt=Zt=>{if(be)return!1;W+=F?Zt.length:-Zt.length;let yi=I(Zt),si;if(yi==CharCategory.Word&&Zt.charCodeAt(0)<128&&/[\W_]/.test(Zt)&&(yi=-1),U==CharCategory.Space&&(U=yi),U!=yi)return!1;if(U==CharCategory.Word)if(Zt.toLowerCase()==Zt){if(!F&&Be)return!1;ct=!0}else if(ct){if(F)return!1;be=!0}else{if(Be&&F&&I(si=u.state.sliceDoc(W,W+1))==CharCategory.Word&&si.toLowerCase()==si)return!1;Be=!0}return Z++,!0},Pt=u.moveByChar(w,F,Zt=>(rt(Zt),rt));if($t&&U==CharCategory.Word&&Pt.from==w.from+Z*(F?1:-1)){let Zt=Math.min(w.head,Pt.head),yi=Math.max(w.head,Pt.head),si=u.state.sliceDoc(Zt,yi);if(si.length>1&&/[\u4E00-\uffff]/.test(si)){let Qi=Array.from($t.segment(si));if(Qi.length>1)return F?EditorSelection.cursor(w.head+Qi[1].index,-1):EditorSelection.cursor(Pt.head+Qi[Qi.length-1].index,1)}}return Pt}function Mi(u,w){return Q(u,F=>F.empty?ci(u,F,w):q(F,w))}const _=u=>Mi(u,!0),M=u=>Mi(u,!1);function H(u,w,F){if(w.type.prop(F))return!0;let I=w.to-w.from;return I&&(I>2||/[^\s,.;
5:]/.test(u.sliceDoc(w.from,w.to)))||w.firstChild}function V(u,w,F){let I=(0,z.mv)(u).resolveInner(w.head),U=F?Oe.uY.closedBy:Oe.uY.openedBy;for(let Be=w.head;;){let ct=F?I.childAfter(Be):I.childBefore(Be);if(!ct)break;H(u,ct,U)?I=ct:Be=F?ct.to:ct.from}let W=I.type.prop(U),Z,be;return W&&(Z=F?(0,z.jU)(u,I.from,1):(0,z.jU)(u,I.to,-1))&&Z.matched?be=F?Z.end.to:Z.end.from:be=F?I.to:I.from,v.OF.cursor(be,F?-1:1)}const Y=u=>Q(u,w=>V(u.state,w,!re(u))),he=u=>Q(u,w=>V(u.state,w,re(u)));function Ae(u,w){return Q(u,F=>{if(!F.empty)return q(F,w);let I=u.moveVertically(F,w);return I.head!=F.head?I:u.moveToLineBoundary(F,w)})}const ke=u=>Ae(u,!1),_e=u=>Ae(u,!0);function Qe(u){let w=u.scrollDOM.clientHeight<u.scrollDOM.scrollHeight-2,F=0,I=0,U;if(w){for(let W of u.state.facet(ie.Lz.scrollMargins)){let Z=W(u);Z?.top&&(F=Math.max(Z?.top,F)),Z?.bottom&&(I=Math.max(Z?.bottom,I))}U=u.scrollDOM.clientHeight-F-I}else U=(u.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:F,marginBottom:I,selfScroll:w,height:Math.max(u.defaultLineHeight,U-5)}}function Wt(u,w){let F=Qe(u),{state:I}=u,U=Me(I.selection,Z=>Z.empty?u.moveVertically(Z,w,F.height):q(Z,w));if(U.eq(I.selection))return!1;let W;if(F.selfScroll){let Z=u.coordsAtPos(I.selection.main.head),be=u.scrollDOM.getBoundingClientRect(),Be=be.top+F.marginTop,ct=be.bottom-F.marginBottom;Z&&Z.top>Be&&Z.bottom<ct&&(W=ie.Lz.scrollIntoView(U.main.head,{y:"start",yMargin:Z.top-Be}))}return u.dispatch(ii(I,U),{effects:W}),!0}const Rt=u=>Wt(u,!1),fi=u=>Wt(u,!0);function Ut(u,w,F){let I=u.lineBlockAt(w.head),U=u.moveToLineBoundary(w,F);if(U.head==w.head&&U.head!=(F?I.to:I.from)&&(U=u.moveToLineBoundary(w,F,!1)),!F&&U.head==I.from&&I.length){let W=/^\s*/.exec(u.state.sliceDoc(I.from,Math.min(I.from+100,I.to)))[0].length;W&&w.head!=I.from+W&&(U=v.OF.cursor(I.from+W))}return U}const _t=u=>Q(u,w=>Ut(u,w,!0)),P=u=>Q(u,w=>Ut(u,w,!1)),ne=u=>Q(u,w=>Ut(u,w,!re(u))),ce=u=>Q(u,w=>Ut(u,w,re(u))),ee=u=>Q(u,w=>v.OF.cursor(u.lineBlockAt(w.head).from,1)),J=u=>Q(u,w=>v.OF.cursor(u.lineBlockAt(w.head).to,-1));function Ee(u,w,F){let I=!1,U=Me(u.selection,W=>{let Z=(0,z.jU)(u,W.head,-1)||(0,z.jU)(u,W.head,1)||W.head>0&&(0,z.jU)(u,W.head-1,1)||W.head<u.doc.length&&(0,z.jU)(u,W.head+1,-1);if(!Z||!Z.end)return W;I=!0;let be=Z.start.from==W.head?Z.end.to:Z.end.from;return F?v.OF.range(W.anchor,be):v.OF.cursor(be)});return I?(w(ii(u,U)),!0):!1}const De=({state:u,dispatch:w})=>Ee(u,w,!1),Ye=({state:u,dispatch:w})=>Ee(u,w,!0);function je(u,w){let F=Me(u.state.selection,I=>{let U=w(I);return v.OF.range(I.anchor,U.head,U.goalColumn,U.bidiLevel||void 0)});return F.eq(u.state.selection)?!1:(u.dispatch(ii(u.state,F)),!0)}function D(u,w){return je(u,F=>u.moveByChar(F,w))}const o=u=>D(u,!re(u)),l=u=>D(u,re(u)),f=u=>D(u,!0),m=u=>D(u,!1),S=u=>je(u,w=>ze(u.state,w,!0)),C=u=>je(u,w=>ze(u.state,w,!1));function R(u,w){return je(u,F=>u.moveByGroup(F,w))}const j=u=>R(u,!re(u)),le=u=>R(u,re(u)),ye=u=>R(u,!0),Ce=u=>R(u,!1),Ve=u=>je(u,w=>u.moveByChar(w,!0,F=>Bt(u,w.head,F)));function Fe(u,w){return je(u,F=>ci(u,F,w))}const Tt=u=>Fe(u,!0),Oi=u=>Fe(u,!1),qt=u=>je(u,w=>V(u.state,w,!re(u))),Fi=u=>je(u,w=>V(u.state,w,re(u)));function Ri(u,w){return je(u,F=>u.moveVertically(F,w))}const Ni=u=>Ri(u,!1),zi=u=>Ri(u,!0);function A(u,w){return je(u,F=>u.moveVertically(F,w,Qe(u).height))}const p=u=>A(u,!1),b=u=>A(u,!0),T=u=>je(u,w=>Ut(u,w,!0)),L=u=>je(u,w=>Ut(u,w,!1)),K=u=>je(u,w=>Ut(u,w,!re(u))),te=u=>je(u,w=>Ut(u,w,re(u))),ae=u=>je(u,w=>v.OF.cursor(u.lineBlockAt(w.head).from)),oe=u=>je(u,w=>v.OF.cursor(u.lineBlockAt(w.head).to)),Se=({state:u,dispatch:w})=>(w(ii(u,{anchor:0})),!0),xe=({state:u,dispatch:w})=>(w(ii(u,{anchor:u.doc.length})),!0),He=({state:u,dispatch:w})=>(w(ii(u,{anchor:u.selection.main.anchor,head:0})),!0),ht=({state:u,dispatch:w})=>(w(ii(u,{anchor:u.selection.main.anchor,head:u.doc.length})),!0),Ot=({state:u,dispatch:w})=>(w(u.update({selection:{anchor:0,head:u.doc.length},userEvent:"select"})),!0),ni=({state:u,dispatch:w})=>{let F=We(u).map(({from:I,to:U})=>v.OF.range(I,Math.min(U+1,u.doc.length)));return w(u.update({selection:v.OF.create(F),userEvent:"select"})),!0},ui=({state:u,dispatch:w})=>{let F=Me(u.selection,I=>{let U=(0,z.mv)(u),W=U.resolveStack(I.from,1);if(I.empty){let Z=U.resolveStack(I.from,-1);Z.node.from>=W.node.from&&Z.node.to<=W.node.to&&(W=Z)}for(let Z=W;Z;Z=Z.next){let{node:be}=Z;if((be.from<I.from&&be.to>=I.to||be.to>I.to&&be.from<=I.from)&&Z.next)return v.OF.range(be.to,be.from)}return I});return F.eq(u.selection)?!1:(w(ii(u,F)),!0)},wi=({state:u,dispatch:w})=>{let F=u.selection,I=null;return F.ranges.length>1?I=v.OF.create([F.main]):F.main.empty||(I=v.OF.create([v.OF.cursor(F.main.head)])),I?(w(ii(u,I)),!0):!1};function vi(u,w){if(u.state.readOnly)return!1;let F="delete.selection",{state:I}=u,U=I.changeByRange(W=>{let{from:Z,to:be}=W;if(Z==be){let Be=w(W);Be<Z?(F="delete.backward",Be=Gt(u,Be,!1)):Be>Z&&(F="delete.forward",Be=Gt(u,Be,!0)),Z=Math.min(Z,Be),be=Math.max(be,Be)}else Z=Gt(u,Z,!1),be=Gt(u,be,!0);return Z==be?{range:W}:{changes:{from:Z,to:be},range:v.OF.cursor(Z,Z<W.head?-1:1)}});return U.changes.empty?!1:(u.dispatch(I.update(U,{scrollIntoView:!0,userEvent:F,effects:F=="delete.selection"?ie.Lz.announce.of(I.phrase("Selection deleted")):void 0})),!0)}function Gt(u,w,F){if(u instanceof ie.Lz)for(let I of u.state.facet(ie.Lz.atomicRanges).map(U=>U(u)))I.between(w,w,(U,W)=>{U<w&&W>w&&(w=F?W:U)});return w}const Bi=(u,w,F)=>vi(u,I=>{let U=I.from,{state:W}=u,Z=W.doc.lineAt(U),be,Be;if(F&&!w&&U>Z.from&&U<Z.from+200&&!/[^ \t]/.test(be=Z.text.slice(0,U-Z.from))){if(be[be.length-1]=="	")return U-1;let ct=(0,v.y$)(be,W.tabSize),rt=ct%(0,z.tp)(W)||(0,z.tp)(W);for(let Pt=0;Pt<rt&&be[be.length-1-Pt]==" ";Pt++)U--;Be=U}else Be=(0,v.zK)(Z.text,U-Z.from,w,w)+Z.from,Be==U&&Z.number!=(w?W.doc.lines:1)?Be+=w?1:-1:!w&&/[\ufe00-\ufe0f]/.test(Z.text.slice(Be-Z.from,U-Z.from))&&(Be=(0,v.zK)(Z.text,Be-Z.from,!1,!1)+Z.from);return Be}),ki=u=>Bi(u,!1,!0),Si=u=>Bi(u,!1,!1),_i=u=>Bi(u,!0,!1),k=(u,w)=>vi(u,F=>{let I=F.head,{state:U}=u,W=U.doc.lineAt(I),Z=U.charCategorizer(I);for(let be=null;;){if(I==(w?W.to:W.from)){I==F.head&&W.number!=(w?U.doc.lines:1)&&(I+=w?1:-1);break}let Be=(0,v.zK)(W.text,I-W.from,w)+W.from,ct=W.text.slice(Math.min(I,Be)-W.from,Math.max(I,Be)-W.from),rt=Z(ct);if(be!=null&&rt!=be)break;(ct!=" "||I!=F.head)&&(be=rt),I=Be}return I}),h=u=>k(u,!1),g=u=>k(u,!0),O=u=>vi(u,w=>{let F=u.lineBlockAt(w.head).to;return w.head<F?F:Math.min(u.state.doc.length,w.head+1)}),B=u=>vi(u,w=>{let F=u.lineBlockAt(w.head).from;return w.head>F?F:Math.max(0,w.head-1)}),$=u=>vi(u,w=>{let F=u.moveToLineBoundary(w,!1).head;return w.head>F?F:Math.max(0,w.head-1)}),G=u=>vi(u,w=>{let F=u.moveToLineBoundary(w,!0).head;return w.head<F?F:Math.min(u.state.doc.length,w.head+1)}),ue=({state:u,dispatch:w})=>{if(u.readOnly)return!1;let F=[];for(let I=0,U="",W=u.doc.iter();;){if(W.next(),W.lineBreak||W.done){let Z=U.search(/\s+$/);if(Z>-1&&F.push({from:I-(U.length-Z),to:I}),W.done)break;U=""}else U=W.value;I+=W.value.length}return F.length?(w(u.update({changes:F,userEvent:"delete"})),!0):!1},fe=({state:u,dispatch:w})=>{if(u.readOnly)return!1;let F=u.changeByRange(I=>({changes:{from:I.from,to:I.to,insert:v.EY.of(["",""])},range:v.OF.cursor(I.from)}));return w(u.update(F,{scrollIntoView:!0,userEvent:"input"})),!0},Te=({state:u,dispatch:w})=>{if(u.readOnly)return!1;let F=u.changeByRange(I=>{if(!I.empty||I.from==0||I.from==u.doc.length)return{range:I};let U=I.from,W=u.doc.lineAt(U),Z=U==W.from?U-1:(0,v.zK)(W.text,U-W.from,!1)+W.from,be=U==W.to?U+1:(0,v.zK)(W.text,U-W.from,!0)+W.from;return{changes:{from:Z,to:be,insert:u.doc.slice(U,be).append(u.doc.slice(Z,U))},range:v.OF.cursor(be)}});return F.changes.empty?!1:(w(u.update(F,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function We(u){let w=[],F=-1;for(let I of u.selection.ranges){let U=u.doc.lineAt(I.from),W=u.doc.lineAt(I.to);if(!I.empty&&I.to==W.from&&(W=u.doc.lineAt(I.to-1)),F>=U.number){let Z=w[w.length-1];Z.to=W.to,Z.ranges.push(I)}else w.push({from:U.from,to:W.to,ranges:[I]});F=W.number+1}return w}function It(u,w,F){if(u.readOnly)return!1;let I=[],U=[];for(let W of We(u)){if(F?W.to==u.doc.length:W.from==0)continue;let Z=u.doc.lineAt(F?W.to+1:W.from-1),be=Z.length+1;if(F){I.push({from:W.to,to:Z.to},{from:W.from,insert:Z.text+u.lineBreak});for(let Be of W.ranges)U.push(v.OF.range(Math.min(u.doc.length,Be.anchor+be),Math.min(u.doc.length,Be.head+be)))}else{I.push({from:Z.from,to:W.from},{from:W.to,insert:u.lineBreak+Z.text});for(let Be of W.ranges)U.push(v.OF.range(Be.anchor-be,Be.head-be))}}return I.length?(w(u.update({changes:I,scrollIntoView:!0,selection:v.OF.create(U,u.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Ei=({state:u,dispatch:w})=>It(u,w,!1),Di=({state:u,dispatch:w})=>It(u,w,!0);function Hi(u,w,F){if(u.readOnly)return!1;let I=[];for(let U of We(u))F?I.push({from:U.from,insert:u.doc.slice(U.from,U.to)+u.lineBreak}):I.push({from:U.to,insert:u.lineBreak+u.doc.slice(U.from,U.to)});return w(u.update({changes:I,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Vi=({state:u,dispatch:w})=>Hi(u,w,!1),Ji=({state:u,dispatch:w})=>Hi(u,w,!0),Xi=u=>{if(u.state.readOnly)return!1;let{state:w}=u,F=w.changes(We(w).map(({from:U,to:W})=>(U>0?U--:W<w.doc.length&&W++,{from:U,to:W}))),I=Me(w.selection,U=>{let W;if(u.lineWrapping){let Z=u.lineBlockAt(U.head),be=u.coordsAtPos(U.head,U.assoc||1);be&&(W=Z.bottom+u.documentTop-be.bottom+u.defaultLineHeight/2)}return u.moveVertically(U,!0,W)}).map(F);return u.dispatch({changes:F,selection:I,scrollIntoView:!0,userEvent:"delete.line"}),!0},Vn=({state:u,dispatch:w})=>(w(u.update(u.replaceSelection(u.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),ms=({state:u,dispatch:w})=>(w(u.update(u.changeByRange(F=>{let I=/^\s*/.exec(u.doc.lineAt(F.from).text)[0];return{changes:{from:F.from,to:F.to,insert:u.lineBreak+I},range:EditorSelection.cursor(F.from+I.length+1)}}),{scrollIntoView:!0,userEvent:"input"})),!0);function Wn(u,w){if(/\(\)|\[\]|\{\}/.test(u.sliceDoc(w-1,w+1)))return{from:w,to:w};let F=(0,z.mv)(u).resolveInner(w),I=F.childBefore(w),U=F.childAfter(w),W;return I&&U&&I.to<=w&&U.from>=w&&(W=I.type.prop(Oe.uY.closedBy))&&W.indexOf(U.name)>-1&&u.doc.lineAt(I.to).from==u.doc.lineAt(U.from).from&&!/\S/.test(u.sliceDoc(I.to,U.from))?{from:I.to,to:U.from}:null}const Zi=Ui(!1),an=Ui(!0);function Ui(u){return({state:w,dispatch:F})=>{if(w.readOnly)return!1;let I=w.changeByRange(U=>{let{from:W,to:Z}=U,be=w.doc.lineAt(W),Be=!u&&W==Z&&Wn(w,W);u&&(W=Z=(Z<=be.to?be:w.doc.lineAt(Z)).to);let ct=new z.KB(w,{simulateBreak:W,simulateDoubleBreak:!!Be}),rt=(0,z._v)(ct,W);for(rt==null&&(rt=(0,v.y$)(/^\s*/.exec(w.doc.lineAt(W).text)[0],w.tabSize));Z<be.to&&/\s/.test(be.text[Z-be.from]);)Z++;Be?{from:W,to:Z}=Be:W>be.from&&W<be.from+100&&!/\S/.test(be.text.slice(0,W))&&(W=be.from);let Pt=["",(0,z.EI)(w,rt)];return Be&&Pt.push((0,z.EI)(w,ct.lineIndent(be.from,-1))),{changes:{from:W,to:Z,insert:v.EY.of(Pt)},range:v.OF.cursor(W+1+Pt[1].length)}});return F(w.update(I,{scrollIntoView:!0,userEvent:"input"})),!0}}function hn(u,w){let F=-1;return u.changeByRange(I=>{let U=[];for(let Z=I.from;Z<=I.to;){let be=u.doc.lineAt(Z);be.number>F&&(I.empty||I.to>be.from)&&(w(be,U,I),F=be.number),Z=be.to+1}let W=u.changes(U);return{changes:U,range:v.OF.range(W.mapPos(I.anchor,1),W.mapPos(I.head,1))}})}const zn=({state:u,dispatch:w})=>{if(u.readOnly)return!1;let F=Object.create(null),I=new z.KB(u,{overrideIndentation:W=>{let Z=F[W];return Z??-1}}),U=hn(u,(W,Z,be)=>{let Be=(0,z._v)(I,W.from);if(Be==null)return;/\S/.test(W.text)||(Be=0);let ct=/^\s*/.exec(W.text)[0],rt=(0,z.EI)(u,Be);(ct!=rt||be.from<W.from+ct.length)&&(F[W.from]=Be,Z.push({from:W.from,to:W.from+ct.length,insert:rt}))});return U.changes.empty||w(u.update(U,{userEvent:"indent"})),!0},sn=({state:u,dispatch:w})=>u.readOnly?!1:(w(u.update(hn(u,(F,I)=>{I.push({from:F.from,insert:u.facet(z.Xt)})}),{userEvent:"input.indent"})),!0),yn=({state:u,dispatch:w})=>u.readOnly?!1:(w(u.update(hn(u,(F,I)=>{let U=/^\s*/.exec(F.text)[0];if(!U)return;let W=(0,v.y$)(U,u.tabSize),Z=0,be=(0,z.EI)(u,Math.max(0,W-(0,z.tp)(u)));for(;
5Z<U.length&&Z<be.length&&U.charCodeAt(Z)==be.charCodeAt(Z);)Z++;I.push({from:F.from+Z,to:F.from+U.length,insert:be.slice(Z)})}),{userEvent:"delete.dedent"})),!0),bn=u=>(u.setTabFocusMode(),!0),wn=u=>(u.setTabFocusMode(2e3),!0),gs=({state:u,dispatch:w})=>u.selection.ranges.some(F=>!F.empty)?sn({state:u,dispatch:w}):(w(u.update(u.replaceSelection("	"),{scrollIntoView:!0,userEvent:"input"})),!0),jn=[{key:"Ctrl-b",run:ve,shift:o,preventDefault:!0},{key:"Ctrl-f",run:Le,shift:l},{key:"Ctrl-p",run:ke,shift:Ni},{key:"Ctrl-n",run:_e,shift:zi},{key:"Ctrl-a",run:ee,shift:ae},{key:"Ctrl-e",run:J,shift:oe},{key:"Ctrl-d",run:_i},{key:"Ctrl-h",run:ki},{key:"Ctrl-k",run:O},{key:"Ctrl-Alt-h",run:h},{key:"Ctrl-o",run:fe},{key:"Ctrl-t",run:Te},{key:"Ctrl-v",run:fi}],$n=[{key:"ArrowLeft",run:ve,shift:o,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:gt,shift:j,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ne,shift:K,preventDefault:!0},{key:"ArrowRight",run:Le,shift:l,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Nt,shift:le,preventDefault:!0},{mac:"Cmd-ArrowRight",run:ce,shift:te,preventDefault:!0},{key:"ArrowUp",run:ke,shift:Ni,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Se,shift:He},{mac:"Ctrl-ArrowUp",run:Rt,shift:p},{key:"ArrowDown",run:_e,shift:zi,preventDefault:!0},{mac:"Cmd-ArrowDown",run:xe,shift:ht},{mac:"Ctrl-ArrowDown",run:fi,shift:b},{key:"PageUp",run:Rt,shift:p},{key:"PageDown",run:fi,shift:b},{key:"Home",run:P,shift:L,preventDefault:!0},{key:"Mod-Home",run:Se,shift:He},{key:"End",run:_t,shift:T,preventDefault:!0},{key:"Mod-End",run:xe,shift:ht},{key:"Enter",run:Zi,shift:Zi},{key:"Mod-a",run:Ot},{key:"Backspace",run:ki,shift:ki},{key:"Delete",run:_i},{key:"Mod-Backspace",mac:"Alt-Backspace",run:h},{key:"Mod-Delete",mac:"Alt-Delete",run:g},{mac:"Mod-Backspace",run:$},{mac:"Mod-Delete",run:G}].concat(jn.map(u=>({mac:u.key,run:u.run,shift:u.shift}))),Kn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Y,shift:qt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:he,shift:Fi},{key:"Alt-ArrowUp",run:Ei},{key:"Shift-Alt-ArrowUp",run:Vi},{key:"Alt-ArrowDown",run:Di},{key:"Shift-Alt-ArrowDown",run:Ji},{key:"Escape",run:wi},{key:"Mod-Enter",run:an},{key:"Alt-l",mac:"Ctrl-l",run:ni},{key:"Mod-i",run:ui,preventDefault:!0},{key:"Mod-[",run:yn},{key:"Mod-]",run:sn},{key:"Mod-Alt-\\",run:zn},{key:"Shift-Mod-k",run:Xi},{key:"Shift-Mod-\\",run:De},{key:"Mod-/",run:Je},{key:"Alt-A",run:bt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:bn}].concat($n),Un={key:"Tab",run:sn,shift:yn}},562348:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{qy:()=>fi});var v=Ke(380567),ie=Ke(73783),z=Ke(963960),Oe=Ke(117203);let Je=null;function Re(){if(!Je&&typeof document=="object"&&document.body){let{style:P}=document.body,ne=[],ce=new Set;for(let ee in P)ee!="cssText"&&ee!="cssFloat"&&typeof P[ee]=="string"&&(/[A-Z]/.test(ee)&&(ee=ee.replace(/[A-Z]/g,J=>"-"+J.toLowerCase())),ce.has(ee)||(ne.push(ee),ce.add(ee)));Je=ne.sort().map(ee=>({type:"property",label:ee,apply:ee+": "}))}return Je||[]}const Ie=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(P=>({type:"class",label:P})),it=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","
5initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(P=>({type:"keyword",label:P})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(P=>({type:"constant",label:P}))),zt=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(P=>({type:"type",label:P})),bt=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supp
5orts","@view-transition"].map(P=>({type:"keyword",label:P})),nt=/^(\w[\w-]*|-\w[\w-]*|)$/,jt=/^-(-[\w-]*)?$/;function Ze(P,ne){var ce;if((P.name=="("||P.type.isError)&&(P=P.parent||P),P.name!="ArgList")return!1;let ee=(ce=P.parent)===null||ce===void 0?void 0:ce.firstChild;return ee?.name!="Callee"?!1:ne.sliceString(ee.from,ee.to)=="var"}const at=new Oe.RY,Dt=["Declaration"];function ei(P){for(let ne=P;;){if(ne.type.isTop)return ne;if(!(ne=ne.parent))return P}}function Ht(P,ne,ce){if(ne.to-ne.from>4096){let ee=at.get(ne);if(ee)return ee;let J=[],Ee=new Set,De=ne.cursor(Oe.Qj.IncludeAnonymous);if(De.firstChild())do for(let Ye of Ht(P,De.node,ce))Ee.has(Ye.label)||(Ee.add(Ye.label),J.push(Ye));while(De.nextSibling());return at.set(ne,J),J}else{let ee=[],J=new Set;return ne.cursor().iterate(Ee=>{var De;if(ce(Ee)&&Ee.matchContext(Dt)&&((De=Ee.node.nextSibling)===null||De===void 0?void 0:De.name)==":"){let Ye=P.sliceString(Ee.from,Ee.to);J.has(Ye)||(J.add(Ye),ee.push({label:Ye,type:"variable"}))}}),ee}}const ai=(P=>ne=>{let{state:ce,pos:ee}=ne,J=(0,z.mv)(ce).resolveInner(ee,-1),Ee=J.type.isError&&J.from==J.to-1&&ce.doc.sliceString(J.from,J.to)=="-";if(J.name=="PropertyName"||(Ee||J.name=="TagName")&&/^(Block|Styles)$/.test(J.resolve(J.to).name))return{from:J.from,options:Re(),validFor:nt};if(J.name=="ValueName")return{from:J.from,options:it,validFor:nt};if(J.name=="PseudoClassName")return{from:J.from,options:Ie,validFor:nt};if(P(J)||(ne.explicit||Ee)&&Ze(J,ce.doc))return{from:P(J)||Ee?J.from:ee,options:Ht(ce.doc,ei(J),P),validFor:jt};if(J.name=="TagName"){for(let{parent:je}=J;je;je=je.parent)if(je.name=="Block")return{from:J.from,options:Re(),validFor:nt};return{from:J.from,options:zt,validFor:nt}}if(J.name=="AtKeyword")return{from:J.from,options:bt,validFor:nt};if(!ne.explicit)return null;let De=J.resolve(ee),Ye=De.childBefore(ee);return Ye&&Ye.name==":"&&De.name=="PseudoClassSelector"?{from:ee,options:Ie,validFor:nt}:Ye&&Ye.name==":"&&De.name=="Declaration"||De.name=="ArgList"?{from:ee,options:it,validFor:nt}:De.name=="Block"||De.name=="Styles"?{from:ee,options:Re(),validFor:nt}:null})(P=>P.name=="VariableName"),mt=z.bj.define({name:"css",parser:ie.K.configure({props:[z.Oh.add({Declaration:(0,z.mz)()}),z.b_.add({"Block KeyframeList":z.yd})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function st(){return new z.Yy(mt,mt.data.of({autocomplete:ai}))}var St=Ke(798941),ft=Ke(924835),Vt=Ke(896765),wt=Ke(309714);const Ci=[(0,wt.Gw)("function ${name}(${params}) {\n	${}\n}",{label:"function",detail:"definition",type:"keyword"}),(0,wt.Gw)("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n	${}\n}",{label:"for",detail:"loop",type:"keyword"}),(0,wt.Gw)("for (let ${name} of ${collection}) {\n	${}\n}",{label:"for",detail:"of loop",type:"keyword"}),(0,wt.Gw)("do {\n	${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),(0,wt.Gw)("while (${}) {\n	${}\n}",{label:"while",detail:"loop",type:"keyword"}),(0,wt.Gw)(`try {
6	\${}
7} catch (\${error}) {
8	\${}
9}`,{label:"try",detail:"/ catch block",type:"keyword"}),(0,wt.Gw)("if (${}) {\n	${}\n}",{label:"if",detail:"block",type:"keyword"}),(0,wt.Gw)(`if (\${}) {
10	\${}
11} else {
12	\${}
13}`,{label:"if",detail:"/ else block",type:"keyword"}),(0,wt.Gw)(`class \${name} {
14	constructor(\${params}) {
15		\${}
16	}
17}`,{label:"class",detail:"definition",type:"keyword"}),(0,wt.Gw)('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),(0,wt.Gw)('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],oi=Ci.concat([(0,wt.Gw)("interface ${name} {\n	${}\n}",{label:"interface",detail:"definition",type:"keyword"}),(0,wt.Gw)("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),(0,wt.Gw)("enum ${name} {\n	${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),mi=new Oe.RY,Yt=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function dt(P){return(ne,ce)=>{let ee=ne.node.getChild("VariableDefinition");return ee&&ce(ee,P),!0}}const pt=["FunctionDeclaration"],Jt={FunctionDeclaration:dt("function"),ClassDeclaration:dt("class"),ClassExpression:()=>!0,EnumDeclaration:dt("constant"),TypeAliasDeclaration:dt("type"),NamespaceDeclaration:dt("namespace"),VariableDefinition(P,ne){P.matchContext(pt)||ne(P,"variable")},TypeDefinition(P,ne){ne(P,"type")},__proto__:null};function Ue(P,ne){let ce=mi.get(ne);if(ce)return ce;let ee=[],J=!0;function Ee(De,Ye){let je=P.sliceString(De.from,De.to);ee.push({label:je,type:Ye})}return ne.cursor(Oe.Qj.IncludeAnonymous).iterate(De=>{if(J)J=!1;else if(De.name){let Ye=Jt[De.name];if(Ye&&Ye(De,Ee)||Yt.has(De.name))return!1}else if(De.to-De.from>8192){for(let Ye of Ue(P,De.node))ee.push(Ye);return!1}}),mi.set(ne,ee),ee}const ti=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,kt=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function hi(P){let ne=(0,z.mv)(P.state).resolveInner(P.pos,-1);if(kt.indexOf(ne.name)>-1)return null;
17let ce=ne.name=="VariableName"||ne.to-ne.from<20&&ti.test(P.state.sliceDoc(ne.from,ne.to));if(!ce&&!P.explicit)return null;let ee=[];for(let J=ne;J;J=J.parent)Yt.has(J.name)&&(ee=ee.concat(Ue(P.state.doc,J)));return{options:ee,from:ce?ne.from:P.pos,validFor:ti}}function gi(P,ne,ce){var ee;let J=[];for(;;){let Ee=ne.firstChild,De;if(Ee?.name=="VariableName")return J.push(P(Ee)),{path:J.reverse(),name:ce};if(Ee?.name=="MemberExpression"&&((ee=De=Ee.lastChild)===null||ee===void 0?void 0:ee.name)=="PropertyName")J.push(P(De)),ne=Ee;else return null}}function Mt(P){let ne=ee=>P.state.doc.sliceString(ee.from,ee.to),ce=syntaxTree(P.state).resolveInner(P.pos,-1);return ce.name=="PropertyName"?gi(ne,ce.parent,ne(ce)):(ce.name=="."||ce.name=="?.")&&ce.parent.name=="MemberExpression"?gi(ne,ce.parent,""):kt.indexOf(ce.name)>-1?null:ce.name=="VariableName"||ce.to-ce.from<20&&ti.test(ne(ce))?{path:[],name:ne(ce)}:ce.name=="MemberExpression"?gi(ne,ce,""):P.explicit?{path:[],name:""}:null}function Ct(P,ne){let ce=[],ee=new Set;for(let J=0;;J++){for(let De of(Object.getOwnPropertyNames||Object.keys)(P)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(De)||ee.has(De))continue;ee.add(De);let Ye;try{Ye=P[De]}catch{continue}ce.push({label:De,type:typeof Ye=="function"?/^[A-Z]/.test(De)?"class":ne?"function":"method":ne?"variable":"property",boost:-J})}let Ee=Object.getPrototypeOf(P);if(!Ee)return ce;P=Ee}}function vt(P){let ne=new Map;return ce=>{let ee=Mt(ce);if(!ee)return null;let J=P;for(let De of ee.path)if(J=J[De],!J)return null;let Ee=ne.get(J);return Ee||ne.set(J,Ee=Ct(J,!ee.path.length)),{from:ce.pos-ee.name.length,options:Ee,validFor:ti}}}const Ft=z.bj.define({name:"javascript",parser:St.K.configure({props:[z.Oh.add({IfStatement:(0,z.mz)({except:/^\s*({|else\b)/}),TryStatement:(0,z.mz)({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:z._Y,SwitchBody:P=>{let ne=P.textAfter,ce=/^\s*\}/.test(ne),ee=/^\s*(case|default)\b/.test(ne);return P.baseIndent+(ce?0:ee?1:2)*P.unit},Block:(0,z.Ay)({closing:"}"}),ArrowFunction:P=>P.baseIndent+P.unit,"TemplateString BlockComment":()=>null,"Statement Property":(0,z.mz)({except:/^{/}),JSXElement(P){let ne=/^\s*<\//.test(P.textAfter);return P.lineIndent(P.node.from)+(ne?0:P.unit)},JSXEscape(P){let ne=/\s*\}/.test(P.textAfter);return P.lineIndent(P.node.from)+(ne?0:P.unit)},"JSXOpenTag JSXSelfClosingTag"(P){return P.column(P.node.from)+P.unit}}),z.b_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":z.yd,BlockComment(P){return{from:P.from+2,to:P.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),li={test:P=>/^JSX/.test(P.name),facet:(0,z.p9)({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Kt=Ft.configure({dialect:"ts"},"typescript"),xt=Ft.configure({dialect:"jsx",props:[z.Q0.add(P=>P.isTop?[li]:void 0)]}),Et=Ft.configure({dialect:"jsx ts",props:[z.Q0.add(P=>P.isTop?[li]:void 0)]},"typescript");let Ai=P=>({label:P,type:"keyword"});const Lt="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Ai),bi=Lt.concat(["declare","implements","private","protected","public"].map(Ai));function Me(P={}){let ne=P.jsx?P.typescript?Et:xt:P.typescript?Kt:Ft,ce=P.typescript?oi.concat(bi):Ci.concat(Lt);return new z.Yy(ne,[Ft.data.of({autocomplete:(0,wt.Ar)(kt,(0,wt.et)(ce))}),Ft.data.of({autocomplete:hi}),P.jsx?pe:[]])}function ii(P){for(;;){if(P.name=="JSXOpenTag"||P.name=="JSXSelfClosingTag"||P.name=="JSXFragmentTag")return P;if(P.name=="JSXEscape"||!P.parent)return null;P=P.parent}}function Q(P,ne,ce=P.length){for(let ee=ne?.firstChild;ee;ee=ee.nextSibling)if(ee.name=="JSXIdentifier"||ee.name=="JSXBuiltin"||ee.name=="JSXNamespacedName"||ee.name=="JSXMemberExpression")return P.sliceString(ee.from,Math.min(ee.to,ce));return""}const q=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),pe=Vt.Lz.inputHandler.of((P,ne,ce,ee,J)=>{if((q?P.composing:P.compositionStarted)||P.state.readOnly||ne!=ce||ee!=">"&&ee!="/"||!Ft.isActiveAt(P.state,ne,-1))return!1;let Ee=J(),{state:De}=Ee,Ye=De.changeByRange(je=>{var D;let{head:o}=je,l=(0,z.mv)(De).resolveInner(o-1,-1),f;if(l.name=="JSXStartTag"&&(l=l.parent),!(De.doc.sliceString(o-1,o)!=ee||l.name=="JSXAttributeValue"&&l.to>o)){if(ee==">"&&l.name=="JSXFragmentTag")return{range:je,changes:{from:o,insert:"</>"}};if(ee=="/"&&l.name=="JSXStartCloseTag"){let m=l.parent,S=m.parent;if(S&&m.from==o-2&&((f=Q(De.doc,S.firstChild,o))||((D=S.firstChild)===null||D===void 0?void 0:D.name)=="JSXFragmentTag")){let C=`${f}>`;return{range:ft.OF.cursor(o+C.length,-1),changes:{from:o,insert:C}}}}else if(ee==">"){let m=ii(l);if(m&&m.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(De.doc.sliceString(o,o+2))&&(f=Q(De.doc,m,o)))return{range:je,changes:{from:o,insert:`</${f}>`}}}}return{range:je}});return Ye.changes.empty?!1:(P.dispatch([Ee,De.update(Ye,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function re(P,ne){return ne||(ne={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}}
17,P.getRules().forEach((ce,ee)=>{ce.meta.docs.recommended&&(ne.rules[ee]=2)})),ce=>{let{state:ee}=ce,J=[];for(let{from:Ee,to:De}of Ft.findRegions(ee)){let Ye=ee.doc.lineAt(Ee),je={line:Ye.number-1,col:Ee-Ye.from,pos:Ee};for(let D of P.verify(ee.sliceDoc(Ee,De),ne))J.push(Le(D,ee.doc,je))}return J}}function ve(P,ne,ce,ee){return ce.line(P+ee.line).from+ne+(P==1?ee.col-1:-1)}function Le(P,ne,ce){let ee=ve(P.line,P.column,ne,ce),J={from:ee,to:P.endLine!=null&&P.endColumn!=1?ve(P.endLine,P.endColumn,ne,ce):ee,message:P.message,source:P.ruleId?"eslint:"+P.ruleId:"eslint",severity:P.severity==1?"warning":"error"};if(P.fix){let{range:Ee,text:De}=P.fix,Ye=Ee[0]+ce.pos-ee,je=Ee[1]+ce.pos-ee;J.actions=[{name:"fix",apply(D,o){D.dispatch({changes:{from:o+Ye,to:o+je,insert:De},scrollIntoView:!0})}}]}return J}const Ne=["_blank","_self","_top","_parent"],Xe=["ascii","utf-8","utf-16","latin1","latin1"],ze=["get","post","put","delete"],tt=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],qe=["true","false"],we={},ut={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ne,hreflang:null}},abbr:we,address:we,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:we,aside:we,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:we,base:{attrs:{href:null,target:Ne}},bdi:we,bdo:we,blockquote:{attrs:{cite:null}},body:we,br:we,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:tt,formmethod:ze,formnovalidate:["novalidate"],formtarget:Ne,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:we,center:we,cite:we,code:we,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:we,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:we,div:we,dl:we,dt:we,em:we,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:we,figure:we,footer:we,form:{attrs:{action:null,name:null,"accept-charset":Xe,autocomplete:["on","off"],enctype:tt,method:ze,novalidate:["novalidate"],target:Ne}},h1:we,h2:we,h3:we,h4:we,h5:we,h6:we,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:we,hgroup:we,hr:we,html:{attrs:{manifest:null}},i:we,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,
vendor: 5,089 bytes, line 17
17step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:tt,formmethod:ze,formnovalidate:["novalidate"],formtarget:Ne,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:we,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:we,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:we,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Xe,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:we,noscript:we,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:we,param:{attrs:{name:null,value:null}},pre:we,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:we,rt:we,ruby:we,samp:we,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Xe}},section:we,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:we,source:{attrs:{src:null,type:null,media:null}},span:we,strong:we,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:we,summary:we,sup:we,table:we,tbody:we,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:we,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:we,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:we,time:{attrs:{datetime:null}},title:we,tr:we,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:we,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:we},gt={accesskey:null,class:null,contenteditable:qe,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:qe,autocorrect:qe,autocapitalize:qe,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":qe,"aria-autocomplete":["inline","list","both","none"],"aria-busy":qe,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":qe,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":qe,"aria-hidden":qe,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":qe,"aria-multiselectable":qe,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":qe,"aria-relevant":null,"aria-required":qe,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Nt="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".
17split(" ").map(P=>"on"+P);for(let P of Nt)gt[P]=null;class yt{constructor(ne,ce){this.tags=Object.assign(Object.assign({},ut),ne),this.globalAttrs=Object.assign(Object.assign({},gt),ce),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}yt.default=new yt;function Pe(P,ne,ce=P.length){if(!ne)return"";let ee=ne.firstChild,J=ee&&ee.getChild("TagName");return J?P.sliceString(J.from,Math.min(J.to,ce)):""}function Bt(P,ne=!1){for(;P;P=P.parent)if(P.name=="Element")if(ne)ne=!1;else return P;return null}function Xt(P,ne,ce){let ee=ce.tags[Pe(P,Bt(ne))];return ee?.children||ce.allTags}function $t(P,ne){let ce=[];for(let ee=Bt(ne);ee&&!ee.type.isTop;ee=Bt(ee.parent)){let J=Pe(P,ee);if(J&&ee.lastChild.name=="CloseTag")break;J&&ce.indexOf(J)<0&&(ne.name=="EndTag"||ne.from>=ee.firstChild.to)&&ce.push(J)}return ce}const ci=/^[:\-\.\w\u00b7-\uffff]*$/;function Mi(P,ne,ce,ee,J){let Ee=/\s*>/.test(P.sliceDoc(J,J+5))?"":">",De=Bt(ce,!0);return{from:ee,to:J,options:Xt(P.doc,De,ne).map(Ye=>({label:Ye,type:"type"})).concat($t(P.doc,ce).map((Ye,je)=>({label:"/"+Ye,apply:"/"+Ye+Ee,type:"type",boost:99-je}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function _(P,ne,ce,ee){let J=/\s*>/.test(P.sliceDoc(ee,ee+5))?"":">";return{from:ce,to:ee,options:$t(P.doc,ne).map((Ee,De)=>({label:Ee,apply:Ee+J,type:"type",boost:99-De})),validFor:ci}}function M(P,ne,ce,ee){let J=[],Ee=0;for(let De of Xt(P.doc,ce,ne))J.push({label:"<"+De,type:"type"});for(let De of $t(P.doc,ce))J.push({label:"</"+De+">",type:"type",boost:99-Ee++});return{from:ee,to:ee,options:J,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function H(P,ne,ce,ee,J){let Ee=Bt(ce),De=Ee?ne.tags[Pe(P.doc,Ee)]:null,Ye=De&&De.attrs?Object.keys(De.attrs):[],je=De&&De.globalAttrs===!1?Ye:Ye.length?Ye.concat(ne.globalAttrNames):ne.globalAttrNames;return{from:ee,to:J,options:je.map(D=>({label:D,type:"property"})),validFor:ci}}function V(P,ne,ce,ee,J){var Ee;let De=(Ee=ce.parent)===null||Ee===void 0?void 0:Ee.getChild("AttributeName"),Ye=[],je;if(De){let D=P.sliceDoc(De.from,De.to),o=ne.globalAttrs[D];if(!o){let l=Bt(ce),f=l?ne.tags[Pe(P.doc,l)]:null;o=f?.attrs&&f.attrs[D]}if(o){let l=P.sliceDoc(ee,J).toLowerCase(),f='"',m='"';/^['"]/.test(l)?(je=l[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",m=P.sliceDoc(J,J+1)==l[0]?"":l[0],l=l.slice(1),ee++):je=/^[^\s<>='"]*$/;for(let S of o)Ye.push({label:S,apply:f+S+m,type:"constant"})}}return{from:ee,to:J,options:Ye,validFor:je}}function Y(P,ne){let{state:ce,pos:ee}=ne,J=(0,z.mv)(ce).resolveInner(ee,-1),Ee=J.resolve(ee);for(let De=ee,Ye;Ee==J&&(Ye=J.childBefore(De));){let je=Ye.lastChild;if(!je||!je.type.isError||je.from<je.to)break;Ee=J=Ye,De=je.from}return J.name=="TagName"?J.parent&&/CloseTag$/.test(J.parent.name)?_(ce,J,J.from,ee):Mi(ce,P,J,J.from,ee):J.name=="StartTag"?Mi(ce,P,J,ee,ee):J.name=="StartCloseTag"||J.name=="IncompleteCloseTag"?_(ce,J,ee,ee):J.name=="OpenTag"||J.name=="SelfClosingTag"||J.name=="AttributeName"?H(ce,P,J,J.name=="AttributeName"?J.from:ee,ee):J.name=="Is"||J.name=="AttributeValue"||J.name=="UnquotedAttributeValue"?V(ce,P,J,J.name=="Is"?ee:J.from,ee):ne.explicit&&(Ee.name=="Element"||Ee.name=="Text"||Ee.name=="Document")?M(ce,P,J,ee):null}function he(P){return Y(yt.default,P)}function Ae(P){let{extraTags:ne,extraGlobalAttributes:ce}=P,ee=ce||ne?new yt(ne,ce):yt.default;return J=>Y(ee,J)}const ke=Ft.parser.configure({top:"SingleExpression"}),_e=[{tag:"script",attrs:P=>P.type=="text/typescript"||P.lang=="ts",parser:Kt.parser},{tag:"script",attrs:P=>P.type=="text/babel"||P.type=="text/jsx",parser:xt.parser},{tag:"script",attrs:P=>P.type=="text/typescript-jsx",parser:Et.parser},{tag:"script",attrs(P){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(P.type)},parser:ke},{tag:"script",attrs(P){return!P.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(P.type)},parser:Ft.parser},{tag:"style",attrs(P){return(!P.lang||P.lang=="css")&&(!P.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(P.type))},parser:mt.parser}],Qe=[{name:"style",parser:mt.parser.configure({top:"Styles"})}].concat(Nt.map(P=>({name:P,parser:Ft.parser}
17))),Wt=z.bj.define({name:"html",parser:v.K.configure({props:[z.Oh.add({Element(P){let ne=/^(\s*)(<\/)?/.exec(P.textAfter);return P.node.to<=P.pos+ne[0].length?P.continue():P.lineIndent(P.node.from)+(ne[2]?0:P.unit)},"OpenTag CloseTag SelfClosingTag"(P){return P.column(P.node.from)+P.unit},Document(P){if(P.pos+/\s*/.exec(P.textAfter)[0].length<P.node.to)return P.continue();let ne=null,ce;for(let ee=P.node;;){let J=ee.lastChild;if(!J||J.name!="Element"||J.to!=ee.to)break;ne=ee=J}return ne&&!((ce=ne.lastChild)&&(ce.name=="CloseTag"||ce.name=="SelfClosingTag"))?P.lineIndent(ne.from)+P.unit:null}}),z.b_.add({Element(P){let ne=P.firstChild,ce=P.lastChild;return!ne||ne.name!="OpenTag"?null:{from:ne.to,to:ce.name=="CloseTag"?ce.from:P.to}}}),z.Q_.add({"OpenTag CloseTag":P=>P.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),Rt=Wt.configure({wrap:(0,v.n)(_e,Qe)});function fi(P={}){let ne="",ce;P.matchClosingTags===!1&&(ne="noMatch"),P.selfClosingTags===!0&&(ne=(ne?ne+" ":"")+"selfClosing"),(P.nestedLanguages&&P.nestedLanguages.length||P.nestedAttributes&&P.nestedAttributes.length)&&(ce=(0,v.n)((P.nestedLanguages||[]).concat(_e),(P.nestedAttributes||[]).concat(Qe)));let ee=ce?Wt.configure({wrap:ce,dialect:ne}):ne?Rt.configure({dialect:ne}):Rt;return new z.Yy(ee,[Rt.data.of({autocomplete:Ae(P)}),P.autoCloseTags!==!1?_t:[],Me().support,st().support])}const Ut=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),_t=Vt.Lz.inputHandler.of((P,ne,ce,ee,J)=>{if(P.composing||P.state.readOnly||ne!=ce||ee!=">"&&ee!="/"||!Rt.isActiveAt(P.state,ne,-1))return!1;let Ee=J(),{state:De}=Ee,Ye=De.changeByRange(je=>{var D,o,l;let f=De.doc.sliceString(je.from-1,je.to)==ee,{head:m}=je,S=(0,z.mv)(De).resolveInner(m,-1),C;if(f&&ee==">"&&S.name=="EndTag"){let R=S.parent;if(((o=(D=R.parent)===null||D===void 0?void 0:D.lastChild)===null||o===void 0?void 0:o.name)!="CloseTag"&&(C=Pe(De.doc,R.parent,m))&&!Ut.has(C)){let j=m+(De.doc.sliceString(m,m+1)===">"?1:0),le=`</${C}>`;return{range:je,changes:{from:m,to:j,insert:le}}}}else if(f&&ee=="/"&&S.name=="IncompleteCloseTag"){let R=S.parent;if(S.from==m-2&&((l=R.lastChild)===null||l===void 0?void 0:l.name)!="CloseTag"&&(C=Pe(De.doc,R,m))&&!Ut.has(C)){let j=m+(De.doc.sliceString(m,m+1)===">"?1:0),le=`${C}>`;return{range:ft.OF.cursor(m+le.length,-1),changes:{from:m,to:j,insert:le}}}}return{range:je}});return Ye.changes.empty?!1:(P.dispatch([Ee,De.update(Ye,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})},963960:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{Ay:()=>Ai,EI:()=>Ue,KB:()=>hi,Lv:()=>Wt,Oh:()=>gi,Q0:()=>bt,Q_:()=>R,SG:()=>C,WD:()=>Q,Xt:()=>pt,Yy:()=>mi,Zt:()=>Ee,_Y:()=>bi,_v:()=>ti,b_:()=>pe,bj:()=>Ze,cr:()=>fi,f7:()=>M,jU:()=>ye,mv:()=>at,mz:()=>Me,p9:()=>zt,tp:()=>Jt,y9:()=>ne,yd:()=>re});var v=Ke(117203),ie=Ke(924835),z=Ke(896765),Oe=Ke(831650),Je=Ke(259683),Re=Ke(80247),Ie;const it=new v.uY;function zt(k){return ie.sj.define({combine:k?h=>h.concat(k):void 0})}const bt=new v.uY;class nt{constructor(h,g,O=[],B=""){this.data=h,this.name=B,ie.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(ie.$t.prototype,"tree",{get(){return at(this)}}),this.parser=g,this.extension=[oi.of(this),ie.$t.languageData.of(($,G,ue)=>{let fe=jt($,G,ue),Te=fe.type.prop(it);if(!Te)return[];let We=$.facet(Te),It=fe.type.prop(bt);if(It){let Ei=fe.resolve(G-fe.from,ue);for(let Di of It)if(Di.test(Ei,$)){let Hi=$.facet(Di.facet);return Di.type=="replace"?Hi:Hi.concat(We)}}return We})].concat(O)}isActiveAt(h,g,O=-1){return jt(h,g,O).type.prop(it)==this.data}findRegions(h){let g=h.facet(oi);if(g?.data==this.data)return[{from:0,to:h.doc.length}];if(!g||!g.allowsNesting)return[];let O=[],B=($,G)=>{if($.prop(it)==this.data){O.push({from:G,to:G+$.length});return}let ue=$.prop(v.uY.mounted);if(ue){if(ue.tree.prop(it)==this.data){if(ue.overlay)for(let fe of ue.overlay)O.push({from:fe.from+G,to:fe.to+G});else O.push({from:G,to:G+$.length});return}else if(ue.overlay){let fe=O.length;if(B(ue.tree,ue.overlay[0].from+G),O.length>fe)return}}for(let fe=0;fe<$.children.length;fe++){let Te=$.children[fe];Te instanceof v.PH&&B(Te,$.positions[fe]+G)}};return B(at(h),0),O}get allowsNesting(){return!0}}nt.setState=ie.Pe.define();function jt(k,h,g){let O=k.facet(oi),B=at(k).topNode;if(!O||O.allowsNesting)for(let $=B;$;$=$.enter(h,g,v.Qj.ExcludeBuffers))$.type.isTop&&(B=$);return B}class Ze extends nt{constructor(h,g,O){super(h,g,[],O),this.parser=g}static define(h){let g=zt(h.languageData);return new Ze(g,h.parser.configure({props:[it.add(O=>O.isTop?g:void 0)]}),h.name)}configure(h,g){return new Ze(this.data,this.parser.configure(h),g||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function at(k){let h=k.field(nt.state,!1);return h?h.tree:v.PH.empty}function Dt(k,h,g=50){var O;let B=(O=k.field(nt.state,!1))===null||O===void 0?void 0:O.context;if(!B)return null;let $=B.viewport;B.updateViewport({from:0,to:h});let G=B.isDone(h)||B.work(g,h)?B.tree:null;return B.updateViewport($),G}function ei(k,h=k.doc.length){var g;return((g=k.field(nt.state,!1))===null||g===void 0?void 0:g.context.
17isDone(h))||!1}function Ht(k,h=k.viewport.to,g=100){let O=Dt(k.state,h,g);return O!=at(k.state)&&k.dispatch({}),!!O}function pi(k){var h;return((h=k.plugin(Ci))===null||h===void 0?void 0:h.isWorking())||!1}class ai{constructor(h){this.doc=h,this.cursorPos=0,this.string="",this.cursor=h.iter()}get length(){return this.doc.length}syncTo(h){return this.string=this.cursor.next(h-this.cursorPos).value,this.cursorPos=h+this.string.length,this.cursorPos-this.string.length}chunk(h){return this.syncTo(h),this.string}get lineChunks(){return!0}read(h,g){let O=this.cursorPos-this.string.length;return h<O||g>=this.cursorPos?this.doc.sliceString(h,g):this.string.slice(h-O,g-O)}}let mt=null;class st{constructor(h,g,O=[],B,$,G,ue,fe){this.parser=h,this.state=g,this.fragments=O,this.tree=B,this.treeLen=$,this.viewport=G,this.skipped=ue,this.scheduleOn=fe,this.parse=null,this.tempSkipped=[]}static create(h,g,O){return new st(h,g,[],v.PH.empty,0,O,[],null)}startParse(){return this.parser.startParse(new ai(this.state.doc),this.fragments)}work(h,g){return g!=null&&g>=this.state.doc.length&&(g=void 0),this.tree!=v.PH.empty&&this.isDone(g??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var O;if(typeof h=="number"){let B=Date.now()+h;h=()=>Date.now()>B}for(this.parse||(this.parse=this.startParse()),g!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>g)&&g<this.state.doc.length&&this.parse.stopAt(g);;){let B=this.parse.advance();if(B)if(this.fragments=this.withoutTempSkipped(v.rr.addTree(B,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(O=this.parse.stoppedAt)!==null&&O!==void 0?O:this.state.doc.length,this.tree=B,this.parse=null,this.treeLen<(g??this.state.doc.length))this.parse=this.startParse();else return!0;if(h())return!1}})}takeTree(){let h,g;this.parse&&(h=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>h)&&this.parse.stopAt(h),this.withContext(()=>{for(;!(g=this.parse.advance()););}),this.treeLen=h,this.tree=g,this.fragments=this.withoutTempSkipped(v.rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(h){let g=mt;mt=this;try{return h()}finally{mt=g}}withoutTempSkipped(h){for(let g;g=this.tempSkipped.pop();)h=St(h,g.from,g.to);return h}changes(h,g){let{fragments:O,tree:B,treeLen:$,viewport:G,skipped:ue}=this;if(this.takeTree(),!h.empty){let fe=[];if(h.iterChangedRanges((Te,We,It,Ei)=>fe.push({fromA:Te,toA:We,fromB:It,toB:Ei})),O=v.rr.applyChanges(O,fe),B=v.PH.empty,$=0,G={from:h.mapPos(G.from,-1),to:h.mapPos(G.to,1)},this.skipped.length){ue=[];for(let Te of this.skipped){let We=h.mapPos(Te.from,1),It=h.mapPos(Te.to,-1);We<It&&ue.push({from:We,to:It})}}}return new st(this.parser,g,O,B,$,G,ue,this.scheduleOn)}updateViewport(h){if(this.viewport.from==h.from&&this.viewport.to==h.to)return!1;this.viewport=h;let g=this.skipped.length;for(let O=0;O<this.skipped.length;O++){let{from:B,to:$}=this.skipped[O];B<h.to&&$>h.from&&(this.fragments=St(this.fragments,B,$),this.skipped.splice(O--,1))}return this.skipped.length>=g?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(h,g){this.skipped.push({from:h,to:g})}static getSkippingParser(h){return new class extends v.iX{createParse(g,O,B){let $=B[0].from,G=B[B.length-1].to;return{parsedPos:$,advance(){let fe=mt;if(fe){for(let Te of B)fe.tempSkipped.push(Te);h&&(fe.scheduleOn=fe.scheduleOn?Promise.all([fe.scheduleOn,h]):h)}return this.parsedPos=G,new v.PH(v.Z6.none,[],[],G-$)},stoppedAt:null,stopAt(){}}}}}isDone(h){h=Math.min(h,this.state.doc.length);let g=this.fragments;return this.treeLen>=h&&g.length&&g[0].from==0&&g[0].to>=h}static get(){return mt}}function St(k,h,g){return v.rr.applyChanges(k,[{fromA:h,toA:g,fromB:h,toB:g}])}class ft{constructor(h){this.context=h,this.tree=h.tree}apply(h){if(!h.docChanged&&this.tree==this.context.tree)return this;let g=this.context.changes(h.changes,h.state),O=this.context.treeLen==h.startState.doc.length?void 0:Math.max(h.changes.mapPos(this.context.treeLen),g.viewport.to);return g.work(20,O)||g.takeTree(),new ft(g)}static init(h){let g=Math.min(3e3,h.doc.length),O=st.create(h.facet(oi).parser,h,{from:0,to:g});return O.work(20,g)||O.takeTree(),new ft(O)}}nt.state=ie.sU.define({create:ft.init,update(k,h){for(let g of h.effects)if(g.is(nt.setState))return g.value;return h.startState.facet(oi)!=h.state.facet(oi)?ft.init(h.state):k.apply(h)}});let Vt=k=>{let h=setTimeout(()=>k(),500);return()=>clearTimeout(h)};typeof requestIdleCallback<"u"&&(Vt=k=>{let h=-1,g=setTimeout(()=>{h=requestIdleCallback(k,{timeout:500-100})},100);return()=>h<0?clearTimeout(g):cancelIdleCallback(h)});const wt=typeof navigator<"u"&&(!((Ie=navigator.scheduling)===null||Ie===void 0)&&Ie.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ci=z.Z9.fromClass(class{constructor(h){this.view=h,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(h){let g=this.view.state.field(nt.state).context;(g.updateViewport(h.view.viewport)||this.view.viewport.to>g.treeLen)&&this.scheduleWork(),(h.docChanged||h.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(g)}scheduleWork(){if(this.working)return;let{state:h}=this.view,g=h.field(nt.state);
17(g.tree!=g.context.tree||!g.context.isDone(h.doc.length))&&(this.working=Vt(this.work))}work(h){this.working=null;let g=Date.now();if(this.chunkEnd<g&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=g+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:O,viewport:{to:B}}=this.view,$=O.field(nt.state);if($.tree==$.context.tree&&$.context.isDone(B+1e5))return;let G=Date.now()+Math.min(this.chunkBudget,100,h&&!wt?Math.max(25,h.timeRemaining()-5):1e9),ue=$.context.treeLen<B&&O.doc.length>B+1e3,fe=$.context.work(()=>wt&&wt()||Date.now()>G,B+(ue?0:1e5));this.chunkBudget-=Date.now()-g,(fe||this.chunkBudget<=0)&&($.context.takeTree(),this.view.dispatch({effects:nt.setState.of(new ft($.context))})),this.chunkBudget>0&&!(fe&&!ue)&&this.scheduleWork(),this.checkAsyncSchedule($.context)}checkAsyncSchedule(h){h.scheduleOn&&(this.workScheduled++,h.scheduleOn.then(()=>this.scheduleWork()).catch(g=>(0,z.c_)(this.view.state,g)).then(()=>this.workScheduled--),h.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),oi=ie.sj.define({combine(k){return k.length?k[0]:null},enables:k=>[nt.state,Ci,z.Lz.contentAttributes.compute([k],h=>{let g=h.facet(k);return g&&g.name?{"data-language":g.name}:{}})]});class mi{constructor(h,g=[]){this.language=h,this.support=g,this.extension=[h,g]}}class Yt{constructor(h,g,O,B,$,G=void 0){this.name=h,this.alias=g,this.extensions=O,this.filename=B,this.loadFunc=$,this.support=G,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(h=>this.support=h,h=>{throw this.loading=null,h}))}static of(h){let{load:g,support:O}=h;if(!g){if(!O)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");g=()=>Promise.resolve(O)}return new Yt(h.name,(h.alias||[]).concat(h.name).map(B=>B.toLowerCase()),h.extensions||[],h.filename,g,O)}static matchFilename(h,g){for(let B of h)if(B.filename&&B.filename.test(g))return B;let O=/\.([^.]+)$/.exec(g);if(O){for(let B of h)if(B.extensions.indexOf(O[1])>-1)return B}return null}static matchLanguageName(h,g,O=!0){g=g.toLowerCase();for(let B of h)if(B.alias.some($=>$==g))return B;if(O)for(let B of h)for(let $ of B.alias){let G=g.indexOf($);if(G>-1&&($.length>2||!/\w/.test(g[G-1])&&!/\w/.test(g[G+$.length])))return B}return null}}const dt=ie.sj.define(),pt=ie.sj.define({combine:k=>{if(!k.length)return"  ";let h=k[0];if(!h||/\S/.test(h)||Array.from(h).some(g=>g!=h[0]))throw new Error("Invalid indent unit: "+JSON.stringify(k[0]));return h}});function Jt(k){let h=k.facet(pt);return h.charCodeAt(0)==9?k.tabSize*h.length:h.length}function Ue(k,h){let g="",O=k.tabSize,B=k.facet(pt)[0];if(B=="	"){for(;h>=O;)g+="	",h-=O;B=" "}for(let $=0;$<h;$++)g+=B;return g}function ti(k,h){k instanceof ie.$t&&(k=new hi(k));for(let O of k.state.facet(dt)){let B=O(k,h);if(B!==void 0)return B}let g=at(k.state);return g.length>=h?Mt(k,g,h):null}function kt(k,h,g){let O=Object.create(null),B=new hi(k,{overrideIndentation:G=>{var ue;return(ue=O[G])!==null&&ue!==void 0?ue:-1}}),$=[];for(let G=h;G<=g;){let ue=k.doc.lineAt(G);G=ue.to+1;let fe=ti(B,ue.from);if(fe==null)continue;/\S/.test(ue.text)||(fe=0);let Te=/^\s*/.exec(ue.text)[0],We=Ue(k,fe);Te!=We&&(O[ue.from]=fe,$.push({from:ue.from,to:ue.from+Te.length,insert:We}))}return k.changes($)}class hi{constructor(h,g={}){this.state=h,this.options=g,this.unit=Jt(h)}lineAt(h,g=1){let O=this.state.doc.lineAt(h),{simulateBreak:B,simulateDoubleBreak:$}=this.options;return B!=null&&B>=O.from&&B<=O.to?$&&B==h?{text:"",from:h}:(g<0?B<h:B<=h)?{text:O.text.slice(B-O.from),from:B}:{text:O.text.slice(0,B-O.from),from:O.from}:O}textAfterPos(h,g=1){if(this.options.simulateDoubleBreak&&h==this.options.simulateBreak)return"";let{text:O,from:B}=this.lineAt(h,g);return O.slice(h-B,Math.min(O.length,h+100-B))}column(h,g=1){let{text:O,from:B}=this.lineAt(h,g),$=this.countColumn(O,h-B),G=this.options.overrideIndentation?this.options.overrideIndentation(B):-1;return G>-1&&($+=G-this.countColumn(O,O.search(/\S|$/))),$}countColumn(h,g=h.length){return(0,ie.y$)(h,this.state.tabSize,g)}lineIndent(h,g=1){let{text:O,from:B}=this.lineAt(h,g),$=this.options.overrideIndentation;if($){let G=$(B);if(G>-1)return G}return this.countColumn(O,O.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const gi=new v.uY;function Mt(k,h,g){let O=h.resolveStack(g),B=h.resolveInner(g,-1).resolve(g,0).enterUnfinishedNodesBefore(g);if(B!=O.node){let $=[];for(let G=B;
17G&&!(G.from==O.node.from&&G.type==O.node.type);G=G.parent)$.push(G);for(let G=$.length-1;G>=0;G--)O={node:$[G],next:O}}return Ct(O,k,g)}function Ct(k,h,g){for(let O=k;O;O=O.next){let B=Ft(O.node);if(B)return B(Kt.create(h,g,O))}return 0}function vt(k){return k.pos==k.options.simulateBreak&&k.options.simulateDoubleBreak}function Ft(k){let h=k.type.prop(gi);if(h)return h;let g=k.firstChild,O;if(g&&(O=g.type.prop(v.uY.closedBy))){let B=k.lastChild,$=B&&O.indexOf(B.name)>-1;return G=>Lt(G,!0,1,void 0,$&&!vt(G)?B.from:void 0)}return k.parent==null?li:null}function li(){return 0}class Kt extends hi{constructor(h,g,O){super(h.state,h.options),this.base=h,this.pos=g,this.context=O}get node(){return this.context.node}static create(h,g,O){return new Kt(h,g,O)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(h){let g=this.state.doc.lineAt(h.from);for(;;){let O=h.resolve(g.from);for(;O.parent&&O.parent.from==O.from;)O=O.parent;if(xt(O,h))break;g=this.state.doc.lineAt(O.from)}return this.lineIndent(g.from)}continue(){return Ct(this.context.next,this.base,this.pos)}}function xt(k,h){for(let g=h;g;g=g.parent)if(k==g)return!0;return!1}function Et(k){let h=k.node,g=h.childAfter(h.from),O=h.lastChild;if(!g)return null;let B=k.options.simulateBreak,$=k.state.doc.lineAt(g.from),G=B==null||B<=$.from?$.to:Math.min($.to,B);for(let ue=g.to;;){let fe=h.childAfter(ue);if(!fe||fe==O)return null;if(!fe.type.isSkipped){if(fe.from>=G)return null;let Te=/^ */.exec($.text.slice(g.to-$.from))[0].length;return{from:g.from,to:g.to+Te}}ue=fe.to}}function Ai({closing:k,align:h=!0,units:g=1}){return O=>Lt(O,h,g,k)}function Lt(k,h,g,O,B){let $=k.textAfter,G=$.match(/^\s*/)[0].length,ue=O&&$.slice(G,G+O.length)==O||B==k.pos+G,fe=h?Et(k):null;return fe?ue?k.column(fe.from):k.column(fe.to):k.baseIndent+(ue?0:k.unit*g)}const bi=k=>k.baseIndent;function Me({except:k,units:h=1}={}){return g=>{let O=k&&k.test(g.textAfter);return g.baseIndent+(O?0:h*g.unit)}}const ii=200;function Q(){return ie.$t.transactionFilter.of(k=>{if(!k.docChanged||!k.isUserEvent("input.type")&&!k.isUserEvent("input.complete"))return k;let h=k.startState.languageDataAt("indentOnInput",k.startState.selection.main.head);if(!h.length)return k;let g=k.newDoc,{head:O}=k.newSelection.main,B=g.lineAt(O);if(O>B.from+ii)return k;let $=g.sliceString(B.from,O);if(!h.some(Te=>Te.test($)))return k;let{state:G}=k,ue=-1,fe=[];for(let{head:Te}of G.selection.ranges){let We=G.doc.lineAt(Te);if(We.from==ue)continue;ue=We.from;let It=ti(G,We.from);if(It==null)continue;let Ei=/^\s*/.exec(We.text)[0],Di=Ue(G,It);Ei!=Di&&fe.push({from:We.from,to:We.from+Ei.length,insert:Di})}return fe.length?[k,{changes:fe,sequential:!0}]:k})}const q=ie.sj.define(),pe=new v.uY;function re(k){let h=k.firstChild,g=k.lastChild;return h&&h.to<g.from?{from:h.to,to:g.type.isError?k.to:g.from}:null}function ve(k,h,g){let O=at(k);if(O.length<g)return null;let B=O.resolveStack(g,1),$=null;for(let G=B;G;G=G.next){let ue=G.node;if(ue.to<=g||ue.from>g)continue;if($&&ue.from<h)break;let fe=ue.type.prop(pe);if(fe&&(ue.to<O.length-50||O.length==k.doc.length||!Le(ue))){let Te=fe(ue,k);Te&&Te.from<=g&&Te.from>=h&&Te.to>g&&($=Te)}}return $}function Le(k){let h=k.lastChild;return h&&h.to==k.to&&h.type.isError}function Ne(k,h,g){for(let O of k.facet(q)){let B=O(k,h,g);if(B)return B}return ve(k,h,g)}function Xe(k,h){let g=h.mapPos(k.from,1),O=h.mapPos(k.to,-1);return g>=O?void 0:{from:g,to:O}}const ze=ie.Pe.define({map:Xe}),tt=ie.Pe.define({map:Xe});function qe(k){let h=[];for(let{head:g}of k.state.selection.ranges)h.some(O=>O.from<=g&&O.to>=g)||h.push(k.lineBlockAt(g));return h}const we=ie.sU.define({create(){return z.NZ.none},update(k,h){k=k.map(h.changes);for(let g of h.effects)if(g.is(ze)&&!Nt(k,g.value.from,g.value.to)){let{preparePlaceholder:O}=h.state.facet(V),B=O?z.NZ.replace({widget:new ke(O(h.state,g.value))}):Ae;k=k.update({add:[B.range(g.value.from,g.value.to)]})}else g.is(tt)&&(k=k.update({filter:(O,B)=>g.value.from!=O||g.value.to!=B,filterFrom:g.value.from,filterTo:g.value.to}));if(h.selection){let g=!1,{head:O}=h.selection.main;k.between(O,O,(B,$)=>{B<O&&$>O&&(g=!0)}),g&&(k=k.update({filterFrom:O,filterTo:O,filter:(B,$)=>$<=O||B>=O}))}return k},provide:k=>z.Lz.decorations.from(k),toJSON(k,h){let g=[];return k.between(0,h.doc.length,(O,B)=>{g.push(O,B)}),g},fromJSON(k){if(!Array.isArray(k)||k.length%2)throw new RangeError("Invalid JSON for fold state");let h=[];for(let g=0;g<k.length;){let O=k[g++],B=k[g++];if(typeof O!="number"||typeof B!="number")throw new RangeError("Invalid JSON for fold state");h.push(Ae.range(O,B))}return z.NZ.set(h,!0)}});function ut(k){return k.field(we,!1)||RangeSet.empty}function gt(k,h,g){var O;let B=null;return(O=k.field(we,!1))===null||O===void 0||O.between(h,g,($,G)=>{(!B||B.from>$)&&(B={from:$,to:G})}),B}function Nt(k,h,g){let O=!1;return k.between(h,h,(B,$)=>{B==h&&$==g&&(O=!0)}),O}function yt(k,h){return k.field(we,!1)?h:h.concat(ie.Pe.appendConfig.of(Y()))}const Pe=k=>{for(let h of qe(k)){let g=Ne(k.state,h.from,h.to);
17if(g)return k.dispatch({effects:yt(k.state,[ze.of(g),Xt(k,g)])}),!0}return!1},Bt=k=>{if(!k.state.field(we,!1))return!1;let h=[];for(let g of qe(k)){let O=gt(k.state,g.from,g.to);O&&h.push(tt.of(O),Xt(k,O,!1))}return h.length&&k.dispatch({effects:h}),h.length>0};function Xt(k,h,g=!0){let O=k.state.doc.lineAt(h.from).number,B=k.state.doc.lineAt(h.to).number;return z.Lz.announce.of(`${k.state.phrase(g?"Folded lines":"Unfolded lines")} ${O} ${k.state.phrase("to")} ${B}.`)}const $t=k=>{let{state:h}=k,g=[];for(let O=0;O<h.doc.length;){let B=k.lineBlockAt(O),$=Ne(h,B.from,B.to);$&&g.push(ze.of($)),O=($?k.lineBlockAt($.to):B).to+1}return g.length&&k.dispatch({effects:yt(k.state,g)}),!!g.length},ci=k=>{let h=k.state.field(we,!1);if(!h||!h.size)return!1;let g=[];return h.between(0,k.state.doc.length,(O,B)=>{g.push(tt.of({from:O,to:B}))}),k.dispatch({effects:g}),!0};function Mi(k,h){for(let g=h;;){let O=Ne(k.state,g.from,g.to);if(O&&O.to>h.from)return O;if(!g.from)return null;g=k.lineBlockAt(g.from-1)}}const _=k=>{let h=[];for(let g of qe(k)){let O=gt(k.state,g.from,g.to);if(O)h.push(tt.of(O),Xt(k,O,!1));else{let B=Mi(k,g);B&&h.push(ze.of(B),Xt(k,B))}}return h.length>0&&k.dispatch({effects:yt(k.state,h)}),!!h.length},M=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Pe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Bt},{key:"Ctrl-Alt-[",run:$t},{key:"Ctrl-Alt-]",run:ci}],H={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},V=ie.sj.define({combine(k){return(0,ie.QR)(k,H)}});function Y(k){let h=[we,Rt];return k&&h.push(V.of(k)),h}function he(k,h){let{state:g}=k,O=g.facet(V),B=G=>{let ue=k.lineBlockAt(k.posAtDOM(G.target)),fe=gt(k.state,ue.from,ue.to);fe&&k.dispatch({effects:tt.of(fe)}),G.preventDefault()};if(O.placeholderDOM)return O.placeholderDOM(k,B,h);let $=document.createElement("span");return $.textContent=O.placeholderText,$.setAttribute("aria-label",g.phrase("folded code")),$.title=g.phrase("unfold"),$.className="cm-foldPlaceholder",$.onclick=B,$}const Ae=z.NZ.replace({widget:new class extends z.xO{toDOM(k){return he(k,null)}}});class ke extends z.xO{constructor(h){super(),this.value=h}eq(h){return this.value==h.value}toDOM(h){return he(h,this.value)}}const _e={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Qe extends z.wJ{constructor(h,g){super(),this.config=h,this.open=g}eq(h){return this.config==h.config&&this.open==h.open}toDOM(h){if(this.config.markerDOM)return this.config.markerDOM(this.open);let g=document.createElement("span");return g.textContent=this.open?this.config.openText:this.config.closedText,g.title=h.state.phrase(this.open?"Fold line":"Unfold line"),g}}function Wt(k={}){let h=Object.assign(Object.assign({},_e),k),g=new Qe(h,!0),O=new Qe(h,!1),B=z.Z9.fromClass(class{constructor(G){this.from=G.viewport.from,this.markers=this.buildMarkers(G)}update(G){(G.docChanged||G.viewportChanged||G.startState.facet(oi)!=G.state.facet(oi)||G.startState.field(we,!1)!=G.state.field(we,!1)||at(G.startState)!=at(G.state)||h.foldingChanged(G))&&(this.markers=this.buildMarkers(G.view))}buildMarkers(G){let ue=new ie.vB;for(let fe of G.viewportLineBlocks){let Te=gt(G.state,fe.from,fe.to)?O:Ne(G.state,fe.from,fe.to)?g:null;Te&&ue.add(fe.from,fe.from,Te)}return ue.finish()}}),{domEventHandlers:$}=h;return[B,(0,z.cU)({class:"cm-foldGutter",markers(G){var ue;return((ue=G.plugin(B))===null||ue===void 0?void 0:ue.markers)||ie.om.empty},initialSpacer(){return new Qe(h,!1)},domEventHandlers:Object.assign(Object.assign({},$),{click:(G,ue,fe)=>{if($.click&&$.click(G,ue,fe))return!0;let Te=gt(G.state,ue.from,ue.to);if(Te)return G.dispatch({effects:tt.of(Te)}),!0;let We=Ne(G.state,ue.from,ue.to);return We?(G.dispatch({effects:ze.of(We)}),!0):!1}})}),Y()]}const Rt=z.Lz.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class fi{constructor(h,g){this.specs=h;let O;function B(ue){let fe=Je.G.newName();return(O||(O=Object.create(null)))["."+fe]=ue,fe}const $=typeof g.all=="string"?g.all:g.all?B(g.all):void 0,G=g.scope;this.scope=G instanceof nt?ue=>ue.prop(it)==G.data:G?ue=>ue==G:void 0,this.style=(0,Oe.az)(h.map(ue=>({tag:ue.tag,class:ue.class||B(Object.assign({},ue,{tag:null}))})),{all:$}).style,this.module=O?new Je.G(O):null,this.themeType=g.themeType}static define(h,g){return new fi(h,g||{})}}const Ut=ie.sj.define(),_t=ie.sj.define({combine(k){return k.length?[k[0]]:null}});function P(k){let h=k.facet(Ut);return h.length?h:k.facet(_t)}function ne(k,h){let g=[J],O;return k instanceof fi&&(k.module&&g.push(z.Lz.styleModule.of(k.module)),O=k.themeType),h?.fallback?g.push(_t.of(k)):O?g.push(Ut.computeN([z.Lz.darkTheme],B=>B.facet(z.Lz.darkTheme)==(O=="dark")?[k]:[])):g.push(Ut.of(k)),g}function ce(k,h,g){let O=P(k),B=null;if(O){for(let $ of O)if(!$.scope||g&&$.scope(g)){let G=$.style(h);G&&(B=B?B+" "+G:G)}}return B}class ee{constructor(h){this.markCache=Object.create(null),this.tree=at(h.state),this.decorations=this.buildDeco(h,P(h.state)),this.decoratedTo=h.viewport.to}update(h){let g=at(h.state),O=P(h.state),B=O!=P(h.startState),{viewport:$}=h.view,G=h.changes.mapPos(this.decoratedTo,1);g.length<$.to&&!B&&g.type==this.tree.type&&G>=$.to?(this.decorations=this.decorations.map(h.changes),this.decoratedTo=G):(g!=this.tree||h.viewportChanged||B)&&(this.tree=g,this.decorations=this.buildDeco(h.view,O),this.decoratedTo=$.to)}buildDeco(h,g){if(!g||!this.tree.length)return z.NZ.none;let O=new ie.vB;for(let{from:B,to:$}of h.visibleRanges)(0,Oe.DM)(this.tree,g,(G,ue,fe)=>{O.add(G,ue,this.markCache[fe]||(this.markCache[fe]=z.NZ.mark({class:fe})))},B,$);return O.finish()}}const J=ie.Nb.high(z.Z9.fromClass(ee,{decorations:k=>k.decorations})),Ee=fi.define([{tag:Oe._A.meta,color:"#404740"},{tag:Oe._A.link,textDecoration:"underline"},{tag:Oe._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Oe._A.emphasis,fontStyle:"italic"},{tag:Oe._A.strong,fontWeight:"bold"},{tag:Oe._A.strikethrough,textDecoration:"line-through"}
17,{tag:Oe._A.keyword,color:"#708"},{tag:[Oe._A.atom,Oe._A.bool,Oe._A.url,Oe._A.contentSeparator,Oe._A.labelName],color:"#219"},{tag:[Oe._A.literal,Oe._A.inserted],color:"#164"},{tag:[Oe._A.string,Oe._A.deleted],color:"#a11"},{tag:[Oe._A.regexp,Oe._A.escape,Oe._A.special(Oe._A.string)],color:"#e40"},{tag:Oe._A.definition(Oe._A.variableName),color:"#00f"},{tag:Oe._A.local(Oe._A.variableName),color:"#30a"},{tag:[Oe._A.typeName,Oe._A.namespace],color:"#085"},{tag:Oe._A.className,color:"#167"},{tag:[Oe._A.special(Oe._A.variableName),Oe._A.macroName],color:"#256"},{tag:Oe._A.definition(Oe._A.propertyName),color:"#00c"},{tag:Oe._A.comment,color:"#940"},{tag:Oe._A.invalid,color:"#f00"}]),De=z.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ye=1e4,je="()[]{}",D=ie.sj.define({combine(k){return(0,ie.QR)(k,{afterCursor:!0,brackets:je,maxScanDistance:Ye,renderMatch:f})}}),o=z.NZ.mark({class:"cm-matchingBracket"}),l=z.NZ.mark({class:"cm-nonmatchingBracket"});function f(k){let h=[],g=k.matched?o:l;return h.push(g.range(k.start.from,k.start.to)),k.end&&h.push(g.range(k.end.from,k.end.to)),h}const S=[ie.sU.define({create(){return z.NZ.none},update(k,h){if(!h.docChanged&&!h.selection)return k;let g=[],O=h.state.facet(D);for(let B of h.state.selection.ranges){if(!B.empty)continue;let $=ye(h.state,B.head,-1,O)||B.head>0&&ye(h.state,B.head-1,1,O)||O.afterCursor&&(ye(h.state,B.head,1,O)||B.head<h.state.doc.length&&ye(h.state,B.head+1,-1,O));$&&(g=g.concat(O.renderMatch($,h.state)))}return z.NZ.set(g,!0)},provide:k=>z.Lz.decorations.from(k)}),De];function C(k={}){return[D.of(k),S]}const R=new v.uY;function j(k,h,g){let O=k.prop(h<0?v.uY.openedBy:v.uY.closedBy);if(O)return O;if(k.name.length==1){let B=g.indexOf(k.name);if(B>-1&&B%2==(h<0?1:0))return[g[B+h]]}return null}function le(k){let h=k.type.prop(R);return h?h(k.node):k}function ye(k,h,g,O={}){let B=O.maxScanDistance||Ye,$=O.brackets||je,G=at(k),ue=G.resolveInner(h,g);for(let fe=ue;fe;fe=fe.parent){let Te=j(fe.type,g,$);if(Te&&fe.from<fe.to){let We=le(fe);if(We&&(g>0?h>=We.from&&h<We.to:h>We.from&&h<=We.to))return Ce(k,h,g,fe,We,Te,$)}}return Ve(k,h,g,G,ue.type,B,$)}function Ce(k,h,g,O,B,$,G){let ue=O.parent,fe={from:B.from,to:B.to},Te=0,We=ue?.cursor();if(We&&(g<0?We.childBefore(O.from):We.childAfter(O.to)))do if(g<0?We.to<=O.from:We.from>=O.to){if(Te==0&&$.indexOf(We.type.name)>-1&&We.from<We.to){let It=le(We);return{start:fe,end:It?{from:It.from,to:It.to}:void 0,matched:!0}}else if(j(We.type,g,G))Te++;else if(j(We.type,-g,G)){if(Te==0){let It=le(We);return{start:fe,end:It&&It.from<It.to?{from:It.from,to:It.to}:void 0,matched:!1}}Te--}}while(g<0?We.prevSibling():We.nextSibling());return{start:fe,matched:!1}}function Ve(k,h,g,O,B,$,G){let ue=g<0?k.sliceDoc(h-1,h):k.sliceDoc(h,h+1),fe=G.indexOf(ue);if(fe<0||fe%2==0!=g>0)return null;let Te={from:g<0?h-1:h,to:g>0?h+1:h},We=k.doc.iterRange(h,g>0?k.doc.length:0),It=0;for(let Ei=0;!We.next().done&&Ei<=$;){let Di=We.value;g<0&&(Ei+=Di.length);let Hi=h+Ei*g;for(let Vi=g>0?0:Di.length-1,Ji=g>0?Di.length:-1;Vi!=Ji;Vi+=g){let Xi=G.indexOf(Di[Vi]);if(!(Xi<0||O.resolveInner(Hi+Vi,1).type!=B))if(Xi%2==0==g>0)It++;else{if(It==1)return{start:Te,end:{from:Hi+Vi,to:Hi+Vi+1},matched:Xi>>1==fe>>1};It--}}g>0&&(Ei+=Di.length)}return We.done?{start:Te,matched:!1}:null}function Fe(k,h,g,O=0,B=0){h==null&&(h=k.search(/[^\s\u00a0]/),h==-1&&(h=k.length));let $=B;for(let G=O;G<h;G++)k.charCodeAt(G)==9?$+=g-$%g:$++;return $}class Tt{constructor(h,g,O,B){this.string=h,this.tabSize=g,this.indentUnit=O,this.overrideIndent=B,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(h){let g=this.string.charAt(this.pos),O;if(typeof h=="string"?O=g==h:O=g&&(h instanceof RegExp?h.test(g):h(g)),O)return++this.pos,g}eatWhile(h){let g=this.pos;for(;this.eat(h););return this.pos>g}eatSpace(){let h=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>h}skipToEnd(){this.pos=this.string.length}skipTo(h){let g=this.string.indexOf(h,this.pos);if(g>-1)return this.pos=g,!0}backUp(h){this.pos-=h}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Fe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var h;
vendor: 4,620 bytes, lines 17-19
17return(h=this.overrideIndent)!==null&&h!==void 0?h:Fe(this.string,null,this.tabSize)}match(h,g,O){if(typeof h=="string"){let B=G=>O?G.toLowerCase():G,$=this.string.substr(this.pos,h.length);return B($)==B(h)?(g!==!1&&(this.pos+=h.length),!0):null}else{let B=this.string.slice(this.pos).match(h);return B&&B.index>0?null:(B&&g!==!1&&(this.pos+=B[0].length),B)}}current(){return this.string.slice(this.start,this.pos)}}function Oi(k){return{name:k.name||"",token:k.token,blankLine:k.blankLine||(()=>{}),startState:k.startState||(()=>!0),copyState:k.copyState||qt,indent:k.indent||(()=>null),languageData:k.languageData||{},tokenTable:k.tokenTable||T}}function qt(k){if(typeof k!="object")return k;let h={};for(let g in k){let O=k[g];h[g]=O instanceof Array?O.slice():O}return h}const Fi=new WeakMap;class Ri extends nt{constructor(h){let g=zt(h.languageData),O=Oi(h),B,$=new class extends v.iX{createParse(G,ue,fe){return new p(B,G,ue,fe)}};super(g,$,[],h.name),this.topNode=Ot(g,this),B=this,this.streamParser=O,this.stateAfter=new v.uY({perNode:!0}),this.tokenTable=h.tokenTable?new Se(O.tokenTable):xe}static define(h){return new Ri(h)}getIndent(h){let g,{overrideIndentation:O}=h.options;O&&(g=Fi.get(h.state),g!=null&&g<h.pos-1e4&&(g=void 0));let B=Ni(this,h.node.tree,h.node.from,h.node.from,g??h.pos),$,G;if(B?(G=B.state,$=B.pos+1):(G=this.streamParser.startState(h.unit),$=h.node.from),h.pos-$>1e4)return null;for(;$<h.pos;){let fe=h.state.doc.lineAt($),Te=Math.min(h.pos,fe.to);if(fe.length){let We=O?O(fe.from):-1,It=new Tt(fe.text,h.state.tabSize,h.unit,We<0?void 0:We);for(;It.pos<Te-fe.from;)b(this.streamParser.token,It,G)}else this.streamParser.blankLine(G,h.unit);if(Te==h.pos)break;$=fe.to+1}let ue=h.lineAt(h.pos);return O&&g==null&&Fi.set(h.state,ue.from),this.streamParser.indent(G,/^\s*(.*)/.exec(ue.text)[1],h)}get allowsNesting(){return!1}}function Ni(k,h,g,O,B){let $=g>=O&&g+h.length<=B&&h.prop(k.stateAfter);if($)return{state:k.streamParser.copyState($),pos:g+h.length};for(let G=h.children.length-1;G>=0;G--){let ue=h.children[G],fe=g+h.positions[G],Te=ue instanceof v.PH&&fe<B&&Ni(k,ue,fe,O,B);if(Te)return Te}return null}function zi(k,h,g,O,B){if(B&&g<=0&&O>=h.length)return h;!B&&g==0&&h.type==k.topNode&&(B=!0);for(let $=h.children.length-1;$>=0;$--){let G=h.positions[$],ue=h.children[$],fe;if(G<O&&ue instanceof v.PH){if(!(fe=zi(k,ue,g-G,O-G,B)))break;return B?new v.PH(h.type,h.children.slice(0,$).concat(fe),h.positions.slice(0,$+1),G+fe.length):fe}}return null}function A(k,h,g,O,B){for(let $ of h){let G=$.from+($.openStart?25:0),ue=$.to-($.openEnd?25:0),fe=G<=g&&ue>g&&Ni(k,$.tree,0-$.offset,g,ue),Te;if(fe&&fe.pos<=O&&(Te=zi(k,$.tree,g+$.offset,fe.pos+$.offset,!1)))return{state:fe.state,tree:Te}}return{state:k.streamParser.startState(B?Jt(B):4),tree:v.PH.empty}}class p{constructor(h,g,O,B){this.lang=h,this.input=g,this.fragments=O,this.ranges=B,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=B[B.length-1].to;let $=st.get(),G=B[0].from,{state:ue,tree:fe}=A(h,O,G,this.to,$?.state);this.state=ue,this.parsedPos=this.chunkStart=G+fe.length;for(let Te=0;Te<fe.children.length;Te++)this.chunks.push(fe.children[Te]),this.chunkPos.push(fe.positions[Te]);$&&this.parsedPos<$.viewport.from-1e5&&B.some(Te=>Te.from<=$.viewport.from&&Te.to>=$.viewport.from)&&(this.state=this.lang.streamParser.startState(Jt($.state)),$.skipUntilInView(this.parsedPos,$.viewport.from),this.parsedPos=$.viewport.from),this.moveRangeIndex()}advance(){let h=st.get(),g=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),O=Math.min(g,this.chunkStart+2048);for(h&&(O=Math.min(O,h.viewport.to));this.parsedPos<O;)this.parseLine(h);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=g?this.finish():h&&this.parsedPos>=h.viewport.to?(h.skipUntilInView(this.parsedPos,g),this.finish()):null}stopAt(h){this.stoppedAt=h}lineAfter(h){let g=this.input.chunk(h);if(this.input.lineChunks)g==`
18`&&(g="");else{let O=g.indexOf(`
19`);O>-1&&(g=g.slice(0,O))}return h+g.length<=this.to?g:g.slice(0,this.to-h)}nextLine(){let h=this.parsedPos,g=this.lineAfter(h),O=h+g.length;for(let B=this.rangeIndex;;){let $=this.ranges[B].to;if($>=O||(g=g.slice(0,$-(O-g.length)),B++,B==this.ranges.length))break;let G=this.ranges[B].from,ue=this.lineAfter(G);g+=ue,O=G+ue.length}return{line:g,end:O}}skipGapsTo(h,g,O){for(;;){let B=this.ranges[this.rangeIndex].to,$=h+g;if(O>0?B>$:B>=$)break;let G=this.ranges[++this.rangeIndex].from;g+=G-B}return g}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}
19emitToken(h,g,O,B){let $=4;if(this.ranges.length>1){B=this.skipGapsTo(g,B,1),g+=B;let ue=this.chunk.length;B=this.skipGapsTo(O,B,-1),O+=B,$+=this.chunk.length-ue}let G=this.chunk.length-4;return $==4&&G>=0&&this.chunk[G]==h&&this.chunk[G+2]==g?this.chunk[G+2]=O:this.chunk.push(h,g,O,$),B}parseLine(h){let{line:g,end:O}=this.nextLine(),B=0,{streamParser:$}=this.lang,G=new Tt(g,h?h.state.tabSize:4,h?Jt(h.state):2);if(G.eol())$.blankLine(this.state,G.indentUnit);else for(;!G.eol();){let ue=b($.token,G,this.state);if(ue&&(B=this.emitToken(this.lang.tokenTable.resolve(ue),this.parsedPos+G.start,this.parsedPos+G.pos,B)),G.start>1e4)break}this.parsedPos=O,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let h=v.PH.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:K,topID:0,maxBufferLength:2048,reused:this.chunkReused});h=new v.PH(h.type,h.children,h.positions,h.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(h),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new v.PH(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function b(k,h,g){h.start=h.pos;for(let O=0;O<10;O++){let B=k(h,g);if(h.pos>h.start)return B}throw new Error("Stream parser failed to advance stream.")}const T=Object.create(null),L=[v.Z6.none],K=new v.fI(L),te=[],ae=Object.create(null),oe=Object.create(null);for(let[k,h]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])oe[k]=ht(T,h);class Se{constructor(h){this.extra=h,this.table=Object.assign(Object.create(null),oe)}resolve(h){return h?this.table[h]||(this.table[h]=ht(this.extra,h)):0}}const xe=new Se(T);function He(k,h){te.indexOf(k)>-1||(te.push(k),Re.warn(h))}function ht(k,h){let g=[];for(let ue of h.split(" ")){let fe=[];for(let Te of ue.split(".")){let We=k[Te]||Oe._A[Te];We?typeof We=="function"?fe.length?fe=fe.map(We):He(Te,`Modifier ${Te} used at start of tag`):fe.length?He(Te,`Tag ${Te} used as modifier`):fe=Array.isArray(We)?We:[We]:He(Te,`Unknown highlighting tag ${Te}`)}for(let Te of fe)g.push(Te)}if(!g.length)return 0;let O=h.replace(/ /g,"_"),B=O+" "+g.map(ue=>ue.id),$=ae[B];if($)return $.id;let G=ae[B]=v.Z6.define({id:L.length,name:O,props:[(0,Oe.pn)({[O]:g})]});return L.push(G),G.id}function Ot(k,h){let g=v.Z6.define({id:L.length,name:"Document",props:[it.add(()=>k),gi.add(()=>O=>h.getIndent(O))],top:!0});return L.push(g),g}function ni(k){return k.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(k)}function ui(k){for(let h=k.iter();!h.next().done;)if(ni(h.value))return!0;return!1}function wi(k){let h=!1;return k.iterChanges((g,O,B,$,G)=>{!h&&ui(G)&&(h=!0)}),h}const vi=ie.sj.define({combine:k=>k.some(h=>h)});function Gt(k={}){let h=[Bi];return k.alwaysIsolate&&h.push(vi.of(!0)),h}const Bi=z.Z9.fromClass(class{constructor(k){this.always=k.state.facet(vi)||k.textDirection!=z.OP.LTR||k.state.facet(z.Lz.perLineTextDirection),this.hasRTL=!this.always&&ui(k.state.doc),this.tree=at(k.state),this.decorations=this.always||this.hasRTL?ki(k,this.tree,this.always):z.NZ.none}update(k){let h=k.state.facet(vi)||k.view.textDirection!=z.OP.LTR||k.state.facet(z.Lz.perLineTextDirection);if(!h&&!this.hasRTL&&wi(k.changes)&&(this.hasRTL=!0),!h&&!this.hasRTL)return;let g=at(k.state);(h!=this.always||g!=this.tree||k.docChanged||k.viewportChanged)&&(this.tree=g,this.always=h,this.decorations=ki(k.view,g,h))}},{provide:k=>{function h(g){var O,B;return(B=(O=g.plugin(k))===null||O===void 0?void 0:O.decorations)!==null&&B!==void 0?B:z.NZ.none}return[z.Lz.outerDecorations.of(h),ie.Nb.lowest(z.Lz.bidiIsolatedRanges.of(h))]}});function ki(k,h,g){let O=new ie.vB,B=k.visibleRanges;g||(B=Si(B,k.state.doc));for(let{from:$,to:G}of B)h.iterate({enter:ue=>{let fe=ue.type.prop(v.uY.isolate);fe&&O.add(ue.from,ue.to,_i[fe])},from:$,to:G});return O.finish()}function Si(k,h){let g=h.iter(),O=0,B=[],$=null;for(let{from:G,to:ue}of k)if(!($&&$.to>G&&(G=$.to,G>=ue)))for(O+g.value.length<G&&(g.next(G-(O+g.value.length)),O=G);;){let fe=O,Te=O+g.value.length;if(!g.lineBreak&&ni(g.value)&&($&&$.to>fe-10?$.to=Math.min(ue,Te):B.push($={from:fe,to:Math.min(ue,Te)})),Te>=ue)break;O=Te,g.next()}return B}const _i={rtl:z.NZ.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:z.OP.RTL}),ltr:z.NZ.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:z.OP.LTR}),auto:z.NZ.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})}},813313:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{$w:()=>St});var v=Ke(896765),ie=Ke(924835),z=Ke(350210);class Oe{constructor(q,pe,re){this.from=q,this.to=pe,this.diagnostic=re}}class Je{constructor(q,pe,re){this.diagnostics=q,this.panel=pe,this.selected=re}static init(q,pe,re){let ve=q,Le=re.facet(wt).markerFilter;Le&&(ve=Le(ve,re));let Ne=q.slice().sort((we,ut)=>we.from-ut.from||we.to-ut.to),Xe=new ie.vB,ze=[],tt=0;for(let we=0;;){let ut=we==Ne.length?null:Ne[we];if(!ut&&!ze.length)break;let gt,Nt;for(ze.length?(gt=tt,Nt=ze.reduce((Pe,Bt)=>Math.min(Pe,Bt.to),ut&&ut.from>gt?ut.from:1e8)):(gt=ut.from,Nt=ut.to,ze.push(ut),we++);we<Ne.length;){let Pe=Ne[we];if(Pe.from==gt&&(Pe.to>Pe.from||Pe.to==gt))ze.push(Pe),we++,Nt=Math.min(Pe.to,Nt);else{Nt=Math.min(Pe.from,Nt);break}}let yt=gi(ze);if(ze.some(Pe=>Pe.from==Pe.to||Pe.from==Pe.to-1&&re.doc.lineAt(Pe.from).to==Pe.from))Xe.add(gt,gt,v.NZ.widget({widget:new dt(yt),diagnostics:ze.slice()}));else{let Pe=ze.reduce((Bt,Xt)=>Xt.markClass?Bt+" "+Xt.markClass:Bt,"");Xe.add(gt,Nt,v.NZ.mark({class:"cm-lintRange cm-lintRange-"+yt+Pe,diagnostics:ze.slice(),inclusiveEnd:ze.some(Bt=>Bt.to>Nt)}))}tt=Nt;for(let Pe=0;Pe<ze.length;Pe++)ze[Pe].to<=tt&&ze.splice(Pe--,1)}let qe=Xe.finish();return new Je(qe,pe,Re(qe))}}function Re(Q,q=null,pe=0){let re=null;return Q.between(pe,1e9,(ve,Le,{spec:Ne})=>
19{if(!(q&&Ne.diagnostics.indexOf(q)<0))if(!re)re=new Oe(ve,Le,q||Ne.diagnostics[0]);else{if(Ne.diagnostics.indexOf(re.diagnostic)<0)return!1;re=new Oe(re.from,Le,re.diagnostic)}}),re}function Ie(Q,q){let pe=q.pos,re=q.end||pe,ve=Q.state.facet(wt).hideOn(Q,pe,re);if(ve!=null)return ve;let Le=Q.startState.doc.lineAt(q.pos);return!!(Q.effects.some(Ne=>Ne.is(bt))||Q.changes.touchesRange(Le.from,Math.max(Le.to,re)))}function it(Q,q){return Q.field(Ze,!1)?q:q.concat(ie.Pe.appendConfig.of(Lt))}function zt(Q,q){return{effects:it(Q,[bt.of(q)])}}const bt=ie.Pe.define(),nt=ie.Pe.define(),jt=ie.Pe.define(),Ze=ie.sU.define({create(){return new Je(v.NZ.none,null,null)},update(Q,q){if(q.docChanged&&Q.diagnostics.size){let pe=Q.diagnostics.map(q.changes),re=null,ve=Q.panel;if(Q.selected){let Le=q.changes.mapPos(Q.selected.from,1);re=Re(pe,Q.selected.diagnostic,Le)||Re(pe,null,Le)}!pe.size&&ve&&q.state.facet(wt).autoPanel&&(ve=null),Q=new Je(pe,ve,re)}for(let pe of q.effects)if(pe.is(bt)){let re=q.state.facet(wt).autoPanel?pe.value.length?Jt.open:null:Q.panel;Q=Je.init(pe.value,re,q.state)}else pe.is(nt)?Q=new Je(Q.diagnostics,pe.value?Jt.open:null,Q.selected):pe.is(jt)&&(Q=new Je(Q.diagnostics,Q.panel,pe.value));return Q},provide:Q=>[v.S7.from(Q,q=>q.panel),v.Lz.decorations.from(Q,q=>q.diagnostics)]});function at(Q){let q=Q.field(Ze,!1);return q?q.diagnostics.size:0}const Dt=v.NZ.mark({class:"cm-lintRange cm-lintRange-active"});function ei(Q,q,pe){let{diagnostics:re}=Q.state.field(Ze),ve,Le=-1,Ne=-1;re.between(q-(pe<0?1:0),q+(pe>0?1:0),(ze,tt,{spec:qe})=>{if(q>=ze&&q<=tt&&(ze==tt||(q>ze||pe>0)&&(q<tt||pe<0)))return ve=qe.diagnostics,Le=ze,Ne=tt,!1});let Xe=Q.state.facet(wt).tooltipFilter;return ve&&Xe&&(ve=Xe(ve,Q.state)),ve?{pos:Le,end:Ne,above:Q.state.doc.lineAt(Le).to<Ne,create(){return{dom:Ht(Q,ve)}}}:null}function Ht(Q,q){return(0,z.A)("ul",{class:"cm-tooltip-lint"},q.map(pe=>Yt(Q,pe,!1)))}const pi=Q=>{let q=Q.state.field(Ze,!1);(!q||!q.panel)&&Q.dispatch({effects:it(Q.state,[nt.of(!0)])});let pe=(0,v.ld)(Q,Jt.open);return pe&&pe.dom.querySelector(".cm-panel-lint ul").focus(),!0},ai=Q=>{let q=Q.state.field(Ze,!1);return!q||!q.panel?!1:(Q.dispatch({effects:nt.of(!1)}),!0)},mt=Q=>{let q=Q.state.field(Ze,!1);if(!q)return!1;let pe=Q.state.selection.main,re=q.diagnostics.iter(pe.to+1);return!re.value&&(re=q.diagnostics.iter(0),!re.value||re.from==pe.from&&re.to==pe.to)?!1:(Q.dispatch({selection:{anchor:re.from,head:re.to},scrollIntoView:!0}),!0)},st=Q=>{let{state:q}=Q,pe=q.field(Ze,!1);if(!pe)return!1;let re=q.selection.main,ve,Le,Ne,Xe;return pe.diagnostics.between(0,q.doc.length,(ze,tt)=>{tt<re.to&&(ve==null||ve<ze)&&(ve=ze,Le=tt),(Ne==null||ze>Ne)&&(Ne=ze,Xe=tt)}),Ne==null||ve==null&&Ne==re.from?!1:(Q.dispatch({selection:{anchor:ve??Ne,head:Le??Xe},scrollIntoView:!0}),!0)},St=[{key:"Mod-Shift-m",run:pi,preventDefault:!0},{key:"F8",run:mt}],ft=null;function Vt(Q,q,pe){let re=[],ve=-1;for(let Le of Q)Le.then(Ne=>{re.push(Ne),clearTimeout(ve),re.length==Q.length?q(re):ve=setTimeout(()=>q(re),200)},pe)}const wt=ie.sj.define({combine(Q){return Object.assign({sources:Q.map(q=>q.source).filter(q=>q!=null)},(0,ie.QR)(Q.map(q=>q.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(q,pe)=>q?pe?re=>q(re)||pe(re):q:pe}))}});function Ci(Q,q={}){return[wt.of({source:Q,config:q}),ft,Lt]}function oi(Q){let q=Q.plugin(ft);q&&q.force()}function mi(Q){let q=[];if(Q)e:for(let{name:pe}of Q){for(let re=0;re<pe.length;re++){let ve=pe[re];if(/[a-zA-Z]/.test(ve)&&!q.some(Le=>Le.toLowerCase()==ve.toLowerCase())){q.push(ve);continue e}}q.push("")}return q}function Yt(Q,q,pe){var re;let ve=pe?mi(q.actions):[];return(0,z.A)("li",{class:"cm-diagnostic cm-diagnostic-"+q.severity},(0,z.A)("span",{class:"cm-diagnosticText"},q.renderMessage?q.renderMessage(Q):q.message),(re=q.actions)===null||re===void 0?void 0:re.map((Le,Ne)=>{let Xe=!1,ze=ut=>{if(ut.preventDefault(),Xe)return;Xe=!0;let gt=Re(Q.state.field(Ze).diagnostics,q);gt&&Le.apply(Q,gt.from,gt.to)},{name:tt}=Le,qe=ve[Ne]?tt.indexOf(ve[Ne]):-1,we=qe<0?tt:[tt.slice(0,qe),(0,z.A)("u",tt.slice(qe,qe+1)),tt.slice(qe+1)];return(0,z.A)("button",{type:"button",class:"cm-diagnosticAction",onclick:ze,onmousedown:ze,"aria-label":` Action: ${tt}${qe<0?"":` (access key "${ve[Ne]})"`}.`},we)}),q.source&&(0,z.A)("div",{class:"cm-diagnosticSource"},q.source))}class dt extends v.xO{constructor(q){super(),this.sev=q}eq(q){return q.sev==this.sev}toDOM(){return(0,z.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class pt{constructor(q,pe){this.diagnostic=pe,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Yt(q,pe,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Jt{constructor(q){this.view=q,this.items=[];let pe=ve=>{if(ve.keyCode==27)ai(this.view),this.view.focus();else if(ve.keyCode==38||ve.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(ve.keyCode==40||ve.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(ve.keyCode==36)this.moveSelection(0);else if(ve.keyCode==35)this.moveSelection(this.items.length-1);else if(ve.keyCode==13)this.view.focus();else if(ve.keyCode>=65&&ve.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:Le}=this.items[this.selectedIndex],Ne=mi(Le.actions);for(let Xe=0;Xe<Ne.length;
vendor: 4,776 bytes, line 19
19Xe++)if(Ne[Xe].toUpperCase().charCodeAt(0)==ve.keyCode){let ze=Re(this.view.state.field(Ze).diagnostics,Le);ze&&Le.actions[Xe].apply(q,ze.from,ze.to)}}else return;ve.preventDefault()},re=ve=>{for(let Le=0;Le<this.items.length;Le++)this.items[Le].dom.contains(ve.target)&&this.moveSelection(Le)};this.list=(0,z.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:pe,onclick:re}),this.dom=(0,z.A)("div",{class:"cm-panel-lint"},this.list,(0,z.A)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ai(this.view)},"\xD7")),this.update()}get selectedIndex(){let q=this.view.state.field(Ze).selected;if(!q)return-1;for(let pe=0;pe<this.items.length;pe++)if(this.items[pe].diagnostic==q.diagnostic)return pe;return-1}update(){let{diagnostics:q,selected:pe}=this.view.state.field(Ze),re=0,ve=!1,Le=null,Ne=new Set;for(q.between(0,this.view.state.doc.length,(Xe,ze,{spec:tt})=>{for(let qe of tt.diagnostics){if(Ne.has(qe))continue;Ne.add(qe);let we=-1,ut;for(let gt=re;gt<this.items.length;gt++)if(this.items[gt].diagnostic==qe){we=gt;break}we<0?(ut=new pt(this.view,qe),this.items.splice(re,0,ut),ve=!0):(ut=this.items[we],we>re&&(this.items.splice(re,we-re),ve=!0)),pe&&ut.diagnostic==pe.diagnostic?ut.dom.hasAttribute("aria-selected")||(ut.dom.setAttribute("aria-selected","true"),Le=ut):ut.dom.hasAttribute("aria-selected")&&ut.dom.removeAttribute("aria-selected"),re++}});re<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)ve=!0,this.items.pop();this.items.length==0&&(this.items.push(new pt(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),ve=!0),Le?(this.list.setAttribute("aria-activedescendant",Le.id),this.view.requestMeasure({key:this,read:()=>({sel:Le.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:Xe,panel:ze})=>{let tt=ze.height/this.list.offsetHeight;Xe.top<ze.top?this.list.scrollTop-=(ze.top-Xe.top)/tt:Xe.bottom>ze.bottom&&(this.list.scrollTop+=(Xe.bottom-ze.bottom)/tt)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),ve&&this.sync()}sync(){let q=this.list.firstChild;function pe(){let re=q;q=re.nextSibling,re.remove()}for(let re of this.items)if(re.dom.parentNode==this.list){for(;q!=re.dom;)pe();q=re.dom.nextSibling}else this.list.insertBefore(re.dom,q);for(;q;)pe()}moveSelection(q){if(this.selectedIndex<0)return;let pe=this.view.state.field(Ze),re=Re(pe.diagnostics,this.items[q].diagnostic);re&&this.view.dispatch({selection:{anchor:re.from,head:re.to},scrollIntoView:!0,effects:jt.of(re)})}static open(q){return new Jt(q)}}function Ue(Q,q='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${q}>${encodeURIComponent(Q)}</svg>')`}function ti(Q){return Ue(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${Q}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const kt=v.Lz.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ti("#d11")},".cm-lintRange-warning":{backgroundImage:ti("orange")},".cm-lintRange-info":{backgroundImage:ti("#999")},".cm-lintRange-hint":{backgroundImage:ti("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});
19function hi(Q){return Q=="error"?4:Q=="warning"?3:Q=="info"?2:1}function gi(Q){let q="hint",pe=1;for(let re of Q){let ve=hi(re.severity);ve>pe&&(pe=ve,q=re.severity)}return q}class Mt extends v.wJ{constructor(q){super(),this.diagnostics=q,this.severity=gi(q)}toDOM(q){let pe=document.createElement("div");pe.className="cm-lint-marker cm-lint-marker-"+this.severity;let re=this.diagnostics,ve=q.state.facet(bi).tooltipFilter;return ve&&(re=ve(re,q.state)),re.length&&(pe.onmouseover=()=>vt(q,pe,re)),pe}}function Ct(Q,q){let pe=re=>{let ve=q.getBoundingClientRect();if(!(re.clientX>ve.left-10&&re.clientX<ve.right+10&&re.clientY>ve.top-10&&re.clientY<ve.bottom+10)){for(let Le=re.target;Le;Le=Le.parentNode)if(Le.nodeType==1&&Le.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",pe),Q.state.field(Et)&&Q.dispatch({effects:xt.of(null)})}};window.addEventListener("mousemove",pe)}function vt(Q,q,pe){function re(){let Ne=Q.elementAtHeight(q.getBoundingClientRect().top+5-Q.documentTop);Q.coordsAtPos(Ne.from)&&Q.dispatch({effects:xt.of({pos:Ne.from,above:!1,clip:!1,create(){return{dom:Ht(Q,pe),getCoords:()=>q.getBoundingClientRect()}}})}),q.onmouseout=q.onmousemove=null,Ct(Q,q)}let{hoverTime:ve}=Q.state.facet(bi),Le=setTimeout(re,ve);q.onmouseout=()=>{clearTimeout(Le),q.onmouseout=q.onmousemove=null},q.onmousemove=()=>{clearTimeout(Le),Le=setTimeout(re,ve)}}function Ft(Q,q){let pe=Object.create(null);for(let ve of q){let Le=Q.lineAt(ve.from);(pe[Le.from]||(pe[Le.from]=[])).push(ve)}let re=[];for(let ve in pe)re.push(new Mt(pe[ve]).range(+ve));return ie.om.of(re,!0)}const li=(0,v.cU)({class:"cm-gutter-lint",markers:Q=>Q.state.field(Kt),widgetMarker:(Q,q,pe)=>{let re=[];return Q.state.field(Kt).between(pe.from,pe.to,(ve,Le,Ne)=>{ve>pe.from&&ve<pe.to&&re.push(...Ne.diagnostics)}),re.length?new Mt(re):null}}),Kt=ie.sU.define({create(){return ie.om.empty},update(Q,q){Q=Q.map(q.changes);let pe=q.state.facet(bi).markerFilter;for(let re of q.effects)if(re.is(bt)){let ve=re.value;pe&&(ve=pe(ve||[],q.state)),Q=Ft(q.state.doc,ve.slice(0))}return Q}}),xt=ie.Pe.define(),Et=ie.sU.define({create(){return null},update(Q,q){return Q&&q.docChanged&&(Q=Ie(q,Q)?null:Object.assign(Object.assign({},Q),{pos:q.changes.mapPos(Q.pos)})),q.effects.reduce((pe,re)=>re.is(xt)?re.value:pe,Q)},provide:Q=>v.DK.from(Q)}),Ai=v.Lz.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Ue('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Ue('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Ue('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Lt=[Ze,v.Lz.decorations.compute([Ze],Q=>{let{selected:q,panel:pe}=Q.field(Ze);return!q||!pe||q.from==q.to?v.NZ.none:v.NZ.set([Dt.range(q.from,q.to)])}),(0,v.Ux)(ei,{hideOn:Ie}),kt],bi=ie.sj.define({combine(Q){return(0,ie.QR)(Q,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Me(Q={}){return[bi.of(Q),Kt,li,Ai,Et]}function ii(Q,q){let pe=Q.field(Ze,!1);if(pe&&pe.diagnostics.size){let re=[],ve=[],Le=-1;for(let Ne=RangeSet.iter([pe.diagnostics]);;Ne.next()){for(let Xe=0;Xe<re.length;Xe++)(!Ne.value||Ne.value.spec.diagnostics.indexOf(re[Xe])<0)&&(q(re[Xe],ve[Xe],Le),re.splice(Xe,1),ve.splice(Xe--,1));if(!Ne.value)break;for(let Xe of Ne.value.spec.diagnostics)re.indexOf(Xe)<0&&(re.push(Xe),ve.push(Ne.from));Le=Ne.to}}}},90246:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{Eo:()=>Nt,gN:()=>st});var v=Ke(896765),ie=Ke(924835),z=Ke(350210);const Oe=typeof String.prototype.normalize=="function"?_=>_.normalize("NFKD"):_=>_;class Je{constructor(M,H,V=0,Y=M.length,he,Ae){this.test=Ae,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=M.iterRange(V,Y),this.bufferStart=V,this.normalize=he?ke=>he(Oe(ke)):Oe,this.query=this.normalize(H)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,ie.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let M=this.peek();if(M<0)return this.done=!0,this;let H=(0,ie.MK)(M),V=this.bufferStart+this.bufferPos;this.bufferPos+=(0,ie.Fh)(M);let Y=this.normalize(H);if(Y.length)for(let he=0,Ae=V;;he++){let ke=Y.charCodeAt(he),_e=this.match(ke,Ae,this.bufferPos+this.bufferStart);if(he==Y.length-1){if(_e)return this.value=_e,this;break}
19Ae==V&&he<H.length&&H.charCodeAt(he)==ke&&Ae++}}}match(M,H,V){let Y=null;for(let he=0;he<this.matches.length;he+=2){let Ae=this.matches[he],ke=!1;this.query.charCodeAt(Ae)==M&&(Ae==this.query.length-1?Y={from:this.matches[he+1],to:V}:(this.matches[he]++,ke=!0)),ke||(this.matches.splice(he,2),he-=2)}return this.query.charCodeAt(0)==M&&(this.query.length==1?Y={from:H,to:V}:this.matches.push(1,H)),Y&&this.test&&!this.test(Y.from,Y.to,this.buffer,this.bufferStart)&&(Y=null),Y}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this});const Re={from:-1,to:-1,match:/.*/.exec("")},Ie="gm"+(/x/.unicode==null?"":"u");class it{constructor(M,H,V,Y=0,he=M.length){if(this.text=M,this.to=he,this.curLine="",this.done=!1,this.value=Re,/\\[sWDnr]|\n|\r|\[\^/.test(H))return new nt(M,H,V,Y,he);this.re=new RegExp(H,Ie+(V?.ignoreCase?"i":"")),this.test=V?.test,this.iter=M.iter();let Ae=M.lineAt(Y);this.curLineStart=Ae.from,this.matchPos=Ze(M,Y),this.getLine(this.curLineStart)}getLine(M){this.iter.next(M),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let M=this.matchPos-this.curLineStart;;){this.re.lastIndex=M;let H=this.matchPos<=this.to&&this.re.exec(this.curLine);if(H){let V=this.curLineStart+H.index,Y=V+H[0].length;if(this.matchPos=Ze(this.text,Y+(V==Y?1:0)),V==this.curLineStart+this.curLine.length&&this.nextLine(),(V<Y||V>this.value.to)&&(!this.test||this.test(V,Y,H)))return this.value={from:V,to:Y,match:H},this;M=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),M=0;else return this.done=!0,this}}}const zt=new WeakMap;class bt{constructor(M,H){this.from=M,this.text=H}get to(){return this.from+this.text.length}static get(M,H,V){let Y=zt.get(M);if(!Y||Y.from>=V||Y.to<=H){let ke=new bt(H,M.sliceString(H,V));return zt.set(M,ke),ke}if(Y.from==H&&Y.to==V)return Y;let{text:he,from:Ae}=Y;return Ae>H&&(he=M.sliceString(H,Ae)+he,Ae=H),Y.to<V&&(he+=M.sliceString(Y.to,V)),zt.set(M,new bt(Ae,he)),new bt(H,he.slice(H-Ae,V-Ae))}}class nt{constructor(M,H,V,Y,he){this.text=M,this.to=he,this.done=!1,this.value=Re,this.matchPos=Ze(M,Y),this.re=new RegExp(H,Ie+(V?.ignoreCase?"i":"")),this.test=V?.test,this.flat=bt.get(M,Y,this.chunkEnd(Y+5e3))}chunkEnd(M){return M>=this.to?this.to:this.text.lineAt(M).to}next(){for(;;){let M=this.re.lastIndex=this.matchPos-this.flat.from,H=this.re.exec(this.flat.text);if(H&&!H[0]&&H.index==M&&(this.re.lastIndex=M+1,H=this.re.exec(this.flat.text)),H){let V=this.flat.from+H.index,Y=V+H[0].length;if((this.flat.to>=this.to||H.index+H[0].length<=this.flat.text.length-10)&&(!this.test||this.test(V,Y,H)))return this.value={from:V,to:Y,match:H},this.matchPos=Ze(this.text,Y+(V==Y?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=bt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(it.prototype[Symbol.iterator]=nt.prototype[Symbol.iterator]=function(){return this});function jt(_){try{return new RegExp(_,Ie),!0}catch{return!1}}function Ze(_,M){if(M>=_.length)return M;let H=_.lineAt(M),V;for(;M<H.to&&(V=H.text.charCodeAt(M-H.from))>=56320&&V<57344;)M++;return M}function at(_){let M=String(_.state.doc.lineAt(_.state.selection.main.head).number),H=(0,z.A)("input",{class:"cm-textfield",name:"line",value:M}),V=(0,z.A)("form",{class:"cm-gotoLine",onkeydown:he=>{he.keyCode==27?(he.preventDefault(),_.dispatch({effects:Dt.of(!1)}),_.focus()):he.keyCode==13&&(he.preventDefault(),Y())},onsubmit:he=>{he.preventDefault(),Y()}},(0,z.A)("label",_.state.phrase("Go to line"),": ",H)," ",(0,z.A)("button",{class:"cm-button",type:"submit"},_.state.phrase("go")));function Y(){let he=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(H.value);if(!he)return;let{state:Ae}=_,ke=Ae.doc.lineAt(Ae.selection.main.head),[,_e,Qe,Wt,Rt]=he,fi=Wt?+Wt.slice(1):0,Ut=Qe?+Qe:ke.number;if(Qe&&Rt){let ne=Ut/100;_e&&(ne=ne*(_e=="-"?-1:1)+ke.number/Ae.doc.lines),Ut=Math.round(Ae.doc.lines*ne)}else Qe&&_e&&(Ut=Ut*(_e=="-"?-1:1)+ke.number);let _t=Ae.doc.line(Math.max(1,Math.min(Ae.doc.lines,Ut))),P=ie.OF.cursor(_t.from+Math.max(0,Math.min(fi,_t.length)));_.dispatch({effects:[Dt.of(!1),v.Lz.scrollIntoView(P.from,{y:"center"})],selection:P}),_.focus()}return{dom:V}}const Dt=ie.Pe.define(),ei=ie.sU.define({create(){return!0},update(_,M){for(let H of M.effects)H.is(Dt)&&(_=H.value);return _},provide:_=>v.S7.from(_,M=>M?at:null)}),Ht=_=>{let M=(0,v.ld)(_,at);if(!M){let H=[Dt.of(!0)];_.state.field(ei,!1)==null&&H.push(ie.Pe.appendConfig.of([ei,pi])),_.dispatch({effects:H}),M=(0,v.ld)(_,at)}return M&&M.dom.querySelector("input").select(),!0},pi=v.Lz.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),ai={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},mt=ie.sj.define({combine(_){return(0,ie.QR)(_,ai,{highlightWordAroundCursor:(M,H)=>M||H,minSelectionLength:Math.min,maxMatches:Math.min})}});function st(_){let M=[oi,Ci];return _&&M.push(mt.of(_)),M}const St=v.NZ.mark({class:"cm-selectionMatch"}),ft=v.NZ.mark({class:"cm-selectionMatch cm-selectionMatch-main"});
19function Vt(_,M,H,V){return(H==0||_(M.sliceDoc(H-1,H))!=ie.Je.Word)&&(V==M.doc.length||_(M.sliceDoc(V,V+1))!=ie.Je.Word)}function wt(_,M,H,V){return _(M.sliceDoc(H,H+1))==ie.Je.Word&&_(M.sliceDoc(V-1,V))==ie.Je.Word}const Ci=v.Z9.fromClass(class{constructor(_){this.decorations=this.getDeco(_)}update(_){(_.selectionSet||_.docChanged||_.viewportChanged)&&(this.decorations=this.getDeco(_.view))}getDeco(_){let M=_.state.facet(mt),{state:H}=_,V=H.selection;if(V.ranges.length>1)return v.NZ.none;let Y=V.main,he,Ae=null;if(Y.empty){if(!M.highlightWordAroundCursor)return v.NZ.none;let _e=H.wordAt(Y.head);if(!_e)return v.NZ.none;Ae=H.charCategorizer(Y.head),he=H.sliceDoc(_e.from,_e.to)}else{let _e=Y.to-Y.from;if(_e<M.minSelectionLength||_e>200)return v.NZ.none;if(M.wholeWords){if(he=H.sliceDoc(Y.from,Y.to),Ae=H.charCategorizer(Y.head),!(Vt(Ae,H,Y.from,Y.to)&&wt(Ae,H,Y.from,Y.to)))return v.NZ.none}else if(he=H.sliceDoc(Y.from,Y.to),!he)return v.NZ.none}let ke=[];for(let _e of _.visibleRanges){let Qe=new Je(H.doc,he,_e.from,_e.to);for(;!Qe.next().done;){let{from:Wt,to:Rt}=Qe.value;if((!Ae||Vt(Ae,H,Wt,Rt))&&(Y.empty&&Wt<=Y.from&&Rt>=Y.to?ke.push(ft.range(Wt,Rt)):(Wt>=Y.to||Rt<=Y.from)&&ke.push(St.range(Wt,Rt)),ke.length>M.maxMatches))return v.NZ.none}}return v.NZ.set(ke)}},{decorations:_=>_.decorations}),oi=v.Lz.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),mi=({state:_,dispatch:M})=>{let{selection:H}=_,V=ie.OF.create(H.ranges.map(Y=>_.wordAt(Y.head)||ie.OF.cursor(Y.head)),H.mainIndex);return V.eq(H)?!1:(M(_.update({selection:V})),!0)};function Yt(_,M){let{main:H,ranges:V}=_.selection,Y=_.wordAt(H.head),he=Y&&Y.from==H.from&&Y.to==H.to;for(let Ae=!1,ke=new Je(_.doc,M,V[V.length-1].to);;)if(ke.next(),ke.done){if(Ae)return null;ke=new Je(_.doc,M,0,Math.max(0,V[V.length-1].from-1)),Ae=!0}else{if(Ae&&V.some(_e=>_e.from==ke.value.from))continue;if(he){let _e=_.wordAt(ke.value.from);if(!_e||_e.from!=ke.value.from||_e.to!=ke.value.to)continue}return ke.value}}const dt=({state:_,dispatch:M})=>{let{ranges:H}=_.selection;if(H.some(he=>he.from===he.to))return mi({state:_,dispatch:M});let V=_.sliceDoc(H[0].from,H[0].to);if(_.selection.ranges.some(he=>_.sliceDoc(he.from,he.to)!=V))return!1;let Y=Yt(_,V);return Y?(M(_.update({selection:_.selection.addRange(ie.OF.range(Y.from,Y.to),!1),effects:v.Lz.scrollIntoView(Y.to)})),!0):!1},pt=ie.sj.define({combine(_){return(0,ie.QR)(_,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:M=>new yt(M),scrollToMatch:M=>v.Lz.scrollIntoView(M)})}});function Jt(_){return _?[pt.of(_),Mi]:Mi}
19class Ue{constructor(M){this.search=M.search,this.caseSensitive=!!M.caseSensitive,this.literal=!!M.literal,this.regexp=!!M.regexp,this.replace=M.replace||"",this.valid=!!this.search&&(!this.regexp||jt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!M.wholeWord}unquote(M){return this.literal?M:M.replace(/\\([nrt\\])/g,(H,V)=>V=="n"?`
20`:V=="r"?"\r":V=="t"?"	":"\\")}eq(M){return this.search==M.search&&this.replace==M.replace&&this.caseSensitive==M.caseSensitive&&this.regexp==M.regexp&&this.wholeWord==M.wholeWord}create(){return this.regexp?new li(this):new gi(this)}getCursor(M,H=0,V){let Y=M.doc?M:ie.$t.create({doc:M});return V==null&&(V=Y.doc.length),this.regexp?Mt(this,Y,H,V):kt(this,Y,H,V)}}class ti{constructor(M){this.spec=M}}function kt(_,M,H,V){return new Je(M.doc,_.unquoted,H,V,_.caseSensitive?void 0:Y=>Y.toLowerCase(),_.wholeWord?hi(M.doc,M.charCategorizer(M.selection.main.head)):void 0)}function hi(_,M){return(H,V,Y,he)=>((he>H||he+Y.length<V)&&(he=Math.max(0,H-2),Y=_.sliceString(he,Math.min(_.length,V+2))),(M(Ct(Y,H-he))!=ie.Je.Word||M(vt(Y,H-he))!=ie.Je.Word)&&(M(vt(Y,V-he))!=ie.Je.Word||M(Ct(Y,V-he))!=ie.Je.Word))}class gi extends ti{constructor(M){super(M)}nextMatch(M,H,V){let Y=kt(this.spec,M,V,M.doc.length).nextOverlapping();if(Y.done){let he=Math.min(M.doc.length,H+this.spec.unquoted.length);Y=kt(this.spec,M,0,he).nextOverlapping()}return Y.done||Y.value.from==H&&Y.value.to==V?null:Y.value}prevMatchInRange(M,H,V){for(let Y=V;;){let he=Math.max(H,Y-1e4-this.spec.unquoted.length),Ae=kt(this.spec,M,he,Y),ke=null;for(;!Ae.nextOverlapping().done;)ke=Ae.value;if(ke)return ke;if(he==H)return null;Y-=1e4}}prevMatch(M,H,V){let Y=this.prevMatchInRange(M,0,H);return Y||(Y=this.prevMatchInRange(M,Math.max(0,V-this.spec.unquoted.length),M.doc.length)),Y&&(Y.from!=H||Y.to!=V)?Y:null}getReplacement(M){return this.spec.unquote(this.spec.replace)}matchAll(M,H){let V=kt(this.spec,M,0,M.doc.length),Y=[];for(;!V.next().done;){if(Y.length>=H)return null;Y.push(V.value)}return Y}highlight(M,H,V,Y){let he=kt(this.spec,M,Math.max(0,H-this.spec.unquoted.length),Math.min(V+this.spec.unquoted.length,M.doc.length));for(;!he.next().done;)Y(he.value.from,he.value.to)}}function Mt(_,M,H,V){return new it(M.doc,_.search,{ignoreCase:!_.caseSensitive,test:_.wholeWord?Ft(M.charCategorizer(M.selection.main.head)):void 0},H,V)}function Ct(_,M){return _.slice((0,ie.zK)(_,M,!1),M)}function vt(_,M){return _.slice(M,(0,ie.zK)(_,M))}function Ft(_){return(M,H,V)=>!V[0].length||(_(Ct(V.input,V.index))!=ie.Je.Word||_(vt(V.input,V.index))!=ie.Je.Word)&&(_(vt(V.input,V.index+V[0].length))!=ie.Je.Word||_(Ct(V.input,V.index+V[0].length))!=ie.Je.Word)}class li extends ti{nextMatch(M,H,V){let Y=Mt(this.spec,M,V,M.doc.length).next();return Y.done&&(Y=Mt(this.spec,M,0,H).next()),Y.done?null:Y.value}prevMatchInRange(M,H,V){for(let Y=1;;Y++){let he=Math.max(H,V-Y*1e4),Ae=Mt(this.spec,M,he,V),ke=null;for(;!Ae.next().done;)ke=Ae.value;if(ke&&(he==H||ke.from>he+10))return ke;if(he==H)return null}}prevMatch(M,H,V){return this.prevMatchInRange(M,0,H)||this.prevMatchInRange(M,V,M.doc.length)}getReplacement(M){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(H,V)=>{if(V=="&")return M.match[0];if(V=="$")return"$";for(let Y=V.length;Y>0;Y--){let he=+V.slice(0,Y);if(he>0&&he<M.match.length)return M.match[he]+V.slice(Y)}return H})}matchAll(M,H){let V=Mt(this.spec,M,0,M.doc.length),Y=[];for(;!V.next().done;){if(Y.length>=H)return null;Y.push(V.value)}return Y}highlight(M,H,V,Y){let he=Mt(this.spec,M,Math.max(0,H-250),Math.min(V+250,M.doc.length));for(;!he.next().done;)Y(he.value.from,he.value.to)}}const Kt=ie.Pe.define(),xt=ie.Pe.define(),Et=ie.sU.define({create(_){return new bi(tt(_).create(),null)},update(_,M){for(let H of M.effects)H.is(Kt)?_=new bi(H.value.create(),_.panel):H.is(xt)&&(_=new bi(_.query,H.value?ze:null));return _},provide:_=>v.S7.from(_,M=>M.panel)});function Ai(_){let M=_.field(Et,!1);return M?M.query.spec:tt(_)}function Lt(_){var M;return((M=_.field(Et,!1))===null||M===void 0?void 0:M.panel)!=null}class bi{constructor(M,H){this.query=M,this.panel=H}}const Me=v.NZ.mark({class:"cm-searchMatch"}),ii=v.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Q=v.Z9.fromClass(class{constructor(_){this.view=_,this.decorations=this.highlight(_.state.field(Et))}update(_){let M=_.state.field(Et);(M!=_.startState.field(Et)||_.docChanged||_.selectionSet||_.viewportChanged)&&(this.decorations=this.highlight(M))}highlight({query:_,panel:M}){if(!M||!_.spec.valid)return v.NZ.none;let{view:H}=this,V=new ie.vB;for(let Y=0,he=H.visibleRanges,Ae=he.length;Y<Ae;Y++){let{from:ke,to:_e}=he[Y];for(;Y<Ae-1&&_e>he[Y+1].from-2*250;)_e=he[++Y].to;_.highlight(H.state,ke,_e,(Qe,Wt)=>{let Rt=H.state.selection.ranges.some(fi=>fi.from==Qe&&fi.to==Wt);V.add(Qe,Wt,Rt?ii:Me)})}return V.finish()}},{decorations:_=>_.decorations});function q(_){return M=>{let H=M.state.field(Et,!1);return H&&H.query.spec.valid?_(M,H):ut(M)}}const pe=q((_,{query:M})=>{let{to:H}=_.state.selection.main,V=M.nextMatch(_.state,H,H);if(!V)return!1;let Y=ie.OF.single(V.from,V.to),he=_.state.facet(pt);return _.dispatch({selection:Y,effects:[$t(_,V),he.scrollToMatch(Y.main,_)],userEvent:"select.search"}),we(_),!0}),re=q((_,{query:M})=>{let{state:H}=_,{from:V}=H.selection.main,Y=M.prevMatch(H,V,V);if(!Y)return!1;let he=ie.OF.single(Y.from,Y.to),Ae=_.state.facet(pt);return _.dispatch({selection:he,effects:[$t(_,Y),Ae.scrollToMatch(he.main,_)],userEvent:"select.search"}),we(_),!0}),ve=q((_,{query:M})=>{let H=M.matchAll(_.state,1e3);return!H||!H.length?!1:(_.dispatch({selection:ie.OF.create(H.map(V=>ie.OF.range(V.from,V.to))),userEvent:"select.search.matches"}),!0)}),Le=({state:_,dispatch:M})=>{let H=_.selection;if(H.ranges.length>1||H.main.empty)return!1;let{from:V,to:Y}=H.main,he=[],Ae=0;for(let ke=new Je(_.doc,_.sliceDoc(V,Y));!ke.next().done;){if(he.length>1e3)return!1;ke.value.from==V&&(Ae=he.length),he.push(ie.OF.range(ke.value.from,ke.value.to))}return M(_.update({selection:ie.OF.create(he,Ae),userEvent:"select.search.matches"})),!0},Ne=q((_,{query:M})=>{let{state:H}=_,{from:V,to:Y}=H.selection.main;if(H.readOnly)return!1;let he=M.nextMatch(H,V,V);if(!he)return!1;let Ae=he,ke=[],_e,Qe,Wt=[];if(Ae.from==V&&Ae.to==Y&&(Qe=H.toText(M.getReplacement(Ae)),ke.push({from:Ae.from,to:Ae.to,insert:Qe}),Ae=M.nextMatch(H,Ae.from,Ae.to),Wt.push(v.Lz.announce.of(H.phrase("replaced match on line $",H.doc.lineAt(V).number)+"."))),Ae){let Rt=ke.length==0||ke[0].from>=he.to?0:he.to-he.from-Qe.length;_e=ie.OF.single(Ae.from-Rt,Ae.to-Rt),Wt.push($t(_,Ae)),Wt.push(H.facet(pt).scrollToMatch(_e.main,_))}return _.dispatch({changes:ke,selection:_e,effects:Wt,userEvent:"input.replace"}),!0}),Xe=q((_,{query:M})=>{if(_.state.readOnly)return!1;let H=M.matchAll(_.state,1e9).map(Y=>{let{from:he,to:Ae}=Y;return{from:he,to:Ae,insert:M.getReplacement(Y)}});if(!H.length)return!1;let V=_.state.phrase("replaced $ matches",H.length)+".";return _.dispatch({changes:H,effects:v.Lz.announce.of(V),userEvent:"input.replace.all"}),!0});function ze(_){return _.state.facet(pt).createPanel(_)}function tt(_,M){var H,V,Y,he,Ae;let ke=_.selection.main,_e=ke.empty||ke.to>ke.from+100?"":_.sliceDoc(ke.from,ke.to);if(M&&!_e)return M;let Qe=_.facet(pt);return new Ue({search:((H=M?.literal)!==null&&H!==void 0?H:Qe.literal)?_e:_e.replace(/\n/g,"\\n"),caseSensitive:(V=M?.caseSensitive)!==null&&V!==void 0?V:Qe.caseSensitive,literal:(Y=M?.literal)!==null&&Y!==void 0?Y:Qe.literal,regexp:(he=M?.regexp)!==null&&he!==void 0?he:Qe.regexp,wholeWord:(Ae=M?.wholeWord)!==null&&Ae!==void 0?Ae:Qe.wholeWord})}function qe(_){let M=(0,v.ld)(_,ze);return M&&M.dom.querySelector("[main-field]")}function we(_){let M=qe(_);M&&M==_.root.activeElement&&M.select()}const ut=_=>{let M=_.state.field(Et,!1);if(M&&M.panel){let H=qe(_);
20if(H&&H!=_.root.activeElement){let V=tt(_.state,M.query.spec);V.valid&&_.dispatch({effects:Kt.of(V)}),H.focus(),H.select()}}else _.dispatch({effects:[xt.of(!0),M?Kt.of(tt(_.state,M.query.spec)):ie.Pe.appendConfig.of(Mi)]});return!0},gt=_=>{let M=_.state.field(Et,!1);if(!M||!M.panel)return!1;let H=(0,v.ld)(_,ze);return H&&H.dom.contains(_.root.activeElement)&&_.focus(),_.dispatch({effects:xt.of(!1)}),!0},Nt=[{key:"Mod-f",run:ut,scope:"editor search-panel"},{key:"F3",run:pe,shift:re,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:pe,shift:re,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:gt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Le},{key:"Mod-Alt-g",run:Ht},{key:"Mod-d",run:dt,preventDefault:!0}];class yt{constructor(M){this.view=M;let H=this.query=M.state.field(Et).query.spec;this.commit=this.commit.bind(this),this.searchField=(0,z.A)("input",{value:H.search,placeholder:Pe(M,"Find"),"aria-label":Pe(M,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,z.A)("input",{value:H.replace,placeholder:Pe(M,"Replace"),"aria-label":Pe(M,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,z.A)("input",{type:"checkbox",name:"case",form:"",checked:H.caseSensitive,onchange:this.commit}),this.reField=(0,z.A)("input",{type:"checkbox",name:"re",form:"",checked:H.regexp,onchange:this.commit}),this.wordField=(0,z.A)("input",{type:"checkbox",name:"word",form:"",checked:H.wholeWord,onchange:this.commit});function V(Y,he,Ae){return(0,z.A)("button",{class:"cm-button",name:Y,onclick:he,type:"button"},Ae)}this.dom=(0,z.A)("div",{onkeydown:Y=>this.keydown(Y),class:"cm-search"},[this.searchField,V("next",()=>pe(M),[Pe(M,"next")]),V("prev",()=>re(M),[Pe(M,"previous")]),V("select",()=>ve(M),[Pe(M,"all")]),(0,z.A)("label",null,[this.caseField,Pe(M,"match case")]),(0,z.A)("label",null,[this.reField,Pe(M,"regexp")]),(0,z.A)("label",null,[this.wordField,Pe(M,"by word")]),...M.state.readOnly?[]:[(0,z.A)("br"),this.replaceField,V("replace",()=>Ne(M),[Pe(M,"replace")]),V("replaceAll",()=>Xe(M),[Pe(M,"replace all")])],(0,z.A)("button",{name:"close",onclick:()=>gt(M),"aria-label":Pe(M,"close"),type:"button"},["\xD7"])])}commit(){let M=new Ue({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});M.eq(this.query)||(this.query=M,this.view.dispatch({effects:Kt.of(M)}))}keydown(M){(0,v.TS)(this.view,M,"search-panel")?M.preventDefault():M.keyCode==13&&M.target==this.searchField?(M.preventDefault(),(M.shiftKey?re:pe)(this.view)):M.keyCode==13&&M.target==this.replaceField&&(M.preventDefault(),Ne(this.view))}update(M){for(let H of M.transactions)for(let V of H.effects)V.is(Kt)&&!V.value.eq(this.query)&&this.setQuery(V.value)}setQuery(M){this.query=M,this.searchField.value=M.search,this.replaceField.value=M.replace,this.caseField.checked=M.caseSensitive,this.reField.checked=M.regexp,this.wordField.checked=M.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(pt).top}}function Pe(_,M){return _.state.phrase(M)}const Bt=30,Xt=/[\s\.,:;?!]/;function $t(_,{from:M,to:H}){let V=_.state.doc.lineAt(M),Y=_.state.doc.lineAt(H).to,he=Math.max(V.from,M-Bt),Ae=Math.min(Y,H+Bt),ke=_.state.sliceDoc(he,Ae);if(he!=V.from){for(let _e=0;_e<Bt;_e++)if(!Xt.test(ke[_e+1])&&Xt.test(ke[_e])){ke=ke.slice(_e);break}}if(Ae!=Y){for(let _e=ke.length-1;_e>ke.length-Bt;_e--)if(!Xt.test(ke[_e-1])&&Xt.test(ke[_e])){ke=ke.slice(0,_e);break}}return v.Lz.announce.of(`${_.state.phrase("current match")}. ${ke} ${_.state.phrase("on line")} ${V.number}.`)}const ci=v.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Mi=[Et,ie.Nb.low(Q),ci]},924835:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{$t:()=>V,EY:()=>ie,FB:()=>he,Fh:()=>pi,Gu:()=>st,Je:()=>ci,MK:()=>Ht,Nb:()=>Kt,OF:()=>dt,Pe:()=>qe,QR:()=>Y,VR:()=>St,YH:()=>Xe,ZX:()=>we,iR:()=>mt,kn:()=>je,om:()=>Qe,sU:()=>vt,sj:()=>Ue,vB:()=>Rt,vS:()=>ei,y$:()=>Ye,zK:()=>Ze});var v=Ke(232053);class ie{lineAt(o){if(o<0||o>this.length)throw new RangeError(`Invalid position ${o} in document of length ${this.length}`);return this.lineInner(o,!1,1,0)}line(o){if(o<1||o>this.lines)throw new RangeError(`Invalid line number ${o} in ${this.lines}-line document`);return this.lineInner(o,!0,1,0)}replace(o,l,f){[o,l]=jt(this,o,l);let m=[];return this.decompose(0,o,m,2),f.length&&f.decompose(0,f.length,m,3),this.decompose(l,this.length,m,1),Oe.from(m,this.length-(l-o)+f.length)}append(o){return this.replace(this.length,this.length,o)}slice(o,l=this.length){[o,l]=jt(this,o,l);let f=[];return this.decompose(o,l,f,0),Oe.from(f,l-o)}eq(o){if(o==this)return!0;
vendor: 5,061 bytes, lines 20-22
20if(o.length!=this.length||o.lines!=this.lines)return!1;let l=this.scanIdentical(o,1),f=this.length-this.scanIdentical(o,-1),m=new it(this),S=new it(o);for(let C=l,R=l;;){if(m.next(C),S.next(C),C=0,m.lineBreak!=S.lineBreak||m.done!=S.done||m.value!=S.value)return!1;if(R+=m.value.length,m.done||R>=f)return!0}}iter(o=1){return new it(this,o)}iterRange(o,l=this.length){return new zt(this,o,l)}iterLines(o,l){let f;if(o==null)f=this.iter();else{l==null&&(l=this.lines+1);let m=this.line(o).from;f=this.iterRange(m,Math.max(m,l==this.lines+1?this.length:l<=1?0:this.line(l-1).to))}return new bt(f)}toString(){return this.sliceString(0)}toJSON(){let o=[];return this.flatten(o),o}constructor(){}static of(o){if(o.length==0)throw new RangeError("A document must have at least one line");return o.length==1&&!o[0]?ie.empty:o.length<=32?new z(o):Oe.from(z.split(o,[]))}}class z extends ie{constructor(o,l=Je(o)){super(),this.text=o,this.length=l}get lines(){return this.text.length}get children(){return null}lineInner(o,l,f,m){for(let S=0;;S++){let C=this.text[S],R=m+C.length;if((l?f:R)>=o)return new nt(m,R,f,C);m=R+1,f++}}decompose(o,l,f,m){let S=o<=0&&l>=this.length?this:new z(Ie(this.text,o,l),Math.min(l,this.length)-Math.max(0,o));if(m&1){let C=f.pop(),R=Re(S.text,C.text.slice(),0,S.length);if(R.length<=32)f.push(new z(R,C.length+S.length));else{let j=R.length>>1;f.push(new z(R.slice(0,j)),new z(R.slice(j)))}}else f.push(S)}replace(o,l,f){if(!(f instanceof z))return super.replace(o,l,f);[o,l]=jt(this,o,l);let m=Re(this.text,Re(f.text,Ie(this.text,0,o)),l),S=this.length+f.length-(l-o);return m.length<=32?new z(m,S):Oe.from(z.split(m,[]),S)}sliceString(o,l=this.length,f=`
21`){[o,l]=jt(this,o,l);let m="";for(let S=0,C=0;S<=l&&C<this.text.length;C++){let R=this.text[C],j=S+R.length;S>o&&C&&(m+=f),o<j&&l>S&&(m+=R.slice(Math.max(0,o-S),l-S)),S=j+1}return m}flatten(o){for(let l of this.text)o.push(l)}scanIdentical(){return 0}static split(o,l){let f=[],m=-1;for(let S of o)f.push(S),m+=S.length+1,f.length==32&&(l.push(new z(f,m)),f=[],m=-1);return m>-1&&l.push(new z(f,m)),l}}class Oe extends ie{constructor(o,l){super(),this.children=o,this.length=l,this.lines=0;for(let f of o)this.lines+=f.lines}lineInner(o,l,f,m){for(let S=0;;S++){let C=this.children[S],R=m+C.length,j=f+C.lines-1;if((l?j:R)>=o)return C.lineInner(o,l,f,m);m=R+1,f=j+1}}decompose(o,l,f,m){for(let S=0,C=0;C<=l&&S<this.children.length;S++){let R=this.children[S],j=C+R.length;if(o<=j&&l>=C){let le=m&((C<=o?1:0)|(j>=l?2:0));C>=o&&j<=l&&!le?f.push(R):R.decompose(o-C,l-C,f,le)}C=j+1}}replace(o,l,f){if([o,l]=jt(this,o,l),f.lines<this.lines)for(let m=0,S=0;m<this.children.length;m++){let C=this.children[m],R=S+C.length;if(o>=S&&l<=R){let j=C.replace(o-S,l-S,f),le=this.lines-C.lines+j.lines;if(j.lines<le>>5-1&&j.lines>le>>5+1){let ye=this.children.slice();return ye[m]=j,new Oe(ye,this.length-(l-o)+f.length)}return super.replace(S,R,j)}S=R+1}return super.replace(o,l,f)}sliceString(o,l=this.length,f=`
22`){[o,l]=jt(this,o,l);let m="";for(let S=0,C=0;S<this.children.length&&C<=l;S++){let R=this.children[S],j=C+R.length;C>o&&S&&(m+=f),o<j&&l>C&&(m+=R.sliceString(o-C,l-C,f)),C=j+1}return m}flatten(o){for(let l of this.children)l.flatten(o)}scanIdentical(o,l){if(!(o instanceof Oe))return 0;let f=0,[m,S,C,R]=l>0?[0,0,this.children.length,o.children.length]:[this.children.length-1,o.children.length-1,-1,-1];for(;;m+=l,S+=l){if(m==C||S==R)return f;let j=this.children[m],le=o.children[S];if(j!=le)return f+j.scanIdentical(le,l);f+=j.length+1}}static from(o,l=o.reduce((f,m)=>f+m.length+1,-1)){let f=0;for(let Fe of o)f+=Fe.lines;if(f<32){let Fe=[];for(let Tt of o)Tt.flatten(Fe);return new z(Fe,l)}let m=Math.max(32,f>>5),S=m<<1,C=m>>1,R=[],j=0,le=-1,ye=[];function Ce(Fe){let Tt;if(Fe.lines>S&&Fe instanceof Oe)for(let Oi of Fe.children)Ce(Oi);else Fe.lines>C&&(j>C||!j)?(Ve(),R.push(Fe)):Fe instanceof z&&j&&(Tt=ye[ye.length-1])instanceof z&&Fe.lines+Tt.lines<=32?(j+=Fe.lines,le+=Fe.length+1,ye[ye.length-1]=new z(Tt.text.concat(Fe.text),Tt.length+1+Fe.length)):(j+Fe.lines>m&&Ve(),j+=Fe.lines,le+=Fe.length+1,ye.push(Fe))}function Ve(){j!=0&&(R.push(ye.length==1?ye[0]:Oe.from(ye,le)),le=-1,j=ye.length=0)}for(let Fe of o)Ce(Fe);return Ve(),R.length==1?R[0]:new Oe(R,l)}}ie.empty=new z([""],0);function Je(D){let o=-1;for(let l of D)o+=l.length+1;return o}function Re(D,o,l=0,f=1e9){for(let m=0,S=0,C=!0;S<D.length&&m<=f;S++){let R=D[S],j=m+R.length;j>=l&&(j>f&&(R=R.slice(0,f-m)),m<l&&(R=R.slice(l-m)),C?(o[o.length-1]+=R,C=!1):o.push(R)),m=j+1}return o}function Ie(D,o,l){return Re(D,[""],o,l)}class it{constructor(o,l=1){this.dir=l,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[o],this.offsets=[l>0?1:(o instanceof z?o.text.length:o.children.length)<<1]}nextInner(o,l){for(this.done=this.lineBreak=!1;;){let f=this.nodes.length-1,m=this.nodes[f],S=this.offsets[f],C=S>>1,R=m instanceof z?m.text.length:m.children.length;if(C==(l>0?R:0)){if(f==0)return this.done=!0,this.value="",this;l>0&&this.offsets[f-1]++,this.nodes.pop(),this.offsets.pop()}else if((S&1)==(l>
vendor: 12,753 bytes, lines 22-23
220?0:1)){if(this.offsets[f]+=l,o==0)return this.lineBreak=!0,this.value=`
23`,this;o--}else if(m instanceof z){let j=m.text[C+(l<0?-1:0)];if(this.offsets[f]+=l,j.length>Math.max(0,o))return this.value=o==0?j:l>0?j.slice(o):j.slice(0,j.length-o),this;o-=j.length}else{let j=m.children[C+(l<0?-1:0)];o>j.length?(o-=j.length,this.offsets[f]+=l):(l<0&&this.offsets[f]--,this.nodes.push(j),this.offsets.push(l>0?1:(j instanceof z?j.text.length:j.children.length)<<1))}}}next(o=0){return o<0&&(this.nextInner(-o,-this.dir),o=this.value.length),this.nextInner(o,this.dir)}}class zt{constructor(o,l,f){this.value="",this.done=!1,this.cursor=new it(o,l>f?-1:1),this.pos=l>f?o.length:0,this.from=Math.min(l,f),this.to=Math.max(l,f)}nextInner(o,l){if(l<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;o+=Math.max(0,l<0?this.pos-this.to:this.from-this.pos);let f=l<0?this.pos-this.from:this.to-this.pos;o>f&&(o=f),f-=o;let{value:m}=this.cursor.next(o);return this.pos+=(m.length+o)*l,this.value=m.length<=f?m:l<0?m.slice(m.length-f):m.slice(0,f),this.done=!this.value,this}next(o=0){return o<0?o=Math.max(o,this.from-this.pos):o>0&&(o=Math.min(o,this.to-this.pos)),this.nextInner(o,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bt{constructor(o){this.inner=o,this.afterBreak=!0,this.value="",this.done=!1}next(o=0){let{done:l,lineBreak:f,value:m}=this.inner.next(o);return l&&this.afterBreak?(this.value="",this.afterBreak=!1):l?(this.done=!0,this.value=""):f?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=m,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},it.prototype[Symbol.iterator]=zt.prototype[Symbol.iterator]=bt.prototype[Symbol.iterator]=function(){return this});class nt{constructor(o,l,f,m){this.from=o,this.to=l,this.number=f,this.text=m}get length(){return this.to-this.from}}function jt(D,o,l){return o=Math.max(0,Math.min(D.length,o)),[o,Math.max(o,Math.min(D.length,l))]}function Ze(D,o,l=!0,f=!0){return(0,v.z)(D,o,l,f)}function at(D){return D>=56320&&D<57344}function Dt(D){return D>=55296&&D<56320}function ei(D,o){let l=D.charCodeAt(o);if(!Dt(l)||o+1==D.length)return l;let f=D.charCodeAt(o+1);return at(f)?(l-55296<<10)+(f-56320)+65536:l}function Ht(D){return D<=65535?String.fromCharCode(D):(D-=65536,String.fromCharCode((D>>10)+55296,(D&1023)+56320))}function pi(D){return D<65536?1:2}const ai=/\r\n?|\n/;var mt=function(D){return D[D.Simple=0]="Simple",D[D.TrackDel=1]="TrackDel",D[D.TrackBefore=2]="TrackBefore",D[D.TrackAfter=3]="TrackAfter",D}(mt||(mt={}));class st{constructor(o){this.sections=o}get length(){let o=0;for(let l=0;l<this.sections.length;l+=2)o+=this.sections[l];return o}get newLength(){let o=0;for(let l=0;l<this.sections.length;l+=2){let f=this.sections[l+1];o+=f<0?this.sections[l]:f}return o}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(o){for(let l=0,f=0,m=0;l<this.sections.length;){let S=this.sections[l++],C=this.sections[l++];C<0?(o(f,m,S),m+=S):m+=C,f+=S}}iterChangedRanges(o,l=!1){wt(this,o,l)}get invertedDesc(){let o=[];for(let l=0;l<this.sections.length;){let f=this.sections[l++],m=this.sections[l++];m<0?o.push(f,m):o.push(m,f)}return new st(o)}composeDesc(o){return this.empty?o:o.empty?this:oi(this,o)}mapDesc(o,l=!1){return o.empty?this:Ci(this,o,l)}mapPos(o,l=-1,f=mt.Simple){let m=0,S=0;for(let C=0;C<this.sections.length;){let R=this.sections[C++],j=this.sections[C++],le=m+R;if(j<0){if(le>o)return S+(o-m);S+=R}else{if(f!=mt.Simple&&le>=o&&(f==mt.TrackDel&&m<o&&le>o||f==mt.TrackBefore&&m<o||f==mt.TrackAfter&&le>o))return null;if(le>o||le==o&&l<0&&!R)return o==m||l<0?S:S+j;S+=j}m=le}if(o>m)throw new RangeError(`Position ${o} is out of range for changeset of length ${m}`);return S}touchesRange(o,l=o){for(let f=0,m=0;f<this.sections.length&&m<=l;){let S=this.sections[f++],C=this.sections[f++],R=m+S;if(C>=0&&m<=l&&R>=o)return m<o&&R>l?"cover":!0;m=R}return!1}toString(){let o="";for(let l=0;l<this.sections.length;){let f=this.sections[l++],m=this.sections[l++];o+=(o?" ":"")+f+(m>=0?":"+m:"")}return o}toJSON(){return this.sections}static fromJSON(o){if(!Array.isArray(o)||o.length%2||o.some(l=>typeof l!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new st(o)}static create(o){return new st(o)}}class St extends st{constructor(o,l){super(o),this.inserted=l}apply(o){if(this.length!=o.length)throw new RangeError("Applying change set to a document with the wrong length");return wt(this,(l,f,m,S,C)=>o=o.replace(m,m+(f-l),C),!1),o}mapDesc(o,l=!1){return Ci(this,o,l,!0)}invert(o){let l=this.sections.slice(),f=[];for(let m=0,S=0;m<l.length;m+=2){let C=l[m],R=l[m+1];if(R>=0){l[m]=R,l[m+1]=C;let j=m>>1;for(;f.length<j;)f.push(ie.empty);f.push(C?o.slice(S,S+C):ie.empty)}S+=C}return new St(l,f)}compose(o){return this.empty?o:o.empty?this:oi(this,o,!0)}map(o,l=!1){return o.empty?this:Ci(this,o,l,!0)}iterChanges(o,l=!1){wt(this,o,l)}get desc(){return st.create(this.sections)}filter(o){let l=[],f=[],m=[],S=new mi(this);e:for(let C=0,R=0;;){let j=C==o.length?1e9:o[C++];for(;R<j||R==j&&S.len==0;){if(S.done)break e;let ye=Math.min(S.len,j-R);ft(m,ye,-1);let Ce=S.ins==-1?-1:S.off==0?S.ins:0;ft(l,ye,Ce),Ce>0&&Vt(f,l,S.text),S.forward(ye),R+=ye}let le=o[C++];for(;R<le;){if(S.done)break e;let ye=Math.min(S.len,le-R);ft(l,ye,-1),ft(m,ye,S.ins==-1?-1:S.off==0?S.ins:0),S.forward(ye),R+=ye}}return{changes:new St(l,f),filtered:st.create(m)}}toJSON(){let o=[];for(let l=0;l<this.sections.length;l+=2){let f=this.sections[l],m=this.sections[l+1];m<0?o.push(f):m==0?o.push([f]):o.push([f].concat(this.inserted[l>>1].toJSON()))}return o}static of(o,l,f){let m=[],S=[],C=0,R=null;function j(ye=!1){if(!ye&&!m.length)return;C<l&&ft(m,l-C,-1);let Ce=new St(m,S);R=R?R.compose(Ce.map(R)):Ce,m=[],S=[],C=0}function le(ye){if(Array.isArray(ye))for(let Ce of ye)le(Ce);else if(ye instanceof St){if(ye.length!=l)throw new RangeError(`Mismatched change set length (got ${ye.length}, expected ${l})`);j(),R=R?R.compose(ye.map(R)):ye}else{let{from:Ce,to:Ve=Ce,insert:Fe}=ye;if(Ce>Ve||Ce<0||Ve>l)throw new RangeError(`Invalid change range ${Ce} to ${Ve} (in doc of length ${l})`);let Tt=Fe?typeof Fe=="string"?ie.of(Fe.split(f||ai)):Fe:ie.empty,Oi=Tt.length;if(Ce==Ve&&Oi==0)return;Ce<C&&j(),Ce>C&&ft(m,Ce-C,-1),ft(m,Ve-Ce,Oi),Vt(S,m,Tt),C=Ve}}return le(o),j(!R),R}static empty(o){return new St(o?[o,-1]:[],[])}static fromJSON(o){if(!Array.isArray(o))throw new RangeError("Invalid JSON representation of ChangeSet");let l=[],f=[];for(let m=0;m<o.length;m++){let S=o[m];if(typeof S=="number")l.push(S,-1);else{if(!Array.isArray(S)||typeof S[0]!="number"||S.some((C,R)=>R&&typeof C!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(S.length==1)l.push(S[0],0);else{for(;f.length<m;)f.push(ie.empty);f[m]=ie.of(S.slice(1)),l.push(S[0],f[m].length)}}}return new St(l,f)}static createSet(o,l){return new St(o,l)}}function ft(D,o,l,f=!1){if(o==0&&l<=0)return;let m=D.length-2;m>=0&&l<=0&&l==D[m+1]?D[m]+=o:m>=0&&o==0&&D[m]==0?D[m+1]+=l:f?(D[m]+=o,D[m+1]+=l):D.push(o,l)}function Vt(D,o,l){if(l.length==0)return;let f=o.length-2>>1;if(f<D.length)D[D.length-1]=D[D.length-1].append(l);else{for(;D.length<f;)D.push(ie.empty);D.push(l)}}function wt(D,o,l){let f=D.inserted;for(let m=0,S=0,C=0;C<D.sections.length;){let R=D.sections[C++],j=D.sections[C++];if(j<0)m+=R,S+=R;else{let le=m,ye=S,Ce=ie.empty;for(;le+=R,ye+=j,j&&f&&(Ce=Ce.append(f[C-2>>1])),!(l||C==D.sections.length||D.sections[C+1]<0);)R=D.sections[C++],j=D.sections[C++];o(m,le,S,ye,Ce),m=le,S=ye}}}function Ci(D,o,l,f=!1){let m=[],S=f?[]:null,C=new mi(D),R=new mi(o);for(let j=-1;;){if(C.done&&R.len||R.done&&C.len)throw new Error("Mismatched change set lengths");if(C.ins==-1&&R.ins==-1){let le=Math.min(C.len,R.len);ft(m,le,-1),C.forward(le),R.forward(le)}else if(R.ins>=0&&(C.ins<0||j==C.i||C.off==0&&(R.len<C.len||R.len==C.len&&!l))){let le=R.len;for(ft(m,R.ins,-1);le;){let ye=Math.min(C.len,le);C.ins>=0&&j<C.i&&C.len<=ye&&(ft(m,0,C.ins),S&&Vt(S,m,C.text),j=C.i),C.forward(ye),le-=ye}R.next()}else if(C.ins>=0){let le=0,ye=C.len;for(;ye;)if(R.ins==-1){let Ce=Math.min(ye,R.len);le+=Ce,ye-=Ce,R.forward(Ce)}else if(R.ins==0&&R.len<ye)ye-=R.len,R.next();else break;ft(m,le,j<C.i?C.ins:0),S&&j<C.i&&Vt(S,m,C.text),j=C.i,C.forward(C.len-ye)}else{if(C.done&&R.done)return S?St.createSet(m,S):st.create(m);throw new Error("Mismatched change set lengths")}}}function oi(D,o,l=!1){let f=[],m=l?[]:null,S=new mi(D),C=new mi(o);for(let R=!1;;){if(S.done&&C.done)return m?St.createSet(f,m):st.create(f);if(S.ins==0)ft(f,S.len,0,R),S.next();else if(C.len==0&&!C.done)ft(f,0,C.ins,R),m&&Vt(m,f,C.text),C.next();else{if(S.done||C.done)throw new Error("Mismatched change set lengths");{let j=Math.min(S.len2,C.len),le=f.length;if(S.ins==-1){let ye=C.ins==-1?-1:C.off?0:C.ins;ft(f,j,ye,R),m&&ye&&Vt(m,f,C.text)}else C.ins==-1?(ft(f,S.off?0:S.len,j,R),m&&Vt(m,f,S.textBit(j))):(ft(f,S.off?0:S.len,C.off?0:C.ins,R),m&&!C.off&&Vt(m,f,C.text));R=(S.ins>j||C.ins>=0&&C.len>j)&&(R||f.length>le),S.forward2(j),C.forward(j)}}}}class mi{constructor(o){this.set=o,this.i=0,this.next()}next(){let{sections:o}=this.set;this.i<o.length?(this.len=o[this.i++],this.ins=o[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:o}=this.set,l=this.i-2>>1;return l>=o.length?ie.empty:o[l]}textBit(o){let{inserted:l}=this.set,f=this.i-2>>1;return f>=l.length&&!o?ie.empty:l[f].slice(this.off,o==null?void 0:this.off+o)}forward(o){o==this.len?this.next():(this.len-=o,this.off+=o)}forward2(o){this.ins==-1?this.forward(o):o==this.ins?this.next():(this.ins-=o,this.off+=o)}}class Yt{constructor(o,l,f){this.from=o,this.to=l,this.flags=f}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let o=this.flags&7;return o==7?null:o}get goalColumn(){let o=this.flags>>6;return o==16777215?void 0:o}map(o,l=-1){let f,m;return this.empty?f=m=o.mapPos(this.from,l):(f=o.mapPos(this.from,1),m=o.mapPos(this.to,-1)),f==this.from&&m==this.to?this:new Yt(f,m,this.flags)}extend(o,l=o){if(o<=this.anchor&&l>=this.anchor)return dt.range(o,l);let f=Math.abs(o-this.anchor)>Math.abs(l-this.anchor)?o:l;return dt.range(this.anchor,f)}eq(o,l=!1){return this.anchor==o.anchor&&this.head==o.head&&(!l||!this.empty||this.assoc==o.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(o){if(!o||typeof o.anchor!="number"||typeof o.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return dt.range(o.anchor,o.head)}static create(o,l,f){return new Yt(o,l,f)}}class dt{constructor(o,l){this.ranges=o,this.mainIndex=l}map(o,l=-1){return o.empty?this:dt.create(this.ranges.map(f=>f.map(o,l)),this.mainIndex)}eq(o,l=!1){if(this.ranges.length!=o.ranges.length||this.mainIndex!=o.mainIndex)return!1;for(let f=0;f<this.ranges.length;f++)if(!this.ranges[f].eq(o.ranges[f],l))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new dt([this.main],0)}addRange(o,l=!0){return dt.create([o].concat(this.ranges),l?0:this.mainIndex+1)}replaceRange(o,l=this.mainIndex){let f=this.ranges.slice();return f[l]=o,dt.create(f,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(o=>o.toJSON()),main:this.mainIndex}}static fromJSON(o){if(!o||!Array.isArray(o.ranges)||typeof o.main!="number"||o.main>=o.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new dt(o.ranges.map(l=>Yt.fromJSON(l)),o.main)}static single(o,l=o){return new dt([dt.range(o,l)],0)}static create(o,l=0){if(o.length==0)throw new RangeError("A selection needs at least one range");for(let f=0,m=0;m<o.length;m++){let S=o[m];if(S.empty?S.from<=f:S.from<f)return dt.normalized(o.slice(),l);f=S.to}return new dt(o,l)}static cursor(o,l=0,f,m){return Yt.create(o,o,(l==0?0:l<0?8:16)|(f==null?7:Math.min(6,f))|(m??16777215)<<6)}static range(o,l,f,m){let S=(f??16777215)<<6|(m==null?7:Math.min(6,m));return l<o?Yt.create(l,o,48|S):Yt.create(o,l,(l>o?8:0)|S)}static normalized(o,l=0){let f=o[l];o.sort((m,S)=>m.from-S.from),l=o.indexOf(f);for(let m=1;m<o.length;m++){let S=o[m],C=o[m-1];if(S.empty?S.from<=C.to:S.from<C.to){let R=C.from,j=Math.max(S.to,C.to);m<=l&&l--,o.splice(--m,2,S.anchor>S.head?dt.range(j,R):dt.range(R,j))}}return new dt(o,l)}}function pt(D,o){for(let l of D.ranges)if(l.to>o)throw new RangeError("Selection points outside of document")}let Jt=0;
23class Ue{constructor(o,l,f,m,S){this.combine=o,this.compareInput=l,this.compare=f,this.isStatic=m,this.id=Jt++,this.default=o([]),this.extensions=typeof S=="function"?S(this):S}get reader(){return this}static define(o={}){return new Ue(o.combine||(l=>l),o.compareInput||((l,f)=>l===f),o.compare||(o.combine?(l,f)=>l===f:ti),!!o.static,o.enables)}of(o){return new kt([],this,0,o)}compute(o,l){if(this.isStatic)throw new Error("Can't compute a static facet");return new kt(o,this,1,l)}computeN(o,l){if(this.isStatic)throw new Error("Can't compute a static facet");return new kt(o,this,2,l)}from(o,l){return l||(l=f=>f),this.compute([o],f=>l(f.field(o)))}}function ti(D,o){return D==o||D.length==o.length&&D.every((l,f)=>l===o[f])}class kt{constructor(o,l,f,m){this.dependencies=o,this.facet=l,this.type=f,this.value=m,this.id=Jt++}dynamicSlot(o){var l;let f=this.value,m=this.facet.compareInput,S=this.id,C=o[S]>>1,R=this.type==2,j=!1,le=!1,ye=[];for(let Ce of this.dependencies)Ce=="doc"?j=!0:Ce=="selection"?le=!0:((l=o[Ce.id])!==null&&l!==void 0?l:1)&1||ye.push(o[Ce.id]);return{create(Ce){return Ce.values[C]=f(Ce),1},update(Ce,Ve){if(j&&Ve.docChanged||le&&(Ve.docChanged||Ve.selection)||gi(Ce,ye)){let Fe=f(Ce);if(R?!hi(Fe,Ce.values[C],m):!m(Fe,Ce.values[C]))return Ce.values[C]=Fe,1}return 0},reconfigure:(Ce,Ve)=>{let Fe,Tt=Ve.config.address[S];if(Tt!=null){let Oi=ii(Ve,Tt);if(this.dependencies.every(qt=>qt instanceof Ue?Ve.facet(qt)===Ce.facet(qt):qt instanceof vt?Ve.field(qt,!1)==Ce.field(qt,!1):!0)||(R?hi(Fe=f(Ce),Oi,m):m(Fe=f(Ce),Oi)))return Ce.values[C]=Oi,0}else Fe=f(Ce);return Ce.values[C]=Fe,1}}}}function hi(D,o,l){if(D.length!=o.length)return!1;for(let f=0;f<D.length;f++)if(!l(D[f],o[f]))return!1;return!0}function gi(D,o){let l=!1;for(let f of o)Me(D,f)&1&&(l=!0);return l}function Mt(D,o,l){let f=l.map(j=>D[j.id]),m=l.map(j=>j.type),S=f.filter(j=>!(j&1)),C=D[o.id]>>1;function R(j){let le=[];for(let ye=0;ye<f.length;ye++){let Ce=ii(j,f[ye]);if(m[ye]==2)for(let Ve of Ce)le.push(Ve);else le.push(Ce)}return o.combine(le)}return{create(j){for(let le of f)Me(j,le);return j.values[C]=R(j),1},update(j,le){if(!gi(j,S))return 0;let ye=R(j);return o.compare(ye,j.values[C])?0:(j.values[C]=ye,1)},reconfigure(j,le){let ye=gi(j,f),Ce=le.config.facets[o.id],Ve=le.facet(o);if(Ce&&!ye&&ti(l,Ce))return j.values[C]=Ve,0;let Fe=R(j);return o.compare(Fe,Ve)?(j.values[C]=Ve,0):(j.values[C]=Fe,1)}}}const Ct=Ue.define({static:!0});class vt{constructor(o,l,f,m,S){this.id=o,this.createF=l,this.updateF=f,this.compareF=m,this.spec=S,this.provides=void 0}static define(o){let l=new vt(Jt++,o.create,o.update,o.compare||((f,m)=>f===m),o);return o.provide&&(l.provides=o.provide(l)),l}create(o){let l=o.facet(Ct).find(f=>f.field==this);return(l?.create||this.createF)(o)}slot(o){let l=o[this.id]>>1;return{create:f=>(f.values[l]=this.create(f),1),update:(f,m)=>{let S=f.values[l],C=this.updateF(S,m);return this.compareF(S,C)?0:(f.values[l]=C,1)},reconfigure:(f,m)=>{let S=f.facet(Ct),C=m.facet(Ct),R;return(R=S.find(j=>j.field==this))&&R!=C.find(j=>j.field==this)?(f.values[l]=R.create(f),1):m.config.address[this.id]!=null?(f.values[l]=m.field(this),0):(f.values[l]=this.create(f),1)}}}init(o){return[this,Ct.of({field:this,create:o})]}get extension(){return this}}const Ft={lowest:4,low:3,default:2,high:1,highest:0};function li(D){return o=>new xt(o,D)}const Kt={highest:li(Ft.highest),high:li(Ft.high),default:li(Ft.default),low:li(Ft.low),lowest:li(Ft.lowest)};class xt{constructor(o,l){this.inner=o,this.prec=l}}class Et{of(o){return new Ai(this,o)}reconfigure(o){return Et.reconfigure.of({compartment:this,extension:o})}get(o){return o.config.compartments.get(this)}}class Ai{constructor(o,l){this.compartment=o,this.inner=l}}class Lt{constructor(o,l,f,m,S,C){for(this.base=o,this.compartments=l,this.dynamicSlots=f,this.address=m,this.staticValues=S,this.facets=C,this.statusTemplate=[];this.statusTemplate.length<f.length;)this.statusTemplate.push(0)}staticFacet(o){let l=this.address[o.id];return l==null?o.default:this.staticValues[l>>1]}static resolve(o,l,f){let m=[],S=Object.create(null),C=new Map;for(let Ve of bi(o,l,C))Ve instanceof vt?m.push(Ve):(S[Ve.facet.id]||(S[Ve.facet.id]=[])).push(Ve);let R=Object.create(null),j=[],le=[];for(let Ve of m)R[Ve.id]=le.length<<1,le.push(Fe=>Ve.slot(Fe));let ye=f?.config.facets;for(let Ve in S){let Fe=S[Ve],Tt=Fe[0].facet,Oi=ye&&ye[Ve]||[];if(Fe.every(qt=>qt.type==0))if(R[Tt.id]=j.length<<1|1,ti(Oi,Fe))j.push(f.facet(Tt));else{let qt=Tt.combine(Fe.map(Fi=>Fi.value));j.push(f&&Tt.compare(qt,f.facet(Tt))?f.facet(Tt):qt)}else{for(let qt of Fe)qt.type==0?(R[qt.id]=j.length<<1|1,j.push(qt.value)):(R[qt.id]=le.length<<1,le.push(Fi=>qt.dynamicSlot(Fi)));R[Tt.id]=le.length<<1,le.push(qt=>Mt(qt,Tt,Fe))}}let Ce=le.map(Ve=>Ve(R));return new Lt(o,C,Ce,R,j,S)}}function bi(D,o,l){let f=[[],[],[],[],[]],m=new Map;function S(C,R){let j=m.get(C);if(j!=null){if(j<=R)return;let le=f[j].indexOf(C);le>-1&&f[j].splice(le,1),C instanceof Ai&&l.delete(C.compartment)}if(m.set(C,R),Array.isArray(C))for(let le of C)S(le,R);else if(C instanceof Ai){if(l.has(C.compartment))throw new RangeError("Duplicate use of compartment in extensions");let le=o.get(C.compartment)||C.inner;l.set(C.compartment,le),S(le,R)}else if(C instanceof xt)S(C.inner,C.prec);else if(C instanceof vt)f[R].push(C),C.provides&&S(C.provides,R);else if(C instanceof kt)f[R].push(C),C.facet.extensions&&S(C.facet.extensions,Ft.default);else{let le=C.extension;if(!le)throw new Error(`Unrecognized extension value in extension set (${C}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);S(le,R)}}return S(D,Ft.default),f.reduce((C,R)=>
23C.concat(R))}function Me(D,o){if(o&1)return 2;let l=o>>1,f=D.status[l];if(f==4)throw new Error("Cyclic dependency between fields and/or facets");if(f&2)return f;D.status[l]=4;let m=D.computeSlot(D,D.config.dynamicSlots[l]);return D.status[l]=2|m}function ii(D,o){return o&1?D.config.staticValues[o>>1]:D.values[o>>1]}const Q=Ue.define(),q=Ue.define({combine:D=>D.some(o=>o),static:!0}),pe=Ue.define({combine:D=>D.length?D[0]:void 0,static:!0}),re=Ue.define(),ve=Ue.define(),Le=Ue.define(),Ne=Ue.define({combine:D=>D.length?D[0]:!1});class Xe{constructor(o,l){this.type=o,this.value=l}static define(){return new ze}}class ze{of(o){return new Xe(this,o)}}class tt{constructor(o){this.map=o}of(o){return new qe(this,o)}}class qe{constructor(o,l){this.type=o,this.value=l}map(o){let l=this.type.map(this.value,o);return l===void 0?void 0:l==this.value?this:new qe(this.type,l)}is(o){return this.type==o}static define(o={}){return new tt(o.map||(l=>l))}static mapEffects(o,l){if(!o.length)return o;let f=[];for(let m of o){let S=m.map(l);S&&f.push(S)}return f}}qe.reconfigure=qe.define(),qe.appendConfig=qe.define();class we{constructor(o,l,f,m,S,C){this.startState=o,this.changes=l,this.selection=f,this.effects=m,this.annotations=S,this.scrollIntoView=C,this._doc=null,this._state=null,f&&pt(f,l.newLength),S.some(R=>R.type==we.time)||(this.annotations=S.concat(we.time.of(Date.now())))}static create(o,l,f,m,S,C){return new we(o,l,f,m,S,C)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(o){for(let l of this.annotations)if(l.type==o)return l.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(o){let l=this.annotation(we.userEvent);return!!(l&&(l==o||l.length>o.length&&l.slice(0,o.length)==o&&l[o.length]=="."))}}we.time=Xe.define(),we.userEvent=Xe.define(),we.addToHistory=Xe.define(),we.remote=Xe.define();function ut(D,o){let l=[];for(let f=0,m=0;;){let S,C;if(f<D.length&&(m==o.length||o[m]>=D[f]))S=D[f++],C=D[f++];else if(m<o.length)S=o[m++],C=o[m++];else return l;!l.length||l[l.length-1]<S?l.push(S,C):l[l.length-1]<C&&(l[l.length-1]=C)}}function gt(D,o,l){var f;let m,S,C;return l?(m=o.changes,S=St.empty(o.changes.length),C=D.changes.compose(o.changes)):(m=o.changes.map(D.changes),S=D.changes.mapDesc(o.changes,!0),C=D.changes.compose(m)),{changes:C,selection:o.selection?o.selection.map(S):(f=D.selection)===null||f===void 0?void 0:f.map(m),effects:qe.mapEffects(D.effects,m).concat(qe.mapEffects(o.effects,S)),annotations:D.annotations.length?D.annotations.concat(o.annotations):o.annotations,scrollIntoView:D.scrollIntoView||o.scrollIntoView}}function Nt(D,o,l){let f=o.selection,m=$t(o.annotations);return o.userEvent&&(m=m.concat(we.userEvent.of(o.userEvent))),{changes:o.changes instanceof St?o.changes:St.of(o.changes||[],l,D.facet(pe)),selection:f&&(f instanceof dt?f:dt.single(f.anchor,f.head)),effects:$t(o.effects),annotations:m,scrollIntoView:!!o.scrollIntoView}}function yt(D,o,l){let f=Nt(D,o.length?o[0]:{},D.doc.length);o.length&&o[0].filter===!1&&(l=!1);for(let S=1;S<o.length;S++){o[S].filter===!1&&(l=!1);let C=!!o[S].sequential;f=gt(f,Nt(D,o[S],C?f.changes.newLength:D.doc.length),C)}let m=we.create(D,f.changes,f.selection,f.effects,f.annotations,f.scrollIntoView);return Bt(l?Pe(m):m)}function Pe(D){let o=D.startState,l=!0;for(let m of o.facet(re)){let S=m(D);if(S===!1){l=!1;break}Array.isArray(S)&&(l=l===!0?S:ut(l,S))}if(l!==!0){let m,S;if(l===!1)S=D.changes.invertedDesc,m=St.empty(o.doc.length);else{let C=D.changes.filter(l);m=C.changes,S=C.filtered.mapDesc(C.changes).invertedDesc}D=we.create(o,m,D.selection&&D.selection.map(S),qe.mapEffects(D.effects,S),D.annotations,D.scrollIntoView)}let f=o.facet(ve);for(let m=f.length-1;m>=0;m--){let S=f[m](D);S instanceof we?D=S:Array.isArray(S)&&S.length==1&&S[0]instanceof we?D=S[0]:D=yt(o,$t(S),!1)}return D}function Bt(D){let o=D.startState,l=o.facet(Le),f=D;for(let m=l.length-1;m>=0;m--){let S=l[m](D);S&&Object.keys(S).length&&(f=gt(f,Nt(o,S,D.changes.newLength),!0))}return f==D?D:we.create(o,D.changes,D.selection,f.effects,f.annotations,f.scrollIntoView)}const Xt=[];function $t(D){return D==null?Xt:Array.isArray(D)?D:[D]}
vendor: 9,329 bytes, lines 23-24
23var ci=function(D){return D[D.Word=0]="Word",D[D.Space=1]="Space",D[D.Other=2]="Other",D}(ci||(ci={}));const Mi=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let _;try{_=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function M(D){if(_)return _.test(D);for(let o=0;o<D.length;o++){let l=D[o];if(/\w/.test(l)||l>"\x80"&&(l.toUpperCase()!=l.toLowerCase()||Mi.test(l)))return!0}return!1}function H(D){return o=>{if(!/\S/.test(o))return ci.Space;if(M(o))return ci.Word;for(let l=0;l<D.length;l++)if(o.indexOf(D[l])>-1)return ci.Word;return ci.Other}}class V{constructor(o,l,f,m,S,C){this.config=o,this.doc=l,this.selection=f,this.values=m,this.status=o.statusTemplate.slice(),this.computeSlot=S,C&&(C._state=this);for(let R=0;R<this.config.dynamicSlots.length;R++)Me(this,R<<1);this.computeSlot=null}field(o,l=!0){let f=this.config.address[o.id];if(f==null){if(l)throw new RangeError("Field is not present in this state");return}return Me(this,f),ii(this,f)}update(...o){return yt(this,o,!0)}applyTransaction(o){let l=this.config,{base:f,compartments:m}=l;for(let R of o.effects)R.is(Et.reconfigure)?(l&&(m=new Map,l.compartments.forEach((j,le)=>m.set(le,j)),l=null),m.set(R.value.compartment,R.value.extension)):R.is(qe.reconfigure)?(l=null,f=R.value):R.is(qe.appendConfig)&&(l=null,f=$t(f).concat(R.value));let S;l?S=o.startState.values.slice():(l=Lt.resolve(f,m,this),S=new V(l,this.doc,this.selection,l.dynamicSlots.map(()=>null),(j,le)=>le.reconfigure(j,this),null).values);let C=o.startState.facet(q)?o.newSelection:o.newSelection.asSingle();new V(l,o.newDoc,C,S,(R,j)=>j.update(R,o),o)}replaceSelection(o){return typeof o=="string"&&(o=this.toText(o)),this.changeByRange(l=>({changes:{from:l.from,to:l.to,insert:o},range:dt.cursor(l.from+o.length)}))}changeByRange(o){let l=this.selection,f=o(l.ranges[0]),m=this.changes(f.changes),S=[f.range],C=$t(f.effects);for(let R=1;R<l.ranges.length;R++){let j=o(l.ranges[R]),le=this.changes(j.changes),ye=le.map(m);for(let Ve=0;Ve<R;Ve++)S[Ve]=S[Ve].map(ye);let Ce=m.mapDesc(le,!0);S.push(j.range.map(Ce)),m=m.compose(ye),C=qe.mapEffects(C,ye).concat(qe.mapEffects($t(j.effects),Ce))}return{changes:m,selection:dt.create(S,l.mainIndex),effects:C}}changes(o=[]){return o instanceof St?o:St.of(o,this.doc.length,this.facet(V.lineSeparator))}toText(o){return ie.of(o.split(this.facet(V.lineSeparator)||ai))}sliceDoc(o=0,l=this.doc.length){return this.doc.sliceString(o,l,this.lineBreak)}facet(o){let l=this.config.address[o.id];return l==null?o.default:(Me(this,l),ii(this,l))}toJSON(o){let l={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(o)for(let f in o){let m=o[f];m instanceof vt&&this.config.address[m.id]!=null&&(l[f]=m.spec.toJSON(this.field(o[f]),this))}return l}static fromJSON(o,l={},f){if(!o||typeof o.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let m=[];if(f){for(let S in f)if(Object.prototype.hasOwnProperty.call(o,S)){let C=f[S],R=o[S];m.push(C.init(j=>C.spec.fromJSON(R,j)))}}return V.create({doc:o.doc,selection:dt.fromJSON(o.selection),extensions:l.extensions?m.concat([l.extensions]):m})}static create(o={}){let l=Lt.resolve(o.extensions||[],new Map),f=o.doc instanceof ie?o.doc:ie.of((o.doc||"").split(l.staticFacet(V.lineSeparator)||ai)),m=o.selection?o.selection instanceof dt?o.selection:dt.single(o.selection.anchor,o.selection.head):dt.single(0);return pt(m,f.length),l.staticFacet(q)||(m=m.asSingle()),new V(l,f,m,l.dynamicSlots.map(()=>null),(S,C)=>C.create(S),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
24`}get readOnly(){return this.facet(Ne)}phrase(o,...l){for(let f of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(f,o)){o=f[o];break}return l.length&&(o=o.replace(/\$(\$|\d*)/g,(f,m)=>{if(m=="$")return"$";let S=+(m||1);return!S||S>l.length?f:l[S-1]})),o}languageDataAt(o,l,f=-1){let m=[];for(let S of this.facet(Q))for(let C of S(this,l,f))Object.prototype.hasOwnProperty.call(C,o)&&m.push(C[o]);return m}charCategorizer(o){return H(this.languageDataAt("wordChars",o).join(""))}wordAt(o){let{text:l,from:f,length:m}=this.doc.lineAt(o),S=this.charCategorizer(o),C=o-f,R=o-f;for(;C>0;){let j=Ze(l,C,!1);if(S(l.slice(j,C))!=ci.Word)break;C=j}for(;R<m;){let j=Ze(l,R);if(S(l.slice(R,j))!=ci.Word)break;R=j}return C==R?null:dt.range(C+f,R+f)}}V.allowMultipleSelections=q,V.tabSize=Ue.define({combine:D=>D.length?D[0]:4}),V.lineSeparator=pe,V.readOnly=Ne,V.phrases=Ue.define({compare(D,o){let l=Object.keys(D),f=Object.keys(o);return l.length==f.length&&l.every(m=>D[m]==o[m])}}),V.languageData=Q,V.changeFilter=re,V.transactionFilter=ve,V.transactionExtender=Le,Et.reconfigure=qe.define();function Y(D,o,l={}){let f={};for(let m of D)for(let S of Object.keys(m)){let C=m[S],R=f[S];if(R===void 0)f[S]=C;else if(!(R===C||C===void 0))if(Object.hasOwnProperty.call(l,S))f[S]=l[S](R,C);else throw new Error("Config merge conflict for field "+S)}for(let m in o)f[m]===void 0&&(f[m]=o[m]);return f}class he{eq(o){return this==o}range(o,l=o){return Ae.create(o,l,this)}}he.prototype.startSide=he.prototype.endSide=0,he.prototype.point=!1,he.prototype.mapMode=mt.TrackDel;class Ae{constructor(o,l,f){this.from=o,this.to=l,this.value=f}static create(o,l,f){return new Ae(o,l,f)}}function ke(D,o){return D.from-o.from||D.value.startSide-o.value.startSide}class _e{constructor(o,l,f,m){this.from=o,this.to=l,this.value=f,this.maxPoint=m}get length(){return this.to[this.to.length-1]}findIndex(o,l,f,m=0){let S=f?this.to:this.from;for(let C=m,R=S.length;;){if(C==R)return C;let j=C+R>>1,le=S[j]-o||(f?this.value[j].endSide:this.value[j].startSide)-l;if(j==C)return le>=0?C:R;le>=0?R=j:C=j+1}}between(o,l,f,m){for(let S=this.findIndex(l,-1e9,!0),C=this.findIndex(f,1e9,!1,S);S<C;S++)if(m(this.from[S]+o,this.to[S]+o,this.value[S])===!1)return!1}map(o,l){let f=[],m=[],S=[],C=-1,R=-1;for(let j=0;j<this.value.length;j++){let le=this.value[j],ye=this.from[j]+o,Ce=this.to[j]+o,Ve,Fe;if(ye==Ce){let Tt=l.mapPos(ye,le.startSide,le.mapMode);if(Tt==null||(Ve=Fe=Tt,le.startSide!=le.endSide&&(Fe=l.mapPos(ye,le.endSide),Fe<Ve)))continue}else if(Ve=l.mapPos(ye,le.startSide),Fe=l.mapPos(Ce,le.endSide),Ve>Fe||Ve==Fe&&le.startSide>0&&le.endSide<=0)continue;(Fe-Ve||le.endSide-le.startSide)<0||(C<0&&(C=Ve),le.point&&(R=Math.max(R,Fe-Ve)),f.push(le),m.push(Ve-C),S.push(Fe-C))}return{mapped:f.length?new _e(m,S,f,R):null,pos:C}}}class Qe{constructor(o,l,f,m){this.chunkPos=o,this.chunk=l,this.nextLayer=f,this.maxPoint=m}static create(o,l,f,m){return new Qe(o,l,f,m)}get length(){let o=this.chunk.length-1;return o<0?0:Math.max(this.chunkEnd(o),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let o=this.nextLayer.size;for(let l of this.chunk)o+=l.value.length;return o}chunkEnd(o){return this.chunkPos[o]+this.chunk[o].length}update(o){let{add:l=[],sort:f=!1,filterFrom:m=0,filterTo:S=this.length}=o,C=o.filter;if(l.length==0&&!C)return this;if(f&&(l=l.slice().sort(ke)),this.isEmpty)return l.length?Qe.of(l):this;let R=new Ut(this,null,-1).goto(0),j=0,le=[],ye=new Rt;for(;R.value||j<l.length;)if(j<l.length&&(R.from-l[j].from||R.startSide-l[j].value.startSide)>=0){let Ce=l[j++];ye.addInner(Ce.from,Ce.to,Ce.value)||le.push(Ce)}else R.rangeIndex==1&&R.chunkIndex<this.chunk.length&&(j==l.length||this.chunkEnd(R.chunkIndex)<l[j].from)&&(!C||m>this.chunkEnd(R.chunkIndex)||S<this.chunkPos[R.chunkIndex])&&ye.addChunk(this.chunkPos[R.chunkIndex],this.chunk[R.chunkIndex])?R.nextChunk():((!C||m>R.to||S<R.from||C(R.from,R.to,R.value))&&(ye.addInner(R.from,R.to,R.value)||le.push(Ae.create(R.from,R.to,R.value))),R.next());return ye.finishInner(this.nextLayer.isEmpty&&!le.length?Qe.empty:this.nextLayer.update({add:le,filter:C,filterFrom:m,filterTo:S}))}map(o){if(o.empty||this.isEmpty)return this;let l=[],f=[],m=-1;for(let C=0;C<this.chunk.length;C++){let R=this.chunkPos[C],j=this.chunk[C],le=o.touchesRange(R,R+j.length);if(le===!1)m=Math.max(m,j.maxPoint),l.push(j),f.push(o.mapPos(R));else if(le===!0){let{mapped:ye,pos:Ce}=j.map(R,o);ye&&(m=Math.max(m,ye.maxPoint),l.push(ye),f.push(Ce))}}let S=this.nextLayer.map(o);return l.length==0?S:new Qe(f,l,S||Qe.empty,m)}between(o,l,f){if(!this.isEmpty){for(let m=0;m<this.chunk.length;m++){let S=this.chunkPos[m],C=this.chunk[m];if(l>=S&&o<=S+C.length&&C.between(S,o-S,l-S,f)===!1)return}this.nextLayer.between(o,l,f)}}iter(o=0){return _t.from([this]).goto(o)}get isEmpty(){return this.nextLayer==this}static iter(o,l=0){return _t.from(o).goto(l)}static compare(o,l,f,m,S=-1){let C=o.filter(Ce=>Ce.maxPoint>0||!Ce.isEmpty&&Ce.maxPoint>=S),R=l.filter(Ce=>Ce.maxPoint>0||!Ce.isEmpty&&Ce.maxPoint>=S),j=fi(C,R,f),le=new ne(C,j,S),ye=new ne(R,j,S);f.iterGaps((Ce,Ve,Fe)=>ce(le,Ce,ye,Ve,Fe,m)),f.empty&&f.length==0&&ce(le,0,ye,0,0,m)}static eq(o,l,f=0,m){m==null&&(m=1e9-1);let S=o.filter(ye=>!ye.isEmpty&&l.indexOf(ye)<0),C=l.filter(ye=>!ye.isEmpty&&o.indexOf(ye)<0);if(S.length!=C.length)return!1;if(!S.length)return!0;let R=fi(S,C),j=new ne(S,R,0).goto(f),le=new ne(C,R,0).goto(f);for(;;){if(j.to!=le.to||!ee(j.active,le.active)||j.point&&(!le.point||!j.point.eq(le.point)))return!1;if(j.to>m)return!0;j.next(),le.next()}}static spans(o,l,f,m,S=-1){let C=new ne(o,null,S).goto(l),R=l,j=C.openStart;for(;;){let le=Math.min(C.to,f);
vendor: 6,069 bytes, line 24
24if(C.point){let ye=C.activeForPoint(C.to),Ce=C.pointFrom<l?ye.length+1:C.point.startSide<0?ye.length:Math.min(ye.length,j);m.point(R,le,C.point,ye,Ce,C.pointRank),j=Math.min(C.openEnd(le),ye.length)}else le>R&&(m.span(R,le,C.active,j),j=C.openEnd(le));if(C.to>f)return j+(C.point&&C.to>f?1:0);R=C.to,C.next()}}static of(o,l=!1){let f=new Rt;for(let m of o instanceof Ae?[o]:l?Wt(o):o)f.add(m.from,m.to,m.value);return f.finish()}static join(o){if(!o.length)return Qe.empty;let l=o[o.length-1];for(let f=o.length-2;f>=0;f--)for(let m=o[f];m!=Qe.empty;m=m.nextLayer)l=new Qe(m.chunkPos,m.chunk,l,Math.max(m.maxPoint,l.maxPoint));return l}}Qe.empty=new Qe([],[],null,-1);function Wt(D){if(D.length>1)for(let o=D[0],l=1;l<D.length;l++){let f=D[l];if(ke(o,f)>0)return D.slice().sort(ke);o=f}return D}Qe.empty.nextLayer=Qe.empty;class Rt{finishChunk(o){this.chunks.push(new _e(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,o&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(o,l,f){this.addInner(o,l,f)||(this.nextLayer||(this.nextLayer=new Rt)).add(o,l,f)}addInner(o,l,f){let m=o-this.lastTo||f.startSide-this.last.endSide;if(m<=0&&(o-this.lastFrom||f.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return m<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=o),this.from.push(o-this.chunkStart),this.to.push(l-this.chunkStart),this.last=f,this.lastFrom=o,this.lastTo=l,this.value.push(f),f.point&&(this.maxPoint=Math.max(this.maxPoint,l-o)),!0)}addChunk(o,l){if((o-this.lastTo||l.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,l.maxPoint),this.chunks.push(l),this.chunkPos.push(o);let f=l.value.length-1;return this.last=l.value[f],this.lastFrom=l.from[f]+o,this.lastTo=l.to[f]+o,!0}finish(){return this.finishInner(Qe.empty)}finishInner(o){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return o;let l=Qe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(o):o,this.setMaxPoint);return this.from=null,l}}function fi(D,o,l){let f=new Map;for(let S of D)for(let C=0;C<S.chunk.length;C++)S.chunk[C].maxPoint<=0&&f.set(S.chunk[C],S.chunkPos[C]);let m=new Set;for(let S of o)for(let C=0;C<S.chunk.length;C++){let R=f.get(S.chunk[C]);R!=null&&(l?l.mapPos(R):R)==S.chunkPos[C]&&!l?.touchesRange(R,R+S.chunk[C].length)&&m.add(S.chunk[C])}return m}class Ut{constructor(o,l,f,m=0){this.layer=o,this.skip=l,this.minPoint=f,this.rank=m}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(o,l=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(o,l,!1),this}gotoInner(o,l,f){for(;this.chunkIndex<this.layer.chunk.length;){let m=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(m)||this.layer.chunkEnd(this.chunkIndex)<o||m.maxPoint<this.minPoint))break;this.chunkIndex++,f=!1}if(this.chunkIndex<this.layer.chunk.length){let m=this.layer.chunk[this.chunkIndex].findIndex(o-this.layer.chunkPos[this.chunkIndex],l,!0);(!f||this.rangeIndex<m)&&this.setRangeIndex(m)}this.next()}forward(o,l){(this.to-o||this.endSide-l)<0&&this.gotoInner(o,l,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let o=this.layer.chunkPos[this.chunkIndex],l=this.layer.chunk[this.chunkIndex],f=o+l.from[this.rangeIndex];if(this.from=f,this.to=o+l.to[this.rangeIndex],this.value=l.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(o){if(o==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=o}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(o){return this.from-o.from||this.startSide-o.startSide||this.rank-o.rank||this.to-o.to||this.endSide-o.endSide}}class _t{constructor(o){this.heap=o}static from(o,l=null,f=-1){let m=[];for(let S=0;S<o.length;S++)for(let C=o[S];!C.isEmpty;C=C.nextLayer)C.maxPoint>=f&&m.push(new Ut(C,l,f,S));return m.length==1?m[0]:new _t(m)}get startSide(){return this.value?this.value.startSide:0}goto(o,l=-1e9){for(let f of this.heap)f.goto(o,l);for(let f=this.heap.length>>1;f>=0;f--)P(this.heap,f);return this.next(),this}forward(o,l){for(let f of this.heap)f.forward(o,l);for(let f=this.heap.length>>1;f>=0;f--)P(this.heap,f);(this.to-o||this.value.endSide-l)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let o=this.heap[0];this.from=o.from,this.to=o.to,this.value=o.value,this.rank=o.rank,o.value&&o.next(),P(this.heap,0)}}}function P(D,o){for(let l=D[o];;){let f=(o<<1)+1;if(f>=D.length)break;let m=D[f];if(f+1<D.length&&m.compare(D[f+1])>=0&&(m=D[f+1],f++),l.compare(m)<0)break;D[f]=l,D[o]=m,o=f}}class ne{constructor(o,l,f){this.minPoint=f,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=_t.from(o,l,f)}goto(o,l=-1e9){return this.cursor.goto(o,l),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=o,this.endSide=l,this.openStart=-1,this.next(),this}forward(o,l){for(;this.minActive>-1&&(this.activeTo[this.minActive]-o||this.active[this.minActive].endSide-l)<0;)this.removeActive(this.minActive);this.cursor.forward(o,l)}removeActive(o){J(this.active,o),J(this.activeTo,o),J(this.activeRank,o),this.minActive=De(this.active,this.activeTo)}
24addActive(o){let l=0,{value:f,to:m,rank:S}=this.cursor;for(;l<this.activeRank.length&&(S-this.activeRank[l]||m-this.activeTo[l])>0;)l++;Ee(this.active,l,f),Ee(this.activeTo,l,m),Ee(this.activeRank,l,S),o&&Ee(o,l,this.cursor.from),this.minActive=De(this.active,this.activeTo)}next(){let o=this.to,l=this.point;this.point=null;let f=this.openStart<0?[]:null;for(;;){let m=this.minActive;if(m>-1&&(this.activeTo[m]-this.cursor.from||this.active[m].endSide-this.cursor.startSide)<0){if(this.activeTo[m]>o){this.to=this.activeTo[m],this.endSide=this.active[m].endSide;break}this.removeActive(m),f&&J(f,m)}else if(this.cursor.value)if(this.cursor.from>o){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let S=this.cursor.value;if(!S.point)this.addActive(f),this.cursor.next();else if(l&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=S,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=S.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(f){this.openStart=0;for(let m=f.length-1;m>=0&&f[m]<o;m--)this.openStart++}}activeForPoint(o){if(!this.active.length)return this.active;let l=[];for(let f=this.active.length-1;f>=0&&!(this.activeRank[f]<this.pointRank);f--)(this.activeTo[f]>o||this.activeTo[f]==o&&this.active[f].endSide>=this.point.endSide)&&l.push(this.active[f]);return l.reverse()}openEnd(o){let l=0;for(let f=this.activeTo.length-1;f>=0&&this.activeTo[f]>o;f--)l++;return l}}function ce(D,o,l,f,m,S){D.goto(o),l.goto(f);let C=f+m,R=f,j=f-o;for(;;){let le=D.to+j-l.to,ye=le||D.endSide-l.endSide,Ce=ye<0?D.to+j:l.to,Ve=Math.min(Ce,C);if(D.point||l.point?D.point&&l.point&&(D.point==l.point||D.point.eq(l.point))&&ee(D.activeForPoint(D.to),l.activeForPoint(l.to))||S.comparePoint(R,Ve,D.point,l.point):Ve>R&&!ee(D.active,l.active)&&S.compareRange(R,Ve,D.active,l.active),Ce>C)break;(le||D.openEnd!=l.openEnd)&&S.boundChange&&S.boundChange(Ce),R=Ce,ye<=0&&D.next(),ye>=0&&l.next()}}function ee(D,o){if(D.length!=o.length)return!1;for(let l=0;l<D.length;l++)if(D[l]!=o[l]&&!D[l].eq(o[l]))return!1;return!0}function J(D,o){for(let l=o,f=D.length-1;l<f;l++)D[l]=D[l+1];D.pop()}function Ee(D,o,l){for(let f=D.length-1;f>=o;f--)D[f+1]=D[f];D[o]=l}function De(D,o){let l=-1,f=1e9;for(let m=0;m<o.length;m++)(o[m]-f||D[m].endSide-D[l].endSide)<0&&(l=m,f=o[m]);return l}function Ye(D,o,l=D.length){let f=0;for(let m=0;m<l&&m<D.length;)D.charCodeAt(m)==9?(f+=o-f%o,m++):(f++,m=Ze(D,m));return f}function je(D,o,l,f){for(let m=0,S=0;;){if(S>=o)return m;if(m==D.length)break;S+=D.charCodeAt(m)==9?l-S%l:1,m=Ze(D,m)}return f===!0?-1:D.length}},90615:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{bM:()=>ft});var v=Ke(896765),ie=Ke(963960),z=Ke(831650);const Oe="#e5c07b",Je="#e06c75",Re="#56b6c2",Ie="#ffffff",it="#abb2bf",zt="#7d8799",bt="#61afef",nt="#98c379",jt="#d19a66",Ze="#c678dd",at="#21252b",Dt="#2c313a",ei="#282c34",Ht="#353a42",pi="#3E4451",ai="#528bff",mt={chalky:Oe,coral:Je,cyan:Re,invalid:Ie,ivory:it,stone:zt,malibu:bt,sage:nt,whiskey:jt,violet:Ze,darkBackground:at,highlightBackgroun
24d:Dt,background:ei,tooltipBackground:Ht,selection:pi,cursor:ai},st=v.Lz.theme({"&":{color:it,backgroundColor:ei},".cm-content":{caretColor:ai},".cm-cursor, .cm-dropCursor":{borderLeftColor:ai},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:pi},".cm-panels":{backgroundColor:at,color:it},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ei,color:zt,border:"none"},".cm-activeLineGutter":{backgroundColor:Dt},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ht},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ht,borderBottomColor:Ht},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Dt,color:it}}},{dark:!0}),St=ie.cr.define([{tag:z._A.keyword,color:Ze},{tag:[z._A.name,z._A.deleted,z._A.character,z._A.propertyName,z._A.macroName],color:Je},{tag:[z._A.function(z._A.variableName),z._A.labelName],color:bt},{tag:[z._A.color,z._A.constant(z._A.name),z._A.standard(z._A.name)],color:jt},{tag:[z._A.definition(z._A.name),z._A.separator],color:it},{tag:[z._A.typeName,z._A.className,z._A.number,z._A.changed,z._A.annotation,z._A.modifier,z._A.self,z._A.namespace],color:Oe},{tag:[z._A.operator,z._A.operatorKeyword,z._A.url,z._A.escape,z._A.regexp,z._A.link,z._A.special(z._A.string)],color:Re},{tag:[z._A.meta,z._A.comment],color:zt},{tag:z._A.strong,fontWeight:"bold"},{tag:z._A.emphasis,fontStyle:"italic"},{tag:z._A.strikethrough,textDecoration:"line-through"},{tag:z._A.link,color:zt,textDecoration:"underline"},{tag:z._A.heading,fontWeight:"bold",color:Je},{tag:[z._A.atom,z._A.bool,z._A.special(z._A.variableName)],color:jt},{tag:[z._A.processingInstruction,z._A.string,z._A.inserted],color:nt},{tag:z._A.invalid,color:Ie}]),ft=[st,(0,ie.y9)(St)]},896765:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{$K:()=>Ko,A:()=>to,D4:()=>xo,DK:()=>as,Eg:()=>Bo,HJ:()=>Co,Lz:()=>At,N$:()=>oo,NZ:()=>Pe,OP:()=>ke,S7:()=>cs,TS:()=>$r,Ux:()=>Lo,VH:()=>Jr,Wu:()=>Go,Z9:()=>L,cU:()=>_o,c_:()=>A,dz:()=>uo,ld:()=>Io,qf:()=>yo,w4:()=>$s,wJ:()=>ji,xO:()=>Nt});var v=Ke(924835),ie=Ke(259683),z=Ke(286304),Oe=Ke(80247);function Je(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function Re(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function Ie(s,e){if(!e.anchorNode)return!1;try{return Re(s,e.anchorNode)}catch{return!1}}function it(s){return s.nodeType==3?ft(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function zt(s,e,t,i){return t?jt(s,e,t,i,-1)||jt(s,e,t,i,1):!1}function bt(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function nt(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}function jt(s,e,t,i,n){for(;;){if(s==t&&e==i)return!0;if(e==(n<0?0:Ze(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;e=bt(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[e+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;e=n<0?Ze(s):0}else return!1}}function Ze(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function at(s,e){let t=e?s.left:s.right;return{left:t,right:t,top:s.top,bottom:s.bottom}}function Dt(s){let e=s.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function ei(s,e){let t=e.width/s.offsetWidth,i=e.height/s.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-s.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-s.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Ht(s,e,t,i,n,r,a,c){let d=s.ownerDocument,x=d.defaultView||window;for(let y=s,E=!1;y&&!E;)if(y.nodeType==1){let N,X=y==d.body,se=1,de=1;if(X)N=Dt(x);else{if(/^(fixed|sticky)$/.test(getComputedStyle(y).position)&&(E=!0),y.scrollHeight<=y.clientHeight&&y.scrollWidth<=y.clientWidth){y=y.assignedSlot||y.parentNode;continue}let $e=y.getBoundingClientRect();({scaleX:se,scaleY:de}=ei(y,$e)),N={left:$e.left,right:$e.left+y.clientWidth*se,top:$e.top,bottom:$e.to
vendor: 11,972 bytes, line 24
24p+y.clientHeight*de}}let ge=0,me=0;if(n=="nearest")e.top<N.top?(me=-(N.top-e.top+a),t>0&&e.bottom>N.bottom+me&&(me=e.bottom-N.bottom+me+a)):e.bottom>N.bottom&&(me=e.bottom-N.bottom+a,t<0&&e.top-me<N.top&&(me=-(N.top+me-e.top+a)));else{let $e=e.bottom-e.top,et=N.bottom-N.top;me=(n=="center"&&$e<=et?e.top+$e/2-et/2:n=="start"||n=="center"&&t<0?e.top-a:e.bottom-et+a)-N.top}if(i=="nearest"?e.left<N.left?(ge=-(N.left-e.left+r),t>0&&e.right>N.right+ge&&(ge=e.right-N.right+ge+r)):e.right>N.right&&(ge=e.right-N.right+r,t<0&&e.left<N.left+ge&&(ge=-(N.left+ge-e.left+r))):ge=(i=="center"?e.left+(e.right-e.left)/2-(N.right-N.left)/2:i=="start"==c?e.left-r:e.right-(N.right-N.left)+r)-N.left,ge||me)if(X)x.scrollBy(ge,me);else{let $e=0,et=0;if(me){let Ge=y.scrollTop;y.scrollTop+=me/de,et=(y.scrollTop-Ge)*de}if(ge){let Ge=y.scrollLeft;y.scrollLeft+=ge/se,$e=(y.scrollLeft-Ge)*se}e={left:e.left-$e,top:e.top-et,right:e.right-$e,bottom:e.bottom-et},$e&&Math.abs($e-ge)<1&&(i="nearest"),et&&Math.abs(et-me)<1&&(n="nearest")}if(X)break;y=y.assignedSlot||y.parentNode}else if(y.nodeType==11)y=y.host;else break}function pi(s){let e=s.ownerDocument,t,i;for(let n=s.parentNode;n&&!(n==e.body||t&&i);)if(n.nodeType==1)!i&&n.scrollHeight>n.clientHeight&&(i=n),!t&&n.scrollWidth>n.clientWidth&&(t=n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;return{x:t,y:i}}class ai{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Ze(t):0),i,Math.min(e.focusOffset,i?Ze(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}}let mt=null;function st(s){if(s.setActive)return s.setActive();if(mt)return s.focus(mt);let e=[];for(let t=s;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(s.focus(mt==null?{get preventScroll(){return mt={preventScroll:!0},!0}}:void 0),!mt){mt=!1;for(let t=0;t<e.length;){let i=e[t++],n=e[t++],r=e[t++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let St;function ft(s,e,t=e){let i=St||(St=document.createRange());return i.setEnd(s,t),i.setStart(s,e),i}function Vt(s,e,t,i){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=i);let r=new KeyboardEvent("keydown",n);r.synthetic=!0,s.dispatchEvent(r);let a=new KeyboardEvent("keyup",n);return a.synthetic=!0,s.dispatchEvent(a),r.defaultPrevented||a.defaultPrevented}function wt(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function Ci(s){for(;s.attributes.length;)s.removeAttributeNode(s.attributes[0])}function oi(s,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ze(t));;)if(i){if(t.nodeType!=1)return!1;let n=t.childNodes[i-1];n.contentEditable=="false"?i--:(t=n,i=Ze(t))}else{if(t==s)return!0;i=bt(t),t=t.parentNode}}function mi(s){return s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}function Yt(s,e){for(let t=s,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Ze(t)}else if(t.parentNode&&!nt(t))i=bt(t),t=t.parentNode;else return null}}function dt(s,e){for(let t=s,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!nt(t))i=bt(t)+1,t=t.parentNode;else return null}}class pt{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new pt(e.parentNode,bt(e),t)}static after(e,t){return new pt(e.parentNode,bt(e)+1,t)}}const Jt=[];class Ue{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(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,n=null,r;for(let a of this.children){if(a.flags&7){if(!a.dom&&(r=n?n.nextSibling:i.firstChild)){let c=Ue.get(r);(!c||!c.parent&&c.canReuseDOM(a))&&a.reuseDOM(r)}a.sync(e,t),a.flags&=-8}if(r=n?n.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;r&&r!=a.dom;)r=ti(r);else i.insertBefore(a.dom,r);n=a.dom}for(r=n?n.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=ti(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let n=Ze(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;n==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?n=-1:n=1),e=r}n<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!Ue.get(i);)i=i.nextSibling;if(!i)return this.length;for(let n=0,r=0;;n++){let a=this.children[n];if(a.dom==i)return r;r+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let n=-1,r=-1,a=-1,c=-1;for(let d=0,x=i,y=i;d<this.children.length;d++){let E=this.children[d],N=x+E.length;if(x<e&&N>t)return E.domBoundsAround(e,t,x);if(N>=e&&n==-1&&(n=d,r=x),x>t&&E.dom.parentNode==this.dom){a=d,c=y;break}y=N,x=N+E.breakAfter}return{from:r,to:c<0?i+this.length:c,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&a>=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=Jt){this.markDirty();for(let n=e;n<t;n++){let r=this.children[n];r.parent==this&&i.indexOf(r)<0&&r.destroy()}i.length<250?this.children.splice(e,t-e,...i):this.children=[].concat(this.children.slice(0,e),i,this.children.slice(t));for(let n=0;n<i.length;n++)i[n].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new kt(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,i,n,r,a){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}Ue.prototype.breakAfter=0;function ti(s){let e=s.nextSibling;return s.parentNode.removeChild(s),e}class kt{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function hi(s,e,t,i,n,r,a,c,d){let{children:x}=s,y=x.length?x[e]:null,E=r.length?r[r.length-1]:null,N=E?E.breakAfter:a;if(!(e==i&&y&&!a&&!N&&r.length<2&&y.merge(t,n,r.length?E:null,t==0,c,d))){if(i<x.length){let X=x[i];X&&(n<X.length||X.breakAfter&&E?.breakAfter)?(e==i&&(X=X.split(n),n=0),!N&&E&&X.merge(0,n,E,!0,0,d)?r[r.length-1]=X:((n||X.children.length&&!X.children[0].length)&&X.merge(0,n,null,!1,0,d),r.push(X))):X?.breakAfter&&(E?E.breakAfter=1:a=1),i++}for(y&&(y.breakAfter=a,t>0&&(!a&&r.length&&y.merge(t,y.length,r[0],!1,c,0)?y.breakAfter=r.shift().breakAfter:(t<y.length||y.children.length&&y.children[y.children.length-1].length==0)&&y.merge(t,y.length,null,!1,c,0),e++));e<i&&r.length;)if(x[i-1].become(r[r.length-1]))i--,r.pop(),d=r.length?0:c;else if(x[e].become(r[0]))e++,r.shift(),c=r.length?0:d;else break;!r.length&&e&&i<x.length&&!x[e-1].breakAfter&&x[i].merge(0,0,x[e-1],!1,c,d)&&e--,(e<i||r.length)&&s.replaceChildren(e,i,r)}}function gi(s,e,t,i,n,r){let a=s.childCursor(),{i:c,off:d}=a.findPos(t,1),{i:x,off:y}=a.findPos(e,-1),E=e-t;for(let N of i)E+=N.length;s.length+=E,hi(s,x,y,c,d,i,0,n,r)}let Mt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ct=typeof document<"u"?document:{documentElement:{style:{}}};const vt=/Edge\/(\d+)/.exec(Mt.userAgent),Ft=/MSIE \d/.test(Mt.userAgent),li=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mt.userAgent),Kt=!!(Ft||li||vt),xt=!Kt&&/gecko\/(\d+)/i.test(Mt.userAgent),Et=!Kt&&/Chrome\/(\d+)/.exec(Mt.userAgent),Ai="webkitFontSmoothing"in Ct.documentElement.style,Lt=!Kt&&/Apple Computer/.test(Mt.vendor),bi=Lt&&(/Mobile\/\w+/.test(Mt.userAgent)||Mt.maxTouchPoints>2);var Me={mac:bi||/Mac/.test(Mt.platform),windows:/Win/.test(Mt.platform),linux:/Linux|X11/.test(Mt.platform),ie:Kt,ie_version:Ft?Ct.documentMode||6:li?+li[1]:vt?+vt[1]:0,gecko:xt,gecko_version:xt?+(/Firefox\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,chrome:!!Et,chrome_version:Et?+Et[1]:0,ios:bi,android:/Android\b/.test(Mt.userAgent),webkit:Ai,safari:Lt,webkit_version:Ai?+(/\bAppleWebKit\/(\d+)/.exec(Mt.userAgent)||[0,0])[1]:0,tabSize:Ct.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const ii=256;class Q extends Ue{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof Q)||this.length-(t-e)+i.length>ii||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Q(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new pt(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return pe(this.dom,e,t)}}class q extends Ue{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let n of t)n.setParent(this)}setAttrs(e){if(Ci(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,n,r,a){return i&&(!(i instanceof q&&i.mark.eq(this.mark))||e&&r<=0||t<this.length&&a<=0)?!1:(gi(this,e,t,i?i.children.slice():[],r-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,n=-1,r=0;for(let c of this.children){let d=i+c.length;d>e&&t.push(i<e?c.split(e-i):c),n<0&&i>=e&&(n=r),i=d,r++}let a=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new q(this.mark,t,a)}domAtPos(e){return Le(this,e)}coordsAt(e,t){return Xe(this,e,t)}}function pe(s,e,t){let i=s.nodeValue.length;e>i&&(e=i);let n=e,r=e,a=0;e==0&&t<0||e==i&&t>=0?Me.chrome||Me.gecko||(e?(n--,a=1):r<i&&(r++,a=-1)):t<0?n--:r<i&&r++;let c=ft(s,n,r).getClientRects();if(!c.length)return null;let d=c[(a?a<0:t>=0)?0:c.length-1];
24return Me.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(c,x=>x.width)||d),a?at(d,a<0):d||null}class re extends Ue{static create(e,t,i){return new re(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=re.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,n,r,a){return i&&(!(i instanceof re)||!this.widget.compare(i.widget)||e>0&&r<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof re&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return v.EY.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,n=this.posAtStart;return i?i.slice(n,n+this.length):v.EY.empty}domAtPos(e){return(this.length?e==0:this.side>0)?pt.before(this.dom):pt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let a=this.side?this.side<0:e>0;for(let c=a?n.length-1:0;r=n[c],!(e>0?c==0:c==n.length-1||r.top<r.bottom);c+=a?-1:1);return at(r,!a)}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 ve extends Ue{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof ve&&e.side==this.side}split(){return new ve(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?pt.before(this.dom):pt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return v.EY.empty}get isHidden(){return!0}}Q.prototype.children=re.prototype.children=ve.prototype.children=Jt;function Le(s,e){let t=s.dom,{children:i}=s,n=0;for(let r=0;n<i.length;n++){let a=i[n],c=r+a.length;if(!(c==r&&a.getSide()<=0)){if(e>r&&e<c&&a.dom.parentNode==t)return a.domAtPos(e-r);if(e<=r)break;r=c}}for(let r=n;r>0;r--){let a=i[r-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let r=n;r<i.length;r++){let a=i[r];if(a.dom.parentNode==t)return a.domAtPos(0)}return new pt(t,0)}function Ne(s,e,t){let i,{children:n}=s;t>0&&e instanceof q&&n.length&&(i=n[n.length-1])instanceof q&&i.mark.eq(e.mark)?Ne(i,e.children[0],t-1):(n.push(e),e.setParent(s)),s.length+=e.length}function Xe(s,e,t){let i=null,n=-1,r=null,a=-1;function c(x,y){for(let E=0,N=0;E<x.children.length&&N<=y;E++){let X=x.children[E],se=N+X.length;se>=y&&(X.children.length?c(X,y-N):(!r||r.isHidden&&t>0)&&(se>y||N==se&&X.getSide()>0)?(r=X,a=y-N):(N<y||N==se&&X.getSide()<0&&!X.isHidden)&&(i=X,n=y-N)),N=se}}c(s,e);let d=(t<0?i:r)||i||r;return d?d.coordsAt(Math.max(0,d==i?n:a),t):ze(s)}function ze(s){let e=s.dom.lastChild;if(!e)return s.dom.getBoundingClientRect();let t=it(e);return t[t.length-1]||null}function tt(s,e){for(let t in s)t=="class"&&e.class?e.class+=" "+s.class:t=="style"&&e.style?e.style+=";"+s.style:e[t]=s[t];return e}const qe=Object.create(null);function we(s,e,t){if(s==e)return!0;s||(s=qe),e||(e=qe);let i=Object.keys(s),n=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(n.indexOf(r)==-1||s[r]!==e[r]))return!1;return!0}function ut(s,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?s.style.cssText=t[n]:s.setAttribute(n,t[n]));return i}function gt(s){let e=Object.create(null);for(let t=0;t<s.attributes.length;t++){let i=s.attributes[t];e[i.name]=i.value}return e}class Nt{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var yt=function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s}(yt||(yt={}));class Pe extends v.FB{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Bt(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new $t(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,n;if(e.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:a}=ci(e,t);i=(r?t?-3e8:-1:5e8)-1,n=(a?t?2e8:1:-6e8)+1}return new $t(e,i,n,t,e.widget||null,!0)}static line(e){return new Xt(e)}static set(e,t=!1){return v.om.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Pe.none=v.om.empty;class Bt extends Pe{constructor(e){let{start:t,end:i}=ci(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof Bt&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&we(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Bt.prototype.point=!1;class Xt extends Pe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Xt&&this.spec.class==e.spec.class&&we(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}
24Xt.prototype.mapMode=v.iR.TrackBefore,Xt.prototype.point=!0;class $t extends Pe{constructor(e,t,i,n,r,a){super(t,i,r,e),this.block=n,this.isReplace=a,this.mapMode=n?t<=0?v.iR.TrackBefore:v.iR.TrackAfter:v.iR.TrackDel}get type(){return this.startSide!=this.endSide?yt.WidgetRange:this.startSide<=0?yt.WidgetBefore:yt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof $t&&Mi(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}$t.prototype.point=!0;function ci(s,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=s;return t==null&&(t=s.inclusive),i==null&&(i=s.inclusive),{start:t??e,end:i??e}}function Mi(s,e){return s==e||!!(s&&e&&s.compare(e))}function _(s,e,t,i=0){let n=t.length-1;n>=0&&t[n]+i>=s?t[n]=Math.max(t[n],e):t.push(s,e)}class M extends Ue{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,n,r,a){if(i){if(!(i instanceof M))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),gi(this,e,t,i?i.children.slice():[],r,a),!0}split(e){let t=new M;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:n}=this.childPos(e);n&&(t.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let r=i;r<this.children.length;r++)t.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=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){we(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ne(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=tt(t,this.attrs||{})),i&&(this.attrs=tt({class:i},this.attrs||{}))}domAtPos(e){return Le(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ci(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&&(ut(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&Ue.get(n)instanceof q;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((i=Ue.get(n))===null||i===void 0?void 0:i.isEditable)==!1&&(!Me.ios||!this.children.some(r=>r instanceof Q))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Q)||/[^ -~]/.test(i.text))return null;let n=it(i.dom);
vendor: 4,607 bytes, line 24
24if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Xe(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:n}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-n.lineHeight)<2&&n.textHeight<r){let a=(r-n.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof M&&this.children.length==0&&e.children.length==0&&we(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,n=0;i<e.children.length;i++){let r=e.children[i],a=n+r.length;if(a>=t){if(r instanceof M)return r;if(a>t)break}n=a+r.breakAfter}return null}}class H extends Ue{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,r,a){return i&&(!(i instanceof H)||!this.widget.compare(i.widget)||e>0&&r<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?pt.before(this.dom):pt.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new H(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return Jt}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):v.EY.empty}domBoundsAround(){return null}become(e){return e instanceof H&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof V?null:at(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class V extends Nt{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Y{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,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=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof H&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new M),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(he(new ve(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof H)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:r,lineBreak:a,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(a){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,e--;continue}else this.text=r,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(he(new Q(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,r,a){if(this.disallowBlockEffectsFor[a]&&i instanceof $t){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");
24if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=t-e;if(i instanceof $t)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new H(i.widget||Ae.block,c,i));else{let d=re.create(i.widget||Ae.inline,c,c?0:i.startSide),x=this.atCursorPos&&!d.isEditable&&r<=n.length&&(e<t||i.startSide>0),y=!d.isEditable&&(e<t||r>n.length||i.startSide<=0),E=this.getLine();this.pendingBuffer==2&&!x&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),x&&(E.append(he(new ve(1),n),r),r=n.length+Math.max(0,r-n.length)),E.append(he(d,n),r),this.atCursorPos=y,this.pendingBuffer=y?e<t||r>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,n,r){let a=new Y(e,t,i,r);return a.openEnd=v.om.spans(n,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function he(s,e){for(let t of e)s=new q(t,[s],s.length);return s}class Ae extends Nt{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ae.inline=new Ae("span"),Ae.block=new Ae("div");var ke=function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s}(ke||(ke={}));const _e=ke.LTR,Qe=ke.RTL;function Wt(s){let e=[];for(let t=0;t<s.length;t++)e.push(1<<+s[t]);return e}const Rt=Wt("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),fi=Wt("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ut=Object.create(null),_t=[];for(let s of["()","[]","{}"]){let e=s.charCodeAt(0),t=s.charCodeAt(1);Ut[e]=t,Ut[t]=-e}function P(s){return s<=247?Rt[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?fi[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8204?256:64336<=s&&s<=65023?4:1}const ne=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ce{get dir(){return this.level%2?Qe:_e}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,n){let r=-1;for(let a=0;a<e.length;a++){let c=e[a];if(c.from<=t&&c.to>=t){if(c.level==i)return a;(r<0||(n!=0?n<0?c.from<t:c.to>t:e[r].level>c.level))&&(r=a)}}if(r<0)throw new RangeError("Index out of range");return r}}function ee(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++){let i=s[t],n=e[t];if(i.from!=n.from||i.to!=n.to||i.direction!=n.direction||!ee(i.inner,n.inner))return!1}return!0}const J=[];function Ee(s,e,t,i,n){for(let r=0;r<=i.length;r++){let a=r?i[r-1].to:e,c=r<i.length?i[r].from:t,d=r?256:n;for(let x=a,y=d,E=d;x<c;x++){let N=P(s.charCodeAt(x));N==512?N=y:N==8&&E==4&&(N=16),J[x]=N==4?2:N,N&7&&(E=N),y=N}for(let x=a,y=d,E=d;x<c;x++){let N=J[x];if(N==128)x<c-1&&y==J[x+1]&&y&24?N=J[x]=y:J[x]=256;else if(N==64){let X=x+1;for(;X<c&&J[X]==64;)X++;let se=x&&y==8||X<t&&J[X]==8?E==1?1:8:256;for(let de=x;de<X;de++)J[de]=se;x=X-1}else N==8&&E==1&&(J[x]=1);y=N,N&7&&(E=N)}}}function De(s,e,t,i,n){let r=n==1?2:1;for(let a=0,c=0,d=0;a<=i.length;a++){let x=a?i[a-1].to:e,y=a<i.length?i[a].from:t;for(let E=x,N,X,se;E<y;E++)if(X=Ut[N=s.charCodeAt(E)])if(X<0){for(let de=c-3;de>=0;de-=3)if(_t[de+1]==-X){let ge=_t[de+2],me=ge&2?n:ge&4?ge&1?r:n:0;me&&(J[E]=J[_t[de]]=me),c=de;break}}else{if(_t.length==189)break;_t[c++]=E,_t[c++]=N,_t[c++]=d}else if((se=J[E])==2||se==1){let de=se==n;d=de?0:1;for(let ge=c-3;ge>=0;ge-=3){let me=_t[ge+2];if(me&2)break;if(de)_t[ge+2]|=2;else{if(me&4)break;_t[ge+2]|=4}}}}}function Ye(s,e,t,i){for(let n=0,r=i;n<=t.length;n++){let a=n?t[n-1].to:s,c=n<t.length?t[n].from:e;for(let d=a;d<c;){let x=J[d];if(x==256){let y=d+1;for(;;)if(y==c){if(n==t.length)break;y=t[n++].to,c=n<t.length?t[n].from:e}else if(J[y]==256)y++;else break;let E=r==1,N=(y<e?J[y]:i)==1,X=E==N?E?1:2:i;for(let se=y,de=n,ge=de?t[de-1].to:s;se>d;)se==ge&&(se=t[--de].from,ge=de?t[de-1].to:s),J[--se]=X;d=y}else r=x,d++}}}function je(s,e,t,i,n,r,a){let c=i%2?2:1;if(i%2==n%2)for(let d=e,x=0;d<t;){let y=!0,E=!1;if(x==r.length||d<r[x].from){let de=J[d];de!=c&&(y=!1,E=de==16)}let N=!y&&c==1?[]:null,X=y?i:i+1,se=d;e:for(;;)if(x<r.length&&se==r[x].from){if(E)break e;let de=r[x];if(!y)for(let ge=de.to,me=x+1;;){if(ge==t)break e;if(me<r.length&&r[me].from==ge)ge=r[me++].to;else{if(J[ge]==c)break e;break}}if(x++,N)N.push(de);else{de.from>d&&a.push(new ce(d,de.from,X));let ge=de.direction==_e!=!(X%2);D(s,ge?i+1:i,n,de.inner,de.from,de.to,a),d=de.to}
24se=de.to}else{if(se==t||(y?J[se]!=c:J[se]==c))break;se++}N?je(s,d,se,i+1,n,N,a):d<se&&a.push(new ce(d,se,X)),d=se}else for(let d=t,x=r.length;d>e;){let y=!0,E=!1;if(!x||d>r[x-1].to){let de=J[d-1];de!=c&&(y=!1,E=de==16)}let N=!y&&c==1?[]:null,X=y?i:i+1,se=d;e:for(;;)if(x&&se==r[x-1].to){if(E)break e;let de=r[--x];if(!y)for(let ge=de.from,me=x;;){if(ge==e)break e;if(me&&r[me-1].to==ge)ge=r[--me].from;else{if(J[ge-1]==c)break e;break}}if(N)N.push(de);else{de.to<d&&a.push(new ce(de.to,d,X));let ge=de.direction==_e!=!(X%2);D(s,ge?i+1:i,n,de.inner,de.from,de.to,a),d=de.from}se=de.from}else{if(se==e||(y?J[se-1]!=c:J[se-1]==c))break;se--}N?je(s,se,d,i+1,n,N,a):se<d&&a.push(new ce(se,d,X)),d=se}}function D(s,e,t,i,n,r,a){let c=e%2?2:1;Ee(s,n,r,i,c),De(s,n,r,i,c),Ye(n,r,i,c),je(s,n,r,e,t,i,a)}function o(s,e,t){if(!s)return[new ce(0,0,e==Qe?1:0)];if(e==_e&&!t.length&&!ne.test(s))return l(s.length);if(t.length)for(;s.length>J.length;)J[J.length]=256;let i=[],n=e==_e?0:1;return D(s,n,n,t,0,s.length,i),i}function l(s){return[new ce(0,s,0)]}let f="";function m(s,e,t,i,n){var r;let a=i.head-s.from,c=ce.find(e,a,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),d=e[c],x=d.side(n,t);if(a==x){let N=c+=n?1:-1;if(N<0||N>=e.length)return null;d=e[c=N],a=d.side(!n,t),x=d.side(n,t)}let y=(0,v.zK)(s.text,a,d.forward(n,t));(y<d.from||y>d.to)&&(y=x),f=s.text.slice(Math.min(a,y),Math.max(a,y));let E=c==(n?e.length-1:0)?null:e[c+(n?1:-1)];return E&&y==x&&E.level+(n?0:1)<d.level?v.OF.cursor(E.side(!n,t)+s.from,E.forward(n,t)?1:-1,E.level):v.OF.cursor(y+s.from,d.forward(n,t)?-1:1,d.level)}function S(s,e,t){for(let i=e;i<t;i++){let n=P(s.charCodeAt(i));if(n==1)return _e;if(n==2||n==4)return Qe}return _e}const C=v.sj.define(),R=v.sj.define(),j=v.sj.define(),le=v.sj.define(),ye=v.sj.define(),Ce=v.sj.define(),Ve=v.sj.define(),Fe=v.sj.define(),Tt=v.sj.define(),Oi=v.sj.define({combine:s=>s.some(e=>e)}),qt=v.sj.define({combine:s=>s.some(e=>e)}),Fi=v.sj.define();class Ri{constructor(e,t="nearest",i="nearest",n=5,r=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=a}map(e){return e.empty?this:new Ri(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ri(v.OF.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ni=v.Pe.define({map:(s,e)=>s.map(e)}),zi=v.Pe.define();function A(s,e,t){let i=s.facet(le);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?Oe.error(t+":",e):Oe.error(e)}const p=v.sj.define({combine:s=>s.length?s[0]:!0});let b=0;const T=v.sj.define();class L{constructor(e,t,i,n,r){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(e,t){const{eventHandlers:i,eventObservers:n,provide:r,decorations:a}=t||{};return new L(b++,e,i,n,c=>{let d=[T.of(c)];return a&&d.push(oe.of(x=>{let y=x.plugin(c);return y?a(y):Pe.none})),r&&d.push(r(c)),d})}static fromClass(e,t){return L.define(i=>new e(i),t)}}class K{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(A(t.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(e)}catch(t){A(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){A(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const te=v.sj.define(),ae=v.sj.define(),oe=v.sj.define(),Se=v.sj.define(),xe=v.sj.define(),He=v.sj.define();function ht(s,e){let t=s.state.facet(He);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(s):r),n=[];return v.om.spans(i,e.from,e.to,{point(){},span(r,a,c,d){let x=r-e.from,y=a-e.from,E=n;for(let N=c.length-1;N>=0;N--,d--){let X=c[N].spec.bidiIsolate,se;if(X==null&&(X=S(e.text,x,y)),d>0&&E.length&&(se=E[E.length-1]).to==x&&se.direction==X)se.to=y,E=se.inner;else{let de={from:x,to:y,direction:X,inner:[]};E.push(de),E=de.inner}}}}),n}const Ot=v.sj.define();function ni(s){let e=0,t=0,i=0,n=0;for(let r of s.state.facet(Ot)){let a=r(s);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(n=Math.max(n,a.bottom)))}return{left:e,right:t,top:i,bottom:n}}const ui=v.sj.define();class wi{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new wi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;
vendor: 15,945 bytes, line 24
24i=i.join(n),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let n=0,r=0,a=0,c=0;;n++){let d=n==e.length?null:e[n],x=a-c,y=d?d.fromB:1e9;for(;r<t.length&&t[r]<y;){let E=t[r],N=t[r+1],X=Math.max(c,E),se=Math.min(y,N);if(X<=se&&new wi(X+x,se+x,X,se).addToSet(i),N>y)break;r+=2}if(!d)return i;new wi(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),a=d.toA,c=d.toB}}}class vi{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=v.VR.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,a,c,d)=>n.push(new wi(r,a,c,d))),this.changedRanges=n}static create(e,t,i){return new vi(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Gt extends Ue{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Pe.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(e.contentDOM),this.children=[new M],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new wi(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:x,toA:y})=>y<this.minWidthFrom||x>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!O(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?Si(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:x,to:y}=this.hasComposition;i=new wi(x,y,e.changes.mapPos(x,-1),e.changes.mapPos(y,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Me.ie||Me.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,c=this.updateDeco(),d=h(a,c,e.changes);return i=wi.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Me.chrome||Me.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||n.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof H&&a.widget instanceof V&&r.push(a.dom);n.updateGaps(r)}updateChildren(e,t,i){let n=i?i.range.addToSet(e.slice()):e,r=this.childCursor(t);for(let a=n.length-1;;a--){let c=a>=0?n[a]:null;if(!c)break;let{fromA:d,toA:x,fromB:y,toB:E}=c,N,X,se,de;if(i&&i.range.fromB<E&&i.range.toB>y){let Ge=Y.build(this.view.state.doc,y,i.range.fromB,this.decorations,this.dynamicDecorationMap),ot=Y.build(this.view.state.doc,i.range.toB,E,this.decorations,this.dynamicDecorationMap);X=Ge.breakAtStart,se=Ge.openStart,de=ot.openEnd;let lt=this.compositionView(i);ot.breakAtStart?lt.breakAfter=1:ot.content.length&&lt.merge(lt.length,lt.length,ot.content[0],!1,ot.openStart,0)&&(lt.breakAfter=ot.content[0].breakAfter,ot.content.shift()),Ge.content.length&&lt.merge(0,0,Ge.content[Ge.content.length-1],!0,0,Ge.openEnd)&&Ge.content.pop(),N=Ge.content.concat(lt).concat(ot.content)}else({content:N,breakAtStart:X,openStart:se,openEnd:de}=Y.build(this.view.state.doc,y,E,this.decorations,this.dynamicDecorationMap));let{i:ge,off:me}=r.findPos(x,1),{i:$e,off:et}=r.findPos(d,-1);hi(this,$e,et,ge,me,N,X,se,de)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(zi)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Q(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new q(n,[t],t.length);let i=new M;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let c=Ue.get(r);c&&c!=a&&(c.dom=null),a.setDOM(r)},i=this.childPos(e.range.fromB,1),n=this.children[i.i];t(e.line,n);for(let r=e.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],t(r>=0?e.marks[r].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&!(this.view.state.facet(p)||this.dom.tabIndex>-1)&&Ie(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||r))return;let a=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(c.anchor)),x=c.empty?d:this.moveToLine(this.domAtPos(c.head));if(Me.gecko&&c.empty&&!this.hasComposition&&Bi(d)){let E=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(E,d.node.childNodes[d.offset]||null)),d=x=new pt(E,0),a=!0}let y=this.view.observer.selectionRange;(a||!y.focusNode||(!zt(d.node,d.offset,y.anchorNode,y.anchorOffset)||!zt(x.node,x.offset,y.focusNode,y.focusOffset))&&!this.suppressWidgetCursorChange(y,c))&&(this.view.observer.ignore(()=>{Me.android&&Me.chrome&&this.dom.contains(y.focusNode)&&g(y.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let E=Je(this.view.root);if(E)if(c.empty){if(Me.gecko){let N=_i(d.node,d.offset);if(N&&N!=3){let X=(N==1?Yt:dt)(d.node,d.offset);X&&(d=new pt(X.node,X.offset))}}E.collapse(d.node,d.offset),c.bidiLevel!=null&&E.caretBidiLevel!==void 0&&(E.caretBidiLevel=c.bidiLevel)}else if(E.extend){E.collapse(d.node,d.offset);try{E.extend(x.node,x.offset)}catch{}}else{let N=document.createRange();c.anchor>c.head&&([d,x]=[x,d]),N.setEnd(x.node,x.offset),N.setStart(d.node,d.offset),E.removeAllRanges(),E.addRange(N)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,x)),this.impreciseAnchor=d.precise?null:new pt(y.anchorNode,y.anchorOffset),this.impreciseHead=x.precise?null:new pt(y.focusNode,y.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&zt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Je(e.root),{anchorNode:n,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=M.find(this,t.head);if(!a)return;let c=a.posAtStart;if(t.head==c||t.head==c+a.length)return;let d=this.coordsAt(t.head,-1),x=this.coordsAt(t.head,1);if(!d||!x||d.bottom>x.top)return;let y=this.domAtPos(t.head+t.assoc);i.collapse(y.node,y.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let E=e.observer.selectionRange;e.docView.posFromDOM(E.anchorNode,E.anchorOffset)!=t.from&&i.collapse(n,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let n=e.offset;!i&&n<t.childNodes.length;n++){let r=Ue.get(t.childNodes[n]);r instanceof M&&(i=r.domAtPos(0))}for(let n=e.offset-1;!i&&n>=0;n--){let r=Ue.get(t.childNodes[n]);r instanceof M&&(i=r.domAtPos(r.length))}return i?new pt(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=Ue.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let n=this.children[t];if(i<n.length||n instanceof M)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,n=0;for(let r=this.length,a=this.children.length-1;a>=0;a--){let c=this.children[a],d=r-c.breakAfter,x=d-c.length;if(d<e)break;if(x<=e&&(x<e||c.covers(-1))&&(d>e||c.covers(1))&&(!i||c instanceof M&&!(i instanceof M&&t>=0)))i=c,n=x;else if(i&&x==e&&d==e&&c instanceof H&&Math.abs(t)<2){if(c.deco.startSide<0)break;a&&(i=null)}r=x}return i?i.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),n=this.children[t];if(!(n instanceof M))return null;for(;n.children.length;){let{i:c,off:d}=n.childPos(i,1);for(;;c++){if(c==n.children.length)return null;if((n=n.children[c]).length)break}i=d}if(!(n instanceof Q))return null;let r=(0,v.zK)(n.text,i);if(r==i)return null;let a=ft(n.dom,i,r).getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(c==a.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:n}=e,r=this.view.contentDOM.clientWidth,a=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,d=this.view.textDirection==ke.LTR;for(let x=0,y=0;y<this.children.length;y++){let E=this.children[y],N=x+E.length;if(N>n)break;if(x>=i){let X=E.dom.getBoundingClientRect();if(t.push(X.height),a){let se=E.dom.lastChild,de=se?it(se):[];if(de.length){let ge=de[de.length-1],me=d?ge.right-X.left:X.right-ge.left;me>c&&(c=me,this.minWidth=r,this.minWidthFrom=x,this.minWidthTo=N)}}}x=N+E.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ke.RTL:ke.LTR}measureTextSize(){for(let r of this.children)if(r instanceof M){let a=r.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=it(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,n=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new kt(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let r=n==t.viewports.length?null:t.viewports[n],a=r?r.from-1:this.length;if(a>i){let c=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Pe.replace({widget:new V(c),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!r)break;i=r.to+1}return Pe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(oe).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,n=this.view.state.facet(Se).map((r,a)=>{let c=typeof r=="function";return c&&(i=!0),c?r(this.view):r});for(n.length&&(this.dynamicDecorationMap[e++]=i,t.push(v.om.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let x=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=x.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let x of this.view.state.facet(Fi))try{if(x(this.view,e.range,e))return!0}catch(y){A(this.view.state,y,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),n;if(!i)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let r=ni(this.view),a={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:c,offsetHeight:d}=this.view.scrollDOM;Ht(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,d),-d),this.view.textDirection==ke.LTR)}}function Bi(s){return s.node.nodeType==1&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}function ki(s,e){let t=s.observer.selectionRange;if(!t.focusNode)return null;let i=Yt(t.focusNode,t.focusOffset),n=dt(t.focusNode,t.focusOffset),r=i||n;if(n&&i&&n.node!=i.node){let c=Ue.get(n.node);if(!c||c instanceof Q&&c.text!=n.node.nodeValue)r=n;else if(s.docView.lastCompositionAfterCursor){let d=Ue.get(i.node);!d||d instanceof Q&&d.text!=i.node.nodeValue||(r=n)}}if(s.docView.lastCompositionAfterCursor=r!=i,!r)return null;let a=e-r.offset;return{from:a,to:a+r.node.nodeValue.length,node:r.node}}function Si(s,e,t){let i=ki(s,t);if(!i)return null;let{node:n,from:r,to:a}=i,c=n.nodeValue;if(/[\n\r]/.test(c)||s.state.doc.sliceString(i.from,i.to)!=c)return null;let d=e.invertedDesc,x=new wi(d.mapPos(r),d.mapPos(a),r,a),y=[];for(let E=n.parentNode;;E=E.parentNode){let N=Ue.get(E);if(N instanceof q)y.push({node:E,deco:N.mark});else{if(N instanceof M||E.nodeName=="DIV"&&E.parentNode==s.contentDOM)return{range:x,text:n,marks:y,line:E};if(E!=s.contentDOM)y.push({node:E,deco:new Bt({inclusive:!0,attributes:gt(E),tagName:E.tagName.toLowerCase()})});else return null}}}function _i(s,e){return s.nodeType!=1?0:(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e<s.childNodes.length&&s.childNodes[e].contentEditable=="false"?2:0)}let k=class{constructor(){this.changes=[]}compareRange(e,t){_(e,t,this.changes)}comparePoint(e,t){_(e,t,this.changes)}boundChange(e){_(e,e,this.changes)}};function h(s,e,t){let i=new k;return v.om.compare(s,e,t,i),i.changes}function g(s,e){for(let t=s;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function O(s,e){let t=!1;return e&&s.iterChangedRanges((i,n)=>{i<e.to&&n>e.from&&(t=!0)}),t}function B(s,e,t=1){let i=s.charCategorizer(e),n=s.doc.lineAt(e),r=e-n.from;if(n.length==0)return v.OF.cursor(e);r==0?t=1:r==n.length&&(t=-1);let a=r,c=r;t<0?a=(0,v.zK)(n.text,r,!1):c=(0,v.zK)(n.text,r);let d=i(n.text.slice(a,c));for(;a>0;){let x=(0,v.zK)(n.text,a,!1);if(i(n.text.slice(x,a))!=d)break;a=x}for(;c<n.length;){let x=(0,v.zK)(n.text,c);if(i(n.text.slice(c,x))!=d)break;c=x}return v.OF.range(a+n.from,c+n.from)}function $(s,e){return e.left>s?e.left-s:Math.max(0,s-e.right)}function G(s,e){return e.top>s?e.top-s:Math.max(0,s-e.bottom)}function ue(s,e){return s.top<e.bottom-1&&s.bottom>e.top+1}function fe(s,e){return e<s.top?{top:e,left:s.left,right:s.right,bottom:s.bottom}:s}function Te(s,e){return e>s.bottom?{top:s.top,left:s.left,right:s.right,bottom:e}:s}function We(s,e,t){let i,n,r,a,c=!1,d,x,y,E;for(let se=s.firstChild;se;se=se.nextSibling){let de=it(se);for(let ge=0;ge<de.length;ge++){let me=de[ge];n&&ue(n,me)&&(me=fe(Te(me,n.bottom),n.top));let $e=$(e,me),et=G(t,me);if($e==0&&et==0)return se.nodeType==3?It(se,e,t):We(se,e,t);if(!i||a>et||a==et&&r>$e){i=se,n=me,r=$e,a=et;let Ge=et?t<me.top?-1:1:$e?e<me.left?-1:1:0;c=!Ge||(Ge>0?ge<de.length-1:ge>0)}$e==0?t>me.bottom&&(!y||y.bottom<me.bottom)?(d=se,y=me):t<me.top&&(!E||E.top>
24me.top)&&(x=se,E=me):y&&ue(y,me)?y=Te(y,me.bottom):E&&ue(E,me)&&(E=fe(E,me.top))}}if(y&&y.bottom>=t?(i=d,n=y):E&&E.top<=t&&(i=x,n=E),!i)return{node:s,offset:0};let N=Math.max(n.left,Math.min(n.right,e));if(i.nodeType==3)return It(i,N,t);if(c&&i.contentEditable!="false")return We(i,N,t);let X=Array.prototype.indexOf.call(s.childNodes,i)+(e>=(n.left+n.right)/2?1:0);return{node:s,offset:X}}function It(s,e,t){let i=s.nodeValue.length,n=-1,r=1e9,a=0;for(let c=0;c<i;c++){let d=ft(s,c,c+1).getClientRects();for(let x=0;x<d.length;x++){let y=d[x];if(y.top==y.bottom)continue;a||(a=e-y.left);let E=(y.top>t?y.top-t:t-y.bottom)-1;if(y.left-1<=e&&y.right+1>=e&&E<r){let N=e>=(y.left+y.right)/2,X=N;if((Me.chrome||Me.gecko)&&ft(s,c).getBoundingClientRect().left==y.right&&(X=!N),E<=0)return{node:s,offset:c+(X?1:0)};n=c+(X?1:0),r=E}}}return{node:s,offset:n>-1?n:a>0?s.nodeValue.length:0}}function Ei(s,e,t,i=-1){var n,r;let a=s.contentDOM.getBoundingClientRect(),c=a.top+s.viewState.paddingTop,d,{docHeight:x}=s.viewState,{x:y,y:E}=e,N=E-c;if(N<0)return 0;if(N>x)return s.state.doc.length;for(let Ge=s.viewState.heightOracle.textHeight/2,ot=!1;d=s.elementAtHeight(N),d.type!=yt.Text;)for(;N=i>0?d.bottom+Ge:d.top-Ge,!(N>=0&&N<=x);){if(ot)return t?null:0;ot=!0,i=-i}E=c+N;let X=d.from;if(X<s.viewport.from)return s.viewport.from==0?0:t?null:Di(s,a,d,y,E);if(X>s.viewport.to)return s.viewport.to==s.state.doc.length?s.state.doc.length:t?null:Di(s,a,d,y,E);let se=s.dom.ownerDocument,de=s.root.elementFromPoint?s.root:se,ge=de.elementFromPoint(y,E);ge&&!s.contentDOM.contains(ge)&&(ge=null),ge||(y=Math.max(a.left+1,Math.min(a.right-1,y)),ge=de.elementFromPoint(y,E),ge&&!s.contentDOM.contains(ge)&&(ge=null));let me,$e=-1;if(ge&&((n=s.docView.nearest(ge))===null||n===void 0?void 0:n.isEditable)!=!1){if(se.caretPositionFromPoint){let Ge=se.caretPositionFromPoint(y,E);Ge&&({offsetNode:me,offset:$e}=Ge)}else if(se.caretRangeFromPoint){let Ge=se.caretRangeFromPoint(y,E);Ge&&({startContainer:me,startOffset:$e}=Ge,(!s.contentDOM.contains(me)||Me.safari&&Hi(me,$e,y)||Me.chrome&&Vi(me,$e,y))&&(me=void 0))}me&&($e=Math.min(Ze(me),$e))}if(!me||!s.docView.dom.contains(me)){let Ge=M.find(s.docView,X);if(!Ge)return N>d.top+d.height/2?d.to:d.from;({node:me,offset:$e}=We(Ge.dom,y,E))}let et=s.docView.nearest(me);if(!et)return null;if(et.isWidget&&((r=et.dom)===null||r===void 0?void 0:r.nodeType)==1){let Ge=et.dom.getBoundingClientRect();return e.y<Ge.top||e.y<=Ge.bottom&&e.x<=(Ge.left+Ge.right)/2?et.posAtStart:et.posAtEnd}else return et.localPosFromDOM(me,$e)+et.posAtStart}function Di(s,e,t,i,n){let r=Math.round((i-e.left)*s.defaultCharacterWidth);if(s.lineWrapping&&t.height>s.defaultLineHeight*1.5){let c=s.viewState.heightOracle.textHeight,d=Math.floor((n-t.top-(s.defaultLineHeight-c)*.5)/c);r+=d*s.viewState.heightOracle.lineLength}let a=s.state.sliceDoc(t.from,t.to);return t.from+(0,v.kn)(a,r,s.state.tabSize)}function Hi(s,e,t){let i;if(s.nodeType!=3||e!=(i=s.nodeValue.length))return!1;for(let n=s.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return ft(s,i-1,i).getBoundingClientRect().left>t}function Vi(s,e,t){if(e!=0)return!1;for(let n=s;;){let r=n.parentNode;if(!r||r.nodeType!=1||r.firstChild!=n)return!1;if(r.classList.contains("cm-line"))break;n=r}let i=s.nodeType==1?s.getBoundingClientRect():ft(s,0,Math.max(s.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Ji(s,e){let t=s.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==yt.Text))return i}return t}function Xi(s,e,t,i){let n=Ji(s,e.head),r=!i||n.type!=yt.Text||!(s.lineWrapping||n.widgetLineBreaks)?null:s.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(r){let a=s.dom.getBoundingClientRect(),c=s.textDirectionAt(n.from),d=s.posAtCoords({x:t==(c==ke.LTR)?a.right-1:a.left+1,y:(r.top+r.bottom)/2});if(d!=null)return v.OF.cursor(d,t?-1:1)}return v.OF.cursor(t?n.to:n.from,t?-1:1)}function Vn(s,e,t,i){let n=s.state.doc.lineAt(e.head),r=s.bidiSpans(n),a=s.textDirectionAt(n.from);for(let c=e,d=null;;){let x=m(n,r,a,c,t),y=f;if(!x){if(n.number==(t?s.state.doc.lines:1))return c;y=`
25`,n=s.state.doc.line(n.number+(t?1:-1)),r=s.bidiSpans(n),x=s.visualLineSide(n,!t)}if(d){if(!d(y))return c}else{if(!i)return x;d=i(y)}c=x}}function ms(s,e,t){let i=s.state.charCategorizer(e),n=i(t);return r=>{let a=i(r);return n==v.Je.Space&&(n=a),n==a}}function Wn(s,e,t,i){let n=e.head,r=t?1:-1;if(n==(t?s.state.doc.length:0))return v.OF.cursor(n,e.assoc);let a=e.goalColumn,c,d=s.contentDOM.getBoundingClientRect(),x=s.coordsAtPos(n,e.assoc||-1),y=s.documentTop;if(x)a==null&&(a=x.left-d.left),c=r<0?x.top:x.bottom;else{let X=s.viewState.lineBlockAt(n);a==null&&(a=Math.min(d.right-d.left,s.defaultCharacterWidth*(n-X.from))),c=(r<0?X.top:X.bottom)+y}let E=d.left+a,N=i??s.viewState.heightOracle.textHeight>>1;for(let X=0;;X+=10){let se=c+(N+X)*r,de=Ei(s,{x:E,y:se},!1,r);if(se<d.top||se>d.bottom||(r<0?de<n:de>
vendor: 20,042 bytes, lines 25-26
25n)){let ge=s.docView.coordsForChar(de),me=!ge||se<ge.top?-1:1;return v.OF.cursor(de,me,void 0,a)}}}function Zi(s,e,t){for(;;){let i=0;for(let n of s)n.between(e-1,e+1,(r,a,c)=>{if(e>r&&e<a){let d=i||t||(e-r<a-e?-1:1);e=d<0?r:a,i=d}});if(!i)return e}}function an(s,e,t){let i=Zi(s.state.facet(xe).map(n=>n(s)),t.from,e.head>t.from?-1:1);return i==t.from?t:v.OF.cursor(i,i<t.from?1:-1)}const Ui="\uFFFF";class hn{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(v.$t.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ui}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n);let r=this.text.length;this.readNode(n);let a=n.nextSibling;if(a==t)break;let c=Ue.get(n),d=Ue.get(a);(c&&d?c.breakAfter:(c?c.breakAfter:nt(n))||nt(a)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>r)&&this.lineBreak(),n=a}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,a=1,c;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(c=n.exec(t))&&(r=c.index,a=c[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),a>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=a-1);i=r+a}}readNode(e){if(e.cmIgnore)return;let t=Ue.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(zn(e,i.node,i.offset)?t:0))}}function zn(s,e,t){for(;;){if(!e||t<Ze(e))return!1;if(e==s)return!0;t=bt(e)+1,e=e.parentNode}}class sn{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class yn{constructor(e,t,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let c=r||a?[]:$n(e),d=new hn(c,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Kn(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=r&&r.node==c.focusNode&&r.offset==c.focusOffset||!Re(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),x=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!Re(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),y=e.viewport;if((Me.ios||Me.chrome)&&e.state.selection.main.empty&&d!=x&&(y.from>0||y.to<e.state.doc.length)){let E=Math.min(d,x),N=Math.max(d,x),X=y.from-E,se=y.to-N;(X==0||X==1||E==0)&&(se==0||se==-1||N==e.state.doc.length)&&(d=0,x=e.state.doc.length)}this.newSel=v.OF.single(x,d)}}}function bn(s,e){let t,{newSel:i}=e,n=s.state.selection.main,r=s.inputState.lastKeyTime>Date.now()-100?s.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:c}=e.bounds,d=n.from,x=null;(r===8||Me.android&&e.text.length<c-a)&&(d=n.to,x="end");let y=jn(s.state.doc.sliceString(a,c,Ui),e.text,d-a,x);y&&(Me.chrome&&r==13&&y.toB==y.from+2&&e.text.slice(y.from,y.toB)==Ui+Ui&&y.toB--,t={from:a+y.from,to:a+y.toA,insert:v.EY.of(e.text.slice(y.from,y.toB).split(Ui))})}else i&&(!s.hasFocus&&s.state.facet(p)||i.main.eq(n))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!n.empty&&i&&i.main.empty?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,n.to)}:(Me.mac||Me.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=v.OF.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:v.EY.of([t.insert.toString().replace("."," ")])}):t&&t.from>=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,t.from).append(t.insert).append(s.state.doc.slice(t.to,n.to))}:Me.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==`
26 `&&s.lineWrapping&&(i&&(i=v.OF.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:v.EY.of([" "])}),t)return wn(s,t,i,r);if(i&&!i.main.eq(n)){let a=!1,c="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(a=!0),c=s.inputState.lastSelectionOrigin),s.dispatch({selection:i,scrollIntoView:a,userEvent:c}),!0}else return!1}function wn(s,e,t,i=-1){if(Me.ios&&s.inputState.flushIOSKey(e))return!0;let n=s.state.selection.main;if(Me.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&s.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Vt(s.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Vt(s.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Vt(s.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let a,c=()=>a||(a=gs(s,e,t));return s.state.facet(Ce).some(d=>d(s,e.from,e.to,r,c))||s.dispatch(c()),!0}function gs(s,e,t){let i,n=s.state,r=n.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&s.inputState.composing<0){let c=r.from<e.from?n.sliceDoc(r.from,e.from):"",d=r.to>e.to?n.sliceDoc(e.to,r.to):"";i=n.replaceSelection(s.state.toText(c+e.insert.sliceString(0,void 0,s.state.lineBreak)+d))}else{let c=n.changes(e),d=t&&t.main.to<=c.newLength?t.main:void 0;if(n.selection.ranges.length>1&&s.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let x=s.state.sliceDoc(e.from,e.to),y,E=t&&ki(s,t.main.head);if(E){let se=e.insert.length-(e.to-e.from);y={from:E.from,to:E.to-se}}else y=s.state.doc.lineAt(r.head);let N=r.to-e.to,X=r.to-r.from;i=n.changeByRange(se=>{if(se.from==r.from&&se.to==r.to)return{changes:c,range:d||se.map(c)};let de=se.to-N,ge=de-x.length;if(se.to-se.from!=X||s.state.sliceDoc(ge,de)!=x||se.to>=y.from&&se.from<=y.to)return{range:se};let me=n.changes({from:ge,to:de,insert:e.insert}),$e=se.to-r.to;return{changes:me,range:d?v.OF.range(Math.max(0,d.anchor+$e),Math.max(0,d.head+$e)):se.map(me)}})}else i={changes:c,selection:d&&n.selection.replaceRange(d)}}let a="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,a+=".compose",s.inputState.compositionFirstChange&&(a+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:a,scrollIntoView:!0})}function jn(s,e,t,i){let n=Math.min(s.length,e.length),r=0;for(;r<n&&s.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==n&&s.length==e.length)return null;let a=s.length,c=e.length;for(;a>0&&c>0&&s.charCodeAt(a-1)==e.charCodeAt(c-1);)a--,c--;if(i=="end"){let d=Math.max(0,r-Math.min(a,c));t-=a+d-r}if(a<r&&s.length<e.length){let d=t<=r&&t>=a?r-t:0;r-=d,c=r+(c-a),a=r}else if(c<r){let d=t<=r&&t>=c?r-t:0;r-=d,a=r+(a-c),c=r}return{from:r,toA:a,toB:c}}function $n(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return t&&(e.push(new sn(t,i)),(n!=t||r!=i)&&e.push(new sn(n,r))),e}function Kn(s,e){if(s.length==0)return null;let t=s[0].pos,i=s.length==2?s[1].pos:t;return t>-1&&i>-1?v.OF.single(t+e,i+e):null}class Un{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,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=e.hasFocus,Me.safari&&e.contentDOM.addEventListener("input",()=>null),Me.gecko&&Cr(e.contentDOM.ownerDocument)}handleEvent(e){!Zt(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=w(e),i=this.handlers,n=this.view.contentDOM;for(let r in t)if(r!="scroll"){let a=!t[r].handlers.length,c=i[r];c&&a!=!c.handlers.length&&(n.removeEventListener(r,this.handleEvent),c=null),c||n.addEventListener(r,this.handleEvent,{passive:a})}for(let r in i)r!="scroll"&&!t[r]&&n.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&U.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Me.android&&Me.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Me.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=F.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||I.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Vt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Me.safari&&!Me.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function u(s,e){return(t,i)=>{try{return e.call(s,i,t)}catch(n){A(t.state,n)}}}function w(s){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of s){let n=i.spec;if(n&&n.domEventHandlers)for(let r in n.domEventHandlers){let a=n.domEventHandlers[r];a&&t(r).handlers.push(u(i.value,a))}if(n&&n.domEventObservers)for(let r in n.domEventObservers){let a=n.domEventObservers[r];a&&t(r).observers.push(u(i.value,a))}}for(let i in yi)t(i).handlers.push(yi[i]);for(let i in si)t(i).observers.push(si[i]);return e}const F=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],I="dthko",U=[16,17,18,20,91,92,224,225],W=6;function Z(s){return Math.max(0,s)*.7+8}function be(s,e){return Math.max(Math.abs(s.clientX-e.clientX),Math.abs(s.clientY-e.clientY))}class Be{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=pi(e.contentDOM),this.atoms=e.state.facet(xe).map(a=>a(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(v.$t.allowMultipleSelections)&&ct(e,t),this.dragging=Pt(e,t)&&Cs(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&be(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,n=0,r=0,a=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:n,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:c}=this.scrollParents.y.getBoundingClientRect());let d=ni(this.view);e.clientX-d.left<=n+W?t=-Z(n-e.clientX):e.clientX+d.right>=a-W&&(t=Z(e.clientX-a)),e.clientY-d.top<=r+W?i=-Z(r-e.clientY):e.clientY+d.bottom>=c-W&&(i=Z(e.clientY-c)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;i<e.ranges.length;i++){let n=e.ranges[i],r=null;if(n.empty){let a=Zi(this.atoms,n.from,0);a!=n.from&&(r=v.OF.cursor(a,-1))}else{let a=Zi(this.atoms,n.from,-1),c=Zi(this.atoms,n.to,1);(a!=n.from||c!=n.to)&&(r=v.OF.range(n.from==n.anchor?a:c,n.from==n.head?a:c))}r&&(t||(t=e.ranges.slice()),t[i]=r)}return t?v.OF.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function ct(s,e){let t=s.state.facet(C);return t.length?t[0](e):Me.mac?e.metaKey:e.ctrlKey}function rt(s,e){let t=s.state.facet(R);return t.length?t[0](e):Me.mac?!e.altKey:!e.ctrlKey}function Pt(s,e){let{main:t}=s.state.selection;if(t.empty)return!1;let i=Je(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r<n.length;r++){let a=n[r];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Zt(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=s.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Ue.get(t))&&i.ignoreEvent(e))return!1;return!0}const yi=Object.create(null),si=Object.create(null),Qi=Me.ie&&Me.ie_version<15||Me.ios&&Me.webkit_version<604;function yr(s){let e=s.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{s.focus(),t.remove(),ys(s,t.value)},50)}function vn(s,e,t){for(let i of s.facet(e))t=i(t,s);return t}function ys(s,e){e=vn(s.state,Fe,e);let{state:t}=s,i,n=1,r=t.toText(e),a=r.lines==t.selection.ranges.length;if(qn!=null&&t.selection.ranges.every(d=>d.empty)&&qn==r.toString()){let d=-1;i=t.changeByRange(x=>{let y=t.doc.lineAt(x.from);if(y.from==d)return{range:x};d=y.from;let E=t.toText((a?r.line(n++).text:e)+t.lineBreak);return{changes:{from:y.from,insert:E},range:v.OF.cursor(x.from+E.length)}})}else a?i=t.changeByRange(d=>{let x=r.line(n++);return{changes:{from:d.from,to:d.to,insert:x.text},range:v.OF.cursor(d.from+x.length)}}):i=t.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}si.scroll=s=>{s.inputState.lastScrollTop=s.scrollDOM.scrollTop,s.inputState.lastScrollLeft=s.scrollDOM.scrollLeft},yi.keydown=(s,e)=>(s.inputState.setSelectionOrigin("select"),e.keyCode==27&&s.inputState.tabFocusMode!=0&&(s.inputState.tabFocusMode=Date.now()+2e3),!1),si.touchstart=(s,e)=>{s.inputState.lastTouchTime=Date.now(),s.inputState.setSelectionOrigin("select.pointer")},si.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")},yi.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of s.state.facet(j))if(t=i(s,e),t)break;if(!t&&e.button==0&&(t=vr(s,e)),t){let i=!s.hasFocus;s.inputState.startMouseSelection(new Be(s,e,t,i)),i&&s.observer.ignore(()=>{st(s.contentDOM);let r=s.root.activeElement;r&&!r.contains(s.contentDOM)&&r.blur()});let n=s.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function bs(s,e,t,i){if(i==1)return v.OF.cursor(e,t);if(i==2)return B(s.state,e,t);{let n=M.find(s.docView,e),r=s.state.doc.lineAt(n?n.posAtEnd:e),a=n?n.posAtStart:r.from,c=n?n.posAtEnd:r.to;return c<s.state.doc.length&&c==r.to&&c++,v.OF.range(a,c)}}let ws=(s,e,t)=>e>=t.top&&e<=t.bottom&&s>=t.left&&s<=t.right;function br(s,e,t,i){let n=M.find(s.docView,e);if(!n)return 1;let r=e-n.posAtStart;if(r==0)return 1;if(r==n.length)return-1;let a=n.coordsAt(r,-1);if(a&&ws(t,i,a))return-1;let c=n.coordsAt(r,1);return c&&ws(t,i,c)?1:a&&a.bottom>=i?-1:1}function vs(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:br(s,t,e.clientX,e.clientY)}}const wr=Me.ie&&Me.ie_version<=11;let xs=null,ks=0,Ss=0;function Cs(s){if(!wr)return s.detail;let e=xs,t=Ss;return xs=s,Ss=Date.now(),ks=!e||t>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(ks+1)%3:1}function vr(s,e){let t=vs(s,e),i=Cs(e),n=s.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),n=n.map(r.changes))},get(r,a,c){let d=vs(s,r),x,y=bs(s,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let E=bs(s,t.pos,t.bias,i),N=Math.min(E.from,y.from),X=Math.max(E.to,y.to);y=N<y.from?v.OF.range(N,X):v.OF.range(X,N)}return a?n.replaceRange(n.main.extend(y.from,y.to)):c&&i==1&&n.ranges.length>1&&(x=xr(n,d.pos))?x:c?n.addRange(y):v.OF.create([y])}}}function xr(s,e){for(let t=0;t<s.ranges.length;t++){let{from:i,to:n}=s.ranges[t];if(i<=e&&n>=e)return v.OF.create(s.ranges.slice(0,t).concat(s.ranges.slice(t+1)),s.mainIndex==t?0:s.mainIndex-(s.mainIndex>t?1:0))}return null}yi.dragstart=(s,e)=>{let{selection:{main:t}}=s.state;if(e.target.draggable){let n=s.docView.nearest(e.target);if(n&&n.isWidget){let r=n.posAtStart,a=r+n.length;(r>=t.to||a<=t.from)&&(t=v.OF.range(r,a))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",vn(s.state,Tt,s.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},yi.dragend=s=>(s.inputState.draggedContent=null,!1);function As(s,e,t,i){if(t=vn(s.state,Fe,t),!t)return;let n=s.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=s.inputState,a=i&&r&&rt(s,e)?{from:r.from,to:r.to}:null,c={from:n,insert:t},d=s.state.changes(a?[a,c]:c);s.focus(),s.dispatch({changes:d,selection:{anchor:d.mapPos(n,-1),head:d.mapPos(n,1)},userEvent:a?"move.drop":"input.drop"}),s.inputState.draggedContent=null}yi.drop=(s,e)=>{if(!e.dataTransfer)return!1;if(s.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),n=0,r=()=>{++n==t.length&&As(s,e,i.filter(a=>a!=null).join(s.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let c=new FileReader;c.onerror=r,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(i[a]=c.result),r()},c.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return As(s,e,i,!0),!0}return!1},yi.paste=(s,e)=>{if(s.state.readOnly)return!0;s.observer.flush();let t=Qi?null:e.clipboardData;
26return t?(ys(s,t.getData("text/plain")||t.getData("text/uri-list")),!0):(yr(s),!1)};function kr(s,e){let t=s.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),s.focus()},50)}function Sr(s){let e=[],t=[],i=!1;for(let n of s.selection.ranges)n.empty||(e.push(s.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:r}of s.selection.ranges){let a=s.doc.lineAt(r);a.number>n&&(e.push(a.text),t.push({from:a.from,to:Math.min(s.doc.length,a.to+1)})),n=a.number}i=!0}return{text:vn(s,Tt,e.join(s.lineBreak)),ranges:t,linewise:i}}let qn=null;yi.copy=yi.cut=(s,e)=>{let{text:t,ranges:i,linewise:n}=Sr(s.state);if(!t&&!n)return!1;qn=n?t:null,e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Qi?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(kr(s,t),!1)};const Ms=v.YH.define();function Os(s,e){let t=[];for(let i of s.facet(Ve)){let n=i(s,e);
vendor: 24,188 bytes, line 26
26n&&t.push(n)}return t?s.update({effects:t,annotations:Ms.of(!0)}):null}function Ds(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let t=Os(s.state,e);t?s.dispatch(t):s.update([])}},10)}si.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),Ds(s)},si.blur=s=>{s.observer.clearSelectionRange(),Ds(s)},si.compositionstart=si.compositionupdate=s=>{s.observer.editContext||(s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0))},si.compositionend=s=>{s.observer.editContext||(s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,Me.chrome&&Me.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50))},si.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()},yi.beforeinput=(s,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&s.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(r&&a.length){let c=a[0],d=s.posAtDOM(c.startContainer,c.startOffset),x=s.posAtDOM(c.endContainer,c.endOffset);return wn(s,{from:d,to:x,insert:s.state.toText(r)},null),!0}}let n;if(Me.chrome&&Me.android&&(n=F.find(r=>r.inputType==e.inputType))&&(s.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>r+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return Me.ios&&e.inputType=="deleteContentForward"&&s.observer.flushSoon(),Me.safari&&e.inputType=="insertText"&&s.inputState.composing>=0&&setTimeout(()=>si.compositionend(s,e),20),!1};const Ts=new Set;function Cr(s){Ts.has(s)||(Ts.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const Ps=["pre-wrap","normal","pre-line","break-spaces"];let en=!1;function Gn(){en=!1}class Es{constructor(e){this.lineWrapping=e,this.doc=v.EY.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ps.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let n=e[i];n<0?i++:this.heightSamples[Math.floor(n*10)]||(t=!0,this.heightSamples[Math.floor(n*10)]=!0)}return t}refresh(e,t,i,n,r,a){let c=Ps.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=r,d){this.heightSamples={};for(let x=0;x<a.length;x++){let y=a[x];y<0?x++:this.heightSamples[Math.floor(y*10)]=!0}}return d}}class Ls{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Wi{constructor(e,t,i,n,r){this.from=e,this.length=t,this.top=i,this.height=n,this._content=r}get type(){return typeof this._content=="number"?yt.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 $t?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Wi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var ri=function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s}(ri||(ri={}));const xn=.001;class Li{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>xn&&(en=!0),this.height=e)}replace(e,t,i){return Li.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let r=this,a=i.doc;for(let c=n.length-1;c>=0;c--){let{fromA:d,toA:x,fromB:y,toB:E}=n[c],N=r.lineAt(d,ri.ByPosNoHeight,i.setDoc(t),0,0),X=N.to>=x?N:r.lineAt(x,ri.ByPosNoHeight,i,0,0);for(E+=X.to-x,x=X.to;c>0&&N.from<=n[c-1].toA;)d=n[c-1].fromA,y=n[c-1].fromB,c--,d<N.from&&(N=r.lineAt(d,ri.ByPosNoHeight,i,0,0));y+=N.from-d,d=N.from;let se=Yn.build(i.setDoc(a),e,y,E);r=kn(r,r.replace(d,x,se))}return r.updateHeight(i,0)}static empty(){return new Ii(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,n=0,r=0;for(;;)if(t==i)if(n>r*2){let c=e[t-1];c.break?e.splice(--t,1,c.left,null,c.right):e.splice(--t,1,c.left,c.right),i+=1+c.break,n-=c.size}else if(r>n*2){let c=e[i];c.break?e.splice(i,1,c.left,null,c.right):e.splice(i,1,c.left,c.right),i+=2+c.break,r-=c.size}else break;else if(n<r){let c=e[t++];c&&(n+=c.size)}else{let c=e[--i];c&&(r+=c.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new Ar(Li.of(e.slice(0,t)),a,Li.of(e.slice(i)))}}function kn(s,e){return s==e?s:(s.constructor!=e.constructor&&(en=!0),e)}Li.prototype.size=1;class Bs extends Li{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,n){return new Wi(n,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,n,r){return this.blockAt(0,i,n,r)}forEachLine(e,t,i,n,r,a){e<=r+this.length&&t>=r&&a(this.blockAt(0,i,n,r))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ii extends Bs{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,n){return new Wi(n,this.length,i,this.height,this.breaks)}replace(e,t,i){let n=i[0];return i.length==1&&(n instanceof Ii||n instanceof Ti&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ti?n=new Ii(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Li.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(n.heights[n.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ti extends Li{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,r=n-i+1,a,c=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*r);a=d/r,this.length>r+1&&(c=(this.height-d)/(this.length-r-1))}else a=this.height/r;return{firstLine:i,lastLine:n,perLine:a,perChar:c}}blockAt(e,t,i,n){let{firstLine:r,lastLine:a,perLine:c,perChar:d}=this.heightMetrics(t,n);if(t.lineWrapping){let x=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),y=t.doc.lineAt(x),E=c+y.length*d,N=Math.max(i,e-E/2);return new Wi(y.from,y.length,N,E,0)}else{let x=Math.max(0,Math.min(a-r,Math.floor((e-i)/c))),{from:y,length:E}=t.doc.line(r+x);return new Wi(y,E,i+c*x,c,0)}}lineAt(e,t,i,n,r){if(t==ri.ByHeight)return this.blockAt(e,i,n,r);if(t==ri.ByPosNoHeight){let{from:X,to:se}=i.doc.lineAt(e);return new Wi(X,se-X,0,0,0)}let{firstLine:a,perLine:c,perChar:d}=this.heightMetrics(i,r),x=i.doc.lineAt(e),y=c+x.length*d,E=x.number-a,N=n+c*E+d*(x.from-r-E);return new Wi(x.from,x.length,Math.max(n,Math.min(N,n+this.height-y)),y,0)}forEachLine(e,t,i,n,r,a){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:c,perLine:d,perChar:x}=this.heightMetrics(i,r);for(let y=e,E=n;y<=t;){let N=i.doc.lineAt(y);if(y==e){let se=N.number-c;E+=d*se+x*(e-r-se)}let X=d+x*N.length;a(new Wi(N.from,N.length,E,X,0)),E+=X,y=N.to+1}}replace(e,t,i){let n=this.length-t;if(n>0){let r=i[i.length-1];r instanceof Ti?i[i.length-1]=new Ti(r.length+n):i.push(null,new Ti(n-1))}if(e>0){let r=i[0];r instanceof Ti?i[0]=new Ti(e+r.length):i.unshift(new Ti(e-1),null)}return Li.of(i)}decomposeLeft(e,t){t.push(new Ti(e-1),null)}decomposeRight(e,t){t.push(null,new Ti(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let r=t+this.length;if(n&&n.from<=t+this.length&&n.more){let a=[],c=Math.max(t,n.from),d=-1;for(n.from>t&&a.push(new Ti(n.from-t-1).updateHeight(e,t));c<=r&&n.more;){let y=e.doc.lineAt(c).length;a.length&&a.push(null);let E=n.heights[n.index++];d==-1?d=E:Math.abs(E-d)>=xn&&(d=-2);let N=new Ii(y,E);N.outdated=!1,a.push(N),c+=y+1}c<=r&&a.push(null,new Ti(r-c).updateHeight(e,c));let x=Li.of(a);return(d<0||Math.abs(x.height-this.height)>=xn||Math.abs(d-this.heightMetrics(e,t).perLine)>=xn)&&(en=!0),kn(this,x)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ar extends Li{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,n){let r=i+this.left.height;return e<r?this.left.blockAt(e,t,i,n):this.right.blockAt(e,t,r,n+this.left.length+this.break)}lineAt(e,t,i,n,r){let a=n+this.left.height,c=r+this.left.length+this.break,d=t==ri.ByHeight?e<a:e<c,x=d?this.left.lineAt(e,t,i,n,r):this.right.lineAt(e,t,i,a,c);if(this.break||(d?x.to<c:x.from>c))return x;let y=t==ri.ByPosNoHeight?ri.ByPosNoHeight:ri.ByPos;return d?x.join(this.right.lineAt(c,y,i,a,c)):this.left.lineAt(c,y,i,n,r).join(x)}forEachLine(e,t,i,n,r,a){let c=n+this.left.height,d=r+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,n,r,a),t>=d&&this.right.forEachLine(e,t,i,c,d,a);else{let x=this.lineAt(d,ri.ByPos,i,n,r);e<x.from&&this.left.forEachLine(e,x.from-1,i,n,r,a),x.to>=e&&x.from<=t&&a(x),t>x.to&&this.right.forEachLine(x.to+1,t,i,c,d,a)}}replace(e,t,i){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let r=[];e>0&&this.decomposeLeft(e,r);let a=r.length;for(let c of i)r.push(c);if(e>0&&Rs(r,a-1),t<this.length){let c=r.length;this.decomposeRight(t,r),Rs(r,c)}return Li.of(r)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Li.of(this.break?[e,null,t]:[e,t]):(this.left=kn(this.left,e),this.right=kn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,n){let{left:r,right:a}=this,c=t+r.length+this.break,d=null;return n&&n.from<=t+r.length&&n.more?d=r=r.updateHeight(e,t,i,n):r.updateHeight(e,t,i),n&&n.from<=c+a.length&&n.more?d=a=a.updateHeight(e,c,i,n):a.updateHeight(e,c,i),d?this.balanced(r,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Rs(s,e){let t,i;s[e]==null&&(t=s[e-1])instanceof Ti&&(i=s[e+1])instanceof Ti&&s.splice(e-1,3,new Ti(t.length+1+i.length))}const Mr=5;class Yn{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ii?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ii(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new Bs(a,n,i)):(a||r||n>=Mr)&&this.addLineDeco(n,r,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ii(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new Ti(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ii)return e;let t=new Ii(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ii)&&!this.isCovered?this.nodes.push(new Ii(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let n of this.nodes)n instanceof Ii&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(e,t,i,n){let r=new Yn(i,e);return v.om.spans(t,i,n,r,0),r.finish(i)}}function Or(s,e,t){let i=new Dr;return v.om.compare(s,e,t,i,0),i.changes}class Dr{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,n){(e<t||i&&i.heightRelevant||n&&n.heightRelevant)&&_(e,t,this.changes,5)}}function Tr(s,e){let t=s.getBoundingClientRect(),i=s.ownerDocument,n=i.defaultView||window,r=Math.max(0,t.left),a=Math.min(n.innerWidth,t.right),c=Math.max(0,t.top),d=Math.min(n.innerHeight,t.bottom);for(let x=s.parentNode;x&&x!=i.body;)if(x.nodeType==1){let y=x,E=window.getComputedStyle(y);if((y.scrollHeight>y.clientHeight||y.scrollWidth>y.clientWidth)&&E.overflow!="visible"){let N=y.getBoundingClientRect();r=Math.max(r,N.left),a=Math.min(a,N.right),c=Math.max(c,N.top),d=Math.min(x==s.parentNode?n.innerHeight:d,N.bottom)}x=E.position=="absolute"||E.position=="fixed"?y.offsetParent:y.parentNode}else if(x.nodeType==11)x=x.host;else break;return{left:r-t.left,right:Math.max(r,a)-t.left,top:c-(t.top+e),bottom:Math.max(c,d)-(t.top+e)}}function Pr(s){let e=s.getBoundingClientRect(),t=s.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Er(s,e){let t=s.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Jn{constructor(e,t,i,n){this.from=e,this.to=t,this.size=i,this.displaySize=n}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],r=t[i];if(n.from!=r.from||n.to!=r.to||n.size!=r.size)return!1}return!0}draw(e,t){return Pe.replace({widget:new Lr(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Lr extends Nt{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Is{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Fs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ke.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(ae).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Es(t),this.stateDeco=e.facet(oe).filter(i=>typeof i!="function"),this.heightMap=Li.empty().applyChanges(this.stateDeco,v.EY.empty,this.heightOracle.setDoc(e.doc),[new wi(0,0,0,e.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=Pe.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:r,to:a})=>n>=r&&n<=a)){let{from:r,to:a}=this.lineBlockAt(n);e.push(new Sn(r,a))}}return this.viewports=e.sort((i,n)=>i.from-n.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Fs:new Xn(this.heightOracle,this.heightMap,this.viewports),e.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,e=>{this.viewportLines.push(cn(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(oe).filter(y=>typeof y!="function");let n=e.changedRanges,r=wi.extendWithRanges(n,Or(i,this.stateDeco,e?e.changes:v.VR.empty(this.state.doc.length))),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Gn(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=a||en)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let x=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(x||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(qt)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?ke.RTL:ke.LTR;let a=this.heightOracle.mustRefreshForWrapping(r),c=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let x=0,y=0;if(c.width&&c.height){let{scaleX:Ge,scaleY:ot}=ei(t,c);(Ge>.005&&Math.abs(this.scaleX-Ge)>.005||ot>.005&&Math.abs(this.scaleY-ot)>.005)&&(this.scaleX=Ge,this.scaleY=ot,x|=16,a=d=!0)}let E=(parseInt(i.paddingTop)||0)*this.scaleY,N=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=E||this.paddingBottom!=N)&&(this.paddingTop=E,this.paddingBottom=N,x|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,x|=16);let X=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=X&&(this.scrollAnchorHeight=-1,this.scrollTop=X),this.scrolledToBottom=mi(e.scrollDOM);let se=(this.printing?Er:Tr)(t,this.paddingTop),de=se.top-this.pixelViewport.top,ge=se.bottom-this.pixelViewport.bottom;this.pixelViewport=se;let me=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(me!=this.inView&&(this.inView=me,me&&(d=!0)),!this.inView&&!this.scrollTarget&&!Pr(e.dom))return 0;let $e=c.width;if((this.contentDOMWidth!=$e||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,x|=16),d){let Ge=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(Ge)&&(a=!0),a||n.lineWrapping&&Math.abs($e-this.contentDOMWidth)>n.charWidth){let{lineHeight:ot,charWidth:lt,textHeight:di}=e.docView.measureTextSize();a=ot>0&&n.refresh(r,ot,lt,di,$e/lt,Ge),a&&(e.docView.minWidth=0,x|=16)}de>0&&ge>0?y=Math.max(de,ge):de<0&&ge<0&&(y=Math.min(de,ge)),Gn();for(let ot of this.viewports){let lt=ot.from==this.viewport.from?Ge:e.docView.measureVisibleLineHeights(ot);this.heightMap=(a?Li.empty().applyChanges(this.stateDeco,v.EY.empty,this.heightOracle,[new wi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,a,new Ls(ot.from,lt))}en&&(x|=2)}let et=!this.viewportIsAppropriate(this.viewport,y)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return et&&(x&2&&(x|=this.updateScaler()),this.viewport=this.getViewport(y,this.scrollTarget),x|=this.updateForViewport()),(x&2||et)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),x|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),x}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,r=this.heightOracle,{visibleTop:a,visibleBottom:c}=this,d=new Sn(n.lineAt(a-i*1e3,ri.ByHeight,r,0,0).from,n.lineAt(c+(1-i)*1e3,ri.ByHeight,r,0,0).to);if(t){let{head:x}=t.range;if(x<d.from||x>d.to){let y=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),E=n.lineAt(x,ri.ByPos,r,0,0),N;t.y=="center"?N=(E.top+E.bottom)/2-y/2:t.y=="start"||t.y=="nearest"&&x<d.from?N=E.top:N=E.bottom-y,d=new Sn(n.lineAt(N-1e3/2,ri.ByHeight,r,0,0).from,n.lineAt(N+y+1e3/2,ri.ByHeight,r,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new Sn(this.heightMap.lineAt(i,ri.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,ri.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,ri.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,ri.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:c}=this;return(e==0||n<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||r>=c+Math.max(10,Math.min(i,250)))&&n>a-2*1e3&&r<c+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let n of e)t.touchesRange(n.from,n.to)||i.push(new Jn(t.mapPos(n.from),t.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,r=n>>1,a=n<<1;if(this.defaultTextDirection!=ke.LTR&&!i)return[];let c=[],d=(y,E,N,X)=>{if(E-y<r)return;let se=this.state.selection.main,de=[se.from];se.empty||de.push(se.to);for(let me of de)if(me>y&&me<E){d(y,me-10,N,X),d(me+10,E,N,X);return}let ge=Rr(e,me=>me.from>=N.from&&me.to<=N.to&&Math.abs(me.from-y)<r&&Math.abs(me.to-E)<r&&!de.some($e=>me.from<$e&&me.to>$e));if(!ge){if(E<N.to&&t&&i&&t.visibleRanges.some(et=>et.from<=E&&et.to>=E)){let et=t.moveToLineBoundary(v.OF.cursor(E),!1,!0).head;et>y&&(E=et)}
vendor: 5,840 bytes, line 26
26let me=this.gapSize(N,y,E,X),$e=i||me<2e6?me:2e6;ge=new Jn(y,E,me,$e)}c.push(ge)},x=y=>{if(y.length<a||y.type!=yt.Text)return;let E=Br(y.from,y.to,this.stateDeco);if(E.total<a)return;let N=this.scrollTarget?this.scrollTarget.range.head:null,X,se;if(i){let de=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,ge,me;if(N!=null){let $e=An(E,N),et=((this.visibleBottom-this.visibleTop)/2+de)/y.height;ge=$e-et,me=$e+et}else ge=(this.visibleTop-y.top-de)/y.height,me=(this.visibleBottom-y.top+de)/y.height;X=Cn(E,ge),se=Cn(E,me)}else{let de=E.total*this.heightOracle.charWidth,ge=n*this.heightOracle.charWidth,me=0;if(de>2e6)for(let lt of e)lt.from>=y.from&&lt.from<y.to&&lt.size!=lt.displaySize&&lt.from*this.heightOracle.charWidth+me<this.pixelViewport.left&&(me=lt.size-lt.displaySize);let $e=this.pixelViewport.left+me,et=this.pixelViewport.right+me,Ge,ot;if(N!=null){let lt=An(E,N),di=((et-$e)/2+ge)/de;Ge=lt-di,ot=lt+di}else Ge=($e-ge)/de,ot=(et+ge)/de;X=Cn(E,Ge),se=Cn(E,ot)}X>y.from&&d(y.from,X,y,E),se<y.to&&d(se,y.to,y,E)};for(let y of this.viewportLines)Array.isArray(y.type)?y.type.forEach(x):x(y);return c}gapSize(e,t,i,n){let r=An(n,i)-An(n,t);return this.heightOracle.lineWrapping?e.height*r:n.total*this.heightOracle.charWidth*r}updateLineGaps(e){Jn.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Pe.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];v.om.spans(t,this.viewport.from,this.viewport.to,{span(r,a){i.push({from:r,to:a})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let r=0;r<i.length&&!(n&8);r++){let a=this.visibleRanges[r],c=i[r];(a.from!=c.from||a.to!=c.to)&&(n|=4,e&&e.mapPos(a.from,-1)==c.from&&e.mapPos(a.to,1)==c.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||cn(this.heightMap.lineAt(e,ri.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||cn(this.heightMap.lineAt(this.scaler.fromDOM(e),ri.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return cn(this.heightMap.blockAt(this.scaler.fromDOM(e),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 Sn{constructor(e,t){this.from=e,this.to=t}}function Br(s,e,t){let i=[],n=s,r=0;return v.om.spans(t,s,e,{span(){},point(a,c){a>n&&(i.push({from:n,to:a}),r+=a-n),n=c}},20),n<e&&(i.push({from:n,to:e}),r+=e-n),{total:r,ranges:i}}function Cn({total:s,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(s*t);for(let n=0;;n++){let{from:r,to:a}=e[n],c=a-r;if(i<=c)return r+i;i-=c}}function An(s,e){let t=0;for(let{from:i,to:n}of s.ranges){if(e<=n){t+=e-i;break}t+=n-i}return t/s.total}function Rr(s,e){for(let t of s)if(e(t))return t}const Fs={toDOM(s){return s},fromDOM(s){return s},scale:1,eq(s){return s==this}};class Xn{constructor(e,t,i){let n=0,r=0,a=0;this.viewports=i.map(({from:c,to:d})=>{let x=t.lineAt(c,ri.ByPos,e,0,0).top,y=t.lineAt(d,ri.ByPos,e,0,0).bottom;return n+=y-x,{from:c,to:d,top:x,bottom:y,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let c of this.viewports)c.domTop=a+(c.top-r)*this.scale,a=c.domBottom=c.domTop+(c.bottom-c.top),r=c.bottom}toDOM(e){for(let t=0,i=0,n=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return n+(e-i)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);i=r.bottom,n=r.domBottom}}fromDOM(e){for(let t=0,i=0,n=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return i+(e-n)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);i=r.bottom,n=r.domBottom}}eq(e){return e instanceof Xn?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function cn(s,e){if(e.scale==1)return s;let t=e.toDOM(s.top),i=e.toDOM(s.bottom);return new Wi(s.from,s.length,t,i-t,Array.isArray(s._content)?s._content.map(n=>cn(n,e)):s._content)}const Mn=v.sj.define({combine:s=>s.join(" ")}),Zn=v.sj.define({combine:s=>s.indexOf(!0)>-1}),Qn=ie.G.newName(),Ns=ie.G.newName(),_s=ie.G.newName(),Hs={"&light":"."+Ns,"&dark":"."+_s};function es(s,e,t){return new ie.G(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return s;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):s+" "+i}})}const Ir=es("."+Qn,{"&":{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"}}
vendor: 10,141 bytes, line 26
26,"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-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":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Hs),Fr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ts=Me.ie&&Me.ie_version<=11;class Nr{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ai,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=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Me.ie&&Me.ie_version<=11||Me.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(Me.chrome&&Me.chrome_version<126)&&(this.editContext=new Hr(e),e.state.facet(p)&&(e.contentDOM.editContext=this.editContext.editContext)),ts&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(p)?i.root.activeElement!=this.dom:!Ie(this.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Me.ie&&Me.ie_version<=11||Me.android&&Me.chrome)&&!i.state.selection.main.empty&&n.focusNode&&zt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Je(e.root);if(!t)return!1;let i=Me.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_r(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let n=Ie(this.dom,i);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&oi(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Fr),ts&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ts&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let n=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Vt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let r of e){let a=this.readMutation(r);a&&(a.typeOver&&(n=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Ie(this.dom,this.selectionRange);
26if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new yn(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=bn(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Vs(t,e.previousSibling||e.target.previousSibling,-1),n=Vs(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(p)!=e.state.facet(p)&&(e.view.contentDOM.editContext=e.state.facet(p)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Vs(s,e,t){for(;e;){let i=Ue.get(e);if(i&&i.parent==s)return i;let n=e.parentNode;e=n!=s.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function Ws(s,e){let t=e.startContainer,i=e.startOffset,n=e.endContainer,r=e.endOffset,a=s.docView.domAtPos(s.state.selection.main.anchor);return zt(a.node,a.offset,n,r)&&([t,i,n,r]=[n,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}}function _r(s,e){if(e.getComposedRanges){let n=e.getComposedRanges(s.root)[0];if(n)return Ws(s,n)}let t=null;function i(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return s.contentDOM.addEventListener("beforeinput",i,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",i,!0),t?Ws(s,t):null}class Hr{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let n=e.state.selection.main,{anchor:r,head:a}=n,c=this.toEditorPos(i.updateRangeStart),d=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:c,drifted:!1});let x={from:c,to:d,insert:v.EY.of(i.text.split(`
27`))};if(x.from==this.from&&r<this.from?x.from=r:x.to==this.to&&r>this.to&&(x.to=r),x.from==x.to&&!x.insert.length){let y=v.OF.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));y.main.eq(n)||e.dispatch({selection:y,userEvent:"select"});return}if((Me.mac||Me.android)&&x.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(x={from:c,to:d,insert:v.EY.of([i.text.replace("."," ")])}),this.pendingContextChange=x,!e.state.readOnly){let y=this.to-this.from+(x.to-x.from+x.insert.length);wn(e,x,v.OF.single(this.toEditorPos(i.selectionStart,y),this.toEditorPos(i.selectionEnd,y)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))}
vendor: 4,407 bytes, line 27
27,this.handlers.characterboundsupdate=i=>{let n=[],r=null;for(let a=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);a<c;a++){let d=e.coordsForChar(a);r=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||r||new DOMRect,n.push(r)}t.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=i=>{let n=[];for(let r of i.getTextFormats()){let a=r.underlineStyle,c=r.underlineThickness;if(a!="None"&&c!="None"){let d=this.toEditorPos(r.rangeStart),x=this.toEditorPos(r.rangeEnd);if(d<x){let y=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${c=="Thin"?1:2}px`;n.push(Pe.mark({attributes:{style:y}}).range(d,x))}}}e.dispatch({effects:zi.of(Pe.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let n=Je(i.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((r,a,c,d,x)=>{if(i)return;let y=x.length-(a-r);if(n&&a>=n.to)if(n.from==r&&n.to==a&&n.insert.eq(x)){n=this.pendingContextChange=null,t+=y,this.to+=y;return}else n=null,this.revertPending(e.state);if(r+=t,a+=t,a<=this.from)this.from+=y,this.to+=y;else if(r<this.to){if(r<this.from||a>this.to||this.to-this.from+x.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(a),x.toString()),this.to+=y}t+=y}),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class At{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(e={}){var t;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="
27cm-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),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(n=>n.forEach(r=>i(r,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||wt(e.parent)||document,this.viewState=new Is(e.state||v.$t.create(e)),e.scrollTo&&e.scrollTo.is(Ni)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(T).map(n=>new K(n));for(let n of this.plugins)n.update(this);this.observer=new Nr(this),this.inputState=new Un(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Gt(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof v.ZX?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,n,r=this.state;for(let N of e){if(N.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=N.state}if(this.destroyed){this.viewState.state=r;return}let a=this.hasFocus,c=0,d=null;e.some(N=>N.annotation(Ms))?(this.inputState.notifiedFocused=a,c=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Os(r,a),d||(c=1));let x=this.observer.delayedAndroidKey,y=null;if(x?(this.observer.clearDelayedAndroidKey(),y=this.observer.readChange(),(y&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(y=null)):this.observer.clear(),r.facet(v.$t.phrases)!=this.state.facet(v.$t.phrases))return this.setState(r);n=vi.create(this,r,e),n.flags|=c;let E=this.viewState.scrollTarget;try{this.updateState=2;for(let N of e){if(E&&(E=E.map(N.changes)),N.scrollIntoView){let{main:X}=N.state.selection;E=new Ri(X.empty?X:v.OF.cursor(X.head,X.head>X.anchor?-1:1))}for(let X of N.effects)X.is(Ni)&&(E=X.value.clip(this.state))}this.viewState.update(n,E),this.bidiCache=On.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(ui)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(N=>N.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(Mn)!=n.state.facet(Mn)&&(this.viewState.mustMeasureContent=!0),(t||i||E||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let N of this.state.facet(ye))try{N(n)}catch(X){A(this.state,X,"update listener")}(d||y)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),y&&!bn(this,y)&&x.force&&Vt(this.contentDOM,x.key,x.keyCode)})}setState(e){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=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Is(e),this.plugins=e.facet(T).map(i=>new K(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Gt(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(T),i=e.state.facet(T);if(t!=i){let n=[];for(let r of i){let a=t.indexOf(r);if(a<0)n.push(new K(r));else{let c=this.plugins[a];c.mustUpdate=e,n.push(c)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){A(this.state,i,"doc view update listener")}}}measure(e=!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,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:a}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(a<0)if(mi(i))r=-1,a=this.viewState.heightMap.height;else{let X=this.viewState.scrollAnchorAt(n);r=X.from,a=X.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;
vendor: 7,922 bytes, line 27
27if(c>5){Oe.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let x=[];d&4||([this.measureRequests,x]=[x,this.measureRequests]);let y=x.map(X=>{try{return X.read(this)}catch(se){return A(this.state,se),zs}}),E=vi.create(this,this.state,[]),N=!1;E.flags|=d,t?t.flags|=d:t=E,this.updateState=2,E.empty||(this.updatePlugins(E),this.inputState.update(E),this.updateAttrs(),N=this.docView.update(E),N&&this.docViewUpdate());for(let X=0;X<x.length;X++)if(y[X]!=zs)try{let se=x[X];se.write&&se.write(y[X],this)}catch(se){A(this.state,se)}if(N&&this.docView.updateSelection(!0),!E.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let se=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-a;if(se>1||se<-1){n=n+se,i.scrollTop=n/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let c of this.state.facet(ye))c(t)}get themeClasses(){return Qn+" "+(this.state.facet(Zn)?_s:Ns)+" "+this.state.facet(Mn)}updateAttrs(){let e=js(this,te,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(p)?"true":"false",class:"cm-content",style:`${Me.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),js(this,ae,t);let i=this.observer.ignore(()=>{let n=ut(this.contentDOM,this.contentAttrs,t),r=ut(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let n of i.effects)if(n.is(At.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(ui);let e=this.state.facet(At.cspNonce);ie.G.mount(this.root,this.styleModules.concat(Ir).reverse(),e?{nonce:e}: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(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==e)||null),t&&t.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(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return an(this,e,Vn(this,e,t,i))}moveByGroup(e,t){return an(this,e,Vn(this,e,t,i=>ms(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return v.OF.cursor(r.side(t,n)+e.from,r.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return Xi(this,e,t,i)}moveVertically(e,t,i){return an(this,e,Wn(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Ei(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),a=r[ce.find(r,e-n.from,-1,t)];return at(i,a.dir==ke.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Oi)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Vr)return l(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||ee(r.isolates,i=ht(this,e))))return r.order;i||(i=ht(this,e));let n=o(e.text,t,i);return this.bidiCache.push(new On(e.from,e.to,t,i,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Me.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{st(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.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(e,t={}){return Ni.of(new Ri(typeof e=="number"?v.OF.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Ni.of(new Ri(v.OF.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return L.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return L.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ie.G.newName(),n=[Mn.of(i),ui.of(es(`.${i}`,e))];return t&&t.dark&&n.push(Zn.of(!0)),n}static baseTheme(e){return v.Nb.lowest(ui.of(es("."+Qn,e,Hs)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&Ue.get(i)||Ue.get(e);return((t=n?.rootView)===null||t===void 0?void 0:t.view)||null}}At.styleModule=ui,At.inputHandler=Ce,At.clipboardInputFilter=Fe,At.clipboardOutputFilter=Tt,At.scrollHandler=Fi,At.focusChangeEffect=Ve,At.perLineTextDirection=Oi,At.exceptionSink=le,At.updateListener=ye,At.editable=p,At.mouseSelectionStyle=j,At.dragMovesSelection=R,At.clickAddsSelectionRange=C,At.decorations=oe,At.outerDecorations=Se,At.atomicRanges=xe,At.bidiIsolatedRanges=He,At.scrollMargins=Ot,At.darkTheme=Zn,At.cspNonce=v.sj.define({combine:s=>s.length?s[0]:""}),At.contentAttributes=ae,At.editorAttributes=te,At.lineWrapping=At.contentAttributes.of({class:"cm-lineWrapping"}),At.announce=v.Pe.define();const Vr=4096,zs={};class On{constructor(e,t,i,n,r,a){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=r,this.order=a}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],n=e.length?e[e.length-1].dir:ke.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let a=e[r];a.dir==n&&!t.touchesRange(a.from,a.to)&&i.push(new On(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function js(s,e,t){for(let i=s.state.facet(e),n=i.length-1;n>=0;n--){let r=i[n],a=typeof r=="function"?r(s):r;a&&tt(a,t)}return t}
27const Wr=Me.mac?"mac":Me.windows?"win":Me.linux?"linux":"key";function zr(s,e){const t=s.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let n,r,a,c;for(let d=0;d<t.length-1;++d){const x=t[d];if(/^(cmd|meta|m)$/i.test(x))c=!0;else if(/^a(lt)?$/i.test(x))n=!0;else if(/^(c|ctrl|control)$/i.test(x))r=!0;else if(/^s(hift)?$/i.test(x))a=!0;else if(/^mod$/i.test(x))e=="mac"?c=!0:r=!0;else throw new Error("Unrecognized modifier name: "+x)}return n&&(i="Alt-"+i),r&&(i="Ctrl-"+i),c&&(i="Meta-"+i),a&&(i="Shift-"+i),i}function Dn(s,e,t){return e.altKey&&(s="Alt-"+s),e.ctrlKey&&(s="Ctrl-"+s),e.metaKey&&(s="Meta-"+s),t!==!1&&e.shiftKey&&(s="Shift-"+s),s}const jr=v.Nb.default(At.domEventHandlers({keydown(s,e){return qs(Us(e.state),s,e,"editor")}})),$s=v.sj.define({enables:jr}),Ks=new WeakMap;function Us(s){let e=s.facet($s),t=Ks.get(e);return t||Ks.set(e,t=Ur(e.reduce((i,n)=>i.concat(n),[]))),t}function $r(s,e,t){return qs(Us(s.state),e,s,t)}let qi=null;const Kr=4e3;function Ur(s,e=Wr){let t=Object.create(null),i=Object.create(null),n=(a,c)=>{let d=i[a];if(d==null)i[a]=c;else if(d!=c)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},r=(a,c,d,x,y)=>{var E,N;let X=t[a]||(t[a]=Object.create(null)),se=c.split(/ (?!$)/).map(me=>zr(me,e));for(let me=1;me<se.length;me++){let $e=se.slice(0,me).join(" ");n($e,!0),X[$e]||(X[$e]={preventDefault:!0,stopPropagation:!1,run:[et=>{let Ge=qi={view:et,prefix:$e,scope:a};return setTimeout(()=>{qi==Ge&&(qi=null)},Kr),!0}]})}let de=se.join(" ");n(de,!1);let ge=X[de]||(X[de]={preventDefault:!1,stopPropagation:!1,run:((N=(E=X._any)===null||E===void 0?void 0:E.run)===null||N===void 0?void 0:N.slice())||[]});d&&ge.run.push(d),x&&(ge.preventDefault=!0),y&&(ge.stopPropagation=!0)};for(let a of s){let c=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let x of c){let y=t[x]||(t[x]=Object.create(null));y._any||(y._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:E}=a;for(let N in y)y[N].run.push(X=>E(X,is))}let d=a[e]||a.key;if(d)for(let x of c)r(x,d,a.run,a.preventDefault,a.stopPropagation),a.shift&&r(x,"Shift-"+d,a.shift,a.preventDefault,a.stopPropagation)}return t}let is=null;function qs(s,e,t,i){is=e;let n=(0,z.xT)(e),r=(0,v.vS)(n,0),a=(0,v.Fh)(r)==n.length&&n!=" ",c="",d=!1,x=!1,y=!1;qi&&qi.view==t&&qi.scope==i&&(c=qi.prefix+" ",U.indexOf(e.keyCode)<0&&(x=!0,qi=null));let E=new Set,N=ge=>{if(ge){for(let me of ge.run)if(!E.has(me)&&(E.add(me),me(t)))return ge.stopPropagation&&(y=!0),!0;ge.preventDefault&&(ge.stopPropagation&&(y=!0),x=!0)}return!1},X=s[i],se,de;return X&&(N(X[c+Dn(n,e,!a)])?d=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Me.windows&&e.ctrlKey&&e.altKey)&&(se=z.E3[e.keyCode])&&se!=n?(N(X[c+Dn(se,e,!0)])||e.shiftKey&&(de=z.BN[e.keyCode])!=n&&de!=se&&N(X[c+Dn(de,e,!1)]))&&(d=!0):a&&e.shiftKey&&N(X[c+Dn(n,e,!0)])&&(d=!0),!d&&N(X._any)&&(d=!0)),x&&(d=!0),d&&y&&e.stopPropagation(),is=null,d}class fn{constructor(e,t,i,n,r){this.className=e,this.left=t,this.top=i,this.width=n,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let n=e.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=Gs(e);return[new fn(t,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return qr(e,t,i)}}function Gs(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==ke.LTR?e.left:e.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:e.top-s.scrollDOM.scrollTop*s.scaleY}}function Ys(s,e,t,i){let n=s.coordsAtPos(e,t*2);if(!n)return i;let r=s.dom.getBoundingClientRect(),a=(n.top+n.bottom)/2,c=s.posAtCoords({x:r.left+1,y:a}),d=s.posAtCoords({x:r.right-1,y:a});return c==null||d==null?i:{from:Math.max(i.from,Math.min(c,d)),to:Math.min(i.to,Math.max(c,d))}}function qr(s,e,t){if(t.to<=s.viewport.from||t.from>=s.viewport.to)return[];let i=Math.max(t.from,s.viewport.from),n=Math.min(t.to,s.viewport.to),r=s.textDirection==ke.LTR,a=s.contentDOM,c=a.getBoundingClientRect(),d=Gs(s),x=a.querySelector(".cm-line"),y=x&&window.getComputedStyle(x),E=c.left+(y?parseInt(y.paddingLeft)+Math.min(0,parseInt(y.textIndent)):0),N=c.right-(y?parseInt(y.paddingRight):0),X=Ji(s,i),se=Ji(s,n),de=X.type==yt.Text?X:null,ge=se.type==yt.Text?se:null;if(de&&(s.lineWrapping||X.widgetLineBreaks)&&(de=Ys(s,i,1,de)),ge&&(s.lineWrapping||se.widgetLineBreaks)&&(ge=Ys(s,n,-1,ge)),de&&ge&&de.from==ge.from&&de.to==ge.to)return $e(et(t.from,t.to,de));{let ot=de?et(t.from,null,de):Ge(X,!1),lt=ge?et(null,t.to,ge):Ge(se,!0),di=[];return(de||X).to<(ge||se).from-(de&&ge?1:0)||X.widgetLineBreaks>1&&ot.bottom+s.defaultLineHeight/2<lt.top?di.push(me(E,ot.bottom,N,lt.top)):ot.bottom<lt.top&&s.elementAtHeight((ot.bottom+lt.top)/2).type==yt.Text&&(ot.bottom=lt.top=(ot.bottom+lt.top)/2),$e(ot).concat(di).c
27oncat($e(lt))}function me(ot,lt,di,Pi){return new fn(e,ot-d.left,lt-d.top,di-ot,Pi-lt)}function $e({top:ot,bottom:lt,horizontal:di}){let Pi=[];for(let Gi=0;Gi<di.length;Gi+=2)Pi.push(me(di[Gi],ot,di[Gi+1],lt));return Pi}function et(ot,lt,di){let Pi=1e9,Gi=-1e9,Nn=[];function gr(tn,Yi,ln,nn,gn){let $i=s.coordsAtPos(tn,tn==di.to?-2:2),Ki=s.coordsAtPos(ln,ln==di.from?2:-2);!$i||!Ki||(Pi=Math.min($i.top,Ki.top,Pi),Gi=Math.max($i.bottom,Ki.bottom,Gi),gn==ke.LTR?Nn.push(r&&Yi?E:$i.left,r&&nn?N:Ki.right):Nn.push(!r&&nn?E:Ki.left,!r&&Yi?N:$i.right))}let _n=ot??di.from,Hn=lt??di.to;for(let tn of s.visibleRanges)if(tn.to>_n&&tn.from<Hn)for(let Yi=Math.max(tn.from,_n),ln=Math.min(tn.to,Hn);;){let nn=s.state.doc.lineAt(Yi);for(let gn of s.bidiSpans(nn)){let $i=gn.from+nn.from,Ki=gn.to+nn.from;if($i>=ln)break;Ki>Yi&&gr(Math.max($i,Yi),ot==null&&$i<=_n,Math.min(Ki,ln),lt==null&&Ki>=Hn,gn.dir)}if(Yi=nn.to+1,Yi>=ln)break}return Nn.length==0&&gr(_n,ot==null,Hn,lt==null,s.textDirection),{top:Pi,bottom:Gi,horizontal:Nn}}function Ge(ot,lt){let di=c.top+(lt?ot.top:ot.bottom);return{top:di,bottom:di,horizontal:[]}}}function Gr(s,e){return s.constructor==e.constructor&&s.eq(e)}class Yr{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Tn)!=e.state.facet(Tn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Tn);for(;t<i.length&&i[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,i)=>!Gr(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[i].constructor&&n.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(n.draw(),t);for(;t;){let n=t.nextSibling;t.remove(),t=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Tn=v.sj.define();function Js(s){return[L.define(e=>new Yr(e,s)),Tn.of(s)]}const Xs=!(Me.ios&&Me.webkit&&Me.webkit_version<534),rn=v.sj.define({combine(s){return(0,v.QR)(s,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Jr(s={}){return[rn.of(s),Xr,Zr,Qr,qt.of(!0)]}function Qo(s){return s.facet(rn)}function Zs(s){return s.startState.facet(rn)!=s.state.facet(rn)}const Xr=Js({above:!0,markers(s){let{state:e}=s,t=e.facet(rn),i=[];for(let n of e.selection.ranges){let r=n==e.selection.main;if(n.empty?!r||Xs:t.drawRangeCursor){let a=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=n.empty?n:v.OF.cursor(n.head,n.head>n.anchor?-1:1);for(let d of fn.forRange(s,a,c))i.push(d)}}return i},update(s,e){s.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Zs(s);return t&&Qs(s.state,e),s.docChanged||s.selectionSet||t},mount(s,e){Qs(e.state,s)},class:"cm-cursorLayer"});function Qs(s,e){e.style.animationDuration=s.facet(rn).cursorBlinkRate+"ms"}const Zr=Js({above:!1,markers(s){return s.state.selection.ranges.map(e=>e.empty?[]:fn.forRange(s,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(s,e){return s.docChanged||s.selectionSet||s.viewportChanged||Zs(s)},class:"cm-selectionLayer"}),ns={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Xs&&(ns[".cm-line"].caretColor=ns[".cm-content"].caretColor="transparent !important");const Qr=v.Nb.highest(At.theme(ns)),er=v.Pe.define({map(s,e){return s==null?null:e.mapPos(s)}}),un=v.sU.define({create(){return null},update(s,e){return s!=null&&(s=e.changes.mapPos(s)),e.effects.reduce((t,i)=>i.is(er)?i.value:t,s)}}),eo=L.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var e;let t=s.state.field(un);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="
27cm-dropCursor"),(s.startState.field(un)!=t||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:s}=this,e=s.state.field(un),t=e!=null&&s.coordsAtPos(e);if(!t)return null;let i=s.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+s.scrollDOM.scrollLeft*s.scaleX,top:t.top-i.top+s.scrollDOM.scrollTop*s.scaleY,height:t.bottom-t.top}}drawCursor(s){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;s?(this.cursor.style.left=s.left/e+"px",this.cursor.style.top=s.top/t+"px",this.cursor.style.height=s.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(un)!=s&&this.view.dispatch({effects:er.of(s)})}},{eventObservers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function to(){return[un,eo]}function tr(s,e,t,i,n){e.lastIndex=0;for(let r=s.iterRange(t,i),a=t,c;!r.next().done;a+=r.value.length)if(!r.lineBreak)for(;c=e.exec(r.value);)n(a+c.index,c)}function io(s,e){let t=s.visibleRanges;if(t.length==1&&t[0].from==s.viewport.from&&t[0].to==s.viewport.to)return t;let i=[];for(let{from:n,to:r}of t)n=Math.max(s.state.doc.lineAt(n).from,n-e),r=Math.min(s.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=n?i[i.length-1].to=r:i.push({from:n,to:r});return i}class ss{constructor(e){const{regexp:t,decoration:i,decorate:n,boundary:r,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(c,d,x,y)=>n(y,x,x+c[0].length,c,d);else if(typeof i=="function")this.addMatch=(c,d,x,y)=>{let E=i(c,d,x);E&&y(x,x+c[0].length,E)};else if(i)this.addMatch=(c,d,x,y)=>y(x,x+c[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=a}createDeco(e){let t=new v.vB,i=t.add.bind(t);for(let{from:n,to:r}of io(e,this.maxLength))tr(e.state.doc,this.regexp,n,r,(a,c)=>this.addMatch(c,e,a,i));return t.finish()}updateDeco(e,t){let i=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((r,a,c,d)=>{d>=e.view.viewport.from&&c<=e.view.viewport.to&&(i=Math.min(c,i),n=Math.max(d,n))}),e.viewportMoved||n-i>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),i,n):t}updateRange(e,t,i,n){for(let r of e.visibleRanges){let a=Math.max(r.from,i),c=Math.min(r.to,n);if(c>a){let d=e.state.doc.lineAt(a),x=d.to<c?e.state.doc.lineAt(c):d,y=Math.max(r.from,d.from),E=Math.min(r.to,x.to);if(this.boundary){for(;a>d.from;a--)if(this.boundary.test(d.text[a-1-d.from])){y=a;break}for(;c<x.to;c++)if(this.boundary.test(x.text[c-x.from])){E=c;break}}let N=[],X,se=(de,ge,me)=>N.push(me.range(de,ge));if(d==x)for(this.regexp.lastIndex=y-d.from;(X=this.regexp.exec(d.text))&&X.index<E-d.from;)this.addMatch(X,e,X.index+d.from,se);else tr(e.state.doc,this.regexp,y,E,(de,ge)=>this.addMatch(ge,e,de,se));t=t.update({filterFrom:y,filterTo:E,filter:(de,ge)=>de<y||ge>E,add:N})}}return t}}const rs=/x/.unicode!=null?"gu":"g",no=new RegExp(`[\0-\b
28-�\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,rs),so={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 os=null;function ro(){var s;if(os==null&&typeof document<"u"&&document.body){let e=document.body.style;os=((s=e.tabSize)!==null&&s!==void 0?s:e.MozTabSize)!=null}return os||!1}const Pn=v.sj.define({combine(s){let e=(0,v.QR)(s,{render:null,specialChars:no,addSpecialChars:null});return(e.replaceTabs=!ro())&&(e.specialChars=new RegExp("	|"+e.specialChars.source,rs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,rs)),e}});function oo(s={}){return[Pn.of(s),lo()]}let ir=null;function lo(){return ir||(ir=L.fromClass(class{constructor(s){this.view=s,this.decorations=Pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(Pn)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new ss({regexp:s.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,r=(0,v.vS)(e[0],0);if(r==9){let a=n.lineAt(i),c=t.state.tabSize,d=(0,v.y$)(a.text,c,i-a.from);return Pe.replace({widget:new fo((c-d%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=Pe.replace({widget:new co(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let e=s.state.facet(Pn);s.startState.facet(Pn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const ao="\u2022";function ho(s){return s>=32?ao:s==10?"\u2424":String.fromCharCode(9216+s)}class co extends Nt{constructor(e,t){super(),this.options=e,this.co
28de=t}eq(e){return e.code==this.code}toDOM(e){let t=ho(this.code),i=e.state.phrase("Control character")+" "+(so[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class fo extends Nt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const nr=null;function el(){return[nr,ae.of(s=>{var e;return((e=s.plugin(nr))===null||e===void 0?void 0:e.attrs)||null})]}function uo(){return mo}const po=Pe.line({class:"cm-activeLine"}),mo=L.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=-1,t=[];for(let i of s.state.selection.ranges){let n=s.lineBlockAt(i.head);n.from>e&&(t.push(po.range(n.from)),e=n.from)}return Pe.set(t)}},{decorations:s=>s.decorations});class go extends Nt{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),typeof this.content=="string"?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?it(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=at(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}}function yo(s){return L.fromClass(class{constructor(e){this.view=e,this.placeholder=s?Pe.set([Pe.widget({widget:new go(s),side:1}).range(0)]):Pe.none}get decorations(){return this.view.state.doc.length?Pe.none:this.placeholder}},{decorations:e=>e.decorations})}const ls=2e3;function bo(s,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),r=[];if(e.off>ls||t.off>ls||e.col<0||t.col<0){let a=Math.min(e.off,t.off),c=Math.max(e.off,t.off);for(let d=i;d<=n;d++){let x=s.doc.line(d);x.length<=c&&r.push(v.OF.range(x.from+a,x.to+c))}}else{let a=Math.min(e.col,t.col),c=Math.max(e.col,t.col);for(let d=i;d<=n;d++){let x=s.doc.line(d),y=(0,v.kn)(x.text,a,s.tabSize,!0);if(y<0)r.push(v.OF.cursor(x.to));else{let E=(0,v.kn)(x.text,c,s.tabSize);r.push(v.OF.range(x.from+y,x.from+E))}}}return r}function wo(s,e){let t=s.coordsAtPos(s.viewport.from);return t?Math.round(Math.abs((t.left-e)/s.defaultCharacterWidth)):-1}function sr(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1),i=s.state.doc.lineAt(t),n=t-i.from,r=n>ls?-1:n==i.length?wo(s,e.clientX):(0,v.y$)(i.text,s.state.tabSize,t-i.from);return{line:i.number,col:r,off:n}}function vo(s,e){let t=sr(s,e),i=s.state.selection;return t?{update(n){if(n.docChanged){let r=n.changes.mapPos(n.startState.doc.line(t.line).from),a=n.state.doc.lineAt(r);t={line:a.number,col:t.col,off:Math.min(t.off,a.length)},i=i.map(n.changes)}},get(n,r,a){let c=sr(s,n);if(!c)return i;let d=bo(s.state,t,c);return d.length?a?v.OF.create(d.concat(i.ranges)):v.OF.create(d):i}}:null}function xo(s){let e=s?.eventFilter||(t=>t.altKey&&t.button==0);return At.mouseSelectionStyle.of((t,i)=>e(i)?vo(t,i):null)}const ko={Alt:[18,s=>!!s.altKey],Control:[17,s=>!!s.ctrlKey],Shift:[16,s=>!!s.shiftKey],Meta:[91,s=>!!s.metaKey]},So={style:"cursor: crosshair"};function Co(s={}){let[e,t]=ko[s.key||"Alt"],i=L.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}});return[i,At.contentAttributes.of(n=>{var r;return!((r=n.plugin(i))===null||r===void 0)&&r.isDown?So:null})]}const dn="-10000px";class rr{constructor(e,t,i,n){this.facet=t,this.createTooltipView=i,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let r=null;this.tooltipViews=this.tooltips.map(a=>r=i(a,r))}update(e,t){var i;let n=e.state.facet(this.facet),r=n.filter(d=>d);if(n===this.input){for(let d of this.tooltipViews)d.update&&d.update(e);return!1}let a=[],c=t?[]:null;for(let d=0;d<r.length;d++){let x=r[d],y=-1;if(x){for(let E=0;E<this.tooltips.length;E++){let N=this.tooltips[E];N&&N.create==x.create&&(y=E)}if(y<0)a[d]=this.createTooltipView(x,d?a[d-1]:null),c&&(c[d]=!!x.above);else{let E=a[d]=this.tooltipViews[y];c&&(c[d]=t[y]),E.update&&E.update(e)}}}for(let d of this.tooltipViews)a.indexOf(d)<0&&(this.removeTooltipView(d),(i=d.destroy)===null||i===void 0||i.call(d));return t&&(c.forEach((d,x)=>t[x]=d),t.length=c.length),this.input=n,this.tooltips=r,this.tooltipViews=a,!0}}function tl(s={}){return En.of(s)}function Ao(s){let e=s.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const En=v.sj.define({combine:s=>{var e,t,i;return{position:Me.ios?"absolute":((e=s.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=s.find(n=>n.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=s.find(n=>n.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Ao}}}),or=new WeakMap,Ln=L.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=s.state.facet(En);this.position=e.position,this.parent=e.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new rr(s,as,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),s.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.theme
vendor: 10,729 bytes, line 28
28Classes,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(s,this.above);e&&this.observeIntersection();let t=e||s.geometryChanged,i=s.state.facet(En);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(s,e){let t=s.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),s.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",t.dom.appendChild(n)}return t.dom.style.position=this.position,t.dom.style.top=dn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var s,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(s=i.destroy)===null||s===void 0||s.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Me.gecko)t=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==dn&&r.style.left=="0px"){let a=r.getBoundingClientRect();t=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(s=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:s,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),n=ni(this.view);return{visible:{left:i.left+n.left,top:i.top+n.top,right:i.right-n.right,bottom:i.bottom-n.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,a)=>{let c=this.manager.tooltipViews[a];return c.getCoords?c.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(En).tooltipSpace(this.view),scaleX:s,scaleY:e,makeAbsolute:t}}writeMeasure(s){var e;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:t,space:i,scaleX:n,scaleY:r}=s,a=[];for(let c=0;c<this.manager.tooltips.length;c++){let d=this.manager.tooltips[c],x=this.manager.tooltipViews[c],{dom:y}=x,E=s.pos[c],N=s.size[c];if(!E||d.clip!==!1&&(E.bottom<=Math.max(t.top,i.top)||E.top>=Math.min(t.bottom,i.bottom)||E.right<Math.max(t.left,i.left)-.1||E.left>Math.min(t.right,i.right)+.1)){y.style.top=dn;continue}let X=d.arrow?x.dom.querySelector(".cm-tooltip-arrow"):null,se=X?7:0,de=N.right-N.left,ge=(e=or.get(x))!==null&&e!==void 0?e:N.bottom-N.top,me=x.offset||Oo,$e=this.view.textDirection==ke.LTR,et=N.width>i.right-i.left?$e?i.left:i.right-N.width:$e?Math.max(i.left,Math.min(E.left-(X?14:0)+me.x,i.right-de)):Math.min(Math.max(i.left,E.left-de+(X?14:0)-me.x),i.right-de),Ge=this.above[c];!d.strictSide&&(Ge?E.top-ge-se-me.y<i.top:E.bottom+ge+se+me.y>i.bottom)&&Ge==i.bottom-E.bottom>E.top-i.top&&(Ge=this.above[c]=!Ge);let ot=(Ge?E.top-i.top:i.bottom-E.bottom)-se;if(ot<ge&&x.resize!==!1){if(ot<this.view.defaultLineHeight){y.style.top=dn;continue}or.set(x,ge),y.style.height=(ge=ot)/r+"px"}else y.style.height&&(y.style.height="");let lt=Ge?E.top-ge-se-me.y:E.bottom+se+me.y,di=et+de;if(x.overlap!==!0)for(let Pi of a)Pi.left<di&&Pi.right>et&&Pi.top<lt+ge&&Pi.bottom>lt&&(lt=Ge?Pi.top-ge-2-se:Pi.bottom+se+2);if(this.position=="absolute"?(y.style.top=(lt-s.parent.top)/r+"px",lr(y,(et-s.parent.left)/n)):(y.style.top=lt/r+"px",lr(y,et/n)),X){let Pi=E.left+($e?me.x:-me.x)-(et+14-7);X.style.left=Pi/n+"px"}x.overlap!==!0&&a.push({left:et,top:lt,right:di,bottom:lt+ge}),y.classList.toggle("cm-tooltip-above",Ge),y.classList.toggle("cm-tooltip-below",!Ge),x.positioned&&x.positioned(s.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let s of this.manager.tooltipViews)s.dom.style.top=dn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lr(s,e){let t=parseInt(s.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(s.style.left=e+"px")}const Mo=At.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Oo={x:0,y:0},as=v.sj.define({enables:[Ln,Mo]}),pn=v.sj.define({combine:s=>s.reduce((e,t)=>e.concat(t),[])});class Bn{static create(e){return new Bn(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new rr(e,pn,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let n=i[e];if(n!==void 0){if(t===void 0)t=n;else if(t!==n)return}}return t}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 Do=as.compute([pn],s=>{let e=s.facet(pn);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Bn.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class To{constructor(e,t,i,n,r){this.view=e,this.source=t,this.field=i,this.setHover=n,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.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 e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.nearest(t.target);if(!i)return;let n,r=1;if(i instanceof re)n=i.posAtStart;else{if(n=e.posAtCoords(t),n==null)return;let c=e.coordsAtPos(n);if(!c||t.y<c.top||t.y>c.bottom||t.x<c.left-e.defaultCharacterWidth||t.x>c.right+e.defaultCharacterWidth)return;let d=e.bidiSpans(e.state.doc.lineAt(n)).find(y=>y.from<=n&&y.to>=n),x=d&&d.dir==ke.RTL?-1:1;r=t.x<c.left?-x:x}let a=this.source(e,n,r);if(a?.then){let c=this.pending={pos:n};a.then(d=>{this.pending==c&&(this.pending=null,d&&!(Array.isArray(d)&&!d.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(d)?d:[d])}))},d=>A(e.state,d,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(Ln),t=e?e.manager.tooltips.findIndex(i=>i.create==Bn.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:r}=this;if(n.length&&r&&!Po(r.dom,e)||this.pending){let{pos:a}=n[0]||this.pending,c=(i=(t=n[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:a;(a==c?this.view.posAtCoords(this.lastMove)!=a:!Eo(this.view,a,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Rn=4;function Po(s,e){let{left:t,right:i,top:n,bottom:r}=s.getBoundingClientRect(),a;if(a=s.querySelector(".cm-tooltip-arrow")){let c=a.getBoundingClientRect();n=Math.min(c.top,n),r=Math.max(c.bottom,r)}return e.clientX>=t-Rn&&e.clientX<=i+Rn&&e.clientY>
28=n-Rn&&e.clientY<=r+Rn}function Eo(s,e,t,i,n,r){let a=s.scrollDOM.getBoundingClientRect(),c=s.documentTop+s.documentPadding.top+s.contentHeight;if(a.left>i||a.right<i||a.top>n||Math.min(a.bottom,c)<n)return!1;let d=s.posAtCoords({x:i,y:n},!1);return d>=e&&d<=t}function Lo(s,e={}){let t=v.Pe.define(),i=v.sU.define({create(){return[]},update(n,r){if(n.length&&(e.hideOnChange&&(r.docChanged||r.selection)?n=[]:e.hideOn&&(n=n.filter(a=>!e.hideOn(r,a))),r.docChanged)){let a=[];for(let c of n){let d=r.changes.mapPos(c.pos,-1,v.iR.TrackDel);if(d!=null){let x=Object.assign(Object.create(null),c);x.pos=d,x.end!=null&&(x.end=r.changes.mapPos(x.end)),a.push(x)}}n=a}for(let a of r.effects)a.is(t)&&(n=a.value),a.is(Ro)&&(n=[]);return n},provide:n=>pn.from(n)});return{active:i,extension:[i,L.define(n=>new To(n,s,i,t,e.hoverTime||300)),Do]}}function Bo(s,e){let t=s.plugin(Ln);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}function il(s){return s.facet(pn).some(e=>e)}const Ro=v.Pe.define(),nl=null;function sl(s){let e=s.plugin(Ln);e&&e.maybeMeasure()}const hs=v.sj.define({combine(s){let e,t;for(let i of s)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function rl(s){return s?[hs.of(s)]:[]}function Io(s,e){let t=s.plugin(ar),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const ar=L.fromClass(class{constructor(s){this.input=s.state.facet(cs),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(s));let e=s.state.facet(hs);this.top=new In(s,!0,e.topContainer),this.bottom=new In(s,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(s){let e=s.state.facet(hs);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new In(s.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new In(s.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=s.state.facet(cs);if(t!=this.input){let i=t.filter(d=>d),n=[],r=[],a=[],c=[];for(let d of i){let x=this.specs.indexOf(d),y;x<0?(y=d(s.view),c.push(y)):(y=this.panels[x],y.update&&y.update(s)),n.push(y),(y.top?r:a).push(y)}this.specs=i,this.panels=n,this.top.sync(r),this.bottom.sync(a);for(let d of c)d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let i of this.panels)i.update&&i.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>At.scrollMargins.of(e=>{let t=e.plugin(s);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class In{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=hr(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=hr(e)}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 e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function hr(s){let e=s.nextSibling;return s.remove(),e}const cs=v.sj.define({enables:ar});class ji extends v.FB{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ji.prototype.elementClass="",ji.prototype.toDOM=void 0,ji.prototype.mapM
vendor: 5,213 bytes, line 28
28ode=v.iR.TrackBefore,ji.prototype.startSide=ji.prototype.endSide=-1,ji.prototype.point=!0;const Fn=v.sj.define(),Fo=v.sj.define(),No={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>v.om.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},mn=v.sj.define();function _o(s){return[cr(),mn.of(Object.assign(Object.assign({},No),s))]}const fs=v.sj.define({combine:s=>s.some(e=>e)});function cr(s){let e=[Ho];return s&&s.fixed===!1&&e.push(fs.of(!0)),e}const Ho=L.fromClass(class{constructor(s){this.view=s,this.prevViewport=s.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=s.state.facet(mn).map(e=>new ur(s,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!s.state.facet(fs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),s.scrollDOM.insertBefore(this.dom,s.contentDOM)}update(s){if(this.updateGutters(s)){let e=this.prevViewport,t=s.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}s.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(fs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=s.view.viewport}syncGutters(s){let e=this.dom.nextSibling;s&&this.dom.remove();let t=v.om.iter(this.view.state.facet(Fn),this.view.viewport.from),i=[],n=this.gutters.map(r=>new Vo(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let a=!0;for(let c of r.type)if(c.type==yt.Text&&a){us(t,i,c.from);for(let d of n)d.line(this.view,c,i);a=!1}else if(c.widget)for(let d of n)d.widget(this.view,c)}else if(r.type==yt.Text){us(t,i,r.from);for(let a of n)a.line(this.view,r,i)}else if(r.widget)for(let a of n)a.widget(this.view,r);for(let r of n)r.finish();s&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(s){let e=s.startState.facet(mn),t=s.state.facet(mn),i=s.docChanged||s.heightChanged||s.viewportChanged||!v.om.eq(s.startState.facet(Fn),s.state.facet(Fn),s.view.viewport.from,s.view.viewport.to);if(e==t)for(let n of this.gutters)n.update(s)&&(i=!0);else{i=!0;let n=[];for(let r of t){let a=e.indexOf(r);a<0?n.push(new ur(this.view,r)):(this.gutters[a].update(s),n.push(this.gutters[a]))}for(let r of this.gutters)r.dom.remove(),n.indexOf(r)<0&&r.destroy();for(let r of n)this.dom.appendChild(r.dom);this.gutters=n}return i}destroy(){for(let s of this.gutters)s.destroy();this.dom.remove()}},{provide:s=>At.scrollMargins.of(e=>{let t=e.plugin(s);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==ke.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function fr(s){return Array.isArray(s)?s:[s]}function us(s,e,t){for(;s.value&&s.from<=t;)s.from==t&&e.push(s.value),s.next()}class Vo{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=v.om.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:n}=this,r=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==n.elements.length){let c=new dr(e,a,r,i);n.elements.push(c),n.dom.appendChild(c.dom)}else n.elements[this.i].update(e,a,r,i);this.height=t.bottom,this.i++}line(e,t,i){let n=[];us(this.cursor,n,t.from),i.length&&(n=n.concat(i));let r=this.gutter.config.lineMarker(e,t,n);r&&n.unshift(r);let a=this.gutter;n.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),n=i?[i]:null;for(let r of e.state.facet(Fo)){let a=r(e,t.widget,t);a&&(n||(n=[])).push(a)}n&&this.addElement(e,t,n)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ur{constructor(e,t){this.view=e,this.config=t,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 t.domEventHandlers)this.dom.addEventListener(i,n=>{let r=n.target,a;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let d=r.getBoundingClientRect();a=(d.top+d.bottom)/2}else a=n.clientY;let c=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,c,n)&&n.preventDefault()});this.markers=fr(t.markers(e)),t.initialSpacer&&(this.spacer=new dr(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=fr(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let i=e.view.viewport;return!v.om.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class dr{constructor(e,t,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="
28cm-gutterElement",this.update(e,t,i,n)}update(e,t,i,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Wo(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let i="cm-gutterElement",n=this.dom.firstChild;for(let r=0,a=0;;){let c=a,d=r<t.length?t[r++]:null,x=!1;if(d){let y=d.elementClass;y&&(i+=" "+y);for(let E=a;E<this.markers.length;E++)if(this.markers[E].compare(d)){c=E,x=!0;break}}else c=this.markers.length;for(;a<c;){let y=this.markers[a++];if(y.toDOM){y.destroy(n);let E=n.nextSibling;n.remove(),n=E}}if(!d)break;d.toDOM&&(x?n=n.nextSibling:this.dom.insertBefore(d.toDOM(e),n)),x&&a++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function Wo(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++)if(!s[t].compare(e[t]))return!1;return!0}const zo=v.sj.define(),jo=v.sj.define(),on=v.sj.define({combine(s){return(0,v.QR)(s,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let n in t){let r=i[n],a=t[n];i[n]=r?(c,d,x)=>r(c,d,x)||a(c,d,x):a}return i}})}});class ds extends ji{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function ps(s,e){return s.state.facet(on).formatNumber(e,s.state)}const $o=mn.compute([on],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(zo)},lineMarker(e,t,i){return i.some(n=>n.toDOM)?null:new ds(ps(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let n of e.state.facet(jo)){let r=n(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(on)!=e.state.facet(on),initialSpacer(e){return new ds(ps(e,pr(e.state.doc.lines)))},updateSpacer(e,t){let i=ps(t.view,pr(t.view.state.doc.lines));return i==e.number?e:new ds(i)},domEventHandlers:s.facet(on).domEventHandlers}));function Ko(s={}){return[on.of(s),cr(),$o]}function pr(s){let e=9;for(;e<s;)e=e*10+9;return e}const Uo=new class extends ji{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},qo=Fn.compute(["selection"],s=>{let e=[],t=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.head).from;n>t&&(t=n,e.push(Uo.range(n)))}return v.om.of(e)});function Go(){return qo}function mr(s){return L.define(e=>({decorations:s.createDeco(e),update(t){this.decorations=s.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const Yo=Pe.mark({class:"cm-highlightTab"}),Jo=Pe.mark({class:"cm-highlightSpace"}),Xo=mr(new ss({regexp:/\t| /g,decoration:s=>s[0]=="	"?Yo:Jo,boundary:/\S/}));function ol(){return Xo}const Zo=mr(new ss({regexp:/\s+$/g,decoration:Pe.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function ll(){return Zo}const al={HeightMap:Li,HeightOracle:Es,MeasuredHeights:Ls,QueryType:ri,ChangedRange:wi,computeOrder:o,moveVisually:m,clearHeightChangeFlag:Gn,getHeightChangeFlag:()=>en}},508530:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{F:()=>Oe});var v=Ke(389369);const ie=Je=>typeof Je=="boolean"?`${Je}`:Je===0?"0":Je,z=v.$,Oe=(Je,Re)=>Ie=>{var it;if(Re?.variants==null)return z(Je,Ie?.class,Ie?.className);const{variants:zt,defaultVariants:bt}=Re,nt=Object.keys(zt).map(at=>{const Dt=Ie?.[at],ei=bt?.[at];if(Dt===null)return null;const Ht=ie(Dt)||ie(ei);return zt[at][Ht]}),jt=Ie&&Object.entries(Ie).reduce((at,Dt)=>{let[ei,Ht]=Dt;return Ht===void 0||(at[ei]=Ht),at},{}),Ze=Re==null||(it=Re.compoundVariants)===null||it===void 0?void 0:it.reduce((at,Dt)=>{let{class:ei,className:Ht,...pi}=Dt;return Object.entries(pi).every(ai=>{let[mt,st]=ai;return Array.isArray(st)?st.includes({...bt,...jt}[mt]):{...bt,...jt}[mt]===st})?[...at,ei,Ht]:at},[]);return z(Je,nt,Ze,Ie?.class,Ie?.className)}},389369:(xi,Qt,Ke)=>{"use strict";Ke.d(Qt,{$:()=>ie});function v(Oe){var Je,Re,Ie="";if(typeof Oe=="string"||typeof Oe=="number")Ie+=Oe;else if(typeof Oe=="object")if(Array.isArray(Oe)){var it=Oe.length;for(Je=0;Je<it;Je++)Oe[Je]&&(Re=v(Oe[Je]))&&(Ie&&(Ie+=" "),Ie+=Re)}else for(Re in Oe)Oe[Re]&&(Ie&&(Ie+=" "),Ie+=Re);return Ie}function ie(){for(var Oe,Je,Re=0,Ie="",it=arguments.length;Re<it;Re++)(Oe=arguments[Re])&&(Je=v(Oe))&&(Ie&&(Ie+=" "),Ie+=Je);return Ie}var z=null}}]);

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.