first commit
This commit is contained in:
commit
c9b36775da
180 files changed
+18476
No files matched your search
@@ -0,0 +1,37 @@
|
||||
var zs=[],Bh=[];(()=>{let O="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(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<O.length;e++)(e%2?Bh:zs).push(t=t+O[e])})();function Nm(O){if(O<768)return!1;for(let e=0,t=zs.length;;){let i=e+t>>1;if(O<zs[i])t=i;else if(O>=Bh[i])e=i+1;else return!0;if(e==t)return!1}}function Mh(O){return O>=127462&&O<=127487}var Dh=8205;function Nh(O,e,t=!0,i=!0){return(t?Fh:Fm)(O,e,i)}function Fh(O,e,t){if(e==O.length)return e;e&&Hh(O.charCodeAt(e))&&Kh(O.charCodeAt(e-1))&&e--;let i=Rs(O,e);for(e+=Ih(i);e<O.length;){let r=Rs(O,e);if(i==Dh||r==Dh||t&&Nm(r))e+=Ih(r),i=r;else if(Mh(r)){let n=0,s=e-2;for(;s>=0&&Mh(Rs(O,s));)n++,s-=2;if(n%2==0)break;e+=2}else break}return e}function Fm(O,e,t){for(;e>0;){let i=Fh(O,e-2,t);if(i<e)return i;e--}return 0}function Rs(O,e){let t=O.charCodeAt(e);if(!Kh(t)||e+1==O.length)return t;let i=O.charCodeAt(e+1);return Hh(i)?(t-55296<<10)+(i-56320)+65536:t}function Hh(O){return O>=56320&&O<57344}function Kh(O){return O>=55296&&O<56320}function Ih(O){return O<65536?1:2}var G=class O{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=CO(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),UO.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=CO(this,e,t);let i=[];return this.decompose(e,t,i,0),UO.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new cO(this),n=new cO(e);for(let s=t,o=t;;){if(r.next(s),n.next(s),s=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(o+=r.value.length,r.done||o>=i)return!0}}iter(e=1){return new cO(this,e)}iterRange(e,t=this.length){return new Zr(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Vr(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?O.empty:e.length<=32?new Le(e):UO.from(Le.split(e,[]))}},Le=class O extends G{constructor(e,t=Hm(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let n=0;;n++){let s=this.text[n],o=r+s.length;if((t?i:o)>=e)return new Ws(r,o,i,s);r=o+1,i++}}decompose(e,t,i,r){let n=e<=0&&t>=this.length?this:new O(Jh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),o=Wr(n.text,s.text.slice(),0,n.length);if(o.length<=32)i.push(new O(o,s.length+n.length));else{let a=o.length>>1;i.push(new O(o.slice(0,a)),new O(o.slice(a)))}}else i.push(n)}replace(e,t,i){if(!(i instanceof O))return super.replace(e,t,i);[e,t]=CO(this,e,t);let r=Wr(this.text,Wr(i.text,Jh(this.text,0,e)),t),n=this.length+i.length-(t-e);return r.length<=32?new O(r,n):UO.from(O.split(r,[]),n)}sliceString(e,t=this.length,i=`
|
||||
`){[e,t]=CO(this,e,t);let r="";for(let n=0,s=0;n<=t&&s<this.text.length;s++){let o=this.text[s],a=n+o.length;n>e&&s&&(r+=i),e<a&&t>n&&(r+=o.slice(Math.max(0,e-n),t-n)),n=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let n of e)i.push(n),r+=n.length+1,i.length==32&&(t.push(new O(i,r)),i=[],r=-1);return r>-1&&t.push(new O(i,r)),t}},UO=class O extends G{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let n=0;;n++){let s=this.children[n],o=r+s.length,a=i+s.lines-1;if((t?a:o)>=e)return s.lineInner(e,t,i,r);r=o+1,i=a+1}}decompose(e,t,i,r){for(let n=0,s=0;s<=t&&n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e<=a&&t>=s){let l=r&((s<=e?1:0)|(a>=t?2:0));s>=e&&a<=t&&!l?i.push(o):o.decompose(e-s,t-s,i,l)}s=a+1}}replace(e,t,i){if([e,t]=CO(this,e,t),i.lines<this.lines)for(let r=0,n=0;r<this.children.length;r++){let s=this.children[r],o=n+s.length;if(e>=n&&t<=o){let a=s.replace(e-n,t-n,i),l=this.lines-s.lines+a.lines;if(a.lines<l>>4&&a.lines>l>>6){let h=this.children.slice();return h[r]=a,new O(h,this.length-(t-e)+i.length)}return super.replace(n,o,a)}n=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
||||
`){[e,t]=CO(this,e,t);let r="";for(let n=0,s=0;n<this.children.length&&s<=t;n++){let o=this.children[n],a=s+o.length;s>e&&n&&(r+=i),e<a&&t>s&&(r+=o.sliceString(e-s,t-s,i)),s=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof O))return 0;let i=0,[r,n,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,n+=t){if(r==s||n==o)return i;let a=this.children[r],l=e.children[n];if(a!=l)return i+a.scanIdentical(l,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let Q of e)Q.flatten(d);return new Le(d,t)}let r=Math.max(32,i>>5),n=r<<1,s=r>>1,o=[],a=0,l=-1,h=[];function c(d){let Q;if(d.lines>n&&d instanceof O)for(let p of d.children)c(p);else d.lines>s&&(a>s||!a)?(f(),o.push(d)):d instanceof Le&&a&&(Q=h[h.length-1])instanceof Le&&d.lines+Q.lines<=32?(a+=d.lines,l+=d.length+1,h[h.length-1]=new Le(Q.text.concat(d.text),Q.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,l+=d.length+1,h.push(d))}function f(){a!=0&&(o.push(h.length==1?h[0]:O.from(h,l)),l=-1,a=h.length=0)}for(let d of e)c(d);return f(),o.length==1?o[0]:new O(o,t)}};G.empty=new Le([""],0);function Hm(O){let e=-1;for(let t of O)e+=t.length+1;return e}function Wr(O,e,t=0,i=1e9){for(let r=0,n=0,s=!0;n<O.length&&r<=i;n++){let o=O[n],a=r+o.length;a>=t&&(a>i&&(o=o.slice(0,i-r)),r<t&&(o=o.slice(t-r)),s?(e[e.length-1]+=o,s=!1):e.push(o)),r=a+1}return e}function Jh(O,e,t){return Wr(O,[""],e,t)}var cO=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],n=this.offsets[i],s=n>>1,o=r instanceof Le?r.text.length:r.children.length;if(s==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof Le){let a=r.text[s+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[s+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Le?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Zr=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new cO(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Vr=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(G.prototype[Symbol.iterator]=function(){return this.iter()},cO.prototype[Symbol.iterator]=Zr.prototype[Symbol.iterator]=Vr.prototype[Symbol.iterator]=function(){return this});var Ws=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function CO(O,e,t){return e=Math.max(0,Math.min(O.length,e)),[e,Math.max(e,Math.min(O.length,t))]}function Qe(O,e,t=!0,i=!0){return Nh(O,e,t,i)}function Km(O){return O>=56320&&O<57344}function Jm(O){return O>=55296&&O<56320}function Pe(O,e){let t=O.charCodeAt(e);if(!Jm(t)||e+1==O.length)return t;let i=O.charCodeAt(e+1);return Km(i)?(t-55296<<10)+(i-56320)+65536:t}function yi(O){return O<=65535?String.fromCharCode(O):(O-=65536,String.fromCharCode((O>>10)+55296,(O&1023)+56320))}function De(O){return O<65536?1:2}var Zs=/\r\n?|\n/,$e=function(O){return O[O.Simple=0]="Simple",O[O.TrackDel=1]="TrackDel",O[O.TrackBefore=2]="TrackBefore",O[O.TrackAfter=3]="TrackAfter",O}($e||($e={})),qt=class O{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];s<0?(e(i,r,n),r+=n):r+=s,i+=n}}iterChangedRanges(e,t=!1){Vs(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new O(e)}composeDesc(e){return this.empty?e:e.empty?this:rc(this,e)}mapDesc(e,t=!1){return e.empty?this:Us(this,e,t)}mapPos(e,t=-1,i=$e.Simple){let r=0,n=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],a=this.sections[s++],l=r+o;if(a<0){if(l>e)return n+(e-r);n+=o}else{if(i!=$e.Simple&&l>=e&&(i==$e.TrackDel&&r<e&&l>e||i==$e.TrackBefore&&r<e||i==$e.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!o)return e==r||t<0?n:n+a;n+=a}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return n}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let n=this.sections[i++],s=this.sections[i++],o=r+n;if(s>=0&&r<=t&&o>=e)return r<e&&o>t?"cover":!0;r=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new O(e)}static create(e){return new O(e)}},ve=class O extends qt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Vs(this,(t,i,r,n,s)=>e=e.replace(r,r+(i-t),s),!1),e}mapDesc(e,t=!1){return Us(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,n=0;r<t.length;r+=2){let s=t[r],o=t[r+1];if(o>=0){t[r]=o,t[r+1]=s;let a=r>>1;for(;i.length<a;)i.push(G.empty);i.push(s?e.slice(n,n+s):G.empty)}n+=s}return new O(t,i)}compose(e){return this.empty?e:e.empty?this:rc(this,e,!0)}map(e,t=!1){return e.empty?this:Us(this,e,t,!0)}iterChanges(e,t=!1){Vs(this,e,t)}get desc(){return qt.c
Line truncated
|
||||
`}get readOnly(){return this.facet(cc)}phrase(e,...t){for(let i of this.facet(O.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let n=+(r||1);return!n||n>t.length?i:t[n-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let n of this.facet(sc))for(let s of n(this,t,i))Object.prototype.hasOwnProperty.call(s,e)&&r.push(s[e]);return r}charCategorizer(e){return ag(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),n=this.charCategorizer(e),s=e-i,o=e-i;for(;s>0;){let a=Qe(t,s,!1);if(n(t.slice(a,s))!=K.Word)break;s=a}for(;o<r;){let a=Qe(t,o);if(n(t.slice(o,a))!=K.Word)break;o=a}return s==o?null:S.range(s+i,o+i)}};M.allowMultipleSelections=js;M.tabSize=v.define({combine:O=>O.length?O[0]:4});M.lineSeparator=oc;M.readOnly=cc;M.phrases=v.define({compare(O,e){let t=Object.keys(O),i=Object.keys(e);return t.length==i.length&&t.every(r=>O[r]==e[r])}});M.languageData=sc;M.changeFilter=ac;M.transactionFilter=lc;M.transactionExtender=hc;GO.reconfigure=W.define();function Te(O,e,t={}){let i={};for(let r of O)for(let n of Object.keys(r)){let s=r[n],o=i[n];if(o===void 0)i[n]=s;else if(!(o===s||s===void 0))if(Object.hasOwnProperty.call(t,n))i[n]=t[n](o,s);else throw new Error("Config merge conflict for field "+n)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}var at=class{eq(e){return this==e}range(e,t=e){return Si.create(e,t,this)}};at.prototype.startSide=at.prototype.endSide=0;at.prototype.point=!1;at.prototype.mapMode=$e.TrackDel;var Si=class O{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new O(e,t,i)}};function Ls(O,e){return O.from-e.from||O.value.startSide-e.value.startSide}var Ms=class O{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let n=i?this.to:this.from;for(let s=r,o=n.length;;){if(s==o)return s;let a=s+o>>1,l=n[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==s)return l>=0?s:o;l>=0?o=a:s=a+1}}between(e,t,i,r){for(let n=this.findIndex(t,-1e9,!0),s=this.findIndex(i,1e9,!1,n);n<s;n++)if(r(this.from[n]+e,this.to[n]+e,this.value[n])===!1)return!1}map(e,t){let i=[],r=[],n=[],s=-1,o=-1;for(let a=0;a<this.value.length;a++){let l=this.value[a],h=this.from[a]+e,c=this.to[a]+e,f,d;if(h==c){let Q=t.mapPos(h,l.startSide,l.mapMode);if(Q==null||(f=d=Q,l.startSide!=l.endSide&&(d=t.mapPos(h,l.endSide),d<f)))continue}else if(f=t.mapPos(h,l.startSide),d=t.mapPos(c,l.endSide),f>d||f==d&&l.startSide>0&&l.endSide<=0)continue;(d-f||l.endSide-l.startSide)<0||(s<0&&(s=f),l.point&&(o=Math.max(o,d-f)),i.push(l),r.push(f-s),n.push(d-s))}return{mapped:i.length?new O(r,n,i,o):null,pos:s}}},N=class O{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new O(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:n=this.length}=e,s=e.filter;if(t.length==0&&!s)return this;if(i&&(t=t.slice().sort(Ls)),this.isEmpty)return t.length?O.of(t):this;let o=new Cr(this,null,-1).goto(0),a=0,l=[],h=new Me;for(;o.value||a<t.length;)if(a<t.length&&(o.from-t[a].from||o.startSide-t[a].value.startSide)>=0){let c=t[a++];h.addInner(c.from,c.to,c.value)||l.push(c)}else o.rangeIndex==1&&o.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(o.chunkIndex)<t[a].from)&&(!s||r>this.chunkEnd(o.chunkIndex)||n<this.chunkPos[o.chunkIndex])&&h.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||r>o.to||n<o.from||s(o.from,o.to,o.value))&&(h.addInner(o.from,o.to,o.value)||l.push(Si.create(o.from,o.to,o.value))),o.next());return h.finishInner(this.nextLayer.isEmpty&&!l.length?O.empty:this.nextLayer.update({add:l,filter:s,filterFrom:r,filterTo:n}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1;for(let s=0;s<this.chunk.length;s++){let o=this.chunkPos[s],a=this.chunk[s],l=e.touchesRange(o,o+a.length);if(l===!1)r=Math.max(r,a.maxPoint),t.push(a),i.push(e.mapPos(o));else if(l===!0){let{mapped:h,pos:c}=a.map(o,e);h&&(r=Math.max(r,h.maxPoint),t.push(h),i.push(c))}}let n=this.nextLayer.map(e);return t.length==0?n:new O(i,t,n||O.empty,r)}between(e,t,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let n=this.chunkPos[r],s=this.chunk[r];if(t>=n&&e<=n+s.length&&s.between(n,e-n,t-n,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Pi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Pi.from(e).goto(t)}static compare(e,t,i,r,n=-1){let s=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=n),o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=n),a=tc(s,o,i),l=new hO
Line truncated
|
||||
`)}static newName(){let e=Qc[dc]||1;return Qc[dc]=e+1,Ns+e.toString(36)}static mount(e,t,i){let r=e[Fs],n=i&&i.nonce;r?n&&r.setNonce(n):r=new Hs(e,n),r.mount(Array.isArray(t)?t:[t],e)}},pc=new Map,Hs=class{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let n=pc.get(i);if(n)return e[Fs]=n;this.sheet=new r.CSSStyleSheet,pc.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Fs]=this}mount(e,t){let i=this.sheet,r=0,n=0;for(let s=0;s<e.length;s++){let o=e[s],a=this.modules.indexOf(o);if(a<n&&a>-1&&(this.modules.splice(a,1),n--,a=-1),a==-1){if(this.modules.splice(n++,0,o),i)for(let l=0;l<o.rules.length;l++)i.insertRule(o.rules[l],r++)}else{for(;n<a;)r+=this.modules[n++].rules.length;r+=o.rules.length,n++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let s="";for(let a=0;a<this.modules.length;a++)s+=this.modules[a].getRules()+`
|
||||
`;this.styleTag.textContent=s;let o=t.head||t;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Rt={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:"'"},EO={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hg=typeof navigator<"u"&&/Mac/.test(navigator.platform),cg=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(pe=0;pe<10;pe++)Rt[48+pe]=Rt[96+pe]=String(pe);var pe;for(pe=1;pe<=24;pe++)Rt[pe+111]="F"+pe;var pe;for(pe=65;pe<=90;pe++)Rt[pe]=String.fromCharCode(pe+32),EO[pe]=String.fromCharCode(pe);var pe;for(Er in Rt)EO.hasOwnProperty(Er)||(EO[Er]=Rt[Er]);var Er;function $c(O){var e=hg&&O.metaKey&&O.shiftKey&&!O.ctrlKey&&!O.altKey||cg&&O.shiftKey&&O.key&&O.key.length==1||O.key=="Unidentified",t=!e&&O.key||(O.shiftKey?EO:Rt)[O.keyCode]||O.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function B(){var O=arguments[0];typeof O=="string"&&(O=document.createElement(O));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?O.setAttribute(i,r):r!=null&&(O[i]=r)}e++}for(;e<arguments.length;e++)mc(O,arguments[e]);return O}function mc(O,e){if(typeof e=="string")O.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)O.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)mc(O,e[t]);else throw new RangeError("Unsupported child node: "+e)}function Zi(O){let e;return O.nodeType==11?e=O.getSelection?O:O.ownerDocument:e=O,e.getSelection()}function no(O,e){return e?O==e||O.contains(e.nodeType!=1?e.parentNode:e):!1}function Kr(O,e){if(!e.anchorNode)return!1;try{return no(O,e.anchorNode)}catch{return!1}}function Vi(O){return O.nodeType==3?QO(O,0,O.nodeValue.length).getClientRects():O.nodeType==1?O.getClientRects():[]}function wi(O,e,t,i){return t?gc(O,e,t,i,-1)||gc(O,e,t,i,1):!1}function dO(O){for(var e=0;;e++)if(O=O.previousSibling,!O)return e}function sn(O){return O.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(O.nodeName)}function gc(O,e,t,i,r){for(;;){if(O==t&&e==i)return!0;if(e==(r<0?0:St(O))){if(O.nodeName=="DIV")return!1;let n=O.parentNode;if(!n||n.nodeType!=1)return!1;e=dO(O)+(r<0?0:1),O=n}else if(O.nodeType==1){if(O=O.childNodes[e+(r<0?-1:0)],O.nodeType==1&&O.contentEditable=="false")return!1;e=r<0?St(O):0}else return!1}}function St(O){return O.nodeType==3?O.nodeValue.length:O.childNodes.length}function Pn(O,e){let t=e?O.left:O.right;return{left:t,right:t,top:O.top,bottom:O.bottom}}function fg(O){let e=O.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:O.innerWidth,top:0,bottom:O.innerHeight}}function af(O,e){let t=e.width/O.offsetWidth,i=e.height/O.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-O.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-O.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ug(O,e,t,i,r,n,s,o){let a=O.ownerDocument,l=a.defaultView||window;for(let h=O,c=!1;h&&!c;)if(h.nodeType==1){let f,d=h==a.body,Q=1,p=1;if(d)f=fg(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(c=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let g=h.getBoundingClientRect();({scaleX:Q,scaleY:p}=af(h,g)),f={left:g.left,right:g.left+h.clientWidth*Q,top:g.top,bottom:g.top+h.clientHeight*p}}let $=0,m=0;if(r=="nearest")e.top<f.top?(m=e.top-(f.top+s),t>0&&e.bottom>f.bottom+m&&(m=e.bottom-f.bottom+s)):e.bottom>f.bottom&&(m=e.bottom-f.bottom+s,t<0&&e.top-m<f.top&&(m=e.top-(f.top+s)));else{let g=e.bottom-e.top,y=f.bottom-f.top;m=(r=="center"&&g<=y?e.top+g/2-y/2:r=="start"||r=="center"&&t<0?e.top-s:e.bottom-y+s)-f.top}if(i=="nearest"?e.left<f.left?($=e.left-(f.left+n),t>0&&e.right>f.right+$&&($=e.right-f.right+n)):e.right>f.right&&($=e.right-f.right+n,t<0&&e.left<f.left+$&&($=e.left-(f.left+n))):$=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==o?e.left-n:e.right-(f.right-f.left)+n)-f.left,$||m)if(d)l.scrollBy($,m);else{let g=0,y=0;if(m){let X=h.sLine truncated
|
||||
`,r=O.state.doc.line(r.number+(t?1:-1)),n=O.bidiSpans(r),l=O.visualLineSide(r,!t)}if(a){if(!a(h))return o}else{if(!i)return l;a=i(h)}o=l}}function Dg(O,e,t){let i=O.state.charCategorizer(e),r=i(t);return n=>{let s=i(n);return r==K.Space&&(r=s),r==s}}function Ig(O,e,t,i){let r=e.head,n=t?1:-1;if(r==(t?O.state.doc.length:0))return S.cursor(r,e.assoc);let s=e.goalColumn,o,a=O.contentDOM.getBoundingClientRect(),l=O.coordsAtPos(r,e.assoc||-1),h=O.documentTop;if(l)s==null&&(s=l.left-a.left),o=n<0?l.top:l.bottom;else{let d=O.viewState.lineBlockAt(r);s==null&&(s=Math.min(a.right-a.left,O.defaultCharacterWidth*(r-d.from))),o=(n<0?d.top:d.bottom)+h}let c=a.left+s,f=i??O.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let Q=o+(f+d)*n,p=Ef(O,{x:c,y:Q},!1,n);if(Q<a.top||Q>a.bottom||(n<0?p<r:p>r)){let $=O.docView.coordsForChar(p),m=!$||Q<$.top?-1:1;return S.cursor(p,m,void 0,s)}}}function en(O,e,t){for(;;){let i=0;for(let r of O)r.between(e-1,e+1,(n,s,o)=>{if(e>n&&e<s){let a=i||t||(e-n<s-e?-1:1);e=a<0?n:s,i=a}});if(!i)return e}}function eo(O,e,t){let i=en(O.state.facet(Ko).map(r=>r(O)),t.from,e.head>t.from?-1:1);return i==t.from?t:S.cursor(i,i<t.from?1:-1)}var bi="\uFFFF",go=class{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(M.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=bi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let n=this.text.length;this.readNode(r);let s=r.nextSibling;if(s==t)break;let o=re.get(r),a=re.get(s);(o&&a?o.breakAfter:(o?o.breakAfter:sn(r))||sn(s)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>n)&&this.lineBreak(),r=s}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,r=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,s=1,o;if(this.lineSeparator?(n=t.indexOf(this.lineSeparator,i),s=this.lineSeparator.length):(o=r.exec(t))&&(n=o.index,s=o[0].length),this.append(t.slice(i,n<0?t.length:n)),n<0)break;if(this.lineBreak(),s>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=s-1);i=n+s}}readNode(e){if(e.cmIgnore)return;let t=re.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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+(Bg(e,i.node,i.offset)?t:0))}};function Bg(O,e,t){for(;;){if(!e||t<St(e))return!1;if(e==O)return!0;t=dO(e)+1,e=e.parentNode}}var cn=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},So=class{constructor(e,t,i,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:n,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let o=n||s?[]:Hg(e),a=new go(o,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Kg(o,this.bounds.from)}else{let o=e.observer.selectionRange,a=n&&n.node==o.focusNode&&n.offset==o.focusOffset||!no(e.contentDOM,o.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(o.focusNode,o.focusOffset),l=s&&s.node==o.anchorNode&&s.offset==o.anchorOffset||!no(e.contentDOM,o.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(o.anchorNode,o.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&a!=l&&(h.from>0||h.to<e.state.doc.length)){let c=Math.min(a,l),f=Math.max(a,l),d=h.from-c,Q=h.to-f;(d==0||d==1||c==0)&&(Q==0||Q==-1||f==e.state.doc.length)&&(a=0,l=e.state.doc.length)}this.newSel=S.single(l,a)}}};function Af(O,e){let t,{newSel:i}=e,r=O.state.selection.main,n=O.inputState.lastKeyTime>Date.now()-100?O.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:o}=e.bounds,a=r.from,l=null;(n===8||q.android&&e.text.length<o-s)&&(a=r.to,l="end");let h=Fg(O.state.doc.sliceString(s,o,bi),e.text,a-s,l);h&&(q.chrome&&n==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==bi+bi&&h.toB--,t={from:s+h.from,to:s+h.toA,insert:G.of(e.text.slice(h.from,h.toB).split(bi))})}else i&&(!O.hasFocus&&O.state.facet(zt)||i.main.eq(r))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!r.empty&&i&&i.main.empty?t={from:r.from,to:r.to,insert:O.state.doc.slice(r.from,r.to)}:(q.mac||q.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&O.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:G.of([t.insert.toString().replace("."," ")])}):t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,i
Line truncated
|
||||
`&&O.lineWrapping&&(i&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:G.of([" "])}),t)return ea(O,t,i,n);if(i&&!i.main.eq(r)){let s=!1,o="select";return O.inputState.lastSelectionTime>Date.now()-50&&(O.inputState.lastSelectionOrigin=="select"&&(s=!0),o=O.inputState.lastSelectionOrigin),O.dispatch({selection:i,scrollIntoView:s,userEvent:o}),!0}else return!1}function ea(O,e,t,i=-1){if(q.ios&&O.inputState.flushIOSKey(e))return!0;let r=O.state.selection.main;if(q.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&O.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&BO(O.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&BO(O.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&BO(O.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();O.inputState.composing>=0&&O.inputState.composing++;let s,o=()=>s||(s=Ng(O,e,t));return O.state.facet(Rf).some(a=>a(O,e.from,e.to,n,o))||O.dispatch(o()),!0}function Ng(O,e,t){let i,r=O.state,n=r.selection.main;if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&O.inputState.composing<0){let o=n.from<e.from?r.sliceDoc(n.from,e.from):"",a=n.to>e.to?r.sliceDoc(e.to,n.to):"";i=r.replaceSelection(O.state.toText(o+e.insert.sliceString(0,void 0,O.state.lineBreak)+a))}else{let o=r.changes(e),a=t&&t.main.to<=o.newLength?t.main:void 0;if(r.selection.ranges.length>1&&O.inputState.composing>=0&&e.to<=n.to&&e.to>=n.to-10){let l=O.state.sliceDoc(e.from,e.to),h,c=t&&Gf(O,t.main.head);if(c){let Q=e.insert.length-(e.to-e.from);h={from:c.from,to:c.to-Q}}else h=O.state.doc.lineAt(n.head);let f=n.to-e.to,d=n.to-n.from;i=r.changeByRange(Q=>{if(Q.from==n.from&&Q.to==n.to)return{changes:o,range:a||Q.map(o)};let p=Q.to-f,$=p-l.length;if(Q.to-Q.from!=d||O.state.sliceDoc($,p)!=l||Q.to>=h.from&&Q.from<=h.to)return{range:Q};let m=r.changes({from:$,to:p,insert:e.insert}),g=Q.to-n.to;return{changes:m,range:a?S.range(Math.max(0,a.anchor+g),Math.max(0,a.head+g)):Q.map(m)}})}else i={changes:o,selection:a&&r.selection.replaceRange(a)}}let s="input.type";return(O.composing||O.inputState.compositionPendingChange&&O.inputState.compositionEndedAt>Date.now()-50)&&(O.inputState.compositionPendingChange=!1,s+=".compose",O.inputState.compositionFirstChange&&(s+=".start",O.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:s,scrollIntoView:!0})}function Fg(O,e,t,i){let r=Math.min(O.length,e.length),n=0;for(;n<r&&O.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==r&&O.length==e.length)return null;let s=O.length,o=e.length;for(;s>0&&o>0&&O.charCodeAt(s-1)==e.charCodeAt(o-1);)s--,o--;if(i=="end"){let a=Math.max(0,n-Math.min(s,o));t-=s+a-n}if(s<n&&O.length<e.length){let a=t<=n&&t>=s?n-t:0;n-=a,o=n+(o-s),s=n}else if(o<n){let a=t<=n&&t>=o?n-t:0;n-=a,s=n+(s-o),o=n}return{from:n,toA:s,toB:o}}function Hg(O){let e=[];if(O.root.activeElement!=O.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:n}=O.observer.selectionRange;return t&&(e.push(new cn(t,i)),(r!=t||n!=i)&&e.push(new cn(r,n))),e}function Kg(O,e){if(O.length==0)return null;let t=O[0].pos,i=O.length==2?O[1].pos:t;return t>-1&&i>-1?S.single(t+e,i+e):null}var Po=class{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,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&uS(e.contentDOM.ownerDocument)}handleEvent(e){!nS(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 r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Jg(e),i=this.handlers,r=this.view.contentDOM;for(let n in t)if(n!="scroll"){let s=!t[n].handlers.length,o=i[n];o&&s!=!o.handlers.length&&(r.removeEventListener(n,this.handleEvent),o=null),o||r.addEventListener(n,this.handleEvent,{passive:s})}for(let n in i)n!="scroll"&&!t[n]&&r.removeEventListener(n,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.tabFocusMo
Line truncated
|
||||
`))};if(l.from==this.from&&n<this.from?l.from=n:l.to==this.to&&n>this.to&&(l.to=n),l.from==l.to&&!l.insert.length){let h=S.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));h.main.eq(r)||e.dispatch({selection:h,userEvent:"select"});return}if((q.mac||q.android)&&l.from==s-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(l={from:o,to:a,insert:G.of([i.text.replace("."," ")])}),this.pendingContextChange=l,!e.state.readOnly){let h=this.to-this.from+(l.to-l.from+l.insert.length);ea(e,l,S.single(this.toEditorPos(i.selectionStart,h),this.toEditorPos(i.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=i=>{let r=[],n=null;for(let s=this.toEditorPos(i.rangeStart),o=this.toEditorPos(i.rangeEnd);s<o;s++){let a=e.coordsForChar(s);n=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||n||new DOMRect,r.push(n)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let n of i.getTextFormats()){let s=n.underlineStyle,o=n.underlineThickness;if(s!="None"&&o!="None"){let a=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);if(a<l){let h=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${o=="Thin"?1:2}px`;r.push(R.mark({attributes:{style:h}}).range(a,l))}}}e.dispatch({effects:Vf.of(R.set(r))})},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 r=Zi(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((n,s,o,a,l)=>{if(i)return;let h=l.length-(s-n);if(r&&s>=r.to)if(r.from==n&&r.to==s&&r.insert.eq(l)){r=this.pendingContextChange=null,t+=h,this.to+=h;return}else r=null,this.revertPending(e.state);if(n+=t,s+=t,s<=this.from)this.from+=h,this.to+=h;else if(n<this.to){if(n<this.from||s>this.to||this.to-this.from+l.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(s),l.toString()),this.to+=h}t+=h}),r&&!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(r=>!r.isUserEvent("input.type")&&r.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))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}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])}},b=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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(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.measureRequest
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,jo),_S={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"},Oo=null;function jS(){var O;if(Oo==null&&typeof document<"u"&&document.body){let e=document.body.style;Oo=((O=e.tabSize)!==null&&O!==void 0?O:e.MozTabSize)!=null}return Oo||!1}var rn=v.define({combine(O){let e=Te(O,{render:null,specialChars:US,addSpecialChars:null});return(e.replaceTabs=!jS())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,jo)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,jo)),e}});function hu(O={}){return[rn.of(O),CS()]}var Jc=null;function CS(){return Jc||(Jc=fe.fromClass(class{constructor(O){this.view=O,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(O.state.facet(rn)),this.decorations=this.decorator.createDeco(O)}makeDecorator(O){return new _o({regexp:O.specialChars,decoration:(e,t,i)=>{let{doc:r}=t.state,n=Pe(e[0],0);if(n==9){let s=r.lineAt(i),o=t.state.tabSize,a=qe(s.text,o,i-s.from);return R.replace({widget:new Go((o-a%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[n]||(this.decorationCache[n]=R.replace({widget:new Co(O,n)}))},boundary:O.replaceTabs?void 0:/[^]/})}update(O){let e=O.state.facet(rn);O.startState.facet(rn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(O.view)):this.decorations=this.decorator.updateDeco(O,this.decorations)}},{decorations:O=>O.decorations}))}var GS="\u2022";function ES(O){return O>=32?GS:O==10?"\u2424":String.fromCharCode(9216+O)}var Co=class extends Ue{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=ES(this.code),i=e.state.phrase("Control character")+" "+(_S[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,t);if(r)return r;let n=document.createElement("span");return n.textContent=t,n.title=i,n.setAttribute("aria-label",i),n.className="cm-specialChar",n}ignoreEvent(){return!1}},Go=class extends Ue{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}};function cu(){return LS}var AS=R.line({class:"cm-activeLine"}),LS=fe.fromClass(class{constructor(O){this.decorations=this.getDeco(O)}update(O){(O.docChanged||O.selectionSet)&&(this.decorations=this.getDeco(O.view))}getDeco(O){let e=-1,t=[];for(let i of O.state.selection.ranges){let r=O.lineBlockAt(i.head);r.from>e&&(t.push(AS.range(r.from)),e=r.from)}return R.set(t)}},{decorations:O=>O.decorations});var Eo=2e3;function MS(O,e,t){let i=Math.min(e.line,t.line),r=Math.max(e.line,t.line),n=[];if(e.off>Eo||t.off>Eo||e.col<0||t.col<0){let s=Math.min(e.off,t.off),o=Math.max(e.off,t.off);for(let a=i;a<=r;a++){let l=O.doc.line(a);l.length<=o&&n.push(S.range(l.from+s,l.to+o))}}else{let s=Math.min(e.col,t.col),o=Math.max(e.col,t.col);for(let a=i;a<=r;a++){let l=O.doc.line(a),h=Gr(l.text,s,O.tabSize,!0);if(h<0)n.push(S.cursor(l.to));else{let c=Gr(l.text,o,O.tabSize);n.push(S.range(l.from+h,l.from+c))}}}return n}function DS(O,e){let t=O.coordsAtPos(O.viewport.from);return t?Math.round(Math.abs((t.left-e)/O.defaultCharacterWidth)):-1}function ef(O,e){let t=O.posAtCoords({x:e.clientX,y:e.clientY},!1),i=O.state.doc.lineAt(t),r=t-i.from,n=r>Eo?-1:r==i.length?DS(O,e.clientX):qe(i.text,O.state.tabSize,t-i.from);return{line:i.number,col:n,off:r}}function IS(O,e){let t=ef(O,e),i=O.state.selection;return t?{update(r){if(r.docChanged){let n=r.changes.mapPos(r.startState.doc.line(t.line).from),s=r.state.doc.lineAt(n);t={line:s.number,col:t.col,off:Math.min(t.off,s.length)},i=i.map(r.changes)}},get(r,n,s){let o=ef(O,r);if(!o)return i;let a=MS(O.state,t,o);return a.length?s?S.create(a.concat(i.ranges)):S.create(a):i}}:null}function fu(O){let e=O?.eventFilter||(t=>t.altKey&&t.button==0);return b.mouseSelectionStyle.of((t,i)=>e(i)?IS(t,i):null)}var BS={Alt:[18,O=>!!O.altKey],Control:[17,O=>!!O.ctrlKey],Shift:[16,O=>!!O.shiftKey],Meta:[91,O=>!!O.metaKey]},NS={style:"cursor: crosshair"};function uu(O={}){let[e,t]=BS[O.key||"Alt"],i=fe.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[i,b.contentAttributes.o
Line truncated
|
||||
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Aa(this):new Ea(this)}getCursor(e,t=0,i){let r=e.doc?e:M.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Oi(this,r,t,i):ti(this,r,t,i)}},Kn=class{constructor(e){this.spec=e}};function ti(O,e,t,i){return new sO(e.doc,O.unquoted,t,i,O.caseSensitive?void 0:r=>r.toLowerCase(),O.wholeWord?PX(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function PX(O,e){return(t,i,r,n)=>((n>t||n+r.length<i)&&(n=Math.max(0,t-2),r=O.sliceString(n,Math.min(O.length,i+2))),(e(Jn(r,t-n))!=K.Word||e(es(r,t-n))!=K.Word)&&(e(es(r,i-n))!=K.Word||e(Jn(r,i-n))!=K.Word))}var Ea=class extends Kn{constructor(e){super(e)}nextMatch(e,t,i){let r=ti(this.spec,e,i,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=ti(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==i?null:r.value}prevMatchInRange(e,t,i){for(let r=i;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),s=ti(this.spec,e,n,r),o=null;for(;!s.nextOverlapping().done;)o=s.value;if(o)return o;if(n==t)return null;r-=1e4}}prevMatch(e,t,i){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=i)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=ti(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let n=ti(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)r(n.value.from,n.value.to)}};function Oi(O,e,t,i){return new In(e.doc,O.search,{ignoreCase:!O.caseSensitive,test:O.wholeWord?yX(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function Jn(O,e){return O.slice(Qe(O,e,!1),e)}function es(O,e){return O.slice(e,Qe(O,e))}function yX(O){return(e,t,i)=>!i[0].length||(O(Jn(i.input,i.index))!=K.Word||O(es(i.input,i.index))!=K.Word)&&(O(es(i.input,i.index+i[0].length))!=K.Word||O(Jn(i.input,i.index+i[0].length))!=K.Word)}var Aa=class extends Kn{nextMatch(e,t,i){let r=Oi(this.spec,e,i,e.doc.length).next();return r.done&&(r=Oi(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let n=Math.max(t,i-r*1e4),s=Oi(this.spec,e,n,i),o=null;for(;!s.next().done;)o=s.value;if(o&&(n==t||o.from>n+10))return o;if(n==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let n=+i.slice(0,r);if(n>0&&n<e.match.length)return e.match[n]+i.slice(r)}return t})}matchAll(e,t){let i=Oi(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let n=Oi(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!n.next().done;)r(n.value.from,n.value.to)}},or=W.define(),Ia=W.define(),nO=he.define({create(O){return new sr(La(O).create(),null)},update(O,e){for(let t of e.effects)t.is(or)?O=new sr(t.value.create(),O.panel):t.is(Ia)&&(O=new sr(O.query,t.value?Ba:null));return O},provide:O=>$O.from(O,e=>e.panel)});var sr=class{constructor(e,t){this.query=e,this.panel=t}},XX=R.mark({class:"cm-searchMatch"}),xX=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),bX=fe.fromClass(class{constructor(O){this.view=O,this.decorations=this.highlight(O.state.field(nO))}update(O){let e=O.state.field(nO);(e!=O.startState.field(nO)||O.docChanged||O.selectionSet||O.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:O,panel:e}){if(!e||!O.spec.valid)return R.none;let{view:t}=this,i=new Me;for(let r=0,n=t.visibleRanges,s=n.length;r<s;r++){let{from:o,to:a}=n[r];for(;r<s-1&&a>n[r+1].from-2*250;)a=n[++r].to;O.highlight(t.state,o,a,(l,h)=>{let c=t.state.selection.ranges.some(f=>f.from==l&&f.to==h);i.add(l,h,c?xX:XX)})}return i.finish()}},{decorations:O=>O.decorations});function ar(O){return e=>{let t=e.state.field(nO,!1);return t&&t.query.spec.valid?O(e,t):OQ(e)}}var ts=ar((O,{query:e})=>{let{to:t}=O.state.selection.main,i=e.nextMatch(O.state,t,t);if(!i)return!1;let r=S.single(i.from,i.to),n=O.state.facet(ii);return O.dispatch({selection:r,effects:[Na(O,i),n.scrollToMatch(r.main,O)],userEvent:"select.search"}),tQ(O),!0}),Os=ar((O,{query:e})=>{let{state:t}=O,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)return!1;let n=S.single(r.from,r.to),s=O.state.facet(ii);return O.dispatch({selection:n,effects:[Na(O,r),s.scrollToMatch(n.main,O)],userEvent:"select.search"}),tQ(O),!0}),TX=ar((O,{query:e})=>{let t=e.matchAll(O.state,1e3);return!t||!t.length?!1:(O.dispatch({selection:S.create(t.map(i=>S.range(i.from,i.to)
Line truncated
|
||||
\${}
|
||||
}`,{label:"select",detail:"statement",type:"keyword"}),V("case ${}:\n${}",{label:"case",type:"keyword"}),V("switch ${} {\n ${}\n}",{label:"switch",detail:"statement",type:"keyword"}),V("switch ${}.(${type}) {\n ${}\n}",{label:"switch",detail:"type statement",type:"keyword"}),V("if ${} {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),V(`if \${} {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),V('import ${name} "${module}"\n${}',{label:"import",detail:"declaration",type:"keyword"})],hp=new Xt,fp=new Set(["SourceFile","Block","FunctionDecl","MethodDecl","FunctionLiteral","ForStatement","SwitchStatement","TypeSwitchStatement","IfStatement"]);function li(O,e){return(t,i)=>{e:for(let r=t.node.firstChild,n=0,s=null;;){for(;!r;){if(!n)break e;n--,r=s.nextSibling,s=s.parent}e&&r.name==e||r.name=="SpecList"?(n++,s=r,r=r.firstChild):(r.name=="DefName"&&i(r,O),r=r.nextSibling)}return!0}}var px={FunctionDecl:li("function"),VarDecl:li("var","VarSpec"),ConstDecl:li("constant","ConstSpec"),TypeDecl:li("type","TypeSpec"),ImportDecl:li("constant","ImportSpec"),Parameter:li("var"),__proto__:null};function up(O,e){let t=hp.get(e);if(t)return t;let i=[],r=!0;function n(s,o){let a=O.sliceString(s.from,s.to);i.push({label:a,type:o})}return e.cursor(A.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let o=px[s.name];if(o&&o(s,n)||fp.has(s.name))return!1}else if(s.to-s.from>8192){for(let o of up(O,s.node))i.push(o);return!1}}),hp.set(e,i),i}var cp=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,dp=["String","LineComment","BlockComment","DefName","LabelName","FieldName",".","?."],$x=O=>{let e=j(O.state).resolveInner(O.pos,-1);if(dp.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&cp.test(O.state.sliceDoc(e.from,e.to));if(!t&&!O.explicit)return null;let i=[];for(let r=e;r;r=r.parent)fp.has(r.name)&&(i=i.concat(up(O.state.doc,r)));return{options:i,from:t?e.from:O.pos,validFor:cp}},Rl=ae.define({name:"go",parser:lp.configure({props:[le.add({IfStatement:ce({except:/^\s*({|else\b)/}),LabeledStatement:iO,"SwitchBlock SelectBlock":O=>{let e=O.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return O.baseIndent+(t||i?0:O.unit)},Block:xe({closing:"}"}),BlockComment:()=>null,Statement:ce({except:/^{/})}),ne.add({"Block SwitchBlock SelectBlock LiteralValue InterfaceType StructType SpecList":me,BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case\b|default\b|\})$/}}),mx=O=>({label:O,type:"keyword"}),gx="interface struct chan map package go return break continue goto fallthrough else defer range true false nil".split(" ").map(mx);function Qp(){let O=Qx.concat(gx);return new Oe(Rl,[Rl.data.of({autocomplete:si(dp,wO(O))}),Rl.data.of({autocomplete:$x})])}var Sx=54,Px=1,yx=55,Xx=2,xx=56,bx=3,pp=4,Tx=5,Qs=6,xp=7,bp=8,Tp=9,kp=10,kx=11,wx=12,vx=13,zl=57,qx=14,$p=58,wp=20,Rx=22,vp=23,zx=24,Wl=26,qp=27,Yx=28,Wx=31,Zx=34,Vx=36,Ux=37,_x=0,jx=1,Cx={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Gx={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},mp={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Ex(O){return O==45||O==46||O==58||O>=65&&O<=90||O==95||O>=97&&O<=122||O>=161}function Rp(O){return O==9||O==10||O==13||O==32}var gp=null,Sp=null,Pp=0;function Zl(O,e){let t=O.pos+e;if(Pp==t&&Sp==O)return gp;let i=O.peek(e);for(;Rp(i);)i=O.peek(++e);let r="";for(;Ex(i);)r+=String.fromCharCode(i),i=O.peek(++e);return Sp=O,Pp=t,gp=r?r.toLowerCase():i==Ax||i==Lx?void 0:null}var zp=60,ps=62,Vl=47,Ax=63,Lx=33,Mx=45;function yp(O,e){this.name=O,this.parent=e}var Dx=[Qs,kp,xp,bp,Tp],Ix=new Ge({start:null,shift(O,e,t,i){return Dx.indexOf(e)>-1?new yp(Zl(i,1)||"",O):O},reduce(O,e){return e==wp&&O?O.parent:O},reuse(O,e,t,i){let r=e.type.id;return r==Qs||r==Vx?new yp(Zl(i,1)||"",O):O},strict:!1}),Bx=new U((O,e)=>{if(O.next!=zp){O.next<0&&e.context&&O.acceptToken(zl);return}O.advance();let t=O.next==Vl;t&&O.advance();let i=Zl(O,0);if(i===void 0)return;if(!i)return O.acceptToken(t?qx:Qs);let r=e.context?e.context.name:null;if(t){if(i==r)return O.acceptToken(kx);if(r&&Gx[r])return O.acceptToken(zl,-2);if(e.dialectEnabled(_x))return O.acceptToken(wx);for(let n=e.context;n;n=n.parent)if(n.name==i)return;O.acceptToken(vx)}else{if(i=="script")return O.acceptToken(xp);if(i=="style")return O.acceptToken(bp);if(i=="textarea")return O.acceptToken(Tp);if(Cx.hasOwnProperty(i))return O.acceptToken(kp);r&&mp[r]&&mp[r][i]?O.acceptToken(zl,-1):O.acceptToken(Qs)}},{contextual:!0}),Nx=new U(O=>{for(let e=0,t=0;;t++){if(O.next<0){t&&O.acceptToken($p);break}if(O.next==Mx)e++;else if(O.next==ps&&e>=2){t>=3&&O.acceptToken($p,-2);break}else e=0;O.advance()}});function Fx(O){for(;O;O=O
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),V("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),V(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),V(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),V('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),V('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],zb=Gp.concat([V("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),V("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),V("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),_p=new Xt,Ep=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function mr(O){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,O),!0}}var Yb=["FunctionDeclaration"],Wb={FunctionDeclaration:mr("function"),ClassDeclaration:mr("class"),ClassExpression:()=>!0,EnumDeclaration:mr("constant"),TypeAliasDeclaration:mr("type"),NamespaceDeclaration:mr("namespace"),VariableDefinition(O,e){O.matchContext(Yb)||e(O,"variable")},TypeDefinition(O,e){e(O,"type")},__proto__:null};function Ap(O,e){let t=_p.get(e);if(t)return t;let i=[],r=!0;function n(s,o){let a=O.sliceString(s.from,s.to);i.push({label:a,type:o})}return e.cursor(A.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let o=Wb[s.name];if(o&&o(s,n)||Ep.has(s.name))return!1}else if(s.to-s.from>8192){for(let o of Ap(O,s.node))i.push(o);return!1}}),_p.set(e,i),i}var jp=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Lp=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Zb(O){let e=j(O.state).resolveInner(O.pos,-1);if(Lp.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&jp.test(O.state.sliceDoc(e.from,e.to));if(!t&&!O.explicit)return null;let i=[];for(let r=e;r;r=r.parent)Ep.has(r.name)&&(i=i.concat(Ap(O.state.doc,r)));return{options:i,from:t?e.from:O.pos,validFor:jp}}var ut=ae.define({name:"javascript",parser:Up.configure({props:[le.add({IfStatement:ce({except:/^\s*({|else\b)/}),TryStatement:ce({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:iO,SwitchBody:O=>{let e=O.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return O.baseIndent+(t?0:i?1:2)*O.unit},Block:xe({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"TemplateString BlockComment":()=>null,"Statement Property":ce({except:/^\s*{/}),JSXElement(O){let e=/^\s*<\//.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},JSXEscape(O){let e=/\s*\}/.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},"JSXOpenTag JSXSelfClosingTag"(O){return O.column(O.node.from)+O.unit}}),ne.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":me,BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Mp={test:O=>/^JSX/.test(O.name),facet:Ji({commentTokens:{block:{open:"{/*",close:"*/}"}}})},El=ut.configure({dialect:"ts"},"typescript"),Al=ut.configure({dialect:"jsx",props:[Zn.add(O=>O.isTop?[Mp]:void 0)]}),Ll=ut.configure({dialect:"jsx ts",props:[Zn.add(O=>O.isTop?[Mp]:void 0)]},"typescript"),Dp=O=>({label:O,type:"keyword"}),Ip="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(Dp),Vb=Ip.concat(["declare","implements","private","protected","public"].map(Dp));function $s(O={}){let e=O.jsx?O.typescript?Ll:Al:O.typescript?El:ut,t=O.typescript?zb.concat(Vb):Gp.concat(Ip);return new Oe(e,[ut.data.of({autocomplete:si(Lp,wO(t))}),ut.data.of({autocomplete:Zb}),O.jsx?jb:[]])}function Ub(O){for(;;){if(O.name=="JSXOpenTag"||O.name=="JSXSelfClosingTag"||O.name=="JSXFragmentTag")return O;if(O.name=="JSXEscape"||!O.parent)return null;O=O.parent}}function Cp(O,e,t=O.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return O.sliceString(i.from,Math.min(i.to,t));return""}var _b=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),jb=b.inputHandler.of((O,e,t,i,r)=>{if((_b?O.composing:O.compositionStarted)||O.state.readOnly||e!=t||i!=">"&&i!="/"||!ut.isActiveAt(O.state,e,-1))return!1;let n=r(),{state:s}=n,o=s.changeByRange(a=>{var l;let{head:h}=a,c=j(s).resolveInner(h-1,-1),f;if(c.name=="JSXStartTag"&&(c=c.parent),!(s.doc.sliceString(h-1,h)!=i||c.name=="JSXAttributeValue"&&c.to>h)){if(i==">"&&c.name=="JSXFragmentTag")return{range:a,changes:{from:h,insert:"</>"}};if(i=="/"&&c.name=="JSXStartCloseTag"){let d=c.parent,Q=d.parent;if(Q&&d.from==h-2&&((f=Cp(s.doc,Q.firstChild,h))||((l=Q.firstChild)===null||l===void 0
Line truncated
|
||||
`+t.scrub(),n=this.advance(r);return n>-1&&n<r.length?this.complete(e,i,n):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Pr(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,L(x.LinkReference,this.start,this.start+i,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(U$(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(L(x.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Z$(e,Pr(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Pr(e,this.pos),i=0;if(t>this.pos){let r=V$(e,t,this.start);if(r){let n=Nl(e,r.to-this.start);n>0&&(this.nextStage(r),i=n)}}return i||(i=Nl(e,this.pos)),i>0&&i<e.length?i:-1}else return Nl(e,this.pos)}}};function Nl(O,e){for(;e<O.length;e++){let t=O.charCodeAt(e);if(t==10)break;if(!ot(t))return-1}return e}var Oh=class{nextLine(e,t,i){let r=t.depth<e.stack.length?-1:T$(t),n=t.next;if(r<0)return!1;let s=L(x.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(i,L(n==61?x.SetextHeading1:x.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),s])),!0}finish(){return!1}},q$={LinkReference(O,e){return e.content.charCodeAt(0)==91?new th(e):null},SetextHeading(){return new Oh}},Kb=[(O,e)=>b$(e)>=0,(O,e)=>y$(e)>=0,(O,e)=>X$(e)>=0,(O,e)=>ch(e,O,!0)>=0,(O,e)=>fh(e,O,!0)>=0,(O,e)=>hh(e,O,!0)>=0,(O,e)=>v$(e,O,!0)>=0],Jb={text:"",end:0},ih=class{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.line=new Kl,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=Ps.create(x.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new ah(i,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let i=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!r||e.markers[i].from<r.end);){let n=e.markers[i++];this.addNode(n.type,n.from,n.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let i of this.parser.blockParsers)if(i){let r=i(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new Hl(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let r=i(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
||||
`+e.scrub();for(let i of e.markers)t.marks.push(i)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=_$(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Jb;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let i=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let n=this.ranges[r].from,s=this.lineChunkAt(n);t.end=n+s.length,t.text=t.text.slice(0,this.ranges[r-1].to-i)+s,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],n=this.parser.skipContextMarkup[r.type];if(!n)throw new Error("Unhandled block context "+x[r.type]);if(!n(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
||||
`?"":t;else{let r=t.indexOf(`
|
||||
`);i=r<0?t:t.slice(0,r)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=Ps.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new D(this.parser.nodeSet.types[e],di,di,(i??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(oh(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?R$(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=oh(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(x.Paragraph,e.content.length),e.start)}elt(e,t,i,r){return typeof e=="string"?L(this.parser.getNodeType(e),t,i,r):new Xs(e,t)}get buffer(){return new ys(this.parser.nodeSet)}};function R$(O,e,t,i,r){let n=O[e].to,s=[],o=[],a=t.from+i;function l(h,c){for(;c?h>=n:h>n;){let f=O[e+1].from-n;i+=f,h+=f,e++,n=O[e].to}}for(let h=t.firstChild;h;h=h.nextSibling){l(h.from+i,!0);let c=h.from+i,f,d=r.get(h.tree);d?f=d:h.to+i>n?(f=R$(O,e,h,i,r),l(h.to+i,!1)):f=h.toTree(),s.push(f),o.push(c-a)}return l(t.to+i,!1),new D(t.type,s,o,t.to+i-a,t.tree?t.tree.propValues:void 0)}var Xr=class O extends Ht{constructor(e,t,i,r,n,s,o,a,l){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=n,this.skipContextMarkup=s,this.inlineParsers=o,this.inlineNames=a,this.wrappers=l,this.nodeTypes=Object.create(null);for(let h of e.types)this.nodeTypes[h.name]=h.id}createParse(e,t,i){let r=new ih(this,e,t,i);for(let n of this.wrappers)r=n(r,e,t,i);return r}configure(e){let t=rh(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:r}=this,n=this.blockParsers.slice(),s=this.leafBlockParsers.slice(),o=this.blockNames.slice(),a=this.inlineParsers.slice(),l=this.inlineNames.slice(),h=this.endLeafBlock.slice(),c=this.wrappers;if(Sr(t.defineNodes)){r=Object.assign({},r);let f=i.types.slice(),d;for(let Q of t.defineNodes){let{name:p,block:$,composite:m,style:g}=typeof Q=="string"?{name:Q}:Q;if(f.some(P=>P.name==p))continue;m&&(r[f.length]=(P,T,k)=>m(T,k,P.value));let y=f.length,X=m?["Block","BlockContext"]:$?y>=x.ATXHeading1&&y<=x.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(ue.define({id:y,name:p,props:X&&[[Y.group,X]]})),g&&(d||(d={}),Array.isArray(g)||g instanceof Ne?d[p]=g:Object.assign(d,g))}i=new Nt(f),d&&(i=i.extend(H(d)))}if(Sr(t.props)&&(i=i.extend(...t.props)),Sr(t.remove))for(let f of t.remove){let d=this.blockNames.indexOf(f),Q=this.inlineNames.indexOf(f);d>-1&&(n[d]=s[d]=void 0),Q>-1&&(a[Q]=void 0)}if(Sr(t.parseBlock))for(let f of t.parseBlock){let d=o.indexOf(f.name);if(d>-1)n[d]=f.parse,s[d]=f.leaf;else{let Q=f.before?Ss(o,f.before):f.after?Ss(o,f.after)+1:o.length-1;n.splice(Q,0,f.parse),s.splice(Q,0,f.leaf),o.splice(Q,0,f.name)}f.endLeaf&&h.push(f.endLeaf)}if(Sr(t.parseInline))for(let f of t.parseInline){let d=l.indexOf(f.name);if(d>-1)a[d]=f.parse;else{let Q=f.before?Ss(l,f.before):f.after?Ss(l,f.after)+1:l.length-1;a.splice(Q,0,f.parse),l.splice(Q,0,f.name)}}return t.wrap&&(c=c.concat(t.wrap)),new O(i,n,s,o,h,r,a,l,c)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let i=new sh(this,e,t);e:for(let r=t;r<i.end;){let n=i.char(r);for(let s of this.inlineParsers)if(s){let o=s(i,n,r);if(o>=0){r=o;continue e}}r++}return i.resolveMarkers(0)}};function Sr(O){return O!=null&&O.length>0}function rh(O){if(!Array.isArray(O))return O;if(O.length==0)return null;let e=rh(O[0]);if(O.length==1)return e;let t=rh(O.slice(1));if(!t||!e)return e||t;let i=(s,o)=>(s||di).concat(o||di),r=e.wrap,n=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:r?n?(s,o,a,l)=>r(n(s,o,a,l),o,a,l):r:n}}function Ss(O,e){let t=O.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var z$=[ue.none];for(let O=1,e;e=x[O];O++)z$[O]=ue.define({id:O,name:e,props:O>=x.Escape?[]:[[Y.group,O in P$?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var di=[],ys=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,r=0){return t
Line truncated
|
||||
`;)n--;this.fragmentEnd=n?n-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Y.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),n=e.absoluteLineStart,s=n,o=e.block.children.length,a=s,l=o;for(;;){if(t.to-i>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let h=_$(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,h);else{let c=new D(e.parser.nodeSet.types[x.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(c,t.tree),e.addNode(c,h)}if(t.type.is("Block")&&(tT.indexOf(t.type.id)<0?(s=t.to-i,o=e.block.children.length):(s=a,o=l,a=t.to-i,l=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return s-n}};function _$(O,e){let t=O;for(let i=1;i<e.length;i++){let r=e[i-1].to,n=e[i].from;r<O&&(t-=n-r)}return t}var OT=H({"Blockquote/...":u.quote,HorizontalRule:u.contentSeparator,"ATXHeading1/... SetextHeading1/...":u.heading1,"ATXHeading2/... SetextHeading2/...":u.heading2,"ATXHeading3/...":u.heading3,"ATXHeading4/...":u.heading4,"ATXHeading5/...":u.heading5,"ATXHeading6/...":u.heading6,"Comment CommentBlock":u.comment,Escape:u.escape,Entity:u.character,"Emphasis/...":u.emphasis,"StrongEmphasis/...":u.strong,"Link/... Image/...":u.link,"OrderedList/... BulletList/...":u.list,"BlockQuote/...":u.quote,"InlineCode CodeText":u.monospace,"URL Autolink":u.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":u.processingInstruction,"CodeInfo LinkLabel":u.labelName,LinkTitle:u.string,Paragraph:u.content}),j$=new Xr(new Nt(z$).extend(OT),Object.keys(gs).map(O=>gs[O]),Object.keys(gs).map(O=>q$[O]),Object.keys(gs),Kb,P$,Object.keys(Fl).map(O=>Fl[O]),Object.keys(Fl),[]);function iT(O,e,t){let i=[];for(let r=O.firstChild,n=e;;r=r.nextSibling){let s=r?r.from:t;if(s>n&&i.push({from:n,to:s}),!r)break;n=r.to}return i}function C$(O){let{codeParser:e,htmlParser:t}=O;return{wrap:PO((r,n)=>{let s=r.type.id;if(e&&(s==x.CodeBlock||s==x.FencedCode)){let o="";if(s==x.FencedCode){let l=r.node.getChild(x.CodeInfo);l&&(o=n.read(l.from,l.to))}let a=e(o);if(a)return{parser:a,overlay:l=>l.type.id==x.CodeText}}else if(t&&(s==x.HTMLBlock||s==x.HTMLTag||s==x.CommentBlock))return{parser:t,overlay:iT(r.node,r.from,r.to)};return null})}}var rT={resolve:"Strikethrough",mark:"StrikethroughMark"},nT={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":u.strikethrough}},{name:"StrikethroughMark",style:u.processingInstruction}],parseInline:[{name:"Strikethrough",parse(O,e,t){if(e!=126||O.char(t+1)!=126||O.char(t+2)==126)return-1;let i=O.slice(t-1,t),r=O.slice(t+2,t+3),n=/\s|^$/.test(i),s=/\s|^$/.test(r),o=xr.test(i),a=xr.test(r);return O.addDelimiter(rT,t,t+2,!s&&(!a||n||o),!n&&(!o||s||a))},after:"Emphasis"}]};function yr(O,e,t=0,i,r=0){let n=0,s=!0,o=-1,a=-1,l=!1,h=()=>{i.push(O.elt("TableCell",r+o,r+a,O.parser.parseInline(e.slice(o,a),r+o)))};for(let c=t;c<e.length;c++){let f=e.charCodeAt(c);f==124&&!l?((!s||o>-1)&&n++,s=!1,i&&(o>-1&&h(),i.push(O.elt("TableDelimiter",c+r,c+r+1))),o=a=-1):(l||f!=32&&f!=9)&&(o<0&&(o=c),a=c+1),l=!l&&f==92}return o>-1&&(n++,i&&h()),n}function d$(O,e){for(let t=e;t<O.length;t++){let i=O.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var G$=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,xs=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&G$.test(r=t.text.slice(t.pos))){let n=[];yr(e,i.content,0,n,i.start)==yr(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,n),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];yr(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},sT={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":u.heading}},"TableRow",{name:"TableCell",style:u.content},{name:"TableDelimiter",style:u.processingInstruction}],parseBlock:[{name:"Table",leaf(O,e){return d$(e.content,0)?new xs:null},endLeaf(O,e,t){if(t.parsers.some(r=>r instanceof xs)||!d$(e.text,e.basePos))return!1;let i=O.peekLine();return G$.test(i)&&yr(O,e.text,e.basePos)==yr(O,i,e.basePos)},before:"SetextHeading"}]},lh=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},oT={defineNodes:[{name:"Task",block:!0,style:u.list},{name:"TaskMarker",style:u.atom}],parseBlock:[{name:"TaskList",leaf(O,e){retu
Line truncated
|
||||
|
||||
`,{label:"if",detail:"block",type:"keyword"}),V("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),V("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),V("import ${module}",{label:"import",detail:"statement",type:"keyword"}),V("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],nv=si(Tm,wO(iv.concat(rv)));function Th(O){let{node:e,pos:t}=O,i=O.lineIndent(t,-1),r=null;for(;;){let n=e.childBefore(t);if(n)if(n.name=="Comment")t=n.from;else if(n.name=="Body"||n.name=="MatchBody")O.baseIndentFor(n)+O.unit<=i&&(r=n),e=n;else if(n.name=="MatchClause")e=n;else if(n.type.is("Statement"))e=n;else break;else break}return r}function kh(O,e){let t=O.baseIndentFor(e),i=O.lineAt(O.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&O.node.to<r+100&&!/\S/.test(O.state.sliceDoc(r,O.node.to))&&O.lineIndent(O.pos,-1)<=t||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(O.textAfter)&&O.lineIndent(O.pos,-1)>t?null:t+O.unit}var wh=ae.define({name:"python",parser:Pm.configure({props:[le.add({Body:O=>{var e;let t=/^\s*(#|$)/.test(O.textAfter)&&Th(O)||O.node;return(e=kh(O,t))!==null&&e!==void 0?e:O.continue()},MatchBody:O=>{var e;let t=Th(O);return(e=kh(O,t||O.node))!==null&&e!==void 0?e:O.continue()},IfStatement:O=>/^\s*(else:|elif )/.test(O.textAfter)?O.baseIndent:O.continue(),"ForStatement WhileStatement":O=>/^\s*else:/.test(O.textAfter)?O.baseIndent:O.continue(),TryStatement:O=>/^\s*(except[ :]|finally:|else:)/.test(O.textAfter)?O.baseIndent:O.continue(),MatchStatement:O=>/^\s*case /.test(O.textAfter)?O.baseIndent+O.unit:O.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":xe({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":xe({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":xe({closing:"]"}),MemberExpression:O=>O.baseIndent+O.unit,"String FormatString":()=>null,Script:O=>{var e;let t=Th(O);return(e=t&&kh(O,t))!==null&&e!==void 0?e:O.continue()}}),ne.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":me,Body:(O,e)=>({from:O.from+1,to:O.to-(O.to==e.doc.length?0:1)}),"String FormatString":(O,e)=>({from:e.doc.lineAt(O.from).to,to:O.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function km(){return new Oe(wh,[wh.data.of({autocomplete:Ov}),wh.data.of({autocomplete:nv})])}var vh=1,sv=2,ov=3,av=4,lv=5,hv=36,cv=37,fv=38,uv=11,dv=13;function Qv(O){return O==45||O==46||O==58||O>=65&&O<=90||O==95||O>=97&&O<=122||O>=161}function pv(O){return O==9||O==10||O==13||O==32}var wm=null,vm=null,qm=0;function qh(O,e){let t=O.pos+e;if(vm==O&&qm==t)return wm;for(;pv(O.peek(e));)e++;let i="";for(;;){let r=O.peek(e);if(!Qv(r))break;i+=String.fromCharCode(r),e++}return vm=O,qm=t,wm=i||null}function Rm(O,e){this.name=O,this.parent=e}var $v=new Ge({start:null,shift(O,e,t,i){return e==vh?new Rm(qh(i,1)||"",O):O},reduce(O,e){return e==uv&&O?O.parent:O},reuse(O,e,t,i){let r=e.type.id;return r==vh||r==dv?new Rm(qh(i,1)||"",O):O},strict:!1}),mv=new U((O,e)=>{if(O.next==60){if(O.advance(),O.next==47){O.advance();let t=qh(O,0);if(!t)return O.acceptToken(lv);if(e.context&&t==e.context.name)return O.acceptToken(sv);for(let i=e.context;i;i=i.parent)if(i.name==t)return O.acceptToken(ov,-2);O.acceptToken(av)}else if(O.next!=33&&O.next!=63)return O.acceptToken(vh)}},{contextual:!0});function Rh(O,e){return new U(t=>{let i=0,r=e.charCodeAt(0);e:for(;!(t.next<0);t.advance(),i++)if(t.next==r){for(let n=1;n<e.length;n++)if(t.peek(n)!=e.charCodeAt(n))continue e;break}i&&t.acceptToken(O)})}var gv=Rh(hv,"-->"),Sv=Rh(cv,"?>"),Pv=Rh(fv,"]]>"),yv=H({Text:u.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":u.angleBracket,TagName:u.tagName,"MismatchedCloseTag/TagName":[u.tagName,u.invalid],AttributeName:u.attributeName,AttributeValue:u.attributeValue,Is:u.definitionOperator,"EntityReference CharacterReference":u.character,Comment:u.blockComment,ProcessingInst:u.processingInstruction,DoctypeDecl:u.documentMeta,Cdata:u.special(u.string)}),zm=se.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,
Line truncated
|
||||
Reference in new issue
Block a user