pocketbase/ui/dist/assets/index-D0ZW3duE.js

15 lines
348 KiB
JavaScript
Raw Normal View History

class V{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=Ue(this,t,e);let s=[];return this.decompose(0,t,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(e,this.length,s,1),Gt.from(s,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Ue(this,t,e);let i=[];return this.decompose(t,e,i,0),Gt.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),s=new gi(this),r=new gi(t);for(let o=e,l=e;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(t=1){return new gi(this,t)}iterRange(t,e=this.length){return new vl(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let s=this.line(t).from;i=this.iterRange(s,Math.max(s,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new kl(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?V.empty:t.length<=32?new _(t):Gt.from(_.split(t,[]))}}class _ extends V{constructor(t,e=mc(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((e?i:l)>=t)return new yc(s,l,i,o);s=l+1,i++}}decompose(t,e,i,s){let r=t<=0&&e>=this.length?this:new _(Wr(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(s&1){let o=i.pop(),l=on(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new _(l,o.length+r.length));else{let a=l.length>>1;i.push(new _(l.slice(0,a)),new _(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof _))return super.replace(t,e,i);[t,e]=Ue(this,t,e);let s=on(this.text,on(i.text,Wr(this.text,0,t)),e),r=this.length+i.length-(e-t);return s.length<=32?new _(s,r):Gt.from(_.split(s,[]),r)}sliceString(t,e=this.length,i=`
`){[t,e]=Ue(this,t,e);let s="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>t&&o&&(s+=i),t<a&&e>r&&(s+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return s}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],s=-1;for(let r of t)i.push(r),s+=r.length+1,i.length==32&&(e.push(new _(i,s)),i=[],s=-1);return s>-1&&e.push(new _(i,s)),e}}class Gt extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,s);s=l+1,i=a+1}}decompose(t,e,i,s){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(t<=a&&e>=o){let h=s&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if([t,e]=Ue(this,t,e),i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(t>=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Gt(c,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=`
`){[t,e]=Ue(this,t,e);let s="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let l=this.children[r],a=o+l.length;o>t&&r&&(s+=i),t<a&&e>o&&(s+=l.sliceString(t-o,e-o,i)),o=a+1}return s}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof Gt))return 0;let i=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return i;let a=this.children[s],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of t)i+=d.lines;if(i<32){let d=[];for(let p of t)p.flatten(d);return new _(d,e)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Gt)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof _&&a&&(p=c[c.length-1])instanceof _&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new _(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Gt.from(c,h)),h=-1,a=c.length=0)}for(let d of t)f(d);return u(),l.length==1?l[0]:new Gt(l,e)}}V.empty=new _([""],0);function mc(n){let t=-1;for(let e of n)t+=e.length+1;return t}function on(n,t,e=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=e&&(a>i&&(l=l.slice(0,i-s)),s<e&&(l=l.slice(e-s)),o?(t[t.length-1]+=l,o=!1):t.push(l)),s=a+1}return t}function Wr(n,t,e){return on(n,[""],t,e)}class gi{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof _?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof _?s.text.length:s.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(s instanceof _){let a=s.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=s.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof _?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class vl{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new gi(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class kl{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:s}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},gi.prototype[Symbol.iterator]=vl.prototype[Symbol.iterator]=kl.prototype[Symbol.iterator]=function(){return this});class yc{constructor(t,e,i,s){this.from=t,this.to=e,this.number=i,this.text=s}get length(){return this.to-this.from}}function Ue(n,t,e){return t=Math.max(0,Math.min(n.length,t)),[t,Math.max(t,Math.min(n.length,e))]}let He="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<He.length;n++)He[n]+=He[n-1];function bc(n){for(let t=1;t<He.length;t+=2)if(He[t]>n)return He[t-1]<=n;return!1}function Hr(n){return n>=127462&&n<=127487}const zr=8205;function ot(n,t,e=!0,i=!0){return(e?Cl:xc)(n,t,i)}function Cl(n,t,e){if(t==n.length)return t;t&&Al(n.charCodeAt(t))&&Ml(n.charCodeAt(t-1))&&t--;let i=nt(n,t);for(t+=Bt(i);t<n.length;){let s=nt(n,t);if(i==zr||s==zr||e&&bc(s))t+=Bt(s),i=s;else if(Hr(s)){let r=0,o=t-2;for(;o>=0&&Hr(nt(n,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function xc(n,t,e){for(;t>0;){let i=Cl(n,t-2,e);if(i<t)return i;t--}return 0}function Al(n){return n>=56320&&n<57344}function Ml(n){return n>=55296&&n<56320}function nt(n,t){let e=n.charCodeAt(t);if(!Ml(e)||t+1==n.lengt
`}get readOnly(){return this.facet(Il)}phrase(t,...e){for(let i of this.facet(H.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>e.length?i:e[r-1]})),t}languageDataAt(t,e,i=-1){let s=[];for(let r of this.facet(Pl))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){return Pc(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:s}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=ot(e,o,!1);if(r(e.slice(a,o))!=G.Word)break;o=a}for(;l<s;){let a=ot(e,l);if(r(e.slice(l,a))!=G.Word)break;l=a}return o==l?null:b.range(o+i,l+i)}}H.allowMultipleSelections=ms;H.tabSize=T.define({combine:n=>n.length?n[0]:4});H.lineSeparator=Bl;H.readOnly=Il;H.phrases=T.define({compare(n,t){let e=Object.keys(n),i=Object.keys(t);return e.length==i.length&&e.every(s=>n[s]==t[s])}});H.languageData=Pl;H.changeFilter=Rl;H.transactionFilter=Ll;H.transactionExtender=El;En.reconfigure=F.define();function Le(n,t,e={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in t)i[s]===void 0&&(i[s]=t[s]);return i}class Me{eq(t){return this==t}range(t,e=t){return xs.create(t,e,this)}}Me.prototype.startSide=Me.prototype.endSide=0;Me.prototype.point=!1;Me.prototype.mapMode=ht.TrackDel;let xs=class Vl{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new Vl(t,e,i)}};function ws(n,t){return n.from-t.from||n.value.startSide-t.value.startSide}class hr{constructor(t,e,i,s){this.from=t,this.to=e,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,s){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e){let i=[],s=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+t,f=this.to[a]+t,u,d;if(c==f){let p=e.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=e.mapPos(c,h.endSide),d<u)))continue}else if(u=e.mapPos(c,h.startSide),d=e.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new hr(s,r,i,l):null,pos:o}}}class K{constructor(t,e,i,s){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s}static create(t,e,i,s){return new K(t,e,i,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(ws)),this.isEmpty)return e.length?K.of(e):this;let l=new Wl(this,null,-1).goto(0),a=0,h=[],c=new De;for(;l.value||a<e.length;)if(a<e.length&&(l.from-e[a].from||l.startSide-e[a].value.startSide)>=0){let f=e[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==e.length||this.chunkEnd(l.chunkIndex)<e[a].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(xs.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?K.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:r}))}map(
`)}static newName(){let t=Jr[Gr]||1;return Jr[Gr]=t+1,ks+t.toString(36)}static mount(t,e,i){let s=t[Cs],r=i&&i.nonce;s?r&&s.setNonce(r):s=new Rc(t,r),s.mount(Array.isArray(e)?e:[e],t)}}let Yr=new Map;class Rc{constructor(t,e){let i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let r=Yr.get(i);if(r)return t[Cs]=r;this.sheet=new s.CSSStyleSheet,Yr.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Cs]=this}mount(t,e){let i=this.sheet,s=0,r=0;for(let o=0;o<t.length;o++){let l=t[o],a=this.modules.indexOf(l);if(a<r&&a>-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h<l.rules.length;h++)i.insertRule(l.rules[h],s++)}else{for(;r<a;)s+=this.modules[r++].rules.length;s+=l.rules.length,r++}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
`;this.styleTag.textContent=o;let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var pe={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Si={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Lc=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ec=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var st=0;st<10;st++)pe[48+st]=pe[96+st]=String(st);for(var st=1;st<=24;st++)pe[st+111]="F"+st;for(var st=65;st<=90;st++)pe[st]=String.fromCharCode(st+32),Si[st]=String.fromCharCode(st);for(var Un in pe)Si.hasOwnProperty(Un)||(Si[Un]=pe[Un]);function Ic(n){var t=Lc&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ec&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?Si:pe)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}function vi(n){let t;return n.nodeType==11?t=n.getSelection?n:n.ownerDocument:t=n,t.getSelection()}function As(n,t){return t?n==t||n.contains(t.nodeType!=1?t.parentNode:t):!1}function Nc(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function an(n,t){if(!t.anchorNode)return!1;try{return As(n,t.anchorNode)}catch{return!1}}function Ge(n){return n.nodeType==3?Te(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function yi(n,t,e,i){return e?Xr(n,t,e,i,-1)||Xr(n,t,e,i,1):!1}function Oe(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t}function mn(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Xr(n,t,e,i,s){for(;;){if(n==e&&t==i)return!0;if(t==(s<0?0:ie(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;t=Oe(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[t+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;t=s<0?ie(n):0}else return!1}}function ie(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function In(n,t){let e=t?n.left:n.right;return{left:e,right:e,top:n.top,bottom:n.bottom}}function Fc(n){let t=n.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Hl(n,t){let e=t.width/n.offsetWidth,i=t.height/n.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-n.offsetWidth)<1)&&(e=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-n.offsetHeight)<1)&&(i=1),{scaleX:e,scaleY:i}}function Vc(n,t,e,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,g=1;if(d)u=Fc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let x=c.getBoundingClientRect();({scaleX:p,scaleY:g}=Hl(c,x)),u={left:x.left,right:x.left+c.clientWidth*p,top:x.top,bottom:x.top+c.clientHeight*g}}let m=0,y=0;if(s=="nearest")t.top<u.top?(y=-(u.top-t.top+o),e>0&&t.bottom>u.bottom+y&&(y=t.bottom-u.bottom+y+o)):t.bottom>u.bottom&&(y=t.bottom-u.bottom+o,e<0&&t.top-y<u.top&&(y=-(u.top+y-t.top+o)));else{let x=t.bottom-t.top,v=u.bottom-u.top;y=(s=="center"&&x<=v?t.top+x/2-v/2:s=="start"||s=="center"&&e<0?t
`,s=n.state.doc.line(s.number+(e?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!e)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function bf(n,t,e){let i=n.state.charCategorizer(t),s=i(e);return r=>{let o=i(r);return s==G.Space&&(s=o),s==o}}function xf(n,t,e,i){let s=t.head,r=e?1:-1;if(s==(e?n.state.doc.length:0))return b.cursor(s,t.assoc);let o=t.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,t.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,g=va(n,{x:f,y:p},!1,r);if(p<a.top||p>a.bottom||(r<0?g<s:g>s)){let m=n.docView.coordsForChar(g),y=!m||p<m.top?-1:1;return b.cursor(g,y,void 0,o)}}}function hn(n,t,e){for(;;){let i=0;for(let s of n)s.between(t-1,t+1,(r,o,l)=>{if(t>r&&t<o){let a=i||e||(t-r<o-t?-1:1);t=a<0?r:o,i=a}});if(!i)return t}}function Xn(n,t,e){let i=hn(n.state.facet(pr).map(s=>s(n)),e.from,t.head>e.from?-1:1);return i==e.from?e:b.cursor(i,i<e.from?1:-1)}class wf{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,D.safari&&t.contentDOM.addEventListener("input",()=>null),D.gecko&&Nf(t.contentDOM.ownerDocument)}handleEvent(t){!Of(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let i=this.handlers[t];if(i){for(let s of i.observers)s(this.view,e);for(let s of i.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Sf(t),i=this.handlers,s=this.view.contentDOM;for(let r in e)if(r!="scroll"){let o=!e[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!e[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&Ca.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),D.android&&D.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return D.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=ka.find(i=>i.keyCode==t.keyCode))&&!t.ctrlKey||vf.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,qe(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:D.safari&&!D.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mou
`&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),e={from:s.from,to:s.to,insert:V.of([" "])}),e)return Fa(n,e,i,r);if(i&&!i.main.eq(s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Fa(n,t,e,i=-1){if(D.ios&&n.inputState.flushIOSKey(t))return!0;let s=n.state.selection.main;if(D.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&n.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&qe(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&qe(n.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&qe(n.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Qf(n,t,e));return n.state.facet(ca).some(a=>a(n,t.from,t.to,r,l))||n.dispatch(l()),!0}function Qf(n,t,e){let i,s=n.state,r=s.selection.main;if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let l=r.from<t.from?s.sliceDoc(r.from,t.from):"",a=r.to>t.to?s.sliceDoc(t.to,r.to):"";i=s.replaceSelection(n.state.toText(l+t.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=s.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(s.selection.ranges.length>1&&n.inputState.composing>=0&&t.to<=r.to&&t.to>=r.to-10){let h=n.state.sliceDoc(t.from,t.to),c,f=e&&Sa(n,e.main.head);if(f){let p=t.insert.length-(t.to-t.from);c={from:f.from,to:f.to-p}}else c=n.state.doc.lineAt(r.head);let u=r.to-t.to,d=r.to-r.from;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:a||p.map(l)};let g=p.to-u,m=g-h.length;if(p.to-p.from!=d||n.state.sliceDoc(m,g)!=h||p.to>=c.from&&p.from<=c.to)return{range:p};let y=s.changes({from:m,to:g,insert:t.insert}),x=p.to-r.to;return{changes:y,range:a?b.range(Math.max(0,a.anchor+x),Math.max(0,a.head+x)):p.map(y)}})}else i={changes:l,selection:a&&s.selection.replaceRange(a)}}let o="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,o+=".compose",n.inputState.compositionFirstChange&&(o+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:o,scrollIntoView:!0})}function Zf(n,t,e,i){let s=Math.min(n.length,t.length),r=0;for(;r<s&&n.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==s&&n.length==t.length)return null;let o=n.length,l=t.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));e-=o+a-r}if(o<r&&n.length<t.length){let a=e<=r&&e>=o?r-e:0;r-=a,l=r+(l-o),o=r}else if(l<r){let a=e<=r&&e>=l?r-e:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function tu(n){let t=[];if(n.root.activeElement!=n.contentDOM)return t;let{anchorNode:e,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return e&&(t.push(new Ao(e,i)),(s!=e||r!=i)&&t.push(new Ao(s,r))),t}function eu(n,t){if(n.length==0)return null;let e=n[0].pos,i=n.length==2?n[1].pos:e;return e>-1&&i>-1?b.single(e+t,i+t):null}const iu={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Qn=D.ie&&D.ie_version<=11;class nu{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Hc,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(D.ie&&D.ie_version<=11||D.ios&&t.composing)&&e.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.
`))};r.from==this.from&&s<this.from?r.from=s:r.to==this.to&&s>this.to&&(r.to=s),!(r.from==r.to&&!r.insert.length)&&(this.pendingContextChange=r,Fa(t,r,b.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&this.revertPending(t.state))}),e.addEventListener("characterboundsupdate",i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=t.coordsForChar(o);r=a&&new DOMRect(a.left,a.right,a.right-a.left,a.bottom-a.top)||r||new DOMRect,s.push(r)}e.updateCharacterBounds(i.rangeStart,s)}),e.addEventListener("textformatupdate",i=>{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;s.push(P.mark({attributes:{style:a}}).range(this.toEditorPos(r.rangeStart),this.toEditorPos(r.rangeEnd)))}}t.dispatch({effects:ga.of(P.set(s))})}),e.addEventListener("compositionstart",()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)}),e.addEventListener("compositionend",()=>{t.inputState.composing=-1,t.inputState.compositionFirstChange=null}),this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=vi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,s=this.pendingContextChange;return t.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,e+=c;return}else s=null,this.revertPending(t.state);if(r+=e,o+=e,o<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}e+=c}),s&&!i&&this.revertPending(t.state),!i}update(t){!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.resetRange(t.state),this.editContext.updateText(0,this.editContext.text.length,t.state.doc.sliceString(this.from,this.to)),this.setSelection(t.state)):(t.docChanged||t.selectionSet)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.to+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t){return t+this.from}toContextPos(t){return t-this.from}}class O{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(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="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("ar
--Ÿ­؜\u2028\u2029\uFEFF-]`,$s),ku={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 Zn=null;function Cu(){var n;if(Zn==null&&typeof document<"u"&&document.body){let t=document.body.style;Zn=((n=t.tabSize)!==null&&n!==void 0?n:t.MozTabSize)!=null}return Zn||!1}const un=T.define({combine(n){let t=Le(n,{render:null,specialChars:vu,addSpecialChars:null});return(t.replaceTabs=!Cu())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,$s)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,$s)),t}});function gm(n={}){return[un.of(n),Au()]}let Eo=null;function Au(){return Eo||(Eo=ut.fromClass(class{constructor(n){this.view=n,this.decorations=P.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(un)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Su({regexp:n.specialChars,decoration:(t,e,i)=>{let{doc:s}=e.state,r=nt(t[0],0);if(r==9){let o=s.lineAt(i),l=e.state.tabSize,a=ti(o.text,l,i-o.from);return P.replace({widget:new Tu((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=P.replace({widget:new Ou(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let t=n.state.facet(un);n.startState.facet(un)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Mu="•";function Du(n){return n>=32?Mu:n==10?"␤":String.fromCharCode(9216+n)}class Ou extends Ee{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=Du(this.code),i=t.state.phrase("Control character")+" "+(ku[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;let r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Tu extends Ee{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class Pu extends Ee{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(t){let e=t.firstChild?Ge(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),s=In(e[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function mm(n){return ut.fromClass(class{constructor(t){this.view=t,this.placeholder=n?P.set([P.widget({widget:new Pu(n),side:1}).range(0)]):P.none}get decorations(){return this.view.state.doc.length?P.none:this.placeholder}},{decorations:t=>t.decorations})}const js=2e3;function Bu(n,t,e){let i=Math.min(t.line,e.line),s=Math.max(t.line,e.line),r=[];if(t.off>js||e.off>js||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=vs(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else
`&&(e="");else{let i=e.indexOf(`
`);i>-1&&(e=e.slice(0,i))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(e=e.slice(0,r-(i-e.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);e+=l,i=o+l.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=t+e;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;e+=o-s}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,e,i,s,r){if(this.ranges.length>1){r=this.skipGapsTo(e,r,1),e+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(t,e,i,s),r}parseLine(t){let{line:e,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new fh(e,t?t.state.tabSize:4,t?Re(t.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=ph(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=j.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Id,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new j(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new j(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function ph(n,t,e){t.start=t.pos;for(let i=0;i<10;i++){let s=n(t,e);if(t.pos>t.start)return s}throw new Error("Stream parser failed to advance stream.")}const Cr=Object.create(null),Di=[mt.none],Id=new br(Di),tl=[],el=Object.create(null),gh=Object.create(null);for(let[n,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])gh[n]=yh(Cr,t);class mh{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),gh)}resolve(t){return t?this.table[t]||(this.table[t]=yh(this.extra,t)):0}}const Nd=new mh(Cr);function rs(n,t){tl.indexOf(n)>-1||(tl.push(n),console.warn(t))}function yh(n,t){let e=[];for(let l of t.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||M[h];c?typeof c=="function"?a.length?a=a.map(c):rs(h,`Modifier ${h} used at start of tag`):a.length?rs(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:rs(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let i=t.replace(/ /g,"_"),s=i+" "+e.map(l=>l.id),r=el[s];if(r)return r.id;let o=el[s]=mt.define({id:Di.length,name:i,props:[rd({[i]:e})]});return Di.push(o),o.id}function Fd(n){let t=mt.define({id:Di.length,name:"Document",props:[Ce.add(()=>n)],top:!0});return Di.push(t),t}X.RTL,X.LTR;const Vd=n=>{let{state:t}=n,e=t.doc.lineAt(t.selection.main.from),i=Mr(n.state,e.from);return i.line?Wd(n):i.block?zd(n):!1};function Ar(n,t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let s=n(t,e);return s?(i(e.update(s)),!0):!1}}const Wd=Ar($d,0),Hd=Ar(bh,0),zd=Ar((n,t)=>bh(n,t,Kd(t)),0);function Mr(n,t){let e=n.languageDataAt("commentTokens",t);return e.length?e[0]:{}}const hi=50;function qd(n,{open:t,close:e},i,s){let r=n.sliceDoc(i-hi,i),o=n.sliceDoc(s,s+hi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*hi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+hi),f=n.sliceDoc(s-hi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-e.length;return c.slice(u,u+t.le
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new ag(this):new og(this)}getCursor(t,e=0,i){let s=t.doc?t:H.create({doc:t});return i==null&&(i=s.doc.length),this.regexp?Ve(this,s,e,i):Fe(this,s,e,i)}}class ec{constructor(t){this.spec=t}}function Fe(n,t,e,i){return new Ze(t.doc,n.unquoted,e,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?rg(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function rg(n,t){return(e,i,s,r)=>((r>e||r+s.length<i)&&(r=Math.max(0,e-2),s=n.sliceString(r,Math.min(n.length,i+2))),(t(On(s,e-r))!=G.Word||t(Tn(s,e-r))!=G.Word)&&(t(Tn(s,i-r))!=G.Word||t(On(s,i-r))!=G.Word))}class og extends ec{constructor(t){super(t)}nextMatch(t,e,i){let s=Fe(this.spec,t,i,t.doc.length).nextOverlapping();return s.done&&(s=Fe(this.spec,t,0,e).nextOverlapping()),s.done?null:s.value}prevMatchInRange(t,e,i){for(let s=i;;){let r=Math.max(e,s-1e4-this.spec.unquoted.length),o=Fe(this.spec,t,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==e)return null;s-=1e4}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,e){let i=Fe(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value)}return s}highlight(t,e,i,s){let r=Fe(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Ve(n,t,e,i){return new Qh(t.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?lg(t.charCategorizer(t.selection.main.head)):void 0},e,i)}function On(n,t){return n.slice(ot(n,t,!1),t)}function Tn(n,t){return n.slice(t,ot(n,t))}function lg(n){return(t,e,i)=>!i[0].length||(n(On(i.input,i.index))!=G.Word||n(Tn(i.input,i.index))!=G.Word)&&(n(Tn(i.input,i.index+i[0].length))!=G.Word||n(On(i.input,i.index+i[0].length))!=G.Word)}class ag extends ec{nextMatch(t,e,i){let s=Ve(this.spec,t,i,t.doc.length).next();return s.done&&(s=Ve(this.spec,t,0,e).next()),s.done?null:s.value}prevMatchInRange(t,e,i){for(let s=1;;s++){let r=Math.max(e,i-s*1e4),o=Ve(this.spec,t,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==e||l.from>r+10))return l;if(r==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(e,i)=>i=="$"?"$":i=="&"?t.match[0]:i!="0"&&+i<t.match.length?t.match[i]:e)}matchAll(t,e){let i=Ve(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value)}return s}highlight(t,e,i,s){let r=Ve(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Oi=F.define(),Tr=F.define(),fe=bt.define({create(n){return new as(sr(n).create(),null)},update(n,t){for(let e of t.effects)e.is(Oi)?n=new as(e.value.create(),n.panel):e.is(Tr)&&(n=new as(n.query,e.value?Pr:null));return n},provide:n=>wn.from(n,t=>t.panel)});class as{constructor(t,e){this.query=t,this.panel=e}}const hg=P.mark({class:"cm-searchMatch"}),cg=P.mark({class:"cm-searchMatch cm-searchMatch-selected"}),fg=ut.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(fe))}update(n){let t=n.state.field(fe);(t!=n.startState.field(fe)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:n,panel:t}){if(!t||!n.spec.valid)return P.none;let{view:e}=this,i=new De;for(let s=0,r=e.visibleRanges,o=r.length;s<o;s++){let{from:l,to:a}=r[s];for(;s<o-1&&a>r[s+1].from-2*250;)a=r[++s].to;n.highlight(e.state,l,a,(h,c)=>{let f=e.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?cg:hg)})}return i.finish()}},{decorations:n=>n.decorations});function Ni(n){return t=>{let e=t.state.field(fe,!1);return e&&e.query.spec.valid?n(t,e):sc(t)}}const Pn=Ni((n,{query:t})=