diff --git a/assets/@codemirror-SM3v-hs2.js b/assets/@codemirror-CCjSF3Vf.js similarity index 99% rename from assets/@codemirror-SM3v-hs2.js rename to assets/@codemirror-CCjSF3Vf.js index 02af8c8..a2f1a16 100644 --- a/assets/@codemirror-SM3v-hs2.js +++ b/assets/@codemirror-CCjSF3Vf.js @@ -1,4 +1,4 @@ -import{t as x,N as _s,s as yl,a as mc,b as pe,I as pc,T as yt,c as $i,P as gc,h as yc,E as bc,L as xc}from"./@lezer-C0_A0N7l.js";import{c as I}from"./crelt-C8TCjufn.js";import{S as je}from"./style-mod-Bc2inJdb.js";import{k as wc,b as vc,s as kc}from"./w3c-keyname-Vcq4gwWv.js";class P{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]=At(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Se.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=At(this,e,t);let i=[];return this.decompose(e,t,i,0),Se.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),s=new Gt(this),r=new Gt(e);for(let o=t,l=t;;){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(e=1){return new Gt(this,e)}iterRange(e,t=this.length){return new bl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xl(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]?P.empty:e.length<=32?new W(e):Se.from(W.split(e,[]))}}class W extends P{constructor(e,t=Sc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Cc(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new W(Dr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Qi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new W(l,o.length+r.length));else{let a=l.length>>1;i.push(new W(l.slice(0,a)),new W(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof W))return super.replace(e,t,i);[e,t]=At(this,e,t);let s=Qi(this.text,Qi(i.text,Dr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new W(s,r):Se.from(W.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{t as mc,a as x,N as _s,s as yl,b as pe,I as pc,T as yt,h as gc,c as $i,P as yc,E as bc,L as xc}from"./@lezer-DgLl1T_N.js";import{c as I}from"./crelt-C8TCjufn.js";import{S as je}from"./style-mod-Bc2inJdb.js";import{k as wc,b as vc,s as kc}from"./w3c-keyname-Vcq4gwWv.js";class P{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]=At(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Se.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=At(this,e,t);let i=[];return this.decompose(e,t,i,0),Se.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),s=new Gt(this),r=new Gt(e);for(let o=t,l=t;;){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(e=1){return new Gt(this,e)}iterRange(e,t=this.length){return new bl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new xl(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]?P.empty:e.length<=32?new W(e):Se.from(W.split(e,[]))}}class W extends P{constructor(e,t=Sc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Cc(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new W(Dr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Qi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new W(l,o.length+r.length));else{let a=l.length>>1;i.push(new W(l.slice(0,a)),new W(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof W))return super.replace(e,t,i);[e,t]=At(this,e,t);let s=Qi(this.text,Qi(i.text,Dr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new W(s,r):Se.from(W.split(s,[]),r)}sliceString(e,t=this.length,i=` `){[e,t]=At(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new W(i,s)),i=[],s=-1);return s>-1&&t.push(new W(i,s)),t}}class Se extends P{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,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=At(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Se(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){[e,t]=At(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Se))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let m of e)m.flatten(d);return new W(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let m;if(d.lines>r&&d instanceof Se)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof W&&a&&(m=c[c.length-1])instanceof W&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new W(m.text.concat(d.text),m.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]:Se.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Se(l,t)}}P.empty=new W([""],0);function Sc(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Qi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof W?e.text.length:e.children.length)<<1]}nextInner(e,t){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 W?s.text.length:s.children.length;if(o==(t>0?l: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((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof W){let a=s.text[o+(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=s.children[o+(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 W?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)}}class bl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Gt(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:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.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!=""}}class xl{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=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=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(P.prototype[Symbol.iterator]=function(){return this.iter()},Gt.prototype[Symbol.iterator]=bl.prototype[Symbol.iterator]=xl.prototype[Symbol.iterator]=function(){return this});class Cc{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function At(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}let vt="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;nn)return vt[e-1]<=n;return!1}function Tr(n){return n>=127462&&n<=127487}const Br=8205;function Y(n,e,t=!0,i=!0){return(t?wl:Mc)(n,e,i)}function wl(n,e,t){if(e==n.length)return e;e&&vl(n.charCodeAt(e))&&kl(n.charCodeAt(e-1))&&e--;let i=X(n,e);for(e+=ue(i);e=0&&Tr(X(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Mc(n,e,t){for(;e>0;){let i=wl(n,e-2,t);if(i=56320&&n<57344}function kl(n){return n>=55296&&n<56320}function X(n,e){let t=n.charCodeAt(e);if(!kl(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return vl(i)?(t-55296<<10)+(i-56320)+65536:t}function Zs(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ue(n){return n<65536?1:2}const rs=/\r\n?|\n/;var te=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(te||(te={}));class Ae{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=te.Simple&&h>=e&&(i==te.TrackDel&&se||i==te.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}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 Ae(e)}static create(e){return new Ae(e)}}class $ extends Ae{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 os(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return ls(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&qe(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let m=d?typeof d=="string"?P.of(d.split(i||rs)):d:P.empty,p=m.length;if(f==u&&p==0)return;fo&&_(s,f-o,-1),_(s,u-f,p),qe(r,s,m),o=u}}return h(e),a(!l),l}static empty(e){return new $(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function qe(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function ls(n,e,t,i=!1){let s=[],r=i?[]:null,o=new ei(n),l=new ei(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);_(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class ei{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?P.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?P.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class st{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new st(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new st(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>st.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Cl(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let er=0;class C{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=er++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new C(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:tr),!!e.static,e.enables)}of(e){return new Ui([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ui(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ui(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function tr(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Ui{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=er++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||as(f,c)){let d=i(f);if(l?!Pr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,m=u.config.address[r];if(m!=null){let p=en(u,m);if(this.dependencies.every(g=>g instanceof C?u.facet(g)===f.facet(g):g instanceof J?u.field(g,!1)==f.field(g,!1):!0)||(l?Pr(d=i(f),p,s):s(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}}function Pr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Lr).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,Lr.of({field:this,create:e})]}get extension(){return this}}const it={lowest:4,low:3,default:2,high:1,highest:0};function Vt(n){return e=>new Ol(e,n)}const ft={highest:Vt(it.highest),high:Vt(it.high),default:Vt(it.default),low:Vt(it.low),lowest:Vt(it.lowest)};class Ol{constructor(e,t){this.inner=e,this.prec=t}}class Sn{of(e){return new hs(this,e)}reconfigure(e){return Sn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class hs{constructor(e,t){this.compartment=e,this.inner=t}}class Zi{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Dc(e,t,o))u instanceof J?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],m=d[0].facet,p=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,tr(p,d))a.push(i.facet(m));else{let g=m.combine(d.map(y=>y.value));a.push(i&&m.compare(g,i.facet(m))?i.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[m.id]=h.length<<1,h.push(g=>Ac(g,m,d))}}let f=h.map(u=>u(l));return new Zi(e,o,f,l,a,r)}}function Dc(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof hs&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof hs){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ol)r(o.inner,o.prec);else if(o instanceof J)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Ui)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,it.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,it.default),i.reduce((o,l)=>o.concat(l))}function Yt(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function en(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Ml=C.define(),cs=C.define({combine:n=>n.some(e=>e),static:!0}),Al=C.define({combine:n=>n.length?n[0]:void 0,static:!0}),Dl=C.define(),Tl=C.define(),Bl=C.define(),Pl=C.define({combine:n=>n.length?n[0]:!1});class Ne{constructor(e,t){this.type=e,this.value=t}static define(){return new Tc}}class Tc{of(e){return new Ne(this,e)}}class Bc{constructor(e){this.map=e}of(e){return new T(this,e)}}class T{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new T(this.type,t)}is(e){return this.type==e}static define(e={}){return new Bc(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}T.reconfigure=T.define();T.appendConfig=T.define();class Q{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Cl(i,t.newLength),r.some(l=>l.type==Q.time)||(this.annotations=r.concat(Q.time.of(Date.now())))}static create(e,t,i,s,r,o){return new Q(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Q.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Q.time=Ne.define();Q.userEvent=Ne.define();Q.addToHistory=Ne.define();Q.remote=Ne.define();function Pc(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Q?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?n=r[0]:n=Rl(e,kt(r),!1)}return n}function Rc(n){let e=n.startState,t=e.facet(Bl),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=Ll(i,fs(e,r,n.changes.newLength),!0))}return i==n?n:Q.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Ec=[];function kt(n){return n==null?Ec:Array.isArray(n)?n:[n]}var V=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(V||(V={}));const Ic=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let us;try{us=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Nc(n){if(us)return us.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Ic.test(t)))return!0}return!1}function Fc(n){return e=>{if(!/\S/.test(e))return V.Space;if(Nc(e))return V.Word;for(let t=0;t-1)return V.Word;return V.Other}}class L{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(T.reconfigure)?(t=null,i=l.value):l.is(T.appendConfig)&&(t=null,i=kt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=Zi.resolve(i,s,this),r=new L(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(cs)?e.newSelection:e.newSelection.asSingle();new L(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=kt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return L.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Zi.resolve(e.extensions||[],new Map),i=e.doc instanceof P?e.doc:P.of((e.doc||"").split(t.staticFacet(L.lineSeparator)||rs)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Cl(s,i.length),t.staticFacet(cs)||(s=s.asSingle()),new L(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(L.tabSize)}get lineBreak(){return this.facet(L.lineSeparator)||` @@ -6,6 +6,6 @@ import{t as x,N as _s,s as yl,a as mc,b as pe,I as pc,T as yt,c as $i,P as gc,h `,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function vf(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==V.Space&&(s=o),s==o}}function kf(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.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 m=l+(u+d)*r,p=ya(n,{x:f,y:m},!1,r);if(ma.bottom||(r<0?ps)){let g=n.docView.coordsForChar(p),y=!g||m{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,ir)&&this.lineBreak(),s=o}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,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=E.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.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+(Cf(e,i.node,i.offset)?t:0))}}function Cf(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Df(e),a=new Sf(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Tf(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!gs(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!gs(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((k.ios||k.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.toDate.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,h=null;(r===8||k.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:(k.mac||k.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:P.of([" "])}):k.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` `&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:P.of([" "])}),t)return lr(n,t,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 lr(n,e,t,i=-1){if(k.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(k.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&St(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&St(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&St(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Mf(n,e,t));return n.state.facet(ra).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Mf(n,e,t){let i,s=n.state,r=s.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=s.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(s.selection.ranges.length>1&&n.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=n.state.sliceDoc(e.from,e.to),c,f=t&&ga(n,t.main.head);if(f){let m=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-m}}else c=n.state.doc.lineAt(r.head);let u=r.to-e.to,d=r.to-r.from;i=s.changeByRange(m=>{if(m.from==r.from&&m.to==r.to)return{changes:l,range:a||m.map(l)};let p=m.to-u,g=p-h.length;if(m.to-m.from!=d||n.state.sliceDoc(g,p)!=h||m.to>=c.from&&m.from<=c.to)return{range:m};let y=s.changes({from:g,to:p,insert:e.insert}),w=m.to-r.to;return{changes:y,range:a?b.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):m.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 Af(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Df(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Jr(t,i)),(s!=t||r!=i)&&e.push(new Jr(s,r))),e}function Tf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}class Bf{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,k.safari&&e.contentDOM.addEventListener("input",()=>null),k.gecko&&Kf(e.contentDOM.ownerDocument)}handleEvent(e){!Hf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Pf(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[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"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&wa.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),k.android&&k.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return k.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xa.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Lf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:k.safari&&!k.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function _r(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){oe(t.state,s)}}}function Pf(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];o&&t(r).handlers.push(_r(i.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];o&&t(r).observers.push(_r(i.value,o))}}for(let i in we)t(i).handlers.push(we[i]);for(let i in ge)t(i).observers.push(ge[i]);return e}const xa=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lf="dthko",wa=[16,17,18,20,91,92,224,225],Ti=6;function Bi(n){return Math.max(0,n)*.7+8}function Rf(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class Ef{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=qc(e.contentDOM),this.atoms=e.state.facet(or).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(L.allowMultipleSelections)&&If(e,t),this.dragging=Ff(e,t)&&Sa(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Rf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=pa(this.view);e.clientX-a.left<=s+Ti?t=-Bi(s-e.clientX):e.clientX+a.right>=o-Ti&&(t=Bi(e.clientX-o)),e.clientY-a.top<=r+Ti?i=-Bi(r-e.clientY):e.clientY+a.bottom>=l-Ti&&(i=Bi(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;it.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function If(n,e){let t=n.state.facet(ta);return t.length?t[0](e):k.mac?e.metaKey:e.ctrlKey}function Nf(n,e){let t=n.state.facet(ia);return t.length?t[0](e):k.mac?!e.altKey:!e.ctrlKey}function Ff(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=ni(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Hf(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=E.get(t))&&i.ignoreEvent(e))return!1;return!0}const we=Object.create(null),ge=Object.create(null),va=k.ie&&k.ie_version<15||k.ios&&k.webkit_version<604;function Vf(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),ka(n,t.value)},50)}function ka(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ts!=null&&t.selection.ranges.every(a=>a.empty)&&Ts==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ge.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};we.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ge.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ge.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};we.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(na))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=qf(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new Ef(n,e,t,i)),i&&n.observer.ignore(()=>{Nl(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}return!1};function Zr(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return pf(n.state,e,t);{let s=q.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return le>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function Wf(n,e,t,i){let s=q.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&eo(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&eo(t,i,l)?1:o&&o.bottom>=i?-1:1}function to(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Wf(n,t,e.clientX,e.clientY)}}const zf=k.ie&&k.ie_version<=11;let io=null,no=0,so=0;function Sa(n){if(!zf)return n.detail;let e=io,t=so;return io=n,so=Date.now(),no=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(no+1)%3:1}function qf(n,e){let t=to(n,e),i=Sa(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=to(n,r),h,c=Zr(n,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=Zr(n,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=$f(s,a.pos))?h:l?s.addRange(c):b.create([c])}}}function $f(n,e){for(let t=0;t=e)return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}we.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};we.dragend=n=>(n.inputState.draggedContent=null,!1);function ro(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&Nf(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}we.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&ro(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return ro(n,e,i,!0),!0}return!1};we.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=va?null:e.clipboardData;return t?(ka(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Vf(n),!1)};function Qf(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Uf(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let Ts=null;we.copy=we.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=Uf(n.state);if(!t&&!s)return!1;Ts=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=va?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(Qf(n,t),!1)};const Ca=Ne.define();function Oa(n,e){let t=[];for(let i of n.facet(oa)){let s=i(n,e);s&&t.push(s)}return t?n.update({effects:t,annotations:Ca.of(!0)}):null}function Ma(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Oa(n.state,e);t?n.dispatch(t):n.update([])}},10)}ge.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Ma(n)};ge.blur=n=>{n.observer.clearSelectionRange(),Ma(n)};ge.compositionstart=ge.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ge.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,k.chrome&&k.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ge.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};we.beforeinput=(n,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return lr(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(k.chrome&&k.android&&(s=xa.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return k.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),k.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ge.compositionend(n,e),20),!1};const oo=new Set;function Kf(n){oo.has(n)||(oo.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const lo=["pre-wrap","normal","pre-line","break-spaces"];let Pt=!1;function ao(){Pt=!1}class jf{constructor(e){this.lineWrapping=e,this.doc=P.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return lo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Xi&&(Pt=!0),this.height=e)}replace(e,t,i){return ne.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,F.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,F.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class he extends Aa{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new Ce(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof he||s instanceof j&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof j?s=new he(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ne.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class j extends ne{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof j?i[i.length-1]=new j(r.length+s):i.push(null,new j(s-1))}if(e>0){let r=i[0];r instanceof j?i[0]=new j(e+r.length):i.unshift(new j(e-1),null)}return ne.of(i)}decomposeLeft(e,t){t.push(new j(e-1),null)}decomposeRight(e,t){t.push(null,new j(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new j(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++];a==-1?a=f:Math.abs(f-a)>=Xi&&(a=-2);let u=new he(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new j(r-l).updateHeight(e,l));let h=ne.of(o);return(a<0||Math.abs(h.height-this.height)>=Xi||Math.abs(a-this.heightMetrics(e,t).perLine)>=Xi)&&(Pt=!0),rn(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Gf extends ne{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==F.ByPosNoHeight?F.ByPosNoHeight:F.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,F.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&ho(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?ne.of(this.break?[e,null,t]:[e,t]):(this.left=rn(this.left,e),this.right=rn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ho(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof j&&(i=n[e+1])instanceof j&&n.splice(e-1,3,new j(t.length+1+i.length))}const Yf=5;class ar{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof he?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new he(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Yf)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new he(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new j(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof he)return e;let t=new he(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof he)&&!this.isCovered?this.nodes.push(new he(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==n.parentNode?u.bottom:Math.min(a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function eu(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Wn{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new jf(t),this.stateDeco=e.facet(si).filter(i=>typeof i!="function"),this.heightMap=ne.empty().applyChanges(this.stateDeco,P.empty,this.heightOracle.setDoc(e.doc),[new me(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=A.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Pi(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?fo:new hr(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(jt(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(si).filter(c=>typeof c!="function");let s=e.changedRanges,r=me.extendWithRanges(s,Jf(i,this.stateDeco,e?e.changes:$.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ao(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Pt)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(aa)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?H.RTL:H.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:v,scaleY:O}=Il(t,l);(v>.005&&Math.abs(this.scaleX-v)>.005||O>.005&&Math.abs(this.scaleY-O)>.005)&&(this.scaleX=v,this.scaleY=O,h|=8,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Hl(e.scrollDOM);let m=(this.printing?eu:Zf)(t,this.paddingTop),p=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:O,charWidth:D,textHeight:N}=e.docView.measureTextSize();o=O>0&&s.refresh(r,O,D,N,w/D,v),o&&(e.docView.minWidth=0,h|=8)}p>0&&g>0?c=Math.max(p,g):p<0&&g<0&&(c=Math.min(p,g)),ao();for(let O of this.viewports){let D=O.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(O);this.heightMap=(o?ne.empty().applyChanges(this.stateDeco,P.empty,this.heightOracle,[new me(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Xf(O.from,D))}Pt&&(h|=2)}let M=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return M&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Pi(s.lineAt(o-i*1e3,F.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,F.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,F.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=H.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromw));if(!g){if(fy.from<=f&&y.to>=f)){let y=t.moveToLineBoundary(b.cursor(f),!1,!0).head;y>c&&(f=y)}g=new Wn(c,f,this.gapSize(u,c,f,d))}l.push(g)},h=c=>{if(c.lengthc.from&&a(c.from,d,c,f),mt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];B.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||jt(this.heightMap.lineAt(e,F.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||jt(this.heightMap.lineAt(this.scaler.fromDOM(e),F.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return jt(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Pi{constructor(e,t){this.from=e,this.to=t}}function iu(n,e,t){let i=[],s=n,r=0;return B.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Ri(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function nu(n,e){for(let t of n)if(e(t))return t}const fo={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class hr{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,F.ByPos,e,0,0).top,c=t.lineAt(a,F.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function jt(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ce(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>jt(s,e)):n._content)}const Ei=C.define({combine:n=>n.join(" ")}),Bs=C.define({combine:n=>n.indexOf(!0)>-1}),Ps=je.newName(),Da=je.newName(),Ta=je.newName(),Ba={"&light":"."+Da,"&dark":"."+Ta};function Ls(n,e,t){return new je(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const su=Ls("."+Ps,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ba),ru={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zn=k.ie&&k.ie_version<=11;class ou{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new $c,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(k.ie&&k.ie_version<=11||k.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(k.chrome&&k.chrome_version<126)&&(this.editContext=new au(e),e.state.facet(We)&&(e.contentDOM.editContext=this.editContext.editContext)),zn&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(We)?i.root.activeElement!=this.dom:!Ki(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(k.ie&&k.ie_version<=11||k.android&&k.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Jt(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ni(e.root);if(!t)return!1;let i=k.safari&&e.root.nodeType==11&&Vc(this.dom.ownerDocument)==this.dom&&lu(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Ki(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&St(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Ki(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Of(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=ba(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=uo(t,e.previousSibling||e.target.previousSibling,-1),s=uo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(We)!=e.state.facet(We)&&(e.view.contentDOM.editContext=e.state.facet(We)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function uo(n,e,t){for(;e;){let i=E.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function mo(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return Jt(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function lu(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return mo(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?mo(n,t):null}class au{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let{anchor:s}=e.state.selection.main,r={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:P.of(i.text.split(` `))};r.from==this.from&&sthis.to&&(r.to=s),!(r.from==r.to&&!r.insert.length)&&(this.pendingContextChange=r,e.state.readOnly||lr(e,r,b.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{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(A.mark({attributes:{style:a}}).range(this.toEditorPos(r.rangeStart),this.toEditorPos(r.rangeEnd)))}}e.dispatch({effects:ca.of(A.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=ni(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.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,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.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}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(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)}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))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class S{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(i=>i.forEach(s=>t(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Qc(e.parent)||document,this.viewState=new co(e.state||L.create(e)),e.scrollTo&&e.scrollTo.is(Di)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Qt).map(i=>new Fn(i));for(let i of this.plugins)i.update(this);this.observer=new ou(this),this.inputState=new Bf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Qr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof Q?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Ca))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Oa(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(L.phrases)!=this.state.facet(L.phrases))return this.setState(r);s=sn.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new Ct(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(Di)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=on.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Ut)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Ei)!=s.state.facet(Ei)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Ms))try{u(s)}catch(d){oe(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!ba(this,c)&&h.force&&St(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new co(e),this.plugins=e.facet(Qt).map(i=>new Fn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Qr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Qt),i=e.state.facet(Qt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Fn(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Hl(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(m){return oe(this.state,m),po}}),f=sn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||m<-1){s=s+m,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Ms))l(t)}get themeClasses(){return Ps+" "+(this.state.facet(Bs)?Ta:Da)+" "+this.state.facet(Ei)}updateAttrs(){let e=go(this,fa,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(We)?"true":"false",class:"cm-content",style:`${k.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),go(this,rr,t);let i=this.observer.ignore(()=>{let s=vs(this.contentDOM,this.contentAttrs,t),r=vs(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(S.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ut);let e=this.state.facet(S.cspNonce);je.mount(this.root,this.styleModules.concat(su).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Vn(this,e,Yr(this,e,t,i))}moveByGroup(e,t){return Vn(this,e,Yr(this,e,t,i=>vf(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return wf(this,e,t,i)}moveVertically(e,t,i){return Vn(this,e,kf(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),ya(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Qe.find(r,e-s.from,-1,t)];return Cn(i,o.dir==H.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(la)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>hu)return Zl(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||_l(r.isolates,i=$r(this,e))))return r.order;i||(i=$r(this,e));let s=sf(e.text,t,i);return this.bidiCache.push(new on(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||k.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nl(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Di.of(new Ct(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Di.of(new Ct(b.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return z.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return z.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=je.newName(),s=[Ei.of(i),Ut.of(Ls(`.${i}`,e))];return t&&t.dark&&s.push(Bs.of(!0)),s}static baseTheme(e){return ft.lowest(Ut.of(Ls("."+Ps,e,Ba)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&E.get(i)||E.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}S.styleModule=Ut;S.inputHandler=ra;S.scrollHandler=ha;S.focusChangeEffect=oa;S.perLineTextDirection=la;S.exceptionSink=sa;S.updateListener=Ms;S.editable=We;S.mouseSelectionStyle=na;S.dragMovesSelection=ia;S.clickAddsSelectionRange=ta;S.decorations=si;S.outerDecorations=ua;S.atomicRanges=or;S.bidiIsolatedRanges=da;S.scrollMargins=ma;S.darkTheme=Bs;S.cspNonce=C.define({combine:n=>n.length?n[0]:""});S.contentAttributes=rr;S.editorAttributes=fa;S.lineWrapping=S.contentAttributes.of({class:"cm-lineWrapping"});S.announce=T.define();const hu=4096,po={};class on{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:H.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&ws(o,t)}return t}const cu=k.mac?"mac":k.windows?"win":k.linux?"linux":"key";function fu(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function du(n,e,t){return Ra(La(n.state),e,n,t)}let ze=null;const mu=4e3;function pu(n,e=cu){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),m=l.split(/ (?!$)/).map(y=>fu(y,e));for(let y=1;y{let v=ze={view:M,prefix:w,scope:o};return setTimeout(()=>{ze==v&&(ze=null)},mu),!0}]})}let p=m.join(" ");s(p,!1);let g=d[p]||(d[p]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,Rs))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let Rs=null;function Ra(n,e,t,i){Rs=e;let s=wc(e),r=X(s,0),o=ue(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;ze&&ze.view==t&&ze.scope==i&&(l=ze.prefix+" ",wa.indexOf(e.keyCode)<0&&(h=!0,ze=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],m,p;return d&&(u(d[l+Ii(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(k.windows&&e.ctrlKey&&e.altKey)&&(m=vc[e.keyCode])&&m!=s?(u(d[l+Ii(m,e,!0)])||e.shiftKey&&(p=kc[e.keyCode])!=s&&p!=m&&u(d[l+Ii(p,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Ii(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),Rs=null,a}class yi{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Ea(e);return[new yi(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return gu(e,t,i)}}function Ea(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==H.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function bo(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function gu(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==H.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Ea(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Ds(n,i),m=Ds(n,s),p=d.type==ie.Text?d:null,g=m.type==ie.Text?m:null;if(p&&(n.lineWrapping||d.widgetLineBreaks)&&(p=bo(n,i,1,p)),g&&(n.lineWrapping||m.widgetLineBreaks)&&(g=bo(n,s,-1,g)),p&&g&&p.from==g.from&&p.to==g.to)return w(M(t.from,t.to,p));{let O=p?M(t.from,null,p):v(d,!1),D=g?M(null,t.to,g):v(m,!0),N=[];return(p||d).to<(g||m).from-(p&&g?1:0)||d.widgetLineBreaks>1&&O.bottom+n.defaultLineHeight/2Si&&_e.from=ut)break;Pe>Ve&&Ar(Math.max(Be,Ve),O==null&&Be<=Si,Math.min(Pe,ut),D==null&&Pe>=Ci,Ht.dir)}if(Ve=Ze.to+1,Ve>=ut)break}return ki.length==0&&Ar(Si,O==null,Ci,D==null,n.textDirection),{top:K,bottom:He,horizontal:ki}}function v(O,D){let N=l.top+(D?O.top:O.bottom);return{top:N,bottom:N,horizontal:[]}}}function yu(n,e){return n.constructor==e.constructor&&n.eq(e)}class bu{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Gi)!=e.state.facet(Gi)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Gi);for(;t!yu(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Gi=C.define();function Ia(n){return[z.define(e=>new bu(e,n)),Gi.of(n)]}const Na=!k.ios,ri=C.define({combine(n){return De(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function S0(n={}){return[ri.of(n),xu,wu,vu,aa.of(!0)]}function Fa(n){return n.startState.facet(ri)!=n.state.facet(ri)}const xu=Ia({above:!0,markers(n){let{state:e}=n,t=e.facet(ri),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||Na:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:b.cursor(s.head,s.head>s.anchor?-1:1);for(let a of yi.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Fa(n);return t&&xo(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){xo(e.state,n)},class:"cm-cursorLayer"});function xo(n,e){e.style.animationDuration=n.facet(ri).cursorBlinkRate+"ms"}const wu=Ia({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:yi.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Fa(n)},class:"cm-selectionLayer"}),Es={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Na&&(Es[".cm-line"].caretColor=Es[".cm-content"].caretColor="transparent !important");const vu=ft.highest(S.theme(Es)),Ha=T.define({map(n,e){return n==null?null:e.mapPos(n)}}),Xt=J.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(Ha)?i.value:t,n)}}),ku=z.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Xt);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Xt)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Xt),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Xt)!=n&&this.view.dispatch({effects:Ha.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function C0(){return[Xt,ku]}function wo(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Su(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Cu{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new Xe,i=t.add.bind(t);for(let{from:s,to:r}of Su(e,this.maxLength))wo(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(p,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,p,m));t=t.update({filterFrom:c,filterTo:f,filter:(p,g)=>pf,add:u})}}return t}}const Is=/x/.unicode!=null?"gu":"g",Ou=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Is),Mu={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 qn=null;function Au(){var n;if(qn==null&&typeof document<"u"&&document.body){let e=document.body.style;qn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return qn||!1}const Yi=C.define({combine(n){let e=De(n,{render:null,specialChars:Ou,addSpecialChars:null});return(e.replaceTabs=!Au())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Is)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Is)),e}});function O0(n={}){return[Yi.of(n),Du()]}let vo=null;function Du(){return vo||(vo=z.fromClass(class{constructor(n){this.view=n,this.decorations=A.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Yi)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Cu({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=X(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=It(o.text,l,i-o.from);return A.replace({widget:new Lu((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=A.replace({widget:new Pu(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Yi);n.startState.facet(Yi)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Tu="•";function Bu(n){return n>=32?Tu:n==10?"␤":String.fromCharCode(9216+n)}class Pu extends Fe{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Bu(this.code),i=e.state.phrase("Control character")+" "+(Mu[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Lu extends Fe{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 M0(){return Eu}const Ru=A.line({class:"cm-activeLine"}),Eu=z.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(Ru.range(s.from)),e=s.from)}return A.set(t)}},{decorations:n=>n.decorations});class Iu extends Fe{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?Dt(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Cn(t[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 A0(n){return z.fromClass(class{constructor(e){this.view=e,this.placeholder=n?A.set([A.widget({widget:new Iu(n),side:1}).range(0)]):A.none}get decorations(){return this.view.state.doc.length?A.none:this.placeholder}},{decorations:e=>e.decorations})}const Ns=2e3;function Nu(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ns||t.off>Ns||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.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(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=ps(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=ps(h.text,l,n.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function Fu(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function ko(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Ns?-1:s==i.length?Fu(n,e.clientX):It(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Hu(n,e){let t=ko(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=ko(n,s);if(!l)return i;let a=Nu(n.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function D0(n){let e=t=>t.altKey&&t.button==0;return S.mouseSelectionStyle.of((t,i)=>e(i)?Hu(t,i):null)}const Vu={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},Wu={style:"cursor: crosshair"};function T0(n={}){let[e,t]=Vu[n.key||"Alt"],i=z.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,S.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?Wu:null})]}const zt="-10000px";class Va{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function zu(n){let{win:e}=n;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const $n=C.define({combine:n=>{var e,t,i;return{position:k.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||zu}}}),So=new WeakMap,cr=z.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet($n);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Va(n,fr,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet($n);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=zt,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect(),e=1,t=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(k.gecko)i=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==zt&&s.style.left=="0px"){let r=s.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((s,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet($n).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1){c.style.top=zt;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,p=u.right-u.left,g=(e=So.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||$u,w=this.view.textDirection==H.LTR,M=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-p)):Math.min(Math.max(i.left,f.left-p+(d?14:0)-y.x),i.right-p),v=this.above[l];!a.strictSide&&(v?f.top-(u.bottom-u.top)-y.yi.bottom)&&v==i.bottom-f.bottom>f.top-i.top&&(v=this.above[l]=!v);let O=(v?f.top-i.top:i.bottom-f.bottom)-m;if(OM&&K.topD&&(D=v?K.top-g-2-m:K.bottom+m+2);if(this.position=="absolute"?(c.style.top=(D-n.parent.top)/r+"px",c.style.left=(M-n.parent.left)/s+"px"):(c.style.top=D/r+"px",c.style.left=M/s+"px"),d){let K=f.left+(w?y.x:-y.x)-(M+14-7);d.style.left=K/s+"px"}h.overlap!==!0&&o.push({left:M,top:D,right:N,bottom:D+g}),c.classList.toggle("cm-tooltip-above",v),c.classList.toggle("cm-tooltip-below",!v),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=zt}},{eventObservers:{scroll(){this.maybeMeasure()}}}),qu=S.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),$u={x:0,y:0},fr=C.define({enables:[cr,qu]}),ln=C.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Mn{static create(e){return new Mn(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Va(e,ln,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Qu=fr.compute([ln],n=>{let e=n.facet(ln);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Mn.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Uu{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==H.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>oe(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(cr),t=e?e.manager.tooltips.findIndex(i=>i.create==Mn.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Ku(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!ju(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ni=4;function Ku(n,e){let t=n.getBoundingClientRect();return e.clientX>=t.left-Ni&&e.clientX<=t.right+Ni&&e.clientY>=t.top-Ni&&e.clientY<=t.bottom+Ni}function ju(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Xu(n,e={}){let t=T.define(),i=J.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,te.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Gu)&&(s=[]);return s},provide:s=>ln.from(s)});return{active:i,extension:[i,z.define(s=>new Uu(s,n,i,t,e.hoverTime||300)),Qu]}}function Wa(n,e){let t=n.plugin(cr);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Gu=T.define(),Co=C.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function oi(n,e){let t=n.plugin(za),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const za=z.fromClass(class{constructor(n){this.input=n.state.facet(li),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Co);this.top=new Fi(n,!0,e.topContainer),this.bottom=new Fi(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Co);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Fi(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Fi(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(li);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>S.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Fi{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Oo(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Oo(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Oo(n){let e=n.nextSibling;return n.remove(),e}const li=C.define({enables:za});class Ie extends ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ie.prototype.elementClass="";Ie.prototype.toDOM=void 0;Ie.prototype.mapMode=te.TrackBefore;Ie.prototype.startSide=Ie.prototype.endSide=-1;Ie.prototype.point=!0;const Ji=C.define(),Yu={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>B.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Zt=C.define();function Ju(n){return[qa(),Zt.of(Object.assign(Object.assign({},Yu),n))]}const Mo=C.define({combine:n=>n.some(e=>e)});function qa(n){return[_u]}const _u=z.fromClass(class{constructor(n){this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Zt).map(e=>new Do(n,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!n.state.facet(Mo),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Mo)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&this.dom.remove();let t=B.iter(this.view.state.facet(Ji),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Zu(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ie.Text&&o){Fs(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ie.Text){Fs(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(n){let e=n.startState.facet(Zt),t=n.state.facet(Zt),i=n.docChanged||n.heightChanged||n.viewportChanged||!B.eq(n.startState.facet(Ji),n.state.facet(Ji),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Do(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove()}},{provide:n=>S.scrollMargins.of(e=>{let t=e.plugin(n);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==H.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Ao(n){return Array.isArray(n)?n:[n]}function Fs(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Zu{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=B.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new $a(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Fs(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);i&&this.addElement(e,t,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Do{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Ao(t.markers(e)),t.initialSpacer&&(this.spacer=new $a(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ao(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!B.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class $a{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),ed(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Qn extends Ie{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Un(n,e){return n.state.facet(bt).formatNumber(e,n.state)}const id=Zt.compute([bt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(td)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Qn(Un(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(bt)!=e.state.facet(bt),initialSpacer(e){return new Qn(Un(e,To(e.state.doc.lines)))},updateSpacer(e,t){let i=Un(t.view,To(t.view.state.doc.lines));return i==e.number?e:new Qn(i)},domEventHandlers:n.facet(bt).domEventHandlers}));function B0(n={}){return[bt.of(n),qa(),id]}function To(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(nd.range(s)))}return B.of(e)});function P0(){return sd}var Kn;const xt=new pe;function rd(n){return C.define({combine:n?e=>e.concat(n):void 0})}const od=new pe;class be{constructor(e,t,i=[],s=""){this.data=e,this.name=s,L.prototype.hasOwnProperty("tree")||Object.defineProperty(L.prototype,"tree",{get(){return U(this)}}),this.parser=t,this.extension=[Ye.of(this),L.languageData.of((r,o,l)=>{let a=Bo(r,o,l),h=a.type.prop(xt);if(!h)return[];let c=r.facet(h),f=a.type.prop(od);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let m=r.facet(d.facet);return d.type=="replace"?m:m.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Bo(e,t,i).type.prop(xt)==this.data}findRegions(e){let t=e.facet(Ye);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(xt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(pe.mounted);if(l){if(l.tree.prop(xt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new an(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function U(n){let e=n.field(be.state,!1);return e?e.tree:yt.empty}class ld{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let qt=null;class hn{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new hn(e,t,[],yt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new ld(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=yt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped($i.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=qt;qt=this;try{return e()}finally{qt=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Po(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=$i.applyChanges(i,a),s=yt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Po(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends gc{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=qt;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new yt(_s.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return qt}}function Po(n,e,t){return $i.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Lt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Lt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=hn.create(e.facet(Ye).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Lt(i)}}be.state=J.define({create:Lt.init,update(n,e){for(let t of e.effects)if(t.is(be.setState))return t.value;return e.startState.facet(Ye)!=e.state.facet(Ye)?Lt.init(e.state):n.apply(e)}});let Qa=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Qa=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const jn=typeof navigator<"u"&&(!((Kn=navigator.scheduling)===null||Kn===void 0)&&Kn.isInputPending)?()=>navigator.scheduling.isInputPending():null,ad=z.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(be.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(be.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Qa(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>jn&&jn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:be.setState.of(new Lt(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>oe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ye=C.define({combine(n){return n.length?n[0]:null},enables:n=>[be.state,ad,S.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hd{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const cd=C.define(),ur=C.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function cn(n){let e=n.facet(ur);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function ai(n,e){let t="",i=n.tabSize,s=n.facet(ur)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?fd(n,t,e):null}class An{constructor(e,t={}){this.state=e,this.options=t,this.unit=cn(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return It(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ua=new pe;function fd(n,e,t){let i=e.resolveStack(t),s=i.node.enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o!=i.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Ka(i,n,t)}function Ka(n,e,t){for(let i=n;i;i=i.next){let s=dd(i.node);if(s)return s(mr.create(e,t,i))}return 0}function ud(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function dd(n){let e=n.type.prop(Ua);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(pe.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>yd(o,!0,1,void 0,r&&!ud(o)?s.from:void 0)}return n.parent==null?md:null}function md(){return 0}class mr extends An{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new mr(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(pd(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Ka(this.context.next,this.base,this.pos)}}function pd(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function gd(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.from{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const xd=200;function R0(){return L.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+xd)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=dr(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=ai(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const wd=C.define(),ja=new pe;function vd(n,e,t){let i=U(n);if(i.lengtht)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function kd(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function fn(n,e,t){for(let i of n.facet(wd)){let s=i(n,e,t);if(s)return s}return vd(n,e,t)}function Xa(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Dn=T.define({map:Xa}),bi=T.define({map:Xa});function Ga(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const ct=J.define({create(){return A.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(Dn)&&!Sd(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(_a),s=i?A.replace({widget:new Td(i(e.state,t.value))}):Lo;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(bi)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:i}=e.selection.main;n.between(i,i,(s,r)=>{si&&(t=!0)}),t&&(n=n.update({filterFrom:i,filterTo:i,filter:(s,r)=>r<=i||s>=i}))}return n},provide:n=>S.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{(!s||s.from>r)&&(s={from:r,to:o})}),s}function Sd(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function Ya(n,e){return n.field(ct,!1)?e:e.concat(T.appendConfig.of(Za()))}const Cd=n=>{for(let e of Ga(n)){let t=fn(n.state,e.from,e.to);if(t)return n.dispatch({effects:Ya(n.state,[Dn.of(t),Ja(n,t)])}),!0}return!1},Od=n=>{if(!n.state.field(ct,!1))return!1;let e=[];for(let t of Ga(n)){let i=un(n.state,t.from,t.to);i&&e.push(bi.of(i),Ja(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function Ja(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return S.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const Md=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(ct,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(bi.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},E0=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Cd},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Od},{key:"Ctrl-Alt-[",run:Md},{key:"Ctrl-Alt-]",run:Ad}],Dd={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},_a=C.define({combine(n){return De(n,Dd)}});function Za(n){return[ct,Pd]}function eh(n,e){let{state:t}=n,i=t.facet(_a),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=un(n.state,l.from,l.to);a&&n.dispatch({effects:bi.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Lo=A.replace({widget:new class extends Fe{toDOM(n){return eh(n,null)}}});class Td extends Fe{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return eh(e,this.value)}}const Bd={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Xn extends Ie{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function I0(n={}){let e=Object.assign(Object.assign({},Bd),n),t=new Xn(e,!0),i=new Xn(e,!1),s=z.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ye)!=o.state.facet(Ye)||o.startState.field(ct,!1)!=o.state.field(ct,!1)||U(o.startState)!=U(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Xe;for(let a of o.viewportLineBlocks){let h=un(o.state,a.from,a.to)?i:fn(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Ju({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||B.empty},initialSpacer(){return new Xn(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=un(o.state,l.from,l.to);if(h)return o.dispatch({effects:bi.of(h)}),!0;let c=fn(o.state,l.from,l.to);return c?(o.dispatch({effects:Dn.of(c)}),!0):!1}})}),Za()]}const Pd=S.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class xi{constructor(e,t){this.specs=e;let i;function s(l){let a=je.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof be?l=>l.prop(xt)==o.data:o?l=>l==o:void 0,this.style=mc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new je(i):null,this.themeType=t.themeType}static define(e,t){return new xi(e,t||{})}}const Hs=C.define(),th=C.define({combine(n){return n.length?[n[0]]:null}});function Gn(n){let e=n.facet(Hs);return e.length?e:n.facet(th)}function Ld(n,e){let t=[Ed],i;return n instanceof xi&&(n.module&&t.push(S.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(th.of(n)):i?t.push(Hs.computeN([S.darkTheme],s=>s.facet(S.darkTheme)==(i=="dark")?[n]:[])):t.push(Hs.of(n)),t}class Rd{constructor(e){this.markCache=Object.create(null),this.tree=U(e.state),this.decorations=this.buildDeco(e,Gn(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=U(e.state),i=Gn(e.state),s=i!=Gn(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return A.none;let i=new Xe;for(let{from:s,to:r}of e.visibleRanges)yc(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=A.mark({class:a})))},s,r);return i.finish()}}const Ed=ft.high(z.fromClass(Rd,{decorations:n=>n.decorations})),N0=xi.define([{tag:x.meta,color:"#404740"},{tag:x.link,textDecoration:"underline"},{tag:x.heading,textDecoration:"underline",fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strong,fontWeight:"bold"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.keyword,color:"#708"},{tag:[x.atom,x.bool,x.url,x.contentSeparator,x.labelName],color:"#219"},{tag:[x.literal,x.inserted],color:"#164"},{tag:[x.string,x.deleted],color:"#a11"},{tag:[x.regexp,x.escape,x.special(x.string)],color:"#e40"},{tag:x.definition(x.variableName),color:"#00f"},{tag:x.local(x.variableName),color:"#30a"},{tag:[x.typeName,x.namespace],color:"#085"},{tag:x.className,color:"#167"},{tag:[x.special(x.variableName),x.macroName],color:"#256"},{tag:x.definition(x.propertyName),color:"#00c"},{tag:x.comment,color:"#940"},{tag:x.invalid,color:"#f00"}]),Id=S.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ih=1e4,nh="()[]{}",sh=C.define({combine(n){return De(n,{afterCursor:!0,brackets:nh,maxScanDistance:ih,renderMatch:Hd})}}),Nd=A.mark({class:"cm-matchingBracket"}),Fd=A.mark({class:"cm-nonmatchingBracket"});function Hd(n){let e=[],t=n.matched?Nd:Fd;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Vd=J.define({create(){return A.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(sh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Oe(e.state,s.head,-1,i)||s.head>0&&Oe(e.state,s.head-1,1,i)||i.afterCursor&&(Oe(e.state,s.head,1,i)||s.headS.decorations.from(n)}),Wd=[Vd,Id];function F0(n={}){return[sh.of(n),Wd]}const zd=new pe;function Vs(n,e,t){let i=n.prop(e<0?pe.openedBy:pe.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Ws(n){let e=n.type.prop(zd);return e?e(n.node):n}function Oe(n,e,t,i={}){let s=i.maxScanDistance||ih,r=i.brackets||nh,o=U(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Vs(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return qd(n,e,t,a,c,h,r)}}return $d(n,e,t,o,l.type,s,r)}function qd(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let m=e+u*t;for(let p=t>0?0:d.length-1,g=t>0?d.length:-1;p!=g;p+=t){let y=o.indexOf(d[p]);if(!(y<0||i.resolveInner(m+p,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:m+p,to:m+p+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}const Qd=Object.create(null),Ro=[_s.none],Eo=[],Io=Object.create(null),Ud=Object.create(null);for(let[n,e]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"]])Ud[n]=Kd(Qd,e);function Yn(n,e){Eo.indexOf(n)>-1||(Eo.push(n),console.warn(e))}function Kd(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||x[h];c?typeof c=="function"?a.length?a=a.map(c):Yn(h,`Modifier ${h} used at start of tag`):a.length?Yn(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Yn(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Io[s];if(r)return r.id;let o=Io[s]=_s.define({id:Ro.length,name:i,props:[yl({[i]:t})]});return Ro.push(o),o.id}H.RTL,H.LTR;class rh{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=U(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(lh(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function No(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function jd(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:jd(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function Xd(n,e){return t=>{for(let i=U(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class Fo{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Ue(n){return n.selection.main.from}function lh(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const ah=Ne.define();function Gd(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return Object.assign(Object.assign({},n.changeByRange(l=>l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i)?{range:l}:{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:e},range:b.cursor(l.from+r+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Ho=new WeakMap;function Yd(n){if(!Array.isArray(n))return n;let e=Ho.get(n);return e||Ho.set(n,e=oh(n)),e}const dn=T.define(),hi=T.define();class Jd{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&O<=57||O>=97&&O<=122?2:O>=65&&O<=90?1:0:(D=Zs(O))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0;(!w||N==1&&g||v==0&&N!=0)&&(t[f]==O||i[f]==O&&(u=!0)?o[f++]=w:o.length&&(y=!1)),v=N,w+=ue(O)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&m==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[m,p]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?ue(X(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class _d{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Zd,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Vo(e(i),t(i)),optionClass:(e,t)=>i=>Vo(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Vo(n,e){return n?e?n+" "+e:n:e}function Zd(n,e,t,i,s,r){let o=n.textDirection==H.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,m=i.right-i.left,p=i.bottom-i.top;if(l&&u=p||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function em(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function Jn(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class tm{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(G);this.optionContent=em(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Jn(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(G).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:hi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=Jn(r.length,o,e.state.facet(G).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Jn(t.options.length,t.selected,this.view.state.facet(G).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>oe(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&nm(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottomi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew tm(t,n,e)}function nm(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function Wo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function sm(n,e){let t=[],i=null,s=h=>{t.push(h);let{section:c}=h.completion;if(c){i||(i=[]);let f=typeof c=="string"?c:c.name;i.some(u=>u.name==f)||i.push(typeof c=="string"?{name:f}:c)}},r=e.facet(G);for(let h of n)if(h.hasResult()){let c=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)s(new Fo(f,h.source,c?c(f):[],1e9-t.length));else{let f=e.sliceDoc(h.from,h.to),u,d=r.filterStrict?new _d(f):new Jd(f);for(let m of h.result.options)if(u=d.match(m.label)){let p=m.displayLabel?c?c(m,u.matched):[]:u.matched;s(new Fo(m,h.source,p,u.score+(m.boost||0)))}}}if(i){let h=Object.create(null),c=0,f=(u,d)=>{var m,p;return((m=u.rank)!==null&&m!==void 0?m:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(u.namef.score-c.score||a(c.completion,f.completion))){let c=h.completion;!l||l.label!=c.label||l.detail!=c.detail||l.type!=null&&c.type!=null&&l.type!=c.type||l.apply!=c.apply||l.boost!=c.boost?o.push(h):Wo(h.completion)>Wo(l)&&(o[o.length-1]=h),l=h.completion}return o}class wt{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new wt(this.options,zo(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r){let o=sm(e,t);if(!o.length)return s&&e.some(a=>a.state==1)?new wt(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;let l=t.facet(G).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let a=s.options[s.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:cm,above:r.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new wt(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class mn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new mn(am,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(G),r=(i.override||t.languageDataAt("autocomplete",Ue(t)).map(Yd)).map(l=>(this.active.find(h=>h.source==l)||new ce(l,this.active.some(h=>h.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,a)=>l==this.active[a])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!rm(r,this.active)?o=wt.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(l=>l.state==1)&&(o=null),!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ce(l.source,0):l));for(let l of e.effects)l.is(fh)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new mn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?om:lm}}function rm(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const am=[];function hh(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(ah);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class ce{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=hh(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new ce(s.source,0)),i&4&&s.state==0&&(s=new ce(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(dn))s=new ce(s.source,1,r.value?Ue(e.state):-1);else if(r.is(hi))s=new ce(s.source,0);else if(r.is(ch))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ce(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(Ue(e.state))}}class Ot extends ce{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ue(e.state);if((this.explicitPos<0?l<=r:lo||!s||t&2&&Ue(e.startState)==this.from)return new ce(this.source,t&4?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return hm(s.validFor,e.state,r,o)?new Ot(this.source,a,s,r,o):s.update&&(s=s.update(s,r,o,new rh(e.state,l,a>=0)))?new Ot(this.source,a,s,s.from,(i=s.to)!==null&&i!==void 0?i:Ue(e.state)):new ce(this.source,1,a)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Ot(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ce(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function hm(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):lh(n,!0).test(s)}const ch=T.define({map(n,e){return n.map(t=>t.map(e))}}),fh=T.define(),re=J.define({create(){return mn.start()},update(n,e){return n.update(e)},provide:n=>[fr.from(n,e=>e.tooltip),S.contentAttributes.from(n,e=>e.attrs)]});function pr(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(re).active.find(s=>s.source==e.source);return i instanceof Ot?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},Gd(n.state,t,i.from,i.to)),{annotations:ah.of(e.completion)})):t(n,e.completion,i.from,i.to),!0):!1}const cm=im(re,pr);function Hi(n,e="option"){return t=>{let i=t.state.field(re,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:fh.of(l)}),!0}}const fm=n=>{let e=n.state.field(re,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(re,!1)?(n.dispatch({effects:dn.of(!0)}),!0):!1,dm=n=>{let e=n.state.field(re,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:hi.of(null)}),!0)};class mm{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const pm=50,gm=1e3,ym=z.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(re).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(re),t=n.state.facet(G);if(!n.selectionSet&&!n.docChanged&&n.startState.field(re)==e)return;let i=n.transactions.some(r=>{let o=hh(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rpm&&Date.now()-o.time>gm){for(let l of o.context.abortListeners)try{l()}catch(a){oe(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(dn)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(re);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=Ue(e),i=new rh(e,t,n.explicitPos==t,this.view),s=new mm(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:hi.of(null)}),oe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(G).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(G);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ce(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:ch.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(re,!1);if(e&&e.tooltip&&this.view.state.facet(G).closeOnBlur){let t=e.open&&Wa(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:hi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:dn.of(!1)}),20),this.composing=0}}}),bm=typeof navigator=="object"&&/Win/.test(navigator.platform),xm=ft.highest(S.domEventHandlers({keydown(n,e){let t=e.state.field(re,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(bm&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&pr(e,i),!1}})),wm=S.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),ci={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},rt=T.define({map(n,e){let t=e.mapPos(n,-1,te.TrackAfter);return t??void 0}}),gr=new class extends ot{};gr.startSide=1;gr.endSide=-1;const uh=J.define({create(){return B.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(rt)&&(n=n.update({add:[gr.range(t.value,t.value+1)]}));return n}});function H0(){return[km,uh]}const _n="()[]{}<>";function dh(n){for(let e=0;e<_n.length;e+=2)if(_n.charCodeAt(e)==n)return _n.charAt(e+1);return Zs(n<128?n:n+1)}function mh(n,e){return n.languageDataAt("closeBrackets",e)[0]||ci}const vm=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),km=S.inputHandler.of((n,e,t,i)=>{if((vm?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&ue(X(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Cm(n.state,i);return r?(n.dispatch(r),!0):!1}),Sm=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=mh(n,n.selection.main.head).brackets||ci.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Om(n.doc,o.head);for(let a of i)if(a==l&&Tn(n.doc,o.head)==dh(X(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},V0=[{key:"Backspace",run:Sm}];function Cm(n,e){let t=mh(n,n.selection.main.head),i=t.brackets||ci.brackets;for(let s of i){let r=dh(X(s,0));if(e==s)return r==s?Dm(n,s,i.indexOf(s+s+s)>-1,t):Mm(n,s,r,t.before||ci.before);if(e==r&&ph(n,n.selection.main.from))return Am(n,s,r)}return null}function ph(n,e){let t=!1;return n.field(uh).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Tn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ue(X(t,0)))}function Om(n,e){let t=n.sliceString(e-2,e);return ue(X(t,0))==t.length?t:t.slice(1)}function Mm(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:rt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Tn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:rt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Am(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Tn(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Dm(n,e,t,i){let s=i.stringPrefixes||ci.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:rt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Tn(n.doc,a),c;if(h==e){if(qo(n,a))return{changes:{insert:e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)};if(ph(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=$o(n,a-2*e.length,s))>-1&&qo(n,c))return{changes:{insert:e+e+e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=V.Word&&$o(n,a,s)>-1&&!Tm(n,a,e,s))return{changes:{insert:e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function qo(n,e){let t=U(n).resolveInner(e+1);return t.parent&&t.from==e}function Tm(n,e,t,i){let s=U(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function $o(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=V.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=V.Word)return r}return-1}function W0(n={}){return[xm,re,G.of(n),ym,Pm,wm]}const Bm=[{key:"Ctrl-Space",run:um},{key:"Escape",run:dm},{key:"ArrowDown",run:Hi(!0)},{key:"ArrowUp",run:Hi(!1)},{key:"PageDown",run:Hi(!0,"page")},{key:"PageUp",run:Hi(!1,"page")},{key:"Enter",run:fm}],Pm=ft.highest(Pa.computeN([G],n=>n.facet(G).defaultKeymap?[Bm]:[])),Lm=36,Qo=1,Rm=2,mt=3,Zn=4,Em=5,Im=6,Nm=7,Fm=8,Hm=9,Vm=10,Wm=11,zm=12,qm=13,$m=14,Qm=15,Um=16,Km=17,Uo=18,jm=19,gh=20,yh=21,Ko=22,Xm=23,Gm=24;function zs(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function Ym(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function tt(n,e,t){for(let i=!1;;){if(n.next<0)return;if(n.next==e&&!i){n.advance();return}i=t&&!i&&n.next==92,n.advance()}}function Jm(n,e){e:for(;;){if(n.next<0)return console.log("exit at end",n.pos);if(n.next==36){n.advance();for(let t=0;t)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==i&&n.peek(1)==39){n.advance(2);return}n.advance()}}function qs(n,e){for(;!(n.next!=95&&!zs(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function Zm(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),tt(n,e,!1)}else qs(n)}function jo(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function Xo(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function Go(n){for(;!(n.next<0||n.next==10);)n.advance()}function et(n,e){for(let t=0;t{let{doc:s}=t.state,r=X(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=It(o.text,l,i-o.from);return A.replace({widget:new Lu((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=A.replace({widget:new Pu(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Yi);n.startState.facet(Yi)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Tu="•";function Bu(n){return n>=32?Tu:n==10?"␤":String.fromCharCode(9216+n)}class Pu extends Fe{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Bu(this.code),i=e.state.phrase("Control character")+" "+(Mu[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Lu extends Fe{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 M0(){return Eu}const Ru=A.line({class:"cm-activeLine"}),Eu=z.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(Ru.range(s.from)),e=s.from)}return A.set(t)}},{decorations:n=>n.decorations});class Iu extends Fe{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?Dt(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Cn(t[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 A0(n){return z.fromClass(class{constructor(e){this.view=e,this.placeholder=n?A.set([A.widget({widget:new Iu(n),side:1}).range(0)]):A.none}get decorations(){return this.view.state.doc.length?A.none:this.placeholder}},{decorations:e=>e.decorations})}const Ns=2e3;function Nu(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ns||t.off>Ns||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.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(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=ps(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=ps(h.text,l,n.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function Fu(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function ko(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Ns?-1:s==i.length?Fu(n,e.clientX):It(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Hu(n,e){let t=ko(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=ko(n,s);if(!l)return i;let a=Nu(n.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function D0(n){let e=t=>t.altKey&&t.button==0;return S.mouseSelectionStyle.of((t,i)=>e(i)?Hu(t,i):null)}const Vu={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},Wu={style:"cursor: crosshair"};function T0(n={}){let[e,t]=Vu[n.key||"Alt"],i=z.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,S.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?Wu:null})]}const zt="-10000px";class Va{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function zu(n){let{win:e}=n;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const $n=C.define({combine:n=>{var e,t,i;return{position:k.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||zu}}}),So=new WeakMap,cr=z.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet($n);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Va(n,fr,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet($n);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=zt,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect(),e=1,t=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(k.gecko)i=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==zt&&s.style.left=="0px"){let r=s.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((s,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet($n).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1){c.style.top=zt;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,p=u.right-u.left,g=(e=So.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||$u,w=this.view.textDirection==H.LTR,M=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-p)):Math.min(Math.max(i.left,f.left-p+(d?14:0)-y.x),i.right-p),v=this.above[l];!a.strictSide&&(v?f.top-(u.bottom-u.top)-y.yi.bottom)&&v==i.bottom-f.bottom>f.top-i.top&&(v=this.above[l]=!v);let O=(v?f.top-i.top:i.bottom-f.bottom)-m;if(OM&&K.topD&&(D=v?K.top-g-2-m:K.bottom+m+2);if(this.position=="absolute"?(c.style.top=(D-n.parent.top)/r+"px",c.style.left=(M-n.parent.left)/s+"px"):(c.style.top=D/r+"px",c.style.left=M/s+"px"),d){let K=f.left+(w?y.x:-y.x)-(M+14-7);d.style.left=K/s+"px"}h.overlap!==!0&&o.push({left:M,top:D,right:N,bottom:D+g}),c.classList.toggle("cm-tooltip-above",v),c.classList.toggle("cm-tooltip-below",!v),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=zt}},{eventObservers:{scroll(){this.maybeMeasure()}}}),qu=S.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),$u={x:0,y:0},fr=C.define({enables:[cr,qu]}),ln=C.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Mn{static create(e){return new Mn(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Va(e,ln,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Qu=fr.compute([ln],n=>{let e=n.facet(ln);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Mn.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Uu{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==H.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>oe(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(cr),t=e?e.manager.tooltips.findIndex(i=>i.create==Mn.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Ku(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!ju(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ni=4;function Ku(n,e){let t=n.getBoundingClientRect();return e.clientX>=t.left-Ni&&e.clientX<=t.right+Ni&&e.clientY>=t.top-Ni&&e.clientY<=t.bottom+Ni}function ju(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Xu(n,e={}){let t=T.define(),i=J.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,te.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Gu)&&(s=[]);return s},provide:s=>ln.from(s)});return{active:i,extension:[i,z.define(s=>new Uu(s,n,i,t,e.hoverTime||300)),Qu]}}function Wa(n,e){let t=n.plugin(cr);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Gu=T.define(),Co=C.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function oi(n,e){let t=n.plugin(za),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const za=z.fromClass(class{constructor(n){this.input=n.state.facet(li),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Co);this.top=new Fi(n,!0,e.topContainer),this.bottom=new Fi(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Co);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Fi(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Fi(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(li);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>S.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Fi{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Oo(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Oo(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Oo(n){let e=n.nextSibling;return n.remove(),e}const li=C.define({enables:za});class Ie extends ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ie.prototype.elementClass="";Ie.prototype.toDOM=void 0;Ie.prototype.mapMode=te.TrackBefore;Ie.prototype.startSide=Ie.prototype.endSide=-1;Ie.prototype.point=!0;const Ji=C.define(),Yu={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>B.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Zt=C.define();function Ju(n){return[qa(),Zt.of(Object.assign(Object.assign({},Yu),n))]}const Mo=C.define({combine:n=>n.some(e=>e)});function qa(n){return[_u]}const _u=z.fromClass(class{constructor(n){this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Zt).map(e=>new Do(n,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!n.state.facet(Mo),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Mo)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&this.dom.remove();let t=B.iter(this.view.state.facet(Ji),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Zu(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ie.Text&&o){Fs(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ie.Text){Fs(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(n){let e=n.startState.facet(Zt),t=n.state.facet(Zt),i=n.docChanged||n.heightChanged||n.viewportChanged||!B.eq(n.startState.facet(Ji),n.state.facet(Ji),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Do(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove()}},{provide:n=>S.scrollMargins.of(e=>{let t=e.plugin(n);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==H.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Ao(n){return Array.isArray(n)?n:[n]}function Fs(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Zu{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=B.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new $a(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Fs(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);i&&this.addElement(e,t,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Do{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Ao(t.markers(e)),t.initialSpacer&&(this.spacer=new $a(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ao(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!B.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class $a{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),ed(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Qn extends Ie{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Un(n,e){return n.state.facet(bt).formatNumber(e,n.state)}const id=Zt.compute([bt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(td)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Qn(Un(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(bt)!=e.state.facet(bt),initialSpacer(e){return new Qn(Un(e,To(e.state.doc.lines)))},updateSpacer(e,t){let i=Un(t.view,To(t.view.state.doc.lines));return i==e.number?e:new Qn(i)},domEventHandlers:n.facet(bt).domEventHandlers}));function B0(n={}){return[bt.of(n),qa(),id]}function To(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(nd.range(s)))}return B.of(e)});function P0(){return sd}var Kn;const xt=new pe;function rd(n){return C.define({combine:n?e=>e.concat(n):void 0})}const od=new pe;class be{constructor(e,t,i=[],s=""){this.data=e,this.name=s,L.prototype.hasOwnProperty("tree")||Object.defineProperty(L.prototype,"tree",{get(){return U(this)}}),this.parser=t,this.extension=[Ye.of(this),L.languageData.of((r,o,l)=>{let a=Bo(r,o,l),h=a.type.prop(xt);if(!h)return[];let c=r.facet(h),f=a.type.prop(od);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let m=r.facet(d.facet);return d.type=="replace"?m:m.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Bo(e,t,i).type.prop(xt)==this.data}findRegions(e){let t=e.facet(Ye);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(xt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(pe.mounted);if(l){if(l.tree.prop(xt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new an(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function U(n){let e=n.field(be.state,!1);return e?e.tree:yt.empty}class ld{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let qt=null;class hn{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new hn(e,t,[],yt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new ld(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=yt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped($i.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=qt;qt=this;try{return e()}finally{qt=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Po(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=$i.applyChanges(i,a),s=yt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Po(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends yc{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=qt;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new yt(_s.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return qt}}function Po(n,e,t){return $i.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Lt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Lt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=hn.create(e.facet(Ye).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Lt(i)}}be.state=J.define({create:Lt.init,update(n,e){for(let t of e.effects)if(t.is(be.setState))return t.value;return e.startState.facet(Ye)!=e.state.facet(Ye)?Lt.init(e.state):n.apply(e)}});let Qa=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Qa=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const jn=typeof navigator<"u"&&(!((Kn=navigator.scheduling)===null||Kn===void 0)&&Kn.isInputPending)?()=>navigator.scheduling.isInputPending():null,ad=z.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(be.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(be.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Qa(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>jn&&jn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:be.setState.of(new Lt(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>oe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ye=C.define({combine(n){return n.length?n[0]:null},enables:n=>[be.state,ad,S.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hd{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const cd=C.define(),ur=C.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function cn(n){let e=n.facet(ur);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function ai(n,e){let t="",i=n.tabSize,s=n.facet(ur)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?fd(n,t,e):null}class An{constructor(e,t={}){this.state=e,this.options=t,this.unit=cn(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return It(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ua=new pe;function fd(n,e,t){let i=e.resolveStack(t),s=i.node.enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o!=i.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Ka(i,n,t)}function Ka(n,e,t){for(let i=n;i;i=i.next){let s=dd(i.node);if(s)return s(mr.create(e,t,i))}return 0}function ud(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function dd(n){let e=n.type.prop(Ua);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(pe.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>yd(o,!0,1,void 0,r&&!ud(o)?s.from:void 0)}return n.parent==null?md:null}function md(){return 0}class mr extends An{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new mr(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(pd(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Ka(this.context.next,this.base,this.pos)}}function pd(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function gd(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.from{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const xd=200;function R0(){return L.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+xd)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=dr(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=ai(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const wd=C.define(),ja=new pe;function vd(n,e,t){let i=U(n);if(i.lengtht)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function kd(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function fn(n,e,t){for(let i of n.facet(wd)){let s=i(n,e,t);if(s)return s}return vd(n,e,t)}function Xa(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Dn=T.define({map:Xa}),bi=T.define({map:Xa});function Ga(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const ct=J.define({create(){return A.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)if(t.is(Dn)&&!Sd(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(_a),s=i?A.replace({widget:new Td(i(e.state,t.value))}):Lo;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(bi)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:i}=e.selection.main;n.between(i,i,(s,r)=>{si&&(t=!0)}),t&&(n=n.update({filterFrom:i,filterTo:i,filter:(s,r)=>r<=i||s>=i}))}return n},provide:n=>S.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{(!s||s.from>r)&&(s={from:r,to:o})}),s}function Sd(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function Ya(n,e){return n.field(ct,!1)?e:e.concat(T.appendConfig.of(Za()))}const Cd=n=>{for(let e of Ga(n)){let t=fn(n.state,e.from,e.to);if(t)return n.dispatch({effects:Ya(n.state,[Dn.of(t),Ja(n,t)])}),!0}return!1},Od=n=>{if(!n.state.field(ct,!1))return!1;let e=[];for(let t of Ga(n)){let i=un(n.state,t.from,t.to);i&&e.push(bi.of(i),Ja(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function Ja(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return S.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const Md=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(ct,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(bi.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},E0=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Cd},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Od},{key:"Ctrl-Alt-[",run:Md},{key:"Ctrl-Alt-]",run:Ad}],Dd={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},_a=C.define({combine(n){return De(n,Dd)}});function Za(n){return[ct,Pd]}function eh(n,e){let{state:t}=n,i=t.facet(_a),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=un(n.state,l.from,l.to);a&&n.dispatch({effects:bi.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Lo=A.replace({widget:new class extends Fe{toDOM(n){return eh(n,null)}}});class Td extends Fe{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return eh(e,this.value)}}const Bd={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Xn extends Ie{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function I0(n={}){let e=Object.assign(Object.assign({},Bd),n),t=new Xn(e,!0),i=new Xn(e,!1),s=z.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ye)!=o.state.facet(Ye)||o.startState.field(ct,!1)!=o.state.field(ct,!1)||U(o.startState)!=U(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Xe;for(let a of o.viewportLineBlocks){let h=un(o.state,a.from,a.to)?i:fn(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Ju({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||B.empty},initialSpacer(){return new Xn(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=un(o.state,l.from,l.to);if(h)return o.dispatch({effects:bi.of(h)}),!0;let c=fn(o.state,l.from,l.to);return c?(o.dispatch({effects:Dn.of(c)}),!0):!1}})}),Za()]}const Pd=S.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class xi{constructor(e,t){this.specs=e;let i;function s(l){let a=je.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof be?l=>l.prop(xt)==o.data:o?l=>l==o:void 0,this.style=mc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new je(i):null,this.themeType=t.themeType}static define(e,t){return new xi(e,t||{})}}const Hs=C.define(),th=C.define({combine(n){return n.length?[n[0]]:null}});function Gn(n){let e=n.facet(Hs);return e.length?e:n.facet(th)}function Ld(n,e){let t=[Ed],i;return n instanceof xi&&(n.module&&t.push(S.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(th.of(n)):i?t.push(Hs.computeN([S.darkTheme],s=>s.facet(S.darkTheme)==(i=="dark")?[n]:[])):t.push(Hs.of(n)),t}class Rd{constructor(e){this.markCache=Object.create(null),this.tree=U(e.state),this.decorations=this.buildDeco(e,Gn(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=U(e.state),i=Gn(e.state),s=i!=Gn(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return A.none;let i=new Xe;for(let{from:s,to:r}of e.visibleRanges)gc(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=A.mark({class:a})))},s,r);return i.finish()}}const Ed=ft.high(z.fromClass(Rd,{decorations:n=>n.decorations})),N0=xi.define([{tag:x.meta,color:"#404740"},{tag:x.link,textDecoration:"underline"},{tag:x.heading,textDecoration:"underline",fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strong,fontWeight:"bold"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.keyword,color:"#708"},{tag:[x.atom,x.bool,x.url,x.contentSeparator,x.labelName],color:"#219"},{tag:[x.literal,x.inserted],color:"#164"},{tag:[x.string,x.deleted],color:"#a11"},{tag:[x.regexp,x.escape,x.special(x.string)],color:"#e40"},{tag:x.definition(x.variableName),color:"#00f"},{tag:x.local(x.variableName),color:"#30a"},{tag:[x.typeName,x.namespace],color:"#085"},{tag:x.className,color:"#167"},{tag:[x.special(x.variableName),x.macroName],color:"#256"},{tag:x.definition(x.propertyName),color:"#00c"},{tag:x.comment,color:"#940"},{tag:x.invalid,color:"#f00"}]),Id=S.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ih=1e4,nh="()[]{}",sh=C.define({combine(n){return De(n,{afterCursor:!0,brackets:nh,maxScanDistance:ih,renderMatch:Hd})}}),Nd=A.mark({class:"cm-matchingBracket"}),Fd=A.mark({class:"cm-nonmatchingBracket"});function Hd(n){let e=[],t=n.matched?Nd:Fd;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Vd=J.define({create(){return A.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(sh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Oe(e.state,s.head,-1,i)||s.head>0&&Oe(e.state,s.head-1,1,i)||i.afterCursor&&(Oe(e.state,s.head,1,i)||s.headS.decorations.from(n)}),Wd=[Vd,Id];function F0(n={}){return[sh.of(n),Wd]}const zd=new pe;function Vs(n,e,t){let i=n.prop(e<0?pe.openedBy:pe.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Ws(n){let e=n.type.prop(zd);return e?e(n.node):n}function Oe(n,e,t,i={}){let s=i.maxScanDistance||ih,r=i.brackets||nh,o=U(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Vs(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return qd(n,e,t,a,c,h,r)}}return $d(n,e,t,o,l.type,s,r)}function qd(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let m=e+u*t;for(let p=t>0?0:d.length-1,g=t>0?d.length:-1;p!=g;p+=t){let y=o.indexOf(d[p]);if(!(y<0||i.resolveInner(m+p,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:m+p,to:m+p+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}const Qd=Object.create(null),Ro=[_s.none],Eo=[],Io=Object.create(null),Ud=Object.create(null);for(let[n,e]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"]])Ud[n]=Kd(Qd,e);function Yn(n,e){Eo.indexOf(n)>-1||(Eo.push(n),console.warn(e))}function Kd(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||x[h];c?typeof c=="function"?a.length?a=a.map(c):Yn(h,`Modifier ${h} used at start of tag`):a.length?Yn(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Yn(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Io[s];if(r)return r.id;let o=Io[s]=_s.define({id:Ro.length,name:i,props:[yl({[i]:t})]});return Ro.push(o),o.id}H.RTL,H.LTR;class rh{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=U(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(lh(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function No(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function jd(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:jd(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function Xd(n,e){return t=>{for(let i=U(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class Fo{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Ue(n){return n.selection.main.from}function lh(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const ah=Ne.define();function Gd(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return Object.assign(Object.assign({},n.changeByRange(l=>l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i)?{range:l}:{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:e},range:b.cursor(l.from+r+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Ho=new WeakMap;function Yd(n){if(!Array.isArray(n))return n;let e=Ho.get(n);return e||Ho.set(n,e=oh(n)),e}const dn=T.define(),hi=T.define();class Jd{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&O<=57||O>=97&&O<=122?2:O>=65&&O<=90?1:0:(D=Zs(O))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0;(!w||N==1&&g||v==0&&N!=0)&&(t[f]==O||i[f]==O&&(u=!0)?o[f++]=w:o.length&&(y=!1)),v=N,w+=ue(O)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&m==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[m,p]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?ue(X(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class _d{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Zd,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Vo(e(i),t(i)),optionClass:(e,t)=>i=>Vo(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Vo(n,e){return n?e?n+" "+e:n:e}function Zd(n,e,t,i,s,r){let o=n.textDirection==H.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,m=i.right-i.left,p=i.bottom-i.top;if(l&&u=p||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function em(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function Jn(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class tm{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(G);this.optionContent=em(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Jn(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(G).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:hi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=Jn(r.length,o,e.state.facet(G).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Jn(t.options.length,t.selected,this.view.state.facet(G).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>oe(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&nm(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottomi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew tm(t,n,e)}function nm(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function Wo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function sm(n,e){let t=[],i=null,s=h=>{t.push(h);let{section:c}=h.completion;if(c){i||(i=[]);let f=typeof c=="string"?c:c.name;i.some(u=>u.name==f)||i.push(typeof c=="string"?{name:f}:c)}},r=e.facet(G);for(let h of n)if(h.hasResult()){let c=h.result.getMatch;if(h.result.filter===!1)for(let f of h.result.options)s(new Fo(f,h.source,c?c(f):[],1e9-t.length));else{let f=e.sliceDoc(h.from,h.to),u,d=r.filterStrict?new _d(f):new Jd(f);for(let m of h.result.options)if(u=d.match(m.label)){let p=m.displayLabel?c?c(m,u.matched):[]:u.matched;s(new Fo(m,h.source,p,u.score+(m.boost||0)))}}}if(i){let h=Object.create(null),c=0,f=(u,d)=>{var m,p;return((m=u.rank)!==null&&m!==void 0?m:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(u.namef.score-c.score||a(c.completion,f.completion))){let c=h.completion;!l||l.label!=c.label||l.detail!=c.detail||l.type!=null&&c.type!=null&&l.type!=c.type||l.apply!=c.apply||l.boost!=c.boost?o.push(h):Wo(h.completion)>Wo(l)&&(o[o.length-1]=h),l=h.completion}return o}class wt{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new wt(this.options,zo(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r){let o=sm(e,t);if(!o.length)return s&&e.some(a=>a.state==1)?new wt(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;let l=t.facet(G).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let a=s.options[s.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:cm,above:r.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new wt(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class mn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new mn(am,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(G),r=(i.override||t.languageDataAt("autocomplete",Ue(t)).map(Yd)).map(l=>(this.active.find(h=>h.source==l)||new ce(l,this.active.some(h=>h.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,a)=>l==this.active[a])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!rm(r,this.active)?o=wt.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(l=>l.state==1)&&(o=null),!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ce(l.source,0):l));for(let l of e.effects)l.is(fh)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new mn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?om:lm}}function rm(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const am=[];function hh(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(ah);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class ce{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=hh(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new ce(s.source,0)),i&4&&s.state==0&&(s=new ce(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(dn))s=new ce(s.source,1,r.value?Ue(e.state):-1);else if(r.is(hi))s=new ce(s.source,0);else if(r.is(ch))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ce(this.source,this.state,e.mapPos(this.explicitPos))}touches(e){return e.changes.touchesRange(Ue(e.state))}}class Ot extends ce{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ue(e.state);if((this.explicitPos<0?l<=r:lo||!s||t&2&&Ue(e.startState)==this.from)return new ce(this.source,t&4?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return hm(s.validFor,e.state,r,o)?new Ot(this.source,a,s,r,o):s.update&&(s=s.update(s,r,o,new rh(e.state,l,a>=0)))?new Ot(this.source,a,s,s.from,(i=s.to)!==null&&i!==void 0?i:Ue(e.state)):new ce(this.source,1,a)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Ot(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ce(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function hm(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):lh(n,!0).test(s)}const ch=T.define({map(n,e){return n.map(t=>t.map(e))}}),fh=T.define(),re=J.define({create(){return mn.start()},update(n,e){return n.update(e)},provide:n=>[fr.from(n,e=>e.tooltip),S.contentAttributes.from(n,e=>e.attrs)]});function pr(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(re).active.find(s=>s.source==e.source);return i instanceof Ot?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},Gd(n.state,t,i.from,i.to)),{annotations:ah.of(e.completion)})):t(n,e.completion,i.from,i.to),!0):!1}const cm=im(re,pr);function Hi(n,e="option"){return t=>{let i=t.state.field(re,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:fh.of(l)}),!0}}const fm=n=>{let e=n.state.field(re,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(re,!1)?(n.dispatch({effects:dn.of(!0)}),!0):!1,dm=n=>{let e=n.state.field(re,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:hi.of(null)}),!0)};class mm{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const pm=50,gm=1e3,ym=z.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(re).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(re),t=n.state.facet(G);if(!n.selectionSet&&!n.docChanged&&n.startState.field(re)==e)return;let i=n.transactions.some(r=>{let o=hh(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rpm&&Date.now()-o.time>gm){for(let l of o.context.abortListeners)try{l()}catch(a){oe(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(dn)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(re);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=Ue(e),i=new rh(e,t,n.explicitPos==t,this.view),s=new mm(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:hi.of(null)}),oe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(G).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(G);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ce(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:ch.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(re,!1);if(e&&e.tooltip&&this.view.state.facet(G).closeOnBlur){let t=e.open&&Wa(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:hi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:dn.of(!1)}),20),this.composing=0}}}),bm=typeof navigator=="object"&&/Win/.test(navigator.platform),xm=ft.highest(S.domEventHandlers({keydown(n,e){let t=e.state.field(re,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(bm&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&pr(e,i),!1}})),wm=S.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),ci={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},rt=T.define({map(n,e){let t=e.mapPos(n,-1,te.TrackAfter);return t??void 0}}),gr=new class extends ot{};gr.startSide=1;gr.endSide=-1;const uh=J.define({create(){return B.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(rt)&&(n=n.update({add:[gr.range(t.value,t.value+1)]}));return n}});function H0(){return[km,uh]}const _n="()[]{}<>";function dh(n){for(let e=0;e<_n.length;e+=2)if(_n.charCodeAt(e)==n)return _n.charAt(e+1);return Zs(n<128?n:n+1)}function mh(n,e){return n.languageDataAt("closeBrackets",e)[0]||ci}const vm=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),km=S.inputHandler.of((n,e,t,i)=>{if((vm?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&ue(X(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Cm(n.state,i);return r?(n.dispatch(r),!0):!1}),Sm=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=mh(n,n.selection.main.head).brackets||ci.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Om(n.doc,o.head);for(let a of i)if(a==l&&Tn(n.doc,o.head)==dh(X(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},V0=[{key:"Backspace",run:Sm}];function Cm(n,e){let t=mh(n,n.selection.main.head),i=t.brackets||ci.brackets;for(let s of i){let r=dh(X(s,0));if(e==s)return r==s?Dm(n,s,i.indexOf(s+s+s)>-1,t):Mm(n,s,r,t.before||ci.before);if(e==r&&ph(n,n.selection.main.from))return Am(n,s,r)}return null}function ph(n,e){let t=!1;return n.field(uh).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Tn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ue(X(t,0)))}function Om(n,e){let t=n.sliceString(e-2,e);return ue(X(t,0))==t.length?t:t.slice(1)}function Mm(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:rt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Tn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:rt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Am(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Tn(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Dm(n,e,t,i){let s=i.stringPrefixes||ci.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:rt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Tn(n.doc,a),c;if(h==e){if(qo(n,a))return{changes:{insert:e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)};if(ph(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=$o(n,a-2*e.length,s))>-1&&qo(n,c))return{changes:{insert:e+e+e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=V.Word&&$o(n,a,s)>-1&&!Tm(n,a,e,s))return{changes:{insert:e+e,from:a},effects:rt.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function qo(n,e){let t=U(n).resolveInner(e+1);return t.parent&&t.from==e}function Tm(n,e,t,i){let s=U(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function $o(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=V.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=V.Word)return r}return-1}function W0(n={}){return[xm,re,G.of(n),ym,Pm,wm]}const Bm=[{key:"Ctrl-Space",run:um},{key:"Escape",run:dm},{key:"ArrowDown",run:Hi(!0)},{key:"ArrowUp",run:Hi(!1)},{key:"PageDown",run:Hi(!0,"page")},{key:"PageUp",run:Hi(!1,"page")},{key:"Enter",run:fm}],Pm=ft.highest(Pa.computeN([G],n=>n.facet(G).defaultKeymap?[Bm]:[])),Lm=36,Qo=1,Rm=2,mt=3,Zn=4,Em=5,Im=6,Nm=7,Fm=8,Hm=9,Vm=10,Wm=11,zm=12,qm=13,$m=14,Qm=15,Um=16,Km=17,Uo=18,jm=19,gh=20,yh=21,Ko=22,Xm=23,Gm=24;function zs(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57}function Ym(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function tt(n,e,t){for(let i=!1;;){if(n.next<0)return;if(n.next==e&&!i){n.advance();return}i=t&&!i&&n.next==92,n.advance()}}function Jm(n,e){e:for(;;){if(n.next<0)return console.log("exit at end",n.pos);if(n.next==36){n.advance();for(let t=0;t)".charCodeAt(t);for(;;){if(n.next<0)return;if(n.next==i&&n.peek(1)==39){n.advance(2);return}n.advance()}}function qs(n,e){for(;!(n.next!=95&&!zs(n.next));)e!=null&&(e+=String.fromCharCode(n.next)),n.advance();return e}function Zm(n){if(n.next==39||n.next==34||n.next==96){let e=n.next;n.advance(),tt(n,e,!1)}else qs(n)}function jo(n,e){for(;n.next==48||n.next==49;)n.advance();e&&n.next==e&&n.advance()}function Xo(n,e){for(;;){if(n.next==46){if(e)break;e=!0}else if(n.next<48||n.next>57)break;n.advance()}if(n.next==69||n.next==101)for(n.advance(),(n.next==43||n.next==45)&&n.advance();n.next>=48&&n.next<=57;)n.advance()}function Go(n){for(;!(n.next<0||n.next==10);)n.advance()}function et(n,e){for(let t=0;t!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:bh(wh,xh)};function ep(n,e,t,i){let s={};for(let r in $s)s[r]=(n.hasOwnProperty(r)?n:$s)[r];return e&&(s.words=bh(e,t||"",i)),s}function vh(n){return new bc(e=>{var t;let{next:i}=e;if(e.advance(),et(i,es)){for(;et(e.next,es);)e.advance();e.acceptToken(Lm)}else if(i==36&&n.doubleDollarQuotedStrings){let s=qs(e,"");e.next==36&&(e.advance(),Jm(e,s),e.acceptToken(mt))}else if(i==39||i==34&&n.doubleQuotedStrings)tt(e,i,n.backslashEscapes),e.acceptToken(mt);else if(i==35&&n.hashComments||i==47&&e.next==47&&n.slashComments)Go(e),e.acceptToken(Qo);else if(i==45&&e.next==45&&(!n.spaceAfterDashes||e.peek(1)==32))Go(e),e.acceptToken(Qo);else if(i==47&&e.next==42){e.advance();for(let s=1;;){let r=e.next;if(e.next<0)break;if(e.advance(),r==42&&e.next==47){if(s--,e.advance(),!s)break}else r==47&&e.next==42&&(s++,e.advance())}e.acceptToken(Rm)}else if((i==101||i==69)&&e.next==39)e.advance(),tt(e,39,!0),e.acceptToken(mt);else if((i==110||i==78)&&e.next==39&&n.charSetCasts)e.advance(),tt(e,39,n.backslashEscapes),e.acceptToken(mt);else if(i==95&&n.charSetCasts)for(let s=0;;s++){if(e.next==39&&s>1){e.advance(),tt(e,39,n.backslashEscapes),e.acceptToken(mt);break}if(!zs(e.next))break;e.advance()}else if(n.plsqlQuotingMechanism&&(i==113||i==81)&&e.next==39&&e.peek(1)>0&&!et(e.peek(1),es)){let s=e.peek(1);e.advance(2),_m(e,s),e.acceptToken(mt)}else if(i==40)e.acceptToken(Nm);else if(i==41)e.acceptToken(Fm);else if(i==123)e.acceptToken(Hm);else if(i==125)e.acceptToken(Vm);else if(i==91)e.acceptToken(Wm);else if(i==93)e.acceptToken(zm);else if(i==59)e.acceptToken(qm);else if(n.unquotedBitLiterals&&i==48&&e.next==98)e.advance(),jo(e),e.acceptToken(Ko);else if((i==98||i==66)&&(e.next==39||e.next==34)){const s=e.next;e.advance(),n.treatBitsAsBytes?(tt(e,s,n.backslashEscapes),e.acceptToken(Xm)):(jo(e,s),e.acceptToken(Ko))}else if(i==48&&(e.next==120||e.next==88)||(i==120||i==88)&&e.next==39){let s=e.next==39;for(e.advance();Ym(e.next);)e.advance();s&&e.next==39&&e.advance(),e.acceptToken(Zn)}else if(i==46&&e.next>=48&&e.next<=57)Xo(e,!0),e.acceptToken(Zn);else if(i==46)e.acceptToken($m);else if(i>=48&&i<=57)Xo(e,!1),e.acceptToken(Zn);else if(et(i,n.operatorChars)){for(;et(e.next,n.operatorChars);)e.advance();e.acceptToken(Qm)}else if(et(i,n.specialVar))e.next==i&&e.advance(),Zm(e),e.acceptToken(Km);else if(et(i,n.identifierQuotes))tt(e,i,!1),e.acceptToken(jm);else if(i==58||i==44)e.acceptToken(Um);else if(zs(i)){let s=qs(e,String.fromCharCode(i));e.acceptToken(e.next==46||e.peek(-s.length-1)==46?Uo:(t=n.words[s.toLowerCase()])!==null&&t!==void 0?t:Uo)}})}const kh=vh($s),tp=xc.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,kh],topRules:{Script:[0,25]},tokenPrec:0});function Qs(n){let e=n.cursor().moveTo(n.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function fi(n,e){let t=n.sliceString(e.from,e.to),i=/^([`'"])(.*)\1$/.exec(t);return i?i[2]:t}function pn(n){return n&&(n.name=="Identifier"||n.name=="QuotedIdentifier")}function ip(n,e){if(e.name=="CompositeIdentifier"){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)pn(i)&&t.push(fi(n,i));return t}return[fi(n,e)]}function Yo(n,e){for(let t=[];;){if(!e||e.name!=".")return t;let i=Qs(e);if(!pn(i))return t;t.unshift(fi(n,i)),e=Qs(i)}}function np(n,e){let t=U(n).resolveInner(e,-1),i=rp(n.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?n.doc.sliceString(t.from,t.from+1):null,parents:Yo(n.doc,Qs(t)),aliases:i}:t.name=="."?{from:e,quoted:null,parents:Yo(n.doc,t),aliases:i}:{from:e,quoted:null,parents:[],empty:!0,aliases:i}}const sp=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function rp(n,e){let t;for(let s=e;!t;s=s.parent){if(!s)return null;s.name=="Statement"&&(t=s)}let i=null;for(let s=t.firstChild,r=!1,o=null;s;s=s.nextSibling){let l=s.name=="Keyword"?n.sliceString(s.from,s.to).toLowerCase():null,a=null;if(!r)r=l=="from";else if(l=="as"&&o&&pn(s.nextSibling))a=fi(n,s.nextSibling);else{if(l&&sp.has(l))break;o&&pn(s)&&(a=fi(n,s))}a&&(i||(i=Object.create(null)),i[a]=ip(n,o)),o=/Identifier$/.test(s.name)?s:null}return i}function op(n,e){return n?e.map(t=>Object.assign(Object.assign({},t),{label:t.label[0]==n?t.label:n+t.label+n,apply:void 0})):e}const lp=/^\w*$/,ap=/^[`'"]?\w*[`'"]?$/;function Jo(n){return n.self&&typeof n.self.label=="string"}class yr{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),i=t[e];return i||(e&&!this.list.some(s=>s.label==e)&&this.list.push(_o(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new yr(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(i=>i.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t=="string"?_o(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Jo(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let i=e[t],s=null,r=t.replace(/\\?\./g,l=>l=="."?"\0":l).split("\0"),o=this;Jo(i)&&(s=i.self,i=i.children);for(let l=0;l{let{parents:f,from:u,quoted:d,empty:m,aliases:p}=np(c.state,c.pos);if(m&&!c.explicit)return null;p&&f.length==1&&(f=p[f[0]]||f);let g=a;for(let M of f){for(;!g.children||!g.children[M];)if(g==a&&h)g=h;else if(g==h&&i)g=g.child(i);else return null;let v=g.maybeChild(M);if(!v)return null;g=v}let y=d&&c.state.sliceDoc(c.pos,c.pos+1)==d,w=g.list;return g==a&&p&&(w=w.concat(Object.keys(p).map(M=>({label:M,type:"constant"})))),{from:u,to:y?c.pos+1:void 0,options:op(d,w),validFor:d?ap:lp}}}function cp(n,e){let t=Object.keys(n).map(i=>({label:e?i.toUpperCase():i,type:n[i]==yh?"type":n[i]==gh?"keyword":"variable",boost:-1}));return Xd(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],oh(t))}let fp=tp.configure({props:[Ua.add({Statement:bd()}),ja.add({Statement(n,e){return{from:Math.min(n.from+100,e.doc.lineAt(n.from).to),to:n.to}},BlockComment(n){return{from:n.from+2,to:n.to-2}}}),yl({Keyword:x.keyword,Type:x.typeName,Builtin:x.standard(x.name),Bits:x.number,Bytes:x.string,Bool:x.bool,Null:x.null,Number:x.number,String:x.string,Identifier:x.name,QuotedIdentifier:x.special(x.string),SpecialVar:x.special(x.name),LineComment:x.lineComment,BlockComment:x.blockComment,Operator:x.operator,"Semi Punctuation":x.punctuation,"( )":x.paren,"{ }":x.brace,"[ ]":x.squareBracket})]});class Bn{constructor(e,t,i){this.dialect=e,this.language=t,this.spec=i}get extension(){return this.language.extension}static define(e){let t=ep(e,e.keywords,e.types,e.builtin),i=an.define({name:"sql",parser:fp.configure({tokenizers:[{from:kh,to:vh(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new Bn(t,i,e)}}function up(n,e=!1){return cp(n.dialect.words,e)}function dp(n,e=!1){return n.language.data.of({autocomplete:up(n,e)})}function mp(n){return n.schema?hp(n.schema,n.tables,n.schemas,n.defaultTable,n.defaultSchema,n.dialect||br):()=>null}function pp(n){return n.schema?(n.dialect||br).language.data.of({autocomplete:mp(n)}):[]}function z0(n={}){let e=n.dialect||br;return new hd(e.language,[pp(n),dp(e,!!n.upperCaseKeywords)])}const br=Bn.define({}),q0=Bn.define({keywords:wh+"abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual",types:xh+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real",builtin:"auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),gp=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=wr(n.state,t.from);return i.line?yp(n):i.block?xp(n):!1};function xr(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const yp=xr(kp,0),bp=xr(Sh,0),xp=xr((n,e)=>Sh(n,e,vp(e)),0);function wr(n,e){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const $t=50;function wp(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-$t,i),o=n.sliceDoc(s,s+$t),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*$t?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+$t),f=n.sliceDoc(s-$t,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,m=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(m,m+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function vp(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Sh(n,e,t=e.selection.ranges){let i=t.map(r=>wr(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>wp(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,m=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Us=Ne.define(),Sp=Ne.define(),Cp=C.define(),Ch=C.define({combine(n){return De(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),Oh=J.define({create(){return Me.empty},update(n,e){let t=e.state.facet(Ch),i=e.annotation(Us);if(i){let a=le.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=gn(c,c.length,t.minDepth,a):c=Dh(c,e.startState.selection),new Me(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(Sp);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=le.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Me(n.done.map(le.fromJSON),n.undone.map(le.fromJSON))}});function $0(n={}){return[Oh,Ch.of(n),S.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Mh:e.inputType=="historyRedo"?Ks:null;return i?(e.preventDefault(),i(t)):!1}})]}function Pn(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Oh,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Mh=Pn(0,!1),Ks=Pn(1,!1),Op=Pn(0,!0),Mp=Pn(1,!0);class le{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new le(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new le(e.changes&&$.fromJSON(e.changes),[],e.mapped&&Ae.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=de;for(let s of e.startState.facet(Cp)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new le(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,de)}static selection(e){return new le(void 0,de,void 0,void 0,e)}}function gn(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function Ap(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function Dp(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Ah(n,e){return n.length?e.length?n.concat(e):n:e}const de=[],Tp=200;function Dh(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Tp));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),gn(n,n.length-1,1e9,t.setSelAfter(i)))}else return[le.selection([e])]}function Bp(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function ts(n,e){if(!n.length)return n;let t=n.length,i=de;for(;t;){let s=Pp(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[le.selection(i)]:de}function Pp(n,e,t){let i=Ah(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):de,t);if(!n.changes)return le.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new le(s,T.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const Lp=/^(input\.type|delete)($|\.)/;class Me{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Me(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Lp.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Ln(t,e))}function ee(n){return n.textDirectionAt(n.state.selection.main.head)==H.LTR}const Bh=n=>Th(n,!ee(n)),Ph=n=>Th(n,ee(n));function Lh(n,e){return ve(n,t=>t.empty?n.moveByGroup(t,e):Ln(t,e))}const Rp=n=>Lh(n,!ee(n)),Ep=n=>Lh(n,ee(n));function Ip(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Rn(n,e,t){let i=U(n).resolveInner(e.head),s=t?pe.closedBy:pe.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Ip(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?Oe(n,i.from,1):Oe(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const Np=n=>ve(n,e=>Rn(n.state,e,!ee(n))),Fp=n=>ve(n,e=>Rn(n.state,e,ee(n)));function Rh(n,e){return ve(n,t=>{if(!t.empty)return Ln(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Eh=n=>Rh(n,!1),Ih=n=>Rh(n,!0);function Nh(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Ln(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomFh(n,!1),js=n=>Fh(n,!0);function Je(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const Hp=n=>ve(n,e=>Je(n,e,!0)),Vp=n=>ve(n,e=>Je(n,e,!1)),Wp=n=>ve(n,e=>Je(n,e,!ee(n))),zp=n=>ve(n,e=>Je(n,e,ee(n))),qp=n=>ve(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),$p=n=>ve(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function Qp(n,e,t){let i=!1,s=Nt(n.selection,r=>{let o=Oe(n,r.head,-1)||Oe(n,r.head,1)||r.head>0&&Oe(n,r.head-1,1)||r.headQp(n,e);function ye(n,e){let t=Nt(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Te(n.state,t)),!0)}function Hh(n,e){return ye(n,t=>n.moveByChar(t,e))}const Vh=n=>Hh(n,!ee(n)),Wh=n=>Hh(n,ee(n));function zh(n,e){return ye(n,t=>n.moveByGroup(t,e))}const Kp=n=>zh(n,!ee(n)),jp=n=>zh(n,ee(n)),Xp=n=>ye(n,e=>Rn(n.state,e,!ee(n))),Gp=n=>ye(n,e=>Rn(n.state,e,ee(n)));function qh(n,e){return ye(n,t=>n.moveVertically(t,e))}const $h=n=>qh(n,!1),Qh=n=>qh(n,!0);function Uh(n,e){return ye(n,t=>n.moveVertically(t,e,Nh(n).height))}const el=n=>Uh(n,!1),tl=n=>Uh(n,!0),Yp=n=>ye(n,e=>Je(n,e,!0)),Jp=n=>ye(n,e=>Je(n,e,!1)),_p=n=>ye(n,e=>Je(n,e,!ee(n))),Zp=n=>ye(n,e=>Je(n,e,ee(n))),eg=n=>ye(n,e=>b.cursor(n.lineBlockAt(e.head).from)),tg=n=>ye(n,e=>b.cursor(n.lineBlockAt(e.head).to)),il=({state:n,dispatch:e})=>(e(Te(n,{anchor:0})),!0),nl=({state:n,dispatch:e})=>(e(Te(n,{anchor:n.doc.length})),!0),sl=({state:n,dispatch:e})=>(e(Te(n,{anchor:n.selection.main.anchor,head:0})),!0),rl=({state:n,dispatch:e})=>(e(Te(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),ig=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),ng=({state:n,dispatch:e})=>{let t=En(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},sg=({state:n,dispatch:e})=>{let t=Nt(n.selection,i=>{var s;let r=U(n).resolveStack(i.from,1);for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&(!((s=l.parent)===null||s===void 0)&&s.parent))return b.range(l.to,l.from)}return i});return e(Te(n,t)),!0},rg=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Te(n,i)),!0):!1};function wi(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Vi(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Vi(n,o,!1),l=Vi(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Kh=(n,e,t)=>wi(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sKh(n,!1,!0),jh=n=>Kh(n,!0,!1),Xh=(n,e)=>wi(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=Y(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Gh=n=>Xh(n,!1),og=n=>Xh(n,!0),lg=n=>wi(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headwi(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),hg=n=>wi(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:P.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},fg=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:Y(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:Y(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function En(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Yh(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of En(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(b.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ug=({state:n,dispatch:e})=>Yh(n,e,!1),dg=({state:n,dispatch:e})=>Yh(n,e,!0);function Jh(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of En(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const mg=({state:n,dispatch:e})=>Jh(n,e,!1),pg=({state:n,dispatch:e})=>Jh(n,e,!0),gg=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(En(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function yg(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=U(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(pe.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const bg=_h(!1),xg=_h(!0);function _h(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&yg(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new An(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=dr(h,r);for(c==null&&(c=It(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const wg=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new An(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=vr(n,(r,o,l)=>{let a=dr(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=ai(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(vr(n,(t,i)=>{i.push({from:t.from,insert:n.facet(ur)})}),{userEvent:"input.indent"})),!0),ec=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(vr(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=It(s,n.tabSize),o=0,l=ai(n,Math.max(0,r-cn(n)));for(;o(n.setTabFocusMode(),!0),kg=[{key:"Ctrl-b",run:Bh,shift:Vh,preventDefault:!0},{key:"Ctrl-f",run:Ph,shift:Wh},{key:"Ctrl-p",run:Eh,shift:$h},{key:"Ctrl-n",run:Ih,shift:Qh},{key:"Ctrl-a",run:qp,shift:eg},{key:"Ctrl-e",run:$p,shift:tg},{key:"Ctrl-d",run:jh},{key:"Ctrl-h",run:Xs},{key:"Ctrl-k",run:lg},{key:"Ctrl-Alt-h",run:Gh},{key:"Ctrl-o",run:cg},{key:"Ctrl-t",run:fg},{key:"Ctrl-v",run:js}],Sg=[{key:"ArrowLeft",run:Bh,shift:Vh,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Rp,shift:Kp,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Wp,shift:_p,preventDefault:!0},{key:"ArrowRight",run:Ph,shift:Wh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ep,shift:jp,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zp,shift:Zp,preventDefault:!0},{key:"ArrowUp",run:Eh,shift:$h,preventDefault:!0},{mac:"Cmd-ArrowUp",run:il,shift:sl},{mac:"Ctrl-ArrowUp",run:Zo,shift:el},{key:"ArrowDown",run:Ih,shift:Qh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:nl,shift:rl},{mac:"Ctrl-ArrowDown",run:js,shift:tl},{key:"PageUp",run:Zo,shift:el},{key:"PageDown",run:js,shift:tl},{key:"Home",run:Vp,shift:Jp,preventDefault:!0},{key:"Mod-Home",run:il,shift:sl},{key:"End",run:Hp,shift:Yp,preventDefault:!0},{key:"Mod-End",run:nl,shift:rl},{key:"Enter",run:bg},{key:"Mod-a",run:ig},{key:"Backspace",run:Xs,shift:Xs},{key:"Delete",run:jh},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Gh},{key:"Mod-Delete",mac:"Alt-Delete",run:og},{mac:"Mod-Backspace",run:ag},{mac:"Mod-Delete",run:hg}].concat(kg.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),U0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Np,shift:Xp},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Fp,shift:Gp},{key:"Alt-ArrowUp",run:ug},{key:"Shift-Alt-ArrowUp",run:mg},{key:"Alt-ArrowDown",run:dg},{key:"Shift-Alt-ArrowDown",run:pg},{key:"Escape",run:rg},{key:"Mod-Enter",run:xg},{key:"Alt-l",mac:"Ctrl-l",run:ng},{key:"Mod-i",run:sg,preventDefault:!0},{key:"Mod-[",run:ec},{key:"Mod-]",run:Zh},{key:"Mod-Alt-\\",run:wg},{key:"Shift-Mod-k",run:gg},{key:"Shift-Mod-\\",run:Up},{key:"Mod-/",run:gp},{key:"Alt-A",run:bp},{key:"Ctrl-m",mac:"Shift-Alt-m",run:vg}].concat(Sg),K0={key:"Tab",run:Zh,shift:ec},ol=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Rt{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(ol(l)):ol,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return X(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Zs(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=ue(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=yn(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Mt(t,e.sliceString(t,i));return is.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=yn(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Mt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ic.prototype[Symbol.iterator]=nc.prototype[Symbol.iterator]=function(){return this});function Cg(n){try{return new RegExp(n,kr),!0}catch{return!1}}function yn(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function Gs(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=I("input",{class:"cm-textfield",name:"line",value:e}),i=I("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),n.dispatch({effects:bn.of(!1)}),n.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},I("label",n.state.phrase("Go to line"),": ",t)," ",I("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),p=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));n.dispatch({effects:[bn.of(!1),S.scrollIntoView(p.from,{y:"center"})],selection:p}),n.focus()}return{dom:i}}const bn=T.define(),ll=J.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(bn)&&(n=t.value);return n},provide:n=>li.from(n,e=>e?Gs:null)}),Og=n=>{let e=oi(n,Gs);if(!e){let t=[bn.of(!0)];n.state.field(ll,!1)==null&&t.push(T.appendConfig.of([ll,Mg])),n.dispatch({effects:t}),e=oi(n,Gs)}return e&&e.dom.querySelector("input").select(),!0},Mg=S.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Ag={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Dg=C.define({combine(n){return De(n,Ag,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function j0(n){return[Rg,Lg]}const Tg=A.mark({class:"cm-selectionMatch"}),Bg=A.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function al(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=V.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=V.Word)}function Pg(n,e,t,i){return n(e.sliceDoc(t,t+1))==V.Word&&n(e.sliceDoc(i-1,i))==V.Word}const Lg=z.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Dg),{state:t}=n,i=t.selection;if(i.ranges.length>1)return A.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return A.none;let a=t.wordAt(s.head);if(!a)return A.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return A.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(al(o,t,s.from,s.to)&&Pg(o,t,s.from,s.to)))return A.none}else if(r=t.sliceDoc(s.from,s.to),!r)return A.none}let l=[];for(let a of n.visibleRanges){let h=new Rt(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||al(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Bg.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Tg.range(c,f)),l.length>e.maxMatches))return A.none}}return A.set(l)}},{decorations:n=>n.decorations}),Rg=S.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Eg=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function Ig(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new Rt(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Rt(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Ng=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return Eg({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=Ig(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:S.scrollIntoView(s.to)})),!0):!1},Ft=C.define({combine(n){return De(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new jg(e),scrollToMatch:e=>S.scrollIntoView(e)})}});class sc{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Cg(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` `: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 Wg(this):new Hg(this)}getCursor(e,t=0,i){let s=e.doc?e:L.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?gt(this,s,t,i):pt(this,s,t,i)}}class rc{constructor(e){this.spec=e}}function pt(n,e,t,i){return new Rt(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?Fg(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Fg(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=pt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function gt(n,e,t,i){return new ic(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?Vg(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function xn(n,e){return n.slice(Y(n,e,!1),e)}function wn(n,e){return n.slice(e,Y(n,e))}function Vg(n){return(e,t,i)=>!i[0].length||(n(xn(i.input,i.index))!=V.Word||n(wn(i.input,i.index))!=V.Word)&&(n(wn(i.input,i.index+i[0].length))!=V.Word||n(xn(i.input,i.index+i[0].length))!=V.Word)}class Wg extends rc{nextMatch(e,t,i){let s=gt(this.spec,e,i,e.doc.length).next();return s.done&&(s=gt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=gt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==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)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=gt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const ui=T.define(),Sr=T.define(),Ke=J.define({create(n){return new ns(Ys(n).create(),null)},update(n,e){for(let t of e.effects)t.is(ui)?n=new ns(t.value.create(),n.panel):t.is(Sr)&&(n=new ns(n.query,t.value?Cr:null));return n},provide:n=>li.from(n,e=>e.panel)});class ns{constructor(e,t){this.query=e,this.panel=t}}const zg=A.mark({class:"cm-searchMatch"}),qg=A.mark({class:"cm-searchMatch cm-searchMatch-selected"}),$g=z.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ke))}update(n){let e=n.state.field(Ke);(e!=n.startState.field(Ke)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return A.none;let{view:t}=this,i=new Xe;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?qg:zg)})}return i.finish()}},{decorations:n=>n.decorations});function vi(n){return e=>{let t=e.state.field(Ke,!1);return t&&t.query.spec.valid?n(e,t):ac(e)}}const vn=vi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=b.single(i.from,i.to),r=n.state.facet(Ft);return n.dispatch({selection:s,effects:[Or(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),lc(n),!0}),kn=vi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=b.single(s.from,s.to),o=n.state.facet(Ft);return n.dispatch({selection:r,effects:[Or(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),lc(n),!0}),Qg=vi((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Ug=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Rt(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},hl=vi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],l,a,h=[];if(r.from==i&&r.to==s&&(a=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(t,r.from,r.to),h.push(S.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-a.length;l=b.single(r.from-c,r.to-c),h.push(Or(n,r)),h.push(t.facet(Ft).scrollToMatch(l.main,n))}return n.dispatch({changes:o,selection:l,effects:h,userEvent:"input.replace"}),!0}),Kg=vi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:S.announce.of(i),userEvent:"input.replace.all"}),!0});function Cr(n){return n.state.facet(Ft).createPanel(n)}function Ys(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(Ft);return new sc({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function oc(n){let e=oi(n,Cr);return e&&e.dom.querySelector("[main-field]")}function lc(n){let e=oc(n);e&&e==n.root.activeElement&&e.select()}const ac=n=>{let e=n.state.field(Ke,!1);if(e&&e.panel){let t=oc(n);if(t&&t!=n.root.activeElement){let i=Ys(n.state,e.query.spec);i.valid&&n.dispatch({effects:ui.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Sr.of(!0),e?ui.of(Ys(n.state,e.query.spec)):T.appendConfig.of(Gg)]});return!0},hc=n=>{let e=n.state.field(Ke,!1);if(!e||!e.panel)return!1;let t=oi(n,Cr);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Sr.of(!1)}),!0},X0=[{key:"Mod-f",run:ac,scope:"editor search-panel"},{key:"F3",run:vn,shift:kn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:vn,shift:kn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:hc,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ug},{key:"Mod-Alt-g",run:Og},{key:"Mod-d",run:Ng,preventDefault:!0}];class jg{constructor(e){this.view=e;let t=this.query=e.state.field(Ke).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:t.search,placeholder:ae(e,"Find"),"aria-label":ae(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:t.replace,placeholder:ae(e,"Replace"),"aria-label":ae(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return I("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=I("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>vn(e),[ae(e,"next")]),i("prev",()=>kn(e),[ae(e,"previous")]),i("select",()=>Qg(e),[ae(e,"all")]),I("label",null,[this.caseField,ae(e,"match case")]),I("label",null,[this.reField,ae(e,"regexp")]),I("label",null,[this.wordField,ae(e,"by word")]),...e.state.readOnly?[]:[I("br"),this.replaceField,i("replace",()=>hl(e),[ae(e,"replace")]),i("replaceAll",()=>Kg(e),[ae(e,"replace all")])],I("button",{name:"close",onclick:()=>hc(e),"aria-label":ae(e,"close"),type:"button"},["×"])])}commit(){let e=new sc({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ui.of(e)}))}keydown(e){du(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?kn:vn)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),hl(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(ui)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ft).top}}function ae(n,e){return n.state.phrase(e)}const Wi=30,zi=/[\s\.,:;?!]/;function Or(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Wi),o=Math.min(s,t+Wi),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Wi;a--)if(!zi.test(l[a-1])&&zi.test(l[a])){l=l.slice(0,a);break}}return S.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const Xg=S.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Gg=[Ke,ft.low($g),Xg];class Yg{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class nt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=e,r=i.facet(di).markerFilter;r&&(s=r(s,i));let o=A.set(s.map(l=>l.from==l.to||l.from==l.to-1&&i.doc.lineAt(l.from).to==l.from?A.widget({widget:new s0(l),diagnostic:l}).range(l.from):A.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l}).range(l.from,l.to)),!0);return new nt(o,t,Et(o))}}function Et(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostic!=e))return i=new Yg(s,r,o.diagnostic),!1}),i}function Jg(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(di).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(cc))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function _g(n,e){return n.field(fe,!1)?e:e.concat(T.appendConfig.of(l0))}const cc=T.define(),Mr=T.define(),fc=T.define(),fe=J.define({create(){return new nt(A.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Et(t,n.selected.diagnostic,r)||Et(t,null,r)}!t.size&&s&&e.state.facet(di).autoPanel&&(s=null),n=new nt(t,s,i)}for(let t of e.effects)if(t.is(cc)){let i=e.state.facet(di).autoPanel?t.value.length?mi.open:null:n.panel;n=nt.init(t.value,i,e.state)}else t.is(Mr)?n=new nt(n.diagnostics,t.value?mi.open:null,n.selected):t.is(fc)&&(n=new nt(n.diagnostics,n.panel,t.value));return n},provide:n=>[li.from(n,e=>e.panel),S.decorations.from(n,e=>e.diagnostics)]}),Zg=A.mark({class:"cm-lintRange cm-lintRange-active"});function e0(n,e,t){let{diagnostics:i}=n.state.field(fe),s=[],r=2e8,o=0;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{e>=a&&e<=h&&(a==h||(e>a||t>0)&&(edc(n,t,!1)))}const i0=n=>{let e=n.state.field(fe,!1);(!e||!e.panel)&&n.dispatch({effects:_g(n.state,[Mr.of(!0)])});let t=oi(n,mi.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},cl=n=>{let e=n.state.field(fe,!1);return!e||!e.panel?!1:(n.dispatch({effects:Mr.of(!1)}),!0)},n0=n=>{let e=n.state.field(fe,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},G0=[{key:"Mod-Shift-m",run:i0,preventDefault:!0},{key:"F8",run:n0}],di=C.define({combine(n){return Object.assign({sources:n.map(e=>e.source).filter(e=>e!=null)},De(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t}))}});function uc(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function dc(n,e,t){var i;let s=t?uc(e.actions):[];return I("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},I("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=Et(n.state.field(fe).diagnostics,e);d&&r.apply(n,d.from,d.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),I("u",h.slice(c,c+1)),h.slice(c+1)];return I("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&I("div",{class:"cm-diagnosticSource"},e.source))}class s0 extends Fe{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return I("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class fl{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=dc(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class mi{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)cl(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=uc(r.actions);for(let l=0;l{for(let r=0;rcl(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(fe).selected;if(!e)return-1;for(let t=0;t{let h=-1,c;for(let f=i;fi&&(this.items.splice(i,h-i),s=!0)),t&&c.diagnostic==t.diagnostic?c.dom.hasAttribute("aria-selected")||(c.dom.setAttribute("aria-selected","true"),r=c):c.dom.hasAttribute("aria-selected")&&c.dom.removeAttribute("aria-selected"),i++});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(fe),i=Et(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:fc.of(i)})}static open(e){return new mi(e)}}function r0(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function qi(n){return r0(``,'width="6" height="3"')}const o0=S.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:qi("#d11")},".cm-lintRange-warning":{backgroundImage:qi("orange")},".cm-lintRange-info":{backgroundImage:qi("#999")},".cm-lintRange-hint":{backgroundImage:qi("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),l0=[fe,S.decorations.compute([fe],n=>{let{selected:e,panel:t}=n.field(fe);return!e||!t||e.from==e.to?A.none:A.set([Zg.range(e.from,e.to)])}),Xu(e0,{hideOn:Jg}),o0],a0="#e5c07b",ul="#e06c75",h0="#56b6c2",c0="#ffffff",_i="#abb2bf",Js="#7d8799",f0="#61afef",u0="#98c379",dl="#d19a66",d0="#c678dd",m0="#21252b",ml="#2c313a",pl="#282c34",ss="#353a42",p0="#3E4451",gl="#528bff",g0=S.theme({"&":{color:_i,backgroundColor:pl},".cm-content":{caretColor:gl},".cm-cursor, .cm-dropCursor":{borderLeftColor:gl},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:p0},".cm-panels":{backgroundColor:m0,color:_i},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:pl,color:Js,border:"none"},".cm-activeLineGutter":{backgroundColor:ml},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ss},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ss,borderBottomColor:ss},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:ml,color:_i}}},{dark:!0}),y0=xi.define([{tag:x.keyword,color:d0},{tag:[x.name,x.deleted,x.character,x.propertyName,x.macroName],color:ul},{tag:[x.function(x.variableName),x.labelName],color:f0},{tag:[x.color,x.constant(x.name),x.standard(x.name)],color:dl},{tag:[x.definition(x.name),x.separator],color:_i},{tag:[x.typeName,x.className,x.number,x.changed,x.annotation,x.modifier,x.self,x.namespace],color:a0},{tag:[x.operator,x.operatorKeyword,x.url,x.escape,x.regexp,x.link,x.special(x.string)],color:h0},{tag:[x.meta,x.comment],color:Js},{tag:x.strong,fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.link,color:Js,textDecoration:"underline"},{tag:x.heading,fontWeight:"bold",color:ul},{tag:[x.atom,x.bool,x.special(x.variableName)],color:dl},{tag:[x.processingInstruction,x.string,x.inserted],color:u0},{tag:x.invalid,color:c0}]),Y0=[g0,Ld(y0)];export{S as A,K0 as B,A0 as C,Y0 as D,L as E,Ne as F,q0 as G,xi as H,z0 as I,T as S,Bm as a,B0 as b,V0 as c,U0 as d,P0 as e,E0 as f,O0 as g,Q0 as h,$0 as i,I0 as j,S0 as k,G0 as l,C0 as m,R0 as n,Ld as o,N0 as p,F0 as q,H0 as r,X0 as s,W0 as t,D0 as u,T0 as v,M0 as w,j0 as x,ur as y,Pa as z}; diff --git a/assets/@codemirror-CCjSF3Vf.js.gz b/assets/@codemirror-CCjSF3Vf.js.gz new file mode 100644 index 0000000..9dd923c Binary files /dev/null and b/assets/@codemirror-CCjSF3Vf.js.gz differ diff --git a/assets/@codemirror-SM3v-hs2.js.gz b/assets/@codemirror-SM3v-hs2.js.gz deleted file mode 100644 index de87e40..0000000 Binary files a/assets/@codemirror-SM3v-hs2.js.gz and /dev/null differ diff --git a/assets/@lezer-C0_A0N7l.js b/assets/@lezer-DgLl1T_N.js similarity index 99% rename from assets/@lezer-C0_A0N7l.js rename to assets/@lezer-DgLl1T_N.js index ad7c746..7c28582 100644 --- a/assets/@lezer-C0_A0N7l.js +++ b/assets/@lezer-DgLl1T_N.js @@ -1 +1 @@ -let Qt=0;class yt{constructor(t,e){this.from=t,this.to=e}}class v{constructor(t={}){this.id=Qt++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=j.match(t)),e=>{let s=t(e);return s===void 0?null:[this,s]}}}v.closedBy=new v({deserialize:l=>l.split(" ")});v.openedBy=new v({deserialize:l=>l.split(" ")});v.group=new v({deserialize:l=>l.split(" ")});v.isolate=new v({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});v.contextHash=new v({perNode:!0});v.lookAhead=new v({perNode:!0});v.mounted=new v({perNode:!0});class gt{constructor(t,e,s){this.tree=t,this.overlay=e,this.parser=s}static get(t){return t&&t.props&&t.props[v.mounted.id]}}const Xt=Object.create(null);class j{constructor(t,e,s,i=0){this.name=t,this.props=e,this.id=s,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):Xt,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new j(t.name||"",e,t.id,s);if(t.props){for(let n of t.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(v.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let s in t)for(let i of s.split(" "))e[i]=t[s];return s=>{for(let i=s.prop(v.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?s.name:i[n]];if(r)return r}}}}j.none=new j("",Object.create(null),0,8);class Tt{constructor(t){this.types=t;for(let e=0;e0;for(let o=this.cursor(r|z.IncludeAnonymous);;){let a=!1;if(o.from<=n&&o.to>=i&&(!h&&o.type.isAnonymous||e(o)!==!1)){if(o.firstChild())continue;a=!0}for(;a&&s&&(h||!o.type.isAnonymous)&&s(o),!o.nextSibling();){if(!o.parent())return;a=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Rt(j.none,this.children,this.positions,0,this.children.length,0,this.length,(e,s,i)=>new B(this.type,e,s,i,this.propValues),t.makeTree||((e,s,i)=>new B(j.none,e,s,i)))}static build(t){return ee(t)}}B.empty=new B(j.none,[],[],0);class zt{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new zt(this.buffer,this.index)}}class X{constructor(t,e,s){this.buffer=t,this.length=e,this.set=s}get type(){return j.none}toString(){let t=[];for(let e=0;e0));o=r[o+3]);return h}slice(t,e,s){let i=this.buffer,n=new Uint16Array(e-t),r=0;for(let h=t,o=0;h=t&&et;case 1:return e<=t&&s>t;case 2:return s>t;case 4:return!0}}function ht(l,t,e,s){for(var i;l.from==l.to||(e<1?l.from>=t:l.from>t)||(e>-1?l.to<=t:l.to0?h.length:-1;t!=a;t+=e){let c=h[t],f=o[t]+r.from;if(qt(i,s,f,f+c.length)){if(c instanceof X){if(n&z.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,e,s-f,i);if(d>-1)return new Q(new Yt(r,c,t,f),null,d)}else if(n&z.IncludeAnonymous||!c.type.isAnonymous||It(c)){let d;if(!(n&z.IgnoreMounts)&&(d=gt.get(c))&&!d.overlay)return new E(d.tree,f,t,r);let g=new E(c,f,t,r);return n&z.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(e<0?c.children.length-1:0,e,s,i)}}}if(n&z.IncludeAnonymous||!r.type.isAnonymous||(r.index>=0?t=r.index+e:t=e<0?-1:r._parent._tree.children.length,r=r._parent,!r))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,s=0){let i;if(!(s&z.IgnoreOverlays)&&(i=gt.get(this._tree))&&i.overlay){let n=t-this.from;for(let{from:r,to:h}of i.overlay)if((e>0?r<=n:r=n:h>n))return new E(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Dt(l,t,e,s){let i=l.cursor(),n=[];if(!i.firstChild())return n;if(e!=null){for(let r=!1;!r;)if(r=i.type.is(e),!i.nextSibling())return n}for(;;){if(s!=null&&i.type.is(s))return n;if(i.type.is(t)&&n.push(i.node),!i.nextSibling())return s==null?n:[]}}function vt(l,t,e=t.length-1){for(let s=l.parent;e>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[e]&&t[e]!=s.name)return!1;e--}}return!0}class Yt{constructor(t,e,s,i){this.parent=t,this.buffer=e,this.index=s,this.start=i}}class Q extends Kt{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,s){super(),this.context=t,this._parent=e,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,e,s){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,s);return n<0?null:new Q(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,s=0){if(s&z.ExcludeBuffers)return null;let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return n<0?null:new Q(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Q(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Q(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:s}=this.context,i=this.index+4,n=s.buffer[this.index+3];if(n>i){let r=s.buffer[this.index+1];t.push(s.slice(i,n,r)),e.push(0)}return new B(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Jt(l){if(!l.length)return null;let t=0,e=l[0];for(let n=1;ne.from||r.to=t){let h=new E(r.tree,r.overlay[0].from+n.from,-1,n);(i||(i=[s])).push(ht(h,t,e,!1))}}return i?Jt(i):s}class Ct{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof E)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:s,buffer:i}=this.buffer;return this.type=e||i.set.types[i.buffer[t]],this.from=s+i.buffer[t+1],this.to=s+i.buffer[t+2],!0}yield(t){return t?t instanceof E?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,s,this.mode));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,s);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,s=this.mode){return this.buffer?s&z.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&z.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&z.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,s=this.stack.length-1;if(t<0){let i=s<0?0:this.stack[s]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{let i=e.buffer[this.index+3];if(i<(s<0?e.buffer.length:e.buffer[this.stack[s]+3]))return this.yieldBuf(i)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,s,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let n=e+t,r=t<0?-1:s._tree.children.length;n!=r;n+=t){let h=s._tree.children[n];if(this.mode&z.IncludeAnonymous||h instanceof X||!h.type.isAnonymous||It(h))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let r=t;r;r=r._parent)if(r.index==i){if(i==this.index)return r;e=r,s=n+1;break t}i=this.stack[--n]}for(let i=s;i=0;n--){if(n<0)return vt(this.node,t,i);let r=s[e.buffer[this.stack[n]]];if(!r.isAnonymous){if(t[i]&&t[i]!=r.name)return!1;i--}}return!0}}function It(l){return l.children.some(t=>t instanceof X||!t.type.isAnonymous||It(t))}function ee(l){var t;let{buffer:e,nodeSet:s,maxBufferLength:i=1024,reused:n=[],minRepeatType:r=s.types.length}=l,h=Array.isArray(e)?new zt(e,e.length):e,o=s.types,a=0,c=0;function f(y,C,p,N,S,w){let{id:x,start:b,end:P,size:A}=h,R=c;for(;A<0;)if(h.next(),A==-1){let q=n[x];p.push(q),N.push(b-y);return}else if(A==-3){a=x;return}else if(A==-4){c=x;return}else throw new RangeError(`Unrecognized record size: ${A}`);let Y=o[x],st,Z,Bt=b-y;if(P-b<=i&&(Z=D(h.pos-C,S))){let q=new Uint16Array(Z.size-Z.skip),M=h.pos-Z.size,$=q.length;for(;h.pos>M;)$=F(Z.start,q,$);st=new X(q,P-Z.start,s),Bt=Z.start-y}else{let q=h.pos-A;h.next();let M=[],$=[],tt=x>=r?x:-1,it=0,lt=P;for(;h.pos>q;)tt>=0&&h.id==tt&&h.size>=0?(h.end<=lt-i&&(k(M,$,b,it,h.end,lt,tt,R),it=M.length,lt=h.end),h.next()):w>2500?d(b,q,M,$):f(b,q,M,$,tt,w+1);if(tt>=0&&it>0&&it-1&&it>0){let Ot=g(Y);st=Rt(Y,M,$,0,M.length,0,P-b,Ot,Ot)}else st=I(Y,M,$,P-b,R-P)}p.push(st),N.push(Bt)}function d(y,C,p,N){let S=[],w=0,x=-1;for(;h.pos>C;){let{id:b,start:P,end:A,size:R}=h;if(R>4)h.next();else{if(x>-1&&P=0;A-=3)b[R++]=S[A],b[R++]=S[A+1]-P,b[R++]=S[A+2]-P,b[R++]=R;p.push(new X(b,S[2]-P,s)),N.push(P-y)}}function g(y){return(C,p,N)=>{let S=0,w=C.length-1,x,b;if(w>=0&&(x=C[w])instanceof B){if(!w&&x.type==y&&x.length==N)return x;(b=x.prop(v.lookAhead))&&(S=p[w]+x.length+b)}return I(y,C,p,N,S)}}function k(y,C,p,N,S,w,x,b){let P=[],A=[];for(;y.length>N;)P.push(y.pop()),A.push(C.pop()+p-S);y.push(I(s.types[x],P,A,w-S,b-w)),C.push(S-p)}function I(y,C,p,N,S=0,w){if(a){let x=[v.contextHash,a];w=w?[x].concat(w):[x]}if(S>25){let x=[v.lookAhead,S];w=w?[x].concat(w):[x]}return new B(y,C,p,N,w)}function D(y,C){let p=h.fork(),N=0,S=0,w=0,x=p.end-i,b={size:0,start:0,skip:0};t:for(let P=p.pos-y;p.pos>P;){let A=p.size;if(p.id==C&&A>=0){b.size=N,b.start=S,b.skip=w,w+=4,N+=4,p.next();continue}let R=p.pos-A;if(A<0||R=r?4:0,st=p.start;for(p.next();p.pos>R;){if(p.size<0)if(p.size==-3)Y+=4;else break t;else p.id>=r&&(Y+=4);p.next()}S=st,N+=A,w+=Y}return(C<0||N==y)&&(b.size=N,b.start=S,b.skip=w),b.size>4?b:void 0}function F(y,C,p){let{id:N,start:S,end:w,size:x}=h;if(h.next(),x>=0&&N4){let P=h.pos-(x-4);for(;h.pos>P;)p=F(y,C,p)}C[--p]=b,C[--p]=w-y,C[--p]=S-y,C[--p]=N}else x==-3?a=N:x==-4&&(c=N);return p}let O=[],T=[];for(;h.pos>0;)f(l.start||0,l.bufferStart||0,O,T,-1,0);let L=(t=l.length)!==null&&t!==void 0?t:O.length?T[0]+O[0].length:0;return new B(o[l.topID],O.reverse(),T.reverse(),L)}const Mt=new WeakMap;function dt(l,t){if(!l.isAnonymous||t instanceof X||t.type!=l)return 1;let e=Mt.get(t);if(e==null){e=1;for(let s of t.children){if(s.type!=l||!(s instanceof B)){e=1;break}e+=dt(l,s)}Mt.set(t,e)}return e}function Rt(l,t,e,s,i,n,r,h,o){let a=0;for(let k=s;k=c)break;C+=p}if(T==L+1){if(C>c){let p=k[L];g(p.children,p.positions,0,p.children.length,I[L]+O);continue}f.push(k[L])}else{let p=I[T-1]+k[T-1].length-y;f.push(Rt(l,k,I,L,T,y,p,null,o))}d.push(y+O-n)}}return g(t,e,s,i,0),(h||o)(f,d,r)}class At{constructor(t,e,s,i,n=!1,r=!1){this.from=t,this.to=e,this.tree=s,this.offset=i,this.open=(n?1:0)|(r?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],s=!1){let i=[new At(0,t.length,t,0,!1,s)];for(let n of e)n.to>t.length&&i.push(n);return i}static applyChanges(t,e,s=128){if(!e.length)return t;let i=[],n=1,r=t.length?t[0]:null;for(let h=0,o=0,a=0;;h++){let c=h=s)for(;r&&r.from=d.from||f<=d.to||a){let g=Math.max(d.from,o)-a,k=Math.min(d.to,f)-a;d=g>=k?null:new At(g,k,d.tree,d.offset+a,h>0,!!c)}if(d&&i.push(d),r.to>f)break;r=nnew yt(i.from,i.to)):[new yt(0,0)]:[new yt(0,t.length)],this.createParse(t,e||[],s)}parse(t,e,s){let i=this.startParse(t,e,s);for(;;){let n=i.advance();if(n)return n}}}class ie{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new v({perNode:!0});let re=0;class W{constructor(t,e,s){this.set=t,this.base=e,this.modified=s,this.id=re++}static define(t){if(t!=null&&t.base)throw new Error("Can not derive from a modified tag");let e=new W([],null,[]);if(e.set.push(e),t)for(let s of t.set)e.set.push(s);return e}static defineModifier(){let t=new mt;return e=>e.modified.indexOf(t)>-1?e:mt.get(e.base||e,e.modified.concat(t).sort((s,i)=>s.id-i.id))}}let ne=0;class mt{constructor(){this.instances=[],this.id=ne++}static get(t,e){if(!e.length)return t;let s=e[0].instances.find(h=>h.base==t&&he(e,h.modified));if(s)return s;let i=[],n=new W(i,t,e);for(let h of e)h.instances.push(n);let r=le(e);for(let h of t.set)if(!h.modified.length)for(let o of r)i.push(mt.get(h,o));return n}}function he(l,t){return l.length==t.length&&l.every((e,s)=>e==t[s])}function le(l){let t=[[]];for(let e=0;es.length-e.length)}function we(l){let t=Object.create(null);for(let e in l){let s=l[e];Array.isArray(s)||(s=[s]);for(let i of e.split(" "))if(i){let n=[],r=2,h=i;for(let f=0;;){if(h=="..."&&f>0&&f+3==i.length){r=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h);if(!d)throw new RangeError("Invalid path: "+i);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let g=i[f++];if(f==i.length&&g=="!"){r=0;break}if(g!="/")throw new RangeError("Invalid path: "+i);h=i.slice(f)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+i);let c=new kt(s,r,o>0?n.slice(0,o):null);t[a]=c.sort(t[a])}}return Vt.add(t)}const Vt=new v;class kt{constructor(t,e,s,i){this.tags=t,this.mode=e,this.context=s,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let r=i;for(let h of n)for(let o of h.set){let a=e[o.id];if(a){r=r?r+" "+a:a;break}}return r},scope:s}}function ae(l,t){let e=null;for(let s of l){let i=s.style(t);i&&(e=e?e+" "+i:i)}return e}function Se(l,t,e,s=0,i=l.length){let n=new fe(s,Array.isArray(t)?t:[t],e);n.highlightRange(l.cursor(),s,i,"",n.highlighters),n.flush(i)}class fe{constructor(t,e,s){this.at=t,this.highlighters=e,this.span=s,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,s,i,n){let{type:r,from:h,to:o}=t;if(h>=s||o<=e)return;r.isTop&&(n=this.highlighters.filter(g=>!g.scope||g.scope(r)));let a=i,c=ue(t)||kt.empty,f=ae(n,c.tags);if(f&&(a&&(a+=" "),a+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(e,h),a),c.opaque)return;let d=t.tree&&t.tree.prop(v.mounted);if(d&&d.overlay){let g=t.node.enter(d.overlay[0].from+h,1),k=this.highlighters.filter(D=>!D.scope||D.scope(d.tree.type)),I=t.firstChild();for(let D=0,F=h;;D++){let O=D=T||!t.nextSibling())););if(!O||T>s)break;F=O.to+h,F>e&&(this.highlightRange(g.cursor(),Math.max(e,O.from+h),Math.min(s,F),"",k),this.startSpan(Math.min(s,F),a))}I&&t.parent()}else if(t.firstChild()){d&&(i="");do if(!(t.to<=e)){if(t.from>=s)break;this.highlightRange(t,e,s,i,n),this.startSpan(Math.min(s,t.to),a)}while(t.nextSibling());t.parent()}}}function ue(l){let t=l.type.prop(Vt);for(;t&&t.context&&!l.matchContext(t.context);)t=t.next;return t||null}const u=W.define,at=u(),J=u(),Et=u(J),Ft=u(J),V=u(),ft=u(V),wt=u(V),U=u(),et=u(U),G=u(),H=u(),Nt=u(),nt=u(Nt),ut=u(),m={comment:at,lineComment:u(at),blockComment:u(at),docComment:u(at),name:J,variableName:u(J),typeName:Et,tagName:u(Et),propertyName:Ft,attributeName:u(Ft),className:u(J),labelName:u(J),namespace:u(J),macroName:u(J),literal:V,string:ft,docString:u(ft),character:u(ft),attributeValue:u(ft),number:wt,integer:u(wt),float:u(wt),bool:u(V),regexp:u(V),escape:u(V),color:u(V),url:u(V),keyword:G,self:u(G),null:u(G),atom:u(G),unit:u(G),modifier:u(G),operatorKeyword:u(G),controlKeyword:u(G),definitionKeyword:u(G),moduleKeyword:u(G),operator:H,derefOperator:u(H),arithmeticOperator:u(H),logicOperator:u(H),bitwiseOperator:u(H),compareOperator:u(H),updateOperator:u(H),definitionOperator:u(H),typeOperator:u(H),controlOperator:u(H),punctuation:Nt,separator:u(Nt),bracket:nt,angleBracket:u(nt),squareBracket:u(nt),paren:u(nt),brace:u(nt),content:U,heading:et,heading1:u(et),heading2:u(et),heading3:u(et),heading4:u(et),heading5:u(et),heading6:u(et),contentSeparator:u(U),list:u(U),quote:u(U),emphasis:u(U),strong:u(U),link:u(U),monospace:u(U),strikethrough:u(U),inserted:u(),deleted:u(),changed:u(),invalid:u(),meta:ut,documentMeta:u(ut),annotation:u(ut),processingInstruction:u(ut),definition:W.defineModifier(),constant:W.defineModifier(),function:W.defineModifier(),standard:W.defineModifier(),local:W.defineModifier(),special:W.defineModifier()};oe([{tag:m.link,class:"tok-link"},{tag:m.heading,class:"tok-heading"},{tag:m.emphasis,class:"tok-emphasis"},{tag:m.strong,class:"tok-strong"},{tag:m.keyword,class:"tok-keyword"},{tag:m.atom,class:"tok-atom"},{tag:m.bool,class:"tok-bool"},{tag:m.url,class:"tok-url"},{tag:m.labelName,class:"tok-labelName"},{tag:m.inserted,class:"tok-inserted"},{tag:m.deleted,class:"tok-deleted"},{tag:m.literal,class:"tok-literal"},{tag:m.string,class:"tok-string"},{tag:m.number,class:"tok-number"},{tag:[m.regexp,m.escape,m.special(m.string)],class:"tok-string2"},{tag:m.variableName,class:"tok-variableName"},{tag:m.local(m.variableName),class:"tok-variableName tok-local"},{tag:m.definition(m.variableName),class:"tok-variableName tok-definition"},{tag:m.special(m.variableName),class:"tok-variableName2"},{tag:m.definition(m.propertyName),class:"tok-propertyName tok-definition"},{tag:m.typeName,class:"tok-typeName"},{tag:m.namespace,class:"tok-namespace"},{tag:m.className,class:"tok-className"},{tag:m.macroName,class:"tok-macroName"},{tag:m.propertyName,class:"tok-propertyName"},{tag:m.operator,class:"tok-operator"},{tag:m.comment,class:"tok-comment"},{tag:m.meta,class:"tok-meta"},{tag:m.invalid,class:"tok-invalid"},{tag:m.punctuation,class:"tok-punctuation"}]);var jt={};class xt{constructor(t,e,s,i,n,r,h,o,a,c=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=n,this.score=r,this.buffer=h,this.bufferBase=o,this.curContext=a,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new xt(t,[],e,s,s,0,[],0,i?new Lt(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:n}=this.p,r=this.reducePos=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,n=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&r.buffer[h-4]==0&&r.buffer[h-1]>-1){if(e==s)return;if(r.buffer[h-2]>=e){r.buffer[h-2]=s;return}}}if(!n||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&this.buffer[r-4]!=0){let h=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){h=!0;break}if(h)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4);else{let n=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(n,1)||(this.reducePos=i)),this.pushState(n,s),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new xt(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new ce(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if(!(s&65536))return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n=0,r;no&1&&h==r)||i.push(e[n],r)}e=i}let s=[];for(let i=0;i>19,i=e&65535,n=this.stack.length-s*3;if(n<0||t.getGoto(this.stack[n],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,n)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let h=(r>>19)-n;if(h>1){let o=r&65535,a=this.stack.length-h*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return h<<19|65536|o}}else{let h=s(r,n+1);if(h!=null)return h}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Lt{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class ce{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class bt{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new bt(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new bt(this.stack,this.pos,this.index)}}function ct(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,h=!0),n+=o,h)break;n*=46}e?e[i++]=n:e=new t(n)}return e}class pt{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $t=new pt;class de{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$t,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,n=this.pos+t;for(;ns.to:n>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];n+=r.from-s.to,s=r}return n}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e=this.chunk2Pos&&sh.to&&(this.chunk2=this.chunk2.slice(0,h.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$t,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class rt{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;pe(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}rt.prototype.contextual=rt.prototype.fallback=rt.prototype.extend=!1;rt.prototype.fallback=rt.prototype.extend=!1;class ve{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function pe(l,t,e,s,i,n){let r=0,h=1<0){let k=l[g];if(o.allows(k)&&(t.token.value==-1||t.token.value==k||ge(k,t.token.value,i,n))){t.acceptToken(k);break}}let c=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f>1,k=a+g+(g<<1),I=l[k],D=l[k+1]||65536;if(c=D)f=g+1;else{r=l[k+2],t.advance();continue t}}break}}function Gt(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function ge(l,t,e,s){let i=Gt(e,s,t);return i<0||Gt(e,s,l)t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class me{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Ht(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Ht(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(n instanceof B){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+n.length}}}class ke{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new pt)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:n}=i,r=i.stateSlot(t.state,3),h=t.curContext?t.curContext.hash:0,o=0;for(let a=0;af.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!c.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new pt,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new pt,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:n}=s.p;for(let r=0;r=0&&s.p.parser.dialect.allows(h>>1)){h&1?t.extended=h>>1:t.value=h>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let n=0;nt.bufferLength*4?new me(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,n;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;re)s.push(h);else{if(this.advanceStack(h,s,t))continue;{i||(i=[],n=[]),i.push(h);let o=this.tokens.getMainToken(h);n.push(o.value,o.end)}}break}}if(!s.length){let r=i&&ye(i);if(r)return _&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw _&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,n,s);if(r)return _&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((h,o)=>o.score-h.score);s.length>r;)s.pop();s.some(h=>h.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r500&&a.buffer.length>500)if((h.score-a.score||h.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,c=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?n.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(v.contextHash)||0)==c))return t.useNode(f,d),_&&console.log(r+this.stackID(t)+` (via reuse of ${n.getName(f.type.id)})`),!0;if(!(f instanceof B)||f.children.length==0||f.positions[0]>0)break;let g=f.children[0];if(g instanceof B&&f.positions[0]==0)f=g;else break}}let h=n.stateSlot(t.state,4);if(h>0)return t.reduce(h),_&&console.log(r+this.stackID(t)+` (via always-reduce ${n.getName(h&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;ai?e.push(k):s.push(k)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return Ut(t,e),!0}}runRecovery(t,e,s){let i=null,n=!1;for(let r=0;r ":"";if(h.deadEnd&&(n||(n=!0,h.restart(),_&&console.log(c+this.stackID(h)+" (restarted)"),this.advanceFully(h,s))))continue;let f=h.split(),d=c;for(let g=0;f.forceReduce()&&g<10&&(_&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));g++)_&&(d=this.stackID(f)+" -> ");for(let g of h.recoverByInsert(o))_&&console.log(c+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,s);this.stream.end>h.pos?(a==h.pos&&(a++,o=0),h.recoverByDelete(o,a),_&&console.log(c+this.stackID(h)+` (via recover-delete ${this.parser.getName(o)})`),Ut(h,s)):(!i||i.scoret.topRules[h][1]),i=[];for(let h=0;h=0)n(c,o,h[a++]);else{let f=h[a+-c];for(let d=-c;d>0;d--)n(h[a++],o,f);a++}}}this.nodeSet=new Tt(e.map((h,o)=>j.define({name:o>=this.minRepeatTerm?void 0:h,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let r=ct(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let h=0;htypeof h=="number"?new rt(r,h):h),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new xe(this,t,e,s);for(let n of this.wrappers)i=n(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let n=i[e+1];;){let r=i[n++],h=r&1,o=i[n++];if(h&&s)return o;for(let a=n+(r>>1);n0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let n=this.stateSlot(t,1);i==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=K(this.data,n+2);else break;i=e(K(this.data,n+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=K(this.data,s+2);else break;if(!(this.data[s+2]&1)){let i=this.data[s+1];e.some((n,r)=>r&1&&n==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(Pt.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(n=>n.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let n=t.specializers.find(h=>h.from==s.external);if(!n)return s;let r=Object.assign(Object.assign({},s),{external:n.to});return e.specializers[i]=Wt(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let n of t.split(" ")){let r=e.indexOf(n);r>=0&&(s[r]=!0)}let i=null;for(let n=0;ns)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorel.external(e,s)<<1|t}return l.get}export{ve as E,z as I,Pt as L,j as N,se as P,B as T,oe as a,v as b,At as c,Se as h,we as s,m as t}; +let Qt=0;class yt{constructor(t,e){this.from=t,this.to=e}}class v{constructor(t={}){this.id=Qt++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=j.match(t)),e=>{let s=t(e);return s===void 0?null:[this,s]}}}v.closedBy=new v({deserialize:l=>l.split(" ")});v.openedBy=new v({deserialize:l=>l.split(" ")});v.group=new v({deserialize:l=>l.split(" ")});v.isolate=new v({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});v.contextHash=new v({perNode:!0});v.lookAhead=new v({perNode:!0});v.mounted=new v({perNode:!0});class gt{constructor(t,e,s){this.tree=t,this.overlay=e,this.parser=s}static get(t){return t&&t.props&&t.props[v.mounted.id]}}const Xt=Object.create(null);class j{constructor(t,e,s,i=0){this.name=t,this.props=e,this.id=s,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):Xt,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new j(t.name||"",e,t.id,s);if(t.props){for(let n of t.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(v.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let s in t)for(let i of s.split(" "))e[i]=t[s];return s=>{for(let i=s.prop(v.group),n=-1;n<(i?i.length:0);n++){let r=e[n<0?s.name:i[n]];if(r)return r}}}}j.none=new j("",Object.create(null),0,8);class Tt{constructor(t){this.types=t;for(let e=0;e0;for(let o=this.cursor(r|z.IncludeAnonymous);;){let a=!1;if(o.from<=n&&o.to>=i&&(!h&&o.type.isAnonymous||e(o)!==!1)){if(o.firstChild())continue;a=!0}for(;a&&s&&(h||!o.type.isAnonymous)&&s(o),!o.nextSibling();){if(!o.parent())return;a=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Rt(j.none,this.children,this.positions,0,this.children.length,0,this.length,(e,s,i)=>new B(this.type,e,s,i,this.propValues),t.makeTree||((e,s,i)=>new B(j.none,e,s,i)))}static build(t){return ee(t)}}B.empty=new B(j.none,[],[],0);class zt{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new zt(this.buffer,this.index)}}class X{constructor(t,e,s){this.buffer=t,this.length=e,this.set=s}get type(){return j.none}toString(){let t=[];for(let e=0;e0));o=r[o+3]);return h}slice(t,e,s){let i=this.buffer,n=new Uint16Array(e-t),r=0;for(let h=t,o=0;h=t&&et;case 1:return e<=t&&s>t;case 2:return s>t;case 4:return!0}}function ht(l,t,e,s){for(var i;l.from==l.to||(e<1?l.from>=t:l.from>t)||(e>-1?l.to<=t:l.to0?h.length:-1;t!=a;t+=e){let c=h[t],f=o[t]+r.from;if(qt(i,s,f,f+c.length)){if(c instanceof X){if(n&z.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,e,s-f,i);if(d>-1)return new Q(new Yt(r,c,t,f),null,d)}else if(n&z.IncludeAnonymous||!c.type.isAnonymous||It(c)){let d;if(!(n&z.IgnoreMounts)&&(d=gt.get(c))&&!d.overlay)return new E(d.tree,f,t,r);let g=new E(c,f,t,r);return n&z.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(e<0?c.children.length-1:0,e,s,i)}}}if(n&z.IncludeAnonymous||!r.type.isAnonymous||(r.index>=0?t=r.index+e:t=e<0?-1:r._parent._tree.children.length,r=r._parent,!r))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,s=0){let i;if(!(s&z.IgnoreOverlays)&&(i=gt.get(this._tree))&&i.overlay){let n=t-this.from;for(let{from:r,to:h}of i.overlay)if((e>0?r<=n:r=n:h>n))return new E(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Dt(l,t,e,s){let i=l.cursor(),n=[];if(!i.firstChild())return n;if(e!=null){for(let r=!1;!r;)if(r=i.type.is(e),!i.nextSibling())return n}for(;;){if(s!=null&&i.type.is(s))return n;if(i.type.is(t)&&n.push(i.node),!i.nextSibling())return s==null?n:[]}}function vt(l,t,e=t.length-1){for(let s=l.parent;e>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[e]&&t[e]!=s.name)return!1;e--}}return!0}class Yt{constructor(t,e,s,i){this.parent=t,this.buffer=e,this.index=s,this.start=i}}class Q extends Kt{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,s){super(),this.context=t,this._parent=e,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,e,s){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,s);return n<0?null:new Q(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,s=0){if(s&z.ExcludeBuffers)return null;let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return n<0?null:new Q(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Q(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Q(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:s}=this.context,i=this.index+4,n=s.buffer[this.index+3];if(n>i){let r=s.buffer[this.index+1];t.push(s.slice(i,n,r)),e.push(0)}return new B(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Jt(l){if(!l.length)return null;let t=0,e=l[0];for(let n=1;ne.from||r.to=t){let h=new E(r.tree,r.overlay[0].from+n.from,-1,n);(i||(i=[s])).push(ht(h,t,e,!1))}}return i?Jt(i):s}class Ct{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof E)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:s,buffer:i}=this.buffer;return this.type=e||i.set.types[i.buffer[t]],this.from=s+i.buffer[t+1],this.to=s+i.buffer[t+2],!0}yield(t){return t?t instanceof E?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,s,this.mode));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,s);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,s=this.mode){return this.buffer?s&z.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&z.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&z.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,s=this.stack.length-1;if(t<0){let i=s<0?0:this.stack[s]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{let i=e.buffer[this.index+3];if(i<(s<0?e.buffer.length:e.buffer[this.stack[s]+3]))return this.yieldBuf(i)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,s,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let n=e+t,r=t<0?-1:s._tree.children.length;n!=r;n+=t){let h=s._tree.children[n];if(this.mode&z.IncludeAnonymous||h instanceof X||!h.type.isAnonymous||It(h))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let r=t;r;r=r._parent)if(r.index==i){if(i==this.index)return r;e=r,s=n+1;break t}i=this.stack[--n]}for(let i=s;i=0;n--){if(n<0)return vt(this.node,t,i);let r=s[e.buffer[this.stack[n]]];if(!r.isAnonymous){if(t[i]&&t[i]!=r.name)return!1;i--}}return!0}}function It(l){return l.children.some(t=>t instanceof X||!t.type.isAnonymous||It(t))}function ee(l){var t;let{buffer:e,nodeSet:s,maxBufferLength:i=1024,reused:n=[],minRepeatType:r=s.types.length}=l,h=Array.isArray(e)?new zt(e,e.length):e,o=s.types,a=0,c=0;function f(y,C,p,N,S,w){let{id:x,start:b,end:P,size:A}=h,R=c;for(;A<0;)if(h.next(),A==-1){let q=n[x];p.push(q),N.push(b-y);return}else if(A==-3){a=x;return}else if(A==-4){c=x;return}else throw new RangeError(`Unrecognized record size: ${A}`);let Y=o[x],st,Z,Bt=b-y;if(P-b<=i&&(Z=D(h.pos-C,S))){let q=new Uint16Array(Z.size-Z.skip),M=h.pos-Z.size,$=q.length;for(;h.pos>M;)$=F(Z.start,q,$);st=new X(q,P-Z.start,s),Bt=Z.start-y}else{let q=h.pos-A;h.next();let M=[],$=[],tt=x>=r?x:-1,it=0,lt=P;for(;h.pos>q;)tt>=0&&h.id==tt&&h.size>=0?(h.end<=lt-i&&(k(M,$,b,it,h.end,lt,tt,R),it=M.length,lt=h.end),h.next()):w>2500?d(b,q,M,$):f(b,q,M,$,tt,w+1);if(tt>=0&&it>0&&it-1&&it>0){let Ot=g(Y);st=Rt(Y,M,$,0,M.length,0,P-b,Ot,Ot)}else st=I(Y,M,$,P-b,R-P)}p.push(st),N.push(Bt)}function d(y,C,p,N){let S=[],w=0,x=-1;for(;h.pos>C;){let{id:b,start:P,end:A,size:R}=h;if(R>4)h.next();else{if(x>-1&&P=0;A-=3)b[R++]=S[A],b[R++]=S[A+1]-P,b[R++]=S[A+2]-P,b[R++]=R;p.push(new X(b,S[2]-P,s)),N.push(P-y)}}function g(y){return(C,p,N)=>{let S=0,w=C.length-1,x,b;if(w>=0&&(x=C[w])instanceof B){if(!w&&x.type==y&&x.length==N)return x;(b=x.prop(v.lookAhead))&&(S=p[w]+x.length+b)}return I(y,C,p,N,S)}}function k(y,C,p,N,S,w,x,b){let P=[],A=[];for(;y.length>N;)P.push(y.pop()),A.push(C.pop()+p-S);y.push(I(s.types[x],P,A,w-S,b-w)),C.push(S-p)}function I(y,C,p,N,S=0,w){if(a){let x=[v.contextHash,a];w=w?[x].concat(w):[x]}if(S>25){let x=[v.lookAhead,S];w=w?[x].concat(w):[x]}return new B(y,C,p,N,w)}function D(y,C){let p=h.fork(),N=0,S=0,w=0,x=p.end-i,b={size:0,start:0,skip:0};t:for(let P=p.pos-y;p.pos>P;){let A=p.size;if(p.id==C&&A>=0){b.size=N,b.start=S,b.skip=w,w+=4,N+=4,p.next();continue}let R=p.pos-A;if(A<0||R=r?4:0,st=p.start;for(p.next();p.pos>R;){if(p.size<0)if(p.size==-3)Y+=4;else break t;else p.id>=r&&(Y+=4);p.next()}S=st,N+=A,w+=Y}return(C<0||N==y)&&(b.size=N,b.start=S,b.skip=w),b.size>4?b:void 0}function F(y,C,p){let{id:N,start:S,end:w,size:x}=h;if(h.next(),x>=0&&N4){let P=h.pos-(x-4);for(;h.pos>P;)p=F(y,C,p)}C[--p]=b,C[--p]=w-y,C[--p]=S-y,C[--p]=N}else x==-3?a=N:x==-4&&(c=N);return p}let O=[],T=[];for(;h.pos>0;)f(l.start||0,l.bufferStart||0,O,T,-1,0);let L=(t=l.length)!==null&&t!==void 0?t:O.length?T[0]+O[0].length:0;return new B(o[l.topID],O.reverse(),T.reverse(),L)}const Mt=new WeakMap;function dt(l,t){if(!l.isAnonymous||t instanceof X||t.type!=l)return 1;let e=Mt.get(t);if(e==null){e=1;for(let s of t.children){if(s.type!=l||!(s instanceof B)){e=1;break}e+=dt(l,s)}Mt.set(t,e)}return e}function Rt(l,t,e,s,i,n,r,h,o){let a=0;for(let k=s;k=c)break;C+=p}if(T==L+1){if(C>c){let p=k[L];g(p.children,p.positions,0,p.children.length,I[L]+O);continue}f.push(k[L])}else{let p=I[T-1]+k[T-1].length-y;f.push(Rt(l,k,I,L,T,y,p,null,o))}d.push(y+O-n)}}return g(t,e,s,i,0),(h||o)(f,d,r)}class At{constructor(t,e,s,i,n=!1,r=!1){this.from=t,this.to=e,this.tree=s,this.offset=i,this.open=(n?1:0)|(r?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],s=!1){let i=[new At(0,t.length,t,0,!1,s)];for(let n of e)n.to>t.length&&i.push(n);return i}static applyChanges(t,e,s=128){if(!e.length)return t;let i=[],n=1,r=t.length?t[0]:null;for(let h=0,o=0,a=0;;h++){let c=h=s)for(;r&&r.from=d.from||f<=d.to||a){let g=Math.max(d.from,o)-a,k=Math.min(d.to,f)-a;d=g>=k?null:new At(g,k,d.tree,d.offset+a,h>0,!!c)}if(d&&i.push(d),r.to>f)break;r=nnew yt(i.from,i.to)):[new yt(0,0)]:[new yt(0,t.length)],this.createParse(t,e||[],s)}parse(t,e,s){let i=this.startParse(t,e,s);for(;;){let n=i.advance();if(n)return n}}}class ie{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new v({perNode:!0});let re=0;class W{constructor(t,e,s){this.set=t,this.base=e,this.modified=s,this.id=re++}static define(t){if(t!=null&&t.base)throw new Error("Can not derive from a modified tag");let e=new W([],null,[]);if(e.set.push(e),t)for(let s of t.set)e.set.push(s);return e}static defineModifier(){let t=new mt;return e=>e.modified.indexOf(t)>-1?e:mt.get(e.base||e,e.modified.concat(t).sort((s,i)=>s.id-i.id))}}let ne=0;class mt{constructor(){this.instances=[],this.id=ne++}static get(t,e){if(!e.length)return t;let s=e[0].instances.find(h=>h.base==t&&he(e,h.modified));if(s)return s;let i=[],n=new W(i,t,e);for(let h of e)h.instances.push(n);let r=le(e);for(let h of t.set)if(!h.modified.length)for(let o of r)i.push(mt.get(h,o));return n}}function he(l,t){return l.length==t.length&&l.every((e,s)=>e==t[s])}function le(l){let t=[[]];for(let e=0;es.length-e.length)}function we(l){let t=Object.create(null);for(let e in l){let s=l[e];Array.isArray(s)||(s=[s]);for(let i of e.split(" "))if(i){let n=[],r=2,h=i;for(let f=0;;){if(h=="..."&&f>0&&f+3==i.length){r=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h);if(!d)throw new RangeError("Invalid path: "+i);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let g=i[f++];if(f==i.length&&g=="!"){r=0;break}if(g!="/")throw new RangeError("Invalid path: "+i);h=i.slice(f)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+i);let c=new kt(s,r,o>0?n.slice(0,o):null);t[a]=c.sort(t[a])}}return Vt.add(t)}const Vt=new v;class kt{constructor(t,e,s,i){this.tags=t,this.mode=e,this.context=s,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let r=i;for(let h of n)for(let o of h.set){let a=e[o.id];if(a){r=r?r+" "+a:a;break}}return r},scope:s}}function ae(l,t){let e=null;for(let s of l){let i=s.style(t);i&&(e=e?e+" "+i:i)}return e}function Se(l,t,e,s=0,i=l.length){let n=new fe(s,Array.isArray(t)?t:[t],e);n.highlightRange(l.cursor(),s,i,"",n.highlighters),n.flush(i)}class fe{constructor(t,e,s){this.at=t,this.highlighters=e,this.span=s,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,s,i,n){let{type:r,from:h,to:o}=t;if(h>=s||o<=e)return;r.isTop&&(n=this.highlighters.filter(g=>!g.scope||g.scope(r)));let a=i,c=ue(t)||kt.empty,f=ae(n,c.tags);if(f&&(a&&(a+=" "),a+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(e,h),a),c.opaque)return;let d=t.tree&&t.tree.prop(v.mounted);if(d&&d.overlay){let g=t.node.enter(d.overlay[0].from+h,1),k=this.highlighters.filter(D=>!D.scope||D.scope(d.tree.type)),I=t.firstChild();for(let D=0,F=h;;D++){let O=D=T||!t.nextSibling())););if(!O||T>s)break;F=O.to+h,F>e&&(this.highlightRange(g.cursor(),Math.max(e,O.from+h),Math.min(s,F),"",k),this.startSpan(Math.min(s,F),a))}I&&t.parent()}else if(t.firstChild()){d&&(i="");do if(!(t.to<=e)){if(t.from>=s)break;this.highlightRange(t,e,s,i,n),this.startSpan(Math.min(s,t.to),a)}while(t.nextSibling());t.parent()}}}function ue(l){let t=l.type.prop(Vt);for(;t&&t.context&&!l.matchContext(t.context);)t=t.next;return t||null}const u=W.define,at=u(),J=u(),Et=u(J),Ft=u(J),V=u(),ft=u(V),wt=u(V),U=u(),et=u(U),G=u(),H=u(),Nt=u(),nt=u(Nt),ut=u(),m={comment:at,lineComment:u(at),blockComment:u(at),docComment:u(at),name:J,variableName:u(J),typeName:Et,tagName:u(Et),propertyName:Ft,attributeName:u(Ft),className:u(J),labelName:u(J),namespace:u(J),macroName:u(J),literal:V,string:ft,docString:u(ft),character:u(ft),attributeValue:u(ft),number:wt,integer:u(wt),float:u(wt),bool:u(V),regexp:u(V),escape:u(V),color:u(V),url:u(V),keyword:G,self:u(G),null:u(G),atom:u(G),unit:u(G),modifier:u(G),operatorKeyword:u(G),controlKeyword:u(G),definitionKeyword:u(G),moduleKeyword:u(G),operator:H,derefOperator:u(H),arithmeticOperator:u(H),logicOperator:u(H),bitwiseOperator:u(H),compareOperator:u(H),updateOperator:u(H),definitionOperator:u(H),typeOperator:u(H),controlOperator:u(H),punctuation:Nt,separator:u(Nt),bracket:nt,angleBracket:u(nt),squareBracket:u(nt),paren:u(nt),brace:u(nt),content:U,heading:et,heading1:u(et),heading2:u(et),heading3:u(et),heading4:u(et),heading5:u(et),heading6:u(et),contentSeparator:u(U),list:u(U),quote:u(U),emphasis:u(U),strong:u(U),link:u(U),monospace:u(U),strikethrough:u(U),inserted:u(),deleted:u(),changed:u(),invalid:u(),meta:ut,documentMeta:u(ut),annotation:u(ut),processingInstruction:u(ut),definition:W.defineModifier(),constant:W.defineModifier(),function:W.defineModifier(),standard:W.defineModifier(),local:W.defineModifier(),special:W.defineModifier()};oe([{tag:m.link,class:"tok-link"},{tag:m.heading,class:"tok-heading"},{tag:m.emphasis,class:"tok-emphasis"},{tag:m.strong,class:"tok-strong"},{tag:m.keyword,class:"tok-keyword"},{tag:m.atom,class:"tok-atom"},{tag:m.bool,class:"tok-bool"},{tag:m.url,class:"tok-url"},{tag:m.labelName,class:"tok-labelName"},{tag:m.inserted,class:"tok-inserted"},{tag:m.deleted,class:"tok-deleted"},{tag:m.literal,class:"tok-literal"},{tag:m.string,class:"tok-string"},{tag:m.number,class:"tok-number"},{tag:[m.regexp,m.escape,m.special(m.string)],class:"tok-string2"},{tag:m.variableName,class:"tok-variableName"},{tag:m.local(m.variableName),class:"tok-variableName tok-local"},{tag:m.definition(m.variableName),class:"tok-variableName tok-definition"},{tag:m.special(m.variableName),class:"tok-variableName2"},{tag:m.definition(m.propertyName),class:"tok-propertyName tok-definition"},{tag:m.typeName,class:"tok-typeName"},{tag:m.namespace,class:"tok-namespace"},{tag:m.className,class:"tok-className"},{tag:m.macroName,class:"tok-macroName"},{tag:m.propertyName,class:"tok-propertyName"},{tag:m.operator,class:"tok-operator"},{tag:m.comment,class:"tok-comment"},{tag:m.meta,class:"tok-meta"},{tag:m.invalid,class:"tok-invalid"},{tag:m.punctuation,class:"tok-punctuation"}]);var jt={};class xt{constructor(t,e,s,i,n,r,h,o,a,c=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=n,this.score=r,this.buffer=h,this.bufferBase=o,this.curContext=a,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new xt(t,[],e,s,s,0,[],0,i?new Lt(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:n}=this.p,r=this.reducePos=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,n=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&r.buffer[h-4]==0&&r.buffer[h-1]>-1){if(e==s)return;if(r.buffer[h-2]>=e){r.buffer[h-2]=s;return}}}if(!n||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&this.buffer[r-4]!=0){let h=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){h=!0;break}if(h)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4);else{let n=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(n,1)||(this.reducePos=i)),this.pushState(n,s),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new xt(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new ce(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if(!(s&65536))return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let n=0,r;no&1&&h==r)||i.push(e[n],r)}e=i}let s=[];for(let i=0;i>19,i=e&65535,n=this.stack.length-s*3;if(n<0||t.getGoto(this.stack[n],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,n)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let h=(r>>19)-n;if(h>1){let o=r&65535,a=this.stack.length-h*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return h<<19|65536|o}}else{let h=s(r,n+1);if(h!=null)return h}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Lt{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class ce{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class bt{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new bt(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new bt(this.stack,this.pos,this.index)}}function ct(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,h=!0),n+=o,h)break;n*=46}e?e[i++]=n:e=new t(n)}return e}class pt{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const $t=new pt;class de{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$t,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,n=this.pos+t;for(;ns.to:n>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];n+=r.from-s.to,s=r}return n}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e=this.chunk2Pos&&sh.to&&(this.chunk2=this.chunk2.slice(0,h.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=$t,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class rt{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;pe(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}rt.prototype.contextual=rt.prototype.fallback=rt.prototype.extend=!1;rt.prototype.fallback=rt.prototype.extend=!1;class ve{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function pe(l,t,e,s,i,n){let r=0,h=1<0){let k=l[g];if(o.allows(k)&&(t.token.value==-1||t.token.value==k||ge(k,t.token.value,i,n))){t.acceptToken(k);break}}let c=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f>1,k=a+g+(g<<1),I=l[k],D=l[k+1]||65536;if(c=D)f=g+1;else{r=l[k+2],t.advance();continue t}}break}}function Gt(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function ge(l,t,e,s){let i=Gt(e,s,t);return i<0||Gt(e,s,l)t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class me{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Ht(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Ht(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(n instanceof B){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(n),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+n.length}}}class ke{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new pt)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:n}=i,r=i.stateSlot(t.state,3),h=t.curContext?t.curContext.hash:0,o=0;for(let a=0;af.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!c.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new pt,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new pt,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:n}=s.p;for(let r=0;r=0&&s.p.parser.dialect.allows(h>>1)){h&1?t.extended=h>>1:t.value=h>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let n=0;nt.bufferLength*4?new me(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,n;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;re)s.push(h);else{if(this.advanceStack(h,s,t))continue;{i||(i=[],n=[]),i.push(h);let o=this.tokens.getMainToken(h);n.push(o.value,o.end)}}break}}if(!s.length){let r=i&&ye(i);if(r)return _&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw _&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,n,s);if(r)return _&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((h,o)=>o.score-h.score);s.length>r;)s.pop();s.some(h=>h.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r500&&a.buffer.length>500)if((h.score-a.score||h.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let r=1;r ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,c=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?n.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(v.contextHash)||0)==c))return t.useNode(f,d),_&&console.log(r+this.stackID(t)+` (via reuse of ${n.getName(f.type.id)})`),!0;if(!(f instanceof B)||f.children.length==0||f.positions[0]>0)break;let g=f.children[0];if(g instanceof B&&f.positions[0]==0)f=g;else break}}let h=n.stateSlot(t.state,4);if(h>0)return t.reduce(h),_&&console.log(r+this.stackID(t)+` (via always-reduce ${n.getName(h&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;ai?e.push(k):s.push(k)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return Ut(t,e),!0}}runRecovery(t,e,s){let i=null,n=!1;for(let r=0;r ":"";if(h.deadEnd&&(n||(n=!0,h.restart(),_&&console.log(c+this.stackID(h)+" (restarted)"),this.advanceFully(h,s))))continue;let f=h.split(),d=c;for(let g=0;f.forceReduce()&&g<10&&(_&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));g++)_&&(d=this.stackID(f)+" -> ");for(let g of h.recoverByInsert(o))_&&console.log(c+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,s);this.stream.end>h.pos?(a==h.pos&&(a++,o=0),h.recoverByDelete(o,a),_&&console.log(c+this.stackID(h)+` (via recover-delete ${this.parser.getName(o)})`),Ut(h,s)):(!i||i.scoret.topRules[h][1]),i=[];for(let h=0;h=0)n(c,o,h[a++]);else{let f=h[a+-c];for(let d=-c;d>0;d--)n(h[a++],o,f);a++}}}this.nodeSet=new Tt(e.map((h,o)=>j.define({name:o>=this.minRepeatTerm?void 0:h,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let r=ct(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let h=0;htypeof h=="number"?new rt(r,h):h),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new xe(this,t,e,s);for(let n of this.wrappers)i=n(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let n=i[e+1];;){let r=i[n++],h=r&1,o=i[n++];if(h&&s)return o;for(let a=n+(r>>1);n0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let n=this.stateSlot(t,1);i==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=K(this.data,n+2);else break;i=e(K(this.data,n+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=K(this.data,s+2);else break;if(!(this.data[s+2]&1)){let i=this.data[s+1];e.some((n,r)=>r&1&&n==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(Pt.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(n=>n.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let n=t.specializers.find(h=>h.from==s.external);if(!n)return s;let r=Object.assign(Object.assign({},s),{external:n.to});return e.specializers[i]=Wt(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let n of t.split(" ")){let r=e.indexOf(n);r>=0&&(s[r]=!0)}let i=null;for(let n=0;ns)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorel.external(e,s)<<1|t}return l.get}export{ve as E,z as I,Pt as L,j as N,se as P,B as T,m as a,v as b,At as c,Se as h,we as s,oe as t}; diff --git a/assets/@lezer-C0_A0N7l.js.gz b/assets/@lezer-DgLl1T_N.js.gz similarity index 99% rename from assets/@lezer-C0_A0N7l.js.gz rename to assets/@lezer-DgLl1T_N.js.gz index ba5e17a..81c270d 100644 Binary files a/assets/@lezer-C0_A0N7l.js.gz and b/assets/@lezer-DgLl1T_N.js.gz differ diff --git a/assets/@uiw-Cmr0UBwL.js.gz b/assets/@uiw-Cmr0UBwL.js.gz deleted file mode 100644 index 8fb0b19..0000000 Binary files a/assets/@uiw-Cmr0UBwL.js.gz and /dev/null differ diff --git a/assets/@uiw-Cmr0UBwL.js b/assets/@uiw-CvcbIrPa.js similarity index 98% rename from assets/@uiw-Cmr0UBwL.js rename to assets/@uiw-CvcbIrPa.js index d95fdcb..8df8dac 100644 --- a/assets/@uiw-Cmr0UBwL.js +++ b/assets/@uiw-CvcbIrPa.js @@ -1 +1 @@ -import{_ as V,a as R}from"./@babel-BjXSgPXB.js";import{r as f,j as P}from"./react-DmpIMwDM.js";import{c as J,d as Q,s as X,h as Y,f as Z,a as $,l as ee,b as te,e as ae,g as re,i as oe,j as ie,k as ne,m as ce,E as A,n as se,o as U,p as le,q as fe,r as de,t as ue,u as ge,v as he,w as me,x as be,y as pe,z as w,A as h,B as ye,C as Se,D as ve,S as ke,F as xe,H as Ce}from"./@codemirror-SM3v-hs2.js";import{t as e}from"./@lezer-C0_A0N7l.js";var j=function(t){t===void 0&&(t={});var{crosshairCursor:a=!1}=t,o=[];t.closeBracketsKeymap!==!1&&(o=o.concat(J)),t.defaultKeymap!==!1&&(o=o.concat(Q)),t.searchKeymap!==!1&&(o=o.concat(X)),t.historyKeymap!==!1&&(o=o.concat(Y)),t.foldKeymap!==!1&&(o=o.concat(Z)),t.completionKeymap!==!1&&(o=o.concat($)),t.lintKeymap!==!1&&(o=o.concat(ee));var r=[];return t.lineNumbers!==!1&&r.push(te()),t.highlightActiveLineGutter!==!1&&r.push(ae()),t.highlightSpecialChars!==!1&&r.push(re()),t.history!==!1&&r.push(oe()),t.foldGutter!==!1&&r.push(ie()),t.drawSelection!==!1&&r.push(ne()),t.dropCursor!==!1&&r.push(ce()),t.allowMultipleSelections!==!1&&r.push(A.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&r.push(se()),t.syntaxHighlighting!==!1&&r.push(U(le,{fallback:!0})),t.bracketMatching!==!1&&r.push(fe()),t.closeBrackets!==!1&&r.push(de()),t.autocompletion!==!1&&r.push(ue()),t.rectangularSelection!==!1&&r.push(ge()),a!==!1&&r.push(he()),t.highlightActiveLine!==!1&&r.push(me()),t.highlightSelectionMatches!==!1&&r.push(be()),t.tabSize&&typeof t.tabSize=="number"&&r.push(pe.of(" ".repeat(t.tabSize))),r.concat([w.of(o.flat())]).filter(Boolean)},Fe=h.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ee=function(t){t===void 0&&(t={});var{indentWithTab:a=!0,editable:o=!0,readOnly:r=!1,theme:s="light",placeholder:l="",basicSetup:u=!0}=t,c=[];switch(a&&c.unshift(w.of([ye])),u&&(typeof u=="boolean"?c.unshift(j()):c.unshift(j(u))),l&&c.unshift(Se(l)),s){case"light":c.push(Fe);break;case"dark":c.push(ve);break;case"none":break;default:c.push(s);break}return o===!1&&c.push(h.editable.of(!1)),r&&c.push(A.readOnly.of(!0)),[...c]},Be=i=>({line:i.state.doc.lineAt(i.state.selection.main.from),lineCount:i.state.doc.lines,lineBreak:i.state.lineBreak,length:i.state.doc.length,readOnly:i.state.readOnly,tabSize:i.state.tabSize,selection:i.state.selection,selectionAsSingle:i.state.selection.asSingle().main,ranges:i.state.selection.ranges,selectionCode:i.state.sliceDoc(i.state.selection.main.from,i.state.selection.main.to),selections:i.state.selection.ranges.map(t=>i.state.sliceDoc(t.from,t.to)),selectedText:i.state.selection.ranges.some(t=>!t.empty)}),G=xe.define(),We=[];function Ne(i){var{value:t,selection:a,onChange:o,onStatistics:r,onCreateEditor:s,onUpdate:l,extensions:u=We,autoFocus:c,theme:m="light",height:C=null,minHeight:b=null,maxHeight:F=null,width:E=null,minWidth:B=null,maxWidth:W=null,placeholder:N="",editable:H=!0,readOnly:K=!1,indentWithTab:L=!0,basicSetup:M=!0,root:I,initialState:v}=i,[p,O]=f.useState(),[n,g]=f.useState(),[y,S]=f.useState(),z=h.theme({"&":{height:C,minHeight:b,maxHeight:F,width:E,minWidth:B,maxWidth:W},"& .cm-scroller":{height:"100% !important"}}),D=h.updateListener.of(d=>{if(d.docChanged&&typeof o=="function"&&!d.transactions.some(q=>q.annotation(G))){var x=d.state.doc,T=x.toString();o(T,d)}r&&r(Be(d))}),_=Ee({theme:m,editable:H,readOnly:K,placeholder:N,indentWithTab:L,basicSetup:M}),k=[D,z,..._];return l&&typeof l=="function"&&k.push(h.updateListener.of(l)),k=k.concat(u),f.useEffect(()=>{if(p&&!y){var d={doc:t,selection:a,extensions:k},x=v?A.fromJSON(v.json,d,v.fields):A.create(d);if(S(x),!n){var T=new h({state:x,parent:p,root:I});g(T),s&&s(T,x)}}return()=>{n&&(S(void 0),g(void 0))}},[p,y]),f.useEffect(()=>O(i.container),[i.container]),f.useEffect(()=>()=>{n&&(n.destroy(),g(void 0))},[n]),f.useEffect(()=>{c&&n&&n.focus()},[c,n]),f.useEffect(()=>{n&&n.dispatch({effects:ke.reconfigure.of(k)})},[m,u,C,b,F,E,B,W,N,H,K,L,M,o,l]),f.useEffect(()=>{if(t!==void 0){var d=n?n.state.doc.toString():"";n&&t!==d&&n.dispatch({changes:{from:0,to:d.length,insert:t||""},annotations:[G.of(!0)]})}},[t,n]),{state:y,setState:S,view:n,setView:g,container:p,setContainer:O}}var He=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Ke=f.forwardRef((i,t)=>{var{className:a,value:o="",selection:r,extensions:s=[],onChange:l,onStatistics:u,onCreateEditor:c,onUpdate:m,autoFocus:C,theme:b="light",height:F,minHeight:E,maxHeight:B,width:W,minWidth:N,maxWidth:H,basicSetup:K,placeholder:L,indentWithTab:M,editable:I,readOnly:v,root:p,initialState:O}=i,n=V(i,He),g=f.useRef(null),{state:y,view:S,container:z}=Ne({container:g.current,root:p,value:o,autoFocus:C,theme:b,height:F,minHeight:E,maxHeight:B,width:W,minWidth:N,maxWidth:H,basicSetup:K,placeholder:L,indentWithTab:M,editable:I,readOnly:v,selection:r,onChange:l,onStatistics:u,onCreateEditor:c,onUpdate:m,extensions:s,initialState:O});if(f.useImperativeHandle(t,()=>({editor:g.current,state:y,view:S}),[g,z,y,S]),typeof o!="string")throw new Error("value must be typeof string but got "+typeof o);var D=typeof b=="string"?"cm-theme-"+b:"cm-theme";return P.jsx("div",R({ref:g,className:""+D+(a?" "+a:"")},n))});Ke.displayName="CodeMirror";var Le=i=>{var{theme:t,settings:a={},styles:o=[]}=i,r={".cm-gutters":{}},s={};a.background&&(s.backgroundColor=a.background),a.backgroundImage&&(s.backgroundImage=a.backgroundImage),a.foreground&&(s.color=a.foreground),a.fontSize&&(s.fontSize=a.fontSize),(a.background||a.foreground)&&(r["&"]=s),a.fontFamily&&(r["&.cm-editor .cm-scroller"]={fontFamily:a.fontFamily}),a.gutterBackground&&(r[".cm-gutters"].backgroundColor=a.gutterBackground),a.gutterForeground&&(r[".cm-gutters"].color=a.gutterForeground),a.gutterBorder&&(r[".cm-gutters"].borderRightColor=a.gutterBorder),a.caret&&(r[".cm-content"]={caretColor:a.caret},r[".cm-cursor, .cm-dropCursor"]={borderLeftColor:a.caret});var l={};a.gutterActiveForeground&&(l.color=a.gutterActiveForeground),a.lineHighlight&&(r[".cm-activeLine"]={backgroundColor:a.lineHighlight},l.backgroundColor=a.lineHighlight),r[".cm-activeLineGutter"]=l,a.selection&&(r["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:a.selection+" !important"}),a.selectionMatch&&(r["& .cm-selectionMatch"]={backgroundColor:a.selectionMatch});var u=h.theme(r,{dark:t==="dark"}),c=Ce.define(o),m=[u,U(c)];return m},Me={background:"#2e3440",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#00000073",selectionMatch:"#00000073",gutterBackground:"#2e3440",gutterForeground:"#4c566a",gutterActiveForeground:"#d8dee9",lineHighlight:"#4c566a29"},Oe=[{tag:e.keyword,color:"#5e81ac"},{tag:[e.name,e.deleted,e.character,e.propertyName,e.macroName],color:"#88c0d0"},{tag:[e.variableName],color:"#8fbcbb"},{tag:[e.function(e.variableName)],color:"#8fbcbb"},{tag:[e.labelName],color:"#81a1c1"},{tag:[e.color,e.constant(e.name),e.standard(e.name)],color:"#5e81ac"},{tag:[e.definition(e.name),e.separator],color:"#a3be8c"},{tag:[e.brace],color:"#8fbcbb"},{tag:[e.annotation],color:"#d30102"},{tag:[e.number,e.changed,e.annotation,e.modifier,e.self,e.namespace],color:"#b48ead"},{tag:[e.typeName,e.className],color:"#ebcb8b"},{tag:[e.operator,e.operatorKeyword],color:"#a3be8c"},{tag:[e.tagName],color:"#b48ead"},{tag:[e.squareBracket],color:"#bf616a"},{tag:[e.angleBracket],color:"#d08770"},{tag:[e.attributeName],color:"#ebcb8b"},{tag:[e.regexp],color:"#5e81ac"},{tag:[e.quote],color:"#b48ead"},{tag:[e.string],color:"#a3be8c"},{tag:e.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[e.url,e.escape,e.special(e.string)],color:"#8fbcbb"},{tag:[e.meta],color:"#88c0d0"},{tag:[e.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[e.comment],color:"#4c566a",fontStyle:"italic"},{tag:e.strong,fontWeight:"bold",color:"#5e81ac"},{tag:e.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:e.strikethrough,textDecoration:"line-through"},{tag:e.heading,fontWeight:"bold",color:"#5e81ac"},{tag:e.special(e.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:e.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[e.heading2,e.heading3,e.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[e.heading5,e.heading6],color:"#5e81ac"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#d08770"},{tag:[e.processingInstruction,e.inserted],color:"#8fbcbb"},{tag:[e.contentSeparator],color:"#ebcb8b"},{tag:e.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],Te=i=>{var{theme:t="dark",settings:a={},styles:o=[]}={};return Le({theme:t,settings:R({},Me,a),styles:[...Oe,...o]})},je=Te();export{Ke as R,je as n}; +import{_ as V,a as R}from"./@babel-BjXSgPXB.js";import{r as f,j as P}from"./react-DmpIMwDM.js";import{c as J,d as Q,s as X,h as Y,f as Z,a as $,l as ee,b as te,e as ae,g as re,i as oe,j as ie,k as ne,m as ce,E as A,n as se,o as U,p as le,q as fe,r as de,t as ue,u as ge,v as he,w as me,x as be,y as pe,z as w,A as h,B as ye,C as Se,D as ve,S as ke,F as xe,H as Ce}from"./@codemirror-CCjSF3Vf.js";import{a as e}from"./@lezer-DgLl1T_N.js";var j=function(t){t===void 0&&(t={});var{crosshairCursor:a=!1}=t,o=[];t.closeBracketsKeymap!==!1&&(o=o.concat(J)),t.defaultKeymap!==!1&&(o=o.concat(Q)),t.searchKeymap!==!1&&(o=o.concat(X)),t.historyKeymap!==!1&&(o=o.concat(Y)),t.foldKeymap!==!1&&(o=o.concat(Z)),t.completionKeymap!==!1&&(o=o.concat($)),t.lintKeymap!==!1&&(o=o.concat(ee));var r=[];return t.lineNumbers!==!1&&r.push(te()),t.highlightActiveLineGutter!==!1&&r.push(ae()),t.highlightSpecialChars!==!1&&r.push(re()),t.history!==!1&&r.push(oe()),t.foldGutter!==!1&&r.push(ie()),t.drawSelection!==!1&&r.push(ne()),t.dropCursor!==!1&&r.push(ce()),t.allowMultipleSelections!==!1&&r.push(A.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&r.push(se()),t.syntaxHighlighting!==!1&&r.push(U(le,{fallback:!0})),t.bracketMatching!==!1&&r.push(fe()),t.closeBrackets!==!1&&r.push(de()),t.autocompletion!==!1&&r.push(ue()),t.rectangularSelection!==!1&&r.push(ge()),a!==!1&&r.push(he()),t.highlightActiveLine!==!1&&r.push(me()),t.highlightSelectionMatches!==!1&&r.push(be()),t.tabSize&&typeof t.tabSize=="number"&&r.push(pe.of(" ".repeat(t.tabSize))),r.concat([w.of(o.flat())]).filter(Boolean)},Fe=h.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Ee=function(t){t===void 0&&(t={});var{indentWithTab:a=!0,editable:o=!0,readOnly:r=!1,theme:s="light",placeholder:l="",basicSetup:u=!0}=t,c=[];switch(a&&c.unshift(w.of([ye])),u&&(typeof u=="boolean"?c.unshift(j()):c.unshift(j(u))),l&&c.unshift(Se(l)),s){case"light":c.push(Fe);break;case"dark":c.push(ve);break;case"none":break;default:c.push(s);break}return o===!1&&c.push(h.editable.of(!1)),r&&c.push(A.readOnly.of(!0)),[...c]},Be=i=>({line:i.state.doc.lineAt(i.state.selection.main.from),lineCount:i.state.doc.lines,lineBreak:i.state.lineBreak,length:i.state.doc.length,readOnly:i.state.readOnly,tabSize:i.state.tabSize,selection:i.state.selection,selectionAsSingle:i.state.selection.asSingle().main,ranges:i.state.selection.ranges,selectionCode:i.state.sliceDoc(i.state.selection.main.from,i.state.selection.main.to),selections:i.state.selection.ranges.map(t=>i.state.sliceDoc(t.from,t.to)),selectedText:i.state.selection.ranges.some(t=>!t.empty)}),G=xe.define(),We=[];function Ne(i){var{value:t,selection:a,onChange:o,onStatistics:r,onCreateEditor:s,onUpdate:l,extensions:u=We,autoFocus:c,theme:m="light",height:C=null,minHeight:b=null,maxHeight:F=null,width:E=null,minWidth:B=null,maxWidth:W=null,placeholder:N="",editable:H=!0,readOnly:K=!1,indentWithTab:L=!0,basicSetup:M=!0,root:I,initialState:v}=i,[p,O]=f.useState(),[n,g]=f.useState(),[y,S]=f.useState(),z=h.theme({"&":{height:C,minHeight:b,maxHeight:F,width:E,minWidth:B,maxWidth:W},"& .cm-scroller":{height:"100% !important"}}),D=h.updateListener.of(d=>{if(d.docChanged&&typeof o=="function"&&!d.transactions.some(q=>q.annotation(G))){var x=d.state.doc,T=x.toString();o(T,d)}r&&r(Be(d))}),_=Ee({theme:m,editable:H,readOnly:K,placeholder:N,indentWithTab:L,basicSetup:M}),k=[D,z,..._];return l&&typeof l=="function"&&k.push(h.updateListener.of(l)),k=k.concat(u),f.useEffect(()=>{if(p&&!y){var d={doc:t,selection:a,extensions:k},x=v?A.fromJSON(v.json,d,v.fields):A.create(d);if(S(x),!n){var T=new h({state:x,parent:p,root:I});g(T),s&&s(T,x)}}return()=>{n&&(S(void 0),g(void 0))}},[p,y]),f.useEffect(()=>O(i.container),[i.container]),f.useEffect(()=>()=>{n&&(n.destroy(),g(void 0))},[n]),f.useEffect(()=>{c&&n&&n.focus()},[c,n]),f.useEffect(()=>{n&&n.dispatch({effects:ke.reconfigure.of(k)})},[m,u,C,b,F,E,B,W,N,H,K,L,M,o,l]),f.useEffect(()=>{if(t!==void 0){var d=n?n.state.doc.toString():"";n&&t!==d&&n.dispatch({changes:{from:0,to:d.length,insert:t||""},annotations:[G.of(!0)]})}},[t,n]),{state:y,setState:S,view:n,setView:g,container:p,setContainer:O}}var He=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Ke=f.forwardRef((i,t)=>{var{className:a,value:o="",selection:r,extensions:s=[],onChange:l,onStatistics:u,onCreateEditor:c,onUpdate:m,autoFocus:C,theme:b="light",height:F,minHeight:E,maxHeight:B,width:W,minWidth:N,maxWidth:H,basicSetup:K,placeholder:L,indentWithTab:M,editable:I,readOnly:v,root:p,initialState:O}=i,n=V(i,He),g=f.useRef(null),{state:y,view:S,container:z}=Ne({container:g.current,root:p,value:o,autoFocus:C,theme:b,height:F,minHeight:E,maxHeight:B,width:W,minWidth:N,maxWidth:H,basicSetup:K,placeholder:L,indentWithTab:M,editable:I,readOnly:v,selection:r,onChange:l,onStatistics:u,onCreateEditor:c,onUpdate:m,extensions:s,initialState:O});if(f.useImperativeHandle(t,()=>({editor:g.current,state:y,view:S}),[g,z,y,S]),typeof o!="string")throw new Error("value must be typeof string but got "+typeof o);var D=typeof b=="string"?"cm-theme-"+b:"cm-theme";return P.jsx("div",R({ref:g,className:""+D+(a?" "+a:"")},n))});Ke.displayName="CodeMirror";var Le=i=>{var{theme:t,settings:a={},styles:o=[]}=i,r={".cm-gutters":{}},s={};a.background&&(s.backgroundColor=a.background),a.backgroundImage&&(s.backgroundImage=a.backgroundImage),a.foreground&&(s.color=a.foreground),a.fontSize&&(s.fontSize=a.fontSize),(a.background||a.foreground)&&(r["&"]=s),a.fontFamily&&(r["&.cm-editor .cm-scroller"]={fontFamily:a.fontFamily}),a.gutterBackground&&(r[".cm-gutters"].backgroundColor=a.gutterBackground),a.gutterForeground&&(r[".cm-gutters"].color=a.gutterForeground),a.gutterBorder&&(r[".cm-gutters"].borderRightColor=a.gutterBorder),a.caret&&(r[".cm-content"]={caretColor:a.caret},r[".cm-cursor, .cm-dropCursor"]={borderLeftColor:a.caret});var l={};a.gutterActiveForeground&&(l.color=a.gutterActiveForeground),a.lineHighlight&&(r[".cm-activeLine"]={backgroundColor:a.lineHighlight},l.backgroundColor=a.lineHighlight),r[".cm-activeLineGutter"]=l,a.selection&&(r["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:a.selection+" !important"}),a.selectionMatch&&(r["& .cm-selectionMatch"]={backgroundColor:a.selectionMatch});var u=h.theme(r,{dark:t==="dark"}),c=Ce.define(o),m=[u,U(c)];return m},Me={background:"#2e3440",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#00000073",selectionMatch:"#00000073",gutterBackground:"#2e3440",gutterForeground:"#4c566a",gutterActiveForeground:"#d8dee9",lineHighlight:"#4c566a29"},Oe=[{tag:e.keyword,color:"#5e81ac"},{tag:[e.name,e.deleted,e.character,e.propertyName,e.macroName],color:"#88c0d0"},{tag:[e.variableName],color:"#8fbcbb"},{tag:[e.function(e.variableName)],color:"#8fbcbb"},{tag:[e.labelName],color:"#81a1c1"},{tag:[e.color,e.constant(e.name),e.standard(e.name)],color:"#5e81ac"},{tag:[e.definition(e.name),e.separator],color:"#a3be8c"},{tag:[e.brace],color:"#8fbcbb"},{tag:[e.annotation],color:"#d30102"},{tag:[e.number,e.changed,e.annotation,e.modifier,e.self,e.namespace],color:"#b48ead"},{tag:[e.typeName,e.className],color:"#ebcb8b"},{tag:[e.operator,e.operatorKeyword],color:"#a3be8c"},{tag:[e.tagName],color:"#b48ead"},{tag:[e.squareBracket],color:"#bf616a"},{tag:[e.angleBracket],color:"#d08770"},{tag:[e.attributeName],color:"#ebcb8b"},{tag:[e.regexp],color:"#5e81ac"},{tag:[e.quote],color:"#b48ead"},{tag:[e.string],color:"#a3be8c"},{tag:e.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[e.url,e.escape,e.special(e.string)],color:"#8fbcbb"},{tag:[e.meta],color:"#88c0d0"},{tag:[e.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[e.comment],color:"#4c566a",fontStyle:"italic"},{tag:e.strong,fontWeight:"bold",color:"#5e81ac"},{tag:e.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:e.strikethrough,textDecoration:"line-through"},{tag:e.heading,fontWeight:"bold",color:"#5e81ac"},{tag:e.special(e.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:e.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[e.heading2,e.heading3,e.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[e.heading5,e.heading6],color:"#5e81ac"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#d08770"},{tag:[e.processingInstruction,e.inserted],color:"#8fbcbb"},{tag:[e.contentSeparator],color:"#ebcb8b"},{tag:e.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],Te=i=>{var{theme:t="dark",settings:a={},styles:o=[]}={};return Le({theme:t,settings:R({},Me,a),styles:[...Oe,...o]})},je=Te();export{Ke as R,je as n}; diff --git a/assets/@uiw-CvcbIrPa.js.gz b/assets/@uiw-CvcbIrPa.js.gz new file mode 100644 index 0000000..d848e08 Binary files /dev/null and b/assets/@uiw-CvcbIrPa.js.gz differ diff --git a/assets/index-C-kKn6GS.css.gz b/assets/index-C-kKn6GS.css.gz deleted file mode 100644 index 45256bf..0000000 Binary files a/assets/index-C-kKn6GS.css.gz and /dev/null differ diff --git a/assets/index-CCxazG49.js b/assets/index-CCxazG49.js new file mode 100644 index 0000000..385b7fa --- /dev/null +++ b/assets/index-CCxazG49.js @@ -0,0 +1,7 @@ +import{r as o,j as e,R as Rt}from"./react-DmpIMwDM.js";import{c as Tt}from"./react-dom-Cjr6YfK8.js";import{c as St}from"./zustand-BpWCCnYR.js";import{i as At}from"./sql.js-Ch_tM77n.js";import{F as fe}from"./file-saver-DhbZvGod.js";import{f as Lt}from"./sql-formatter-BoZ82dp4.js";import{I as Dt,H as It,c as xe,d as pe,e as Ft,S as kt,f as Ot,g as ge,h as Mt,i as Pt,j as he,k as be,l as ye,m as Bt,n as Ne,o as qt,p as je,q as we,r as Ut,s as Ce,V as $t,L as Ee,t as ve,u as Qt,v as zt,w as Re,x as Ht,G as Vt,y as Gt,z as Te,A as _t,B as Wt,E as Se,F as Ae,J as Le,K as De,M as Ie,N as Fe,Q as Kt,U as Yt}from"./@radix-ui-BQVY8FyZ.js";import{c as Xt}from"./clsx-B-dksMZM.js";import{t as Jt}from"./tailwind-merge-BkWO730n.js";import{C as J,L as Zt,I as es,a as ts,T as ss,F as as,b as rs,R as os,c as ke,P as Oe,S as Me,d as ns,M as ls,e as is,f as cs,g as ds,h as ms,A as us,i as fs,j as xs,K as ps,k as gs,l as hs,m as bs,H as ys,n as Ns,o as js,p as ws,q as Cs,r as Es,s as vs,G as Rs,Z as Ts,t as Ss,u as As,v as Ls,w as Ds}from"./lucide-react-S8ZAjIB-.js";import{c as Z}from"./class-variance-authority-Bb4qSo10.js";import{J as L,T as Is}from"./sonner-CxG_nbEz.js";import{D as T}from"./vaul-OrZLygqJ.js";import{p as Pe,i as Be,f as Fs,a as ks}from"./date-fns-BAPXOope.js";import{G as Os,I as Ms,t as Ps}from"./@codemirror-CCjSF3Vf.js";import{R as Bs,n as qs}from"./@uiw-CvcbIrPa.js";import{u as Us}from"./react-dropzone-D-IBOhIS.js";import"./attr-accept-BWI1aNlo.js";import"./scheduler-CzFDRTuY.js";import"./use-sync-external-store-ByYeed7R.js";import"./nearley-CG12bGQB.js";import"./aria-hidden-DQ5UC2Eg.js";import"./react-remove-scroll-BOyN_WUU.js";import"./tslib-CuZy2iRz.js";import"./react-remove-scroll-bar-DZjhPxUV.js";import"./react-style-singleton-CpxBwIWS.js";import"./get-nonce-C-Z93AgS.js";import"./use-sidecar-D8_hMcUG.js";import"./use-callback-ref-DRzK4jWO.js";import"./@floating-ui-Bob4LHZu.js";import"./@lezer-DgLl1T_N.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";import"./@babel-BjXSgPXB.js";import"./prop-types-psm7UO16.js";import"./file-selector-CBHVlu32.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=a(n);fetch(n.href,l)}})();const $s="/sql.wasm";let G;const Qs=async()=>(G||(G=await At({locateFile:()=>$s})),G),zs=async t=>{try{const s=await Qs();return new s.Database(t)}catch(s){throw console.error("Failed to load database:",s),s}},ee=t=>{try{const s=t.prepare("SELECT name FROM sqlite_master WHERE type='table';"),a=[];for(;s.step();)a.push(s.get()[0]);return s.free(),a}catch{throw new Error("Invalid database file")}},Hs=(t,s)=>{try{const a={},r=t.prepare(`PRAGMA table_info("${s}");`);for(;r.step();){const l=r.getAsObject();a[l.name]={type:l.type?l.type.toUpperCase():l.type,isPrimaryKey:l.pk===1,isForeignKey:!1,nullable:l.notnull===0}}r.free();const n=t.prepare(`PRAGMA foreign_key_list("${s}");`);for(;n.step();){const l=n.getAsObject();a[l.from]&&(a[l.from].isForeignKey=!0)}return n.free(),a}catch(a){throw console.error(`Failed to get schema for table "${s}":`,a),a}},le=t=>{if(t.length===0)return{data:[],columns:[]};const{columns:s,values:a}=t[0];return{data:a.map(n=>Object.fromEntries(s.map((l,i)=>[l,n[i]]))),columns:s}},Vs=t=>{try{const s=t.export(),a=new Blob([s],{type:"application/x-sqlite3"});fe.saveAs(a,"database.sqlite")}catch(s){throw console.error("Failed to export database:",s),s}},Gs=(t,s)=>{const a=t.map(n=>`"${n}"`).join(","),r=s.map(n=>t.map(l=>`"${n[l]??""}"`).join(","));return[a,...r].join(` +`)},te=(t,s,a)=>{try{const r=s.prepare(t),n=r.getColumnNames(),l=[];for(;r.step();){const d=r.getAsObject();l.push(d)}if(r.free(),l.length===0)throw new Error(`Query "${t}" returned no results.`);const i=Gs(n,l),c=new Blob([i],{type:"text/csv;charset=utf-8;"});fe.saveAs(c,`${a}.csv`)}catch(r){throw console.error(`Failed to get CSV for query "${t}":`,r),r}},_s=(t,s)=>{const r=ee(t)[s],n=`SELECT * FROM "${r}"`;te(n,t,r)},Ws=t=>{const s=ee(t);for(const a of s)try{const r=`SELECT * FROM "${a}"`;te(r,t,a)}catch(r){throw console.error(`Failed to get CSV for table "${a}":`,r),r}},Ks=(t,s)=>{te(s,t,"custom_query")},ie=["Bytes","KB","MB","GB","TB"];function Ys(t){let s=0;for(;t>=1024&&s({db:null,isLoading:!1,loadDatabaseBytes:async a=>{t({isLoading:!0});try{const r=await zs(a),n=ee(r),l=await Promise.all(n.map(async d=>{const u=r.exec(`SELECT COUNT(*) FROM "${d}"`),f=Number.parseInt(u[0].values[0][0],10),x=await Hs(r,d);return{name:d,count:f,schema:x}})),i=l.map(({name:d,count:u})=>({name:d,count:u})),c=l.reduce((d,{name:u,schema:f})=>(d[u]=f,d),{});t({db:r,tables:i,tableSchemas:c,isLoading:!1})}catch(r){throw t({isLoading:!1}),r}},tables:[],setTables:a=>t({tables:a}),selectedTable:"0",setSelectedTable:a=>t({selectedTable:a}),tableSchemas:{},customQuery:"",setIsCustomQuery:a=>t({isCustomQuery:a}),setCustomQuery:a=>t({customQuery:a}),isCustomQuery:!1,queryError:null,setQueryError:a=>t({queryError:a}),query:a=>{const{db:r}=s();return r?r.exec(a):(console.warn("Database is not loaded."),[])},rowPerPageOrAuto:"auto",setRowPerPageOrAuto:a=>t({rowPerPageOrAuto:a}),queryHistory:[],unShiftToQueryHistory:a=>t(r=>({queryHistory:[a,...r.queryHistory]})),expandPage:!1,setExpandPage:a=>t({expandPage:a}),dateFormatValue:"formatDateFormatted",setDateFormatValue:a=>t({dateFormatValue:a}),filters:{},setFilters:a=>t({filters:a}),appendToFilters:(a,r)=>t(n=>({filters:{...n.filters,[a]:r}})),filtersNeedClear:!1,setFiltersNeedClear:a=>t({filtersNeedClear:a}),totalRows:0,setTotalRows:a=>t({totalRows:a}),orderBy:{column:null,direction:"ASC"},setOrderBy:(a,r)=>t({orderBy:{column:a,direction:r}}),databaseData:{name:"database.db",size:0,sizeAsString:"0 Bytes"},setDatabaseData:a=>{t({databaseData:{...a,sizeAsString:Ys(a.size)}})}}));function Xs(t,s,a){const{db:r,setQueryError:n,setIsCustomQuery:l,query:i,unShiftToQueryHistory:c,customQuery:d,setCustomQuery:u,filters:f,totalRows:x,setTotalRows:g,orderBy:p,selectedTable:y,tables:N}=h(),[w,C]=o.useState([]),[S,D]=o.useState([]),[E,A]=o.useState(!0),P=o.useMemo(()=>Object.fromEntries(Object.entries(f).filter(([,j])=>j!=="")),[f]),v=o.useMemo(()=>Object.entries(P).map(([j,R])=>`LOWER(${j}) LIKE LOWER('%${R}%')`).join(" AND "),[P]);o.useEffect(()=>{if(!r||!t)return;(async()=>{A(!0);try{const R=`PRAGMA table_info("${t}");`,V=i(R)[0].values.map(I=>({name:I[1],type:I[2]})).map(I=>I.type.toUpperCase()==="BLOB"?`hex(${I.name}) as ${I.name}`:I.name).join(", "),k=`SELECT COUNT(*) as count FROM "${t}"${v?` WHERE ${v}`:""}`,U=i(k)[0].values[0][0];g(U);let O=`SELECT + ${V} +FROM "${t}"`;v&&(O+=` +WHERE ${v}`),p.column&&(O+=` +ORDER BY "${p.column}" ${p.direction}`),O+=` +LIMIT ${s} OFFSET ${a};`;const Ct=i(O),{data:Et,columns:vt}=le(Ct);D(vt),C(Et),n(null),u(O),c(O)}catch(R){R instanceof Error&&n(R.message)}finally{A(!1)}})()},[r,t,a,s,v,p,i,n,u,c,g]);const H=o.useCallback(()=>{if(d.trim()===""){n(null);return}A(!0);try{const j=N[Number.parseInt(y)].name,R=i(d.replace("@",`"${j}"`)),{data:B,columns:q}=le(R);D(q),C(B),l(!0),n(null)}catch(j){j instanceof Error&&n(j.message)}finally{A(!1)}},[d,i,n,l,N,y]);return{data:w,columns:S,customQuery:d,setCustomQuery:u,isQueryLoading:E,handleCustomQuery:H,totalRows:x}}function Js(t){const{setIsCustomQuery:s}=h(),[a,r]=o.useState(0);o.useEffect(()=>{r(0),s(!1)},[s]);const n=o.useMemo(()=>{if(t!=="auto")return t;const l=window.innerHeight,u=Math.min(2e3,40+l*.03),f=Math.max(1,Math.floor(l/u));return Math.min(Math.max(f,5),50)},[t]);return{page:a,setPage:r,rowsPerPage:n}}function m(...t){return Jt(Xt(t))}const Zs=Ft,qe=o.forwardRef(({className:t,...s},a)=>e.jsx(Dt,{ref:a,className:m("border-b",t),...s}));qe.displayName="AccordionItem";const Ue=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(It,{className:"flex",children:e.jsxs(xe,{ref:r,className:m("flex flex-1 items-center justify-between py-3 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(J,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ue.displayName=xe.displayName;const $e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(pe,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:m("pb-4 pt-0",t),children:s})}));$e.displayName=pe.displayName;const se=Z("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),b=o.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},l)=>{const i=r?kt:"button";return e.jsx(i,{className:m(se({variant:s,size:a,className:t})),ref:l,...n})});b.displayName="Button";const ea=o.memo(Zt);function K({type:t,children:s,className:a=""}){let r,n;switch(t){case"error":r=e.jsx(ss,{className:"mr-3 h-6 w-6 text-red-500"}),n="bg-red-100 text-red-800 border-l-4 border-red-500";break;case"loading":{r=e.jsx(ea,{className:"mr-3 h-6 w-6 animate-spin text-blue-500"}),n="bg-blue-100 text-blue-800 border-l-4 border-blue-500";break}case"success":r=e.jsx(ts,{className:"mr-3 h-6 w-6 text-green-500"}),n="bg-green-100 text-green-800 border-l-4 border-green-500";break;case"info":r=e.jsx(es,{className:"mr-3 h-6 w-6 text-yellow-500"}),n="bg-yellow-100 text-yellow-800 border-l-4 border-yellow-500";break;default:r=null,n=""}return e.jsxs("div",{className:`flex items-center rounded-lg p-4 shadow-md ${n} ${a}`,children:[r,e.jsx("span",{className:"font-medium",children:s})]})}const ta=Mt,sa=Pt,Qe=o.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Ot,{children:e.jsx(ge,{ref:n,align:s,sideOffset:a,className:m("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Qe.displayName=ge.displayName;function aa(){const{selectedTable:t,customQuery:s,db:a}=h(),r=o.useMemo(()=>a&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx($,{onClick:()=>{try{Vs(a)}catch{L.error("Failed to download database")}},label:"Export as SQLite",title:"Download database as SQLite"}),e.jsx($,{onClick:()=>{try{_s(a,Number.parseInt(t))}catch{L.error("Failed to export selected table as CSV")}},label:"Export selected table as CSV"}),e.jsx($,{onClick:()=>{try{Ws(a)}catch{L.error("Failed to export all tables as CSV")}},label:"Export all tables as CSV"}),e.jsx($,{onClick:()=>{try{Ks(a,s)}catch{L.error("Failed to export custom query as CSV")}},label:"Export custom query as CSV",title:"Export the result of the custom query as CSV"})]}),[a,t,s]);return e.jsxs(ta,{children:[e.jsx(sa,{asChild:!0,children:e.jsx(b,{title:"Open export options",children:e.jsx(as,{className:"h-5 w-5"})})}),e.jsx(Qe,{align:"end",className:"w-80",children:r})]})}function $({onClick:t,label:s,className:a,title:r}){return e.jsx(b,{className:a,onClick:t,title:r??s,children:e.jsx("span",{className:"ml-2",children:s})})}const ze=(t,s)=>localStorage.getItem(t)||s,He=(t,s)=>localStorage.setItem(t,s),ce=(t,s)=>{const[a,r]=o.useState(()=>ze(t,s));return o.useEffect(()=>{He(t,a)},[t,a]),[a,r]},Ve=({shouldScaleBackground:t=!0,...s})=>e.jsx(T.Root,{shouldScaleBackground:t,...s});Ve.displayName="Drawer";const ra=T.Trigger,oa=T.Portal,na=T.Close,Ge=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Overlay,{ref:a,className:m("fixed inset-0 z-50 bg-black/80",t),...s}));Ge.displayName=T.Overlay.displayName;const _e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(oa,{children:[e.jsx(Ge,{}),e.jsxs(T.Content,{ref:r,className:m("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",t),...a,children:[e.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),s]})]}));_e.displayName="DrawerContent";const We=({className:t,...s})=>e.jsx("div",{className:m("grid gap-1.5 p-4 text-center sm:text-left",t),...s});We.displayName="DrawerHeader";const Ke=({className:t,...s})=>e.jsx("div",{className:m("mt-auto flex flex-col gap-2 pb-4",t),...s});Ke.displayName="DrawerFooter";const Ye=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Title,{ref:a,className:m("text-lg font-semibold leading-none tracking-tight",t),...s}));Ye.displayName=T.Title.displayName;const Xe=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Description,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Xe.displayName=T.Description.displayName;const _=t=>s=>{const a=Pe(s);return Be(a)?Fs(a,t):s},la=t=>{const s=Pe(t);return Be(s)?ks(s,{addSuffix:!0}):t},Y={formatDateRelative:{label:"Over 56 years ago",func:la},formatDateFormatted:{label:"January 9th, 1968",func:_("MMMM do, yyyy")},formatDateLong:{label:"1968/09/01",func:_("yyyy/MM/dd")},formatDateShort:{label:"01/09/1968",func:_("MM/dd/yyyy")}},ia=Z("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Je=o.forwardRef(({className:t,...s},a)=>e.jsx(he,{ref:a,className:m(ia(),t),...s}));Je.displayName=he.displayName;const ae=o.forwardRef(({className:t,...s},a)=>e.jsx(be,{className:m("grid gap-2",t),...s,ref:a}));ae.displayName=be.displayName;const Ze=o.forwardRef(({className:t,...s},a)=>e.jsx(ye,{ref:a,className:m("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Bt,{className:"flex items-center justify-center",children:e.jsx(rs,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ze.displayName=ye.displayName;const re=o.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:m("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a}));re.displayName="Input";const Q=({value:t,label:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{value:t,id:`r-${t}`}),e.jsx(Je,{htmlFor:`r-${t}`,children:s})]}),ca=({rowsPerPage:t,onRowsPerPageChange:s})=>{const a=t==="auto";return e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Rows Per Page"})]}),e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:[e.jsx(re,{id:"rowsPerPage",value:a?"":t,onChange:r=>s(r.target.value),placeholder:"Number of rows",type:"number",className:"w-full",autoFocus:!1}),e.jsx(b,{variant:"outline",onClick:()=>s("auto"),className:"w-full whitespace-nowrap",children:"Auto Calculate"})]})]})},da=({dateFormatValue:t,onDateFormatChange:s})=>e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Date Format"})]}),e.jsx("div",{className:"h-full rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:e.jsxs(ae,{className:"flex h-full flex-col gap-2",name:"dateType",value:t,onValueChange:s,children:[e.jsx(Q,{value:"default",label:"Default"}),Object.entries(Y).map(([a,{label:r}])=>e.jsx(Q,{value:a,label:r},a))]})})]}),ma=({themeColor:t,onThemeColorChange:s,themeColors:a})=>e.jsxs("div",{className:"flex grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Theme Color"})]}),e.jsxs(ae,{className:"flex flex-col gap-2 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",name:"themeColor",value:t,onValueChange:s,children:[e.jsx(Q,{value:"default",label:"Default"}),a.map(r=>e.jsx(Q,{value:r,label:r[0].toUpperCase()+r.slice(1)},r))]})]}),ua="rowsPerPage",de="dateFormat",fa="theme-color",me=["nord","zinc"],xa=o.memo(function(){const{setRowPerPageOrAuto:s,setIsCustomQuery:a,dateFormatValue:r,setDateFormatValue:n}=h(),[l,i]=ce(ua,"auto"),[c,d]=ce(fa,"default"),u=l==="auto";o.useEffect(()=>{s(u?"auto":Number(l))},[l,s,u]),o.useEffect(()=>{n(ze(de,"default"))},[n]),o.useEffect(()=>{var p;for(const y of me)(p=document.body)==null||p.classList.toggle(y,y===c)},[c]);const f=o.useCallback(p=>{a(!1),p==="auto"||Number(p)>0?i(p):L.error("Please provide a positive number of rows per page or set it to auto.")},[a,i]),x=o.useCallback(p=>{n(p),He(de,p)},[n]),g=o.useCallback(p=>{d(p)},[d]);return e.jsxs(Ve,{children:[e.jsx(ra,{asChild:!0,children:e.jsx(b,{className:"grow",title:"Open settings drawer",children:e.jsx(Me,{className:"h-5 w-5"})})}),e.jsxs(_e,{children:[e.jsxs(We,{className:"hidden",children:[e.jsx(Ye,{children:"Settings"}),e.jsx(Xe,{children:"Change settings."})]}),e.jsxs("div",{className:"mx-auto flex w-full max-w-sm flex-col gap-3",children:[e.jsx(ca,{rowsPerPage:l,onRowsPerPageChange:f}),e.jsx(ma,{themeColor:c,onThemeColorChange:g,themeColors:me}),e.jsx(da,{dateFormatValue:r,onDateFormatChange:x}),e.jsx(Ke,{children:e.jsx(na,{asChild:!0,children:e.jsx(b,{variant:"outline",children:"Cancel"})})})]})]})]},"settings-drawer")}),W="theme-mode",ue="animate-circular-reveal";function pa(){const[t,s]=o.useState(()=>{const l=localStorage.getItem(W),i=window.matchMedia("(prefers-color-scheme: dark)").matches;return l||(i?"dark":"light")}),a=o.useCallback(l=>{s(l),document.body.classList.remove("light","dark"),document.body.classList.add(l),localStorage.setItem(W,l),document.body.classList.add(ue),setTimeout(()=>{document.body.classList.remove(ue)},500)},[]);o.useEffect(()=>{const l=c=>{localStorage.getItem(W)||a(c.matches?"dark":"light")},i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",l),a(t),()=>{i.removeEventListener("change",l)}},[a,t]);const r=o.useCallback(()=>{a(t==="light"?"dark":"light")},[t,a]);return o.useMemo(()=>e.jsx(b,{className:"relative grow",onClick:r,title:t==="dark"?"Enable light mode":"Enable dark mode",children:t==="dark"?e.jsx(ns,{className:"h-5 w-5"}):e.jsx(ls,{className:"h-5 w-5"})}),[t,r])}const et=o.memo(pa),ga=o.memo(is),ha=o.memo(cs);function ba({page:t,setPage:s,rowsPerPage:a}){const{totalRows:r}=h(),n=o.useMemo(()=>Math.ceil(r/a),[r,a]),l=o.useMemo(()=>Math.ceil(t/a)+1,[t,a]),i=l1,d=o.useCallback(()=>{i&&s(f=>f+a)},[i,a,s]),u=o.useCallback(()=>{c&&s(f=>f-a)},[c,a,s]);return e.jsx("section",{className:"fixed bottom-2 left-1/2 z-10 w-[270px] -translate-x-1/2 transform",children:e.jsxs("div",{className:"flex justify-between gap-2 rounded border bg-secondary p-[6px]",children:[e.jsx(b,{onClick:u,title:"Previous page",disabled:!c,children:e.jsx(ga,{className:"h-4 w-4"})}),e.jsxs("span",{className:"flex items-center justify-center text-sm",children:["Page ",l," of ",n]}),e.jsx(b,{onClick:d,title:"Next page",disabled:!i,children:e.jsx(ha,{className:"h-4 w-4"})})]})})}const ya=Ht,Na=Vt,ja=Gt,wa=o.memo(J),tt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ne,{ref:r,className:m("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(qt,{asChild:!0,children:e.jsx(wa,{className:"h-4 w-4 opacity-50"})})]}));tt.displayName=Ne.displayName;const st=o.forwardRef(({className:t,...s},a)=>e.jsx(je,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ds,{className:"h-4 w-4"})}));st.displayName=je.displayName;const at=o.forwardRef(({className:t,...s},a)=>e.jsx(we,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(J,{className:"h-4 w-4"})}));at.displayName=we.displayName;const rt=o.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(Ut,{children:e.jsxs(Ce,{ref:n,className:m("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(st,{}),e.jsx($t,{className:m("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(at,{})]})}));rt.displayName=Ce.displayName;const ot=o.forwardRef(({className:t,...s},a)=>e.jsx(Ee,{ref:a,className:m("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));ot.displayName=Ee.displayName;const nt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ve,{ref:r,className:m("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Qt,{children:e.jsx(ms,{className:"h-4 w-4"})})}),e.jsx(zt,{children:s})]}));nt.displayName=ve.displayName;const Ca=o.forwardRef(({className:t,...s},a)=>e.jsx(Re,{ref:a,className:m("-mx-1 my-1 h-px bg-muted",t),...s}));Ca.displayName=Re.displayName;const Ea=Z("inline-flex items-center rounded border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function z({className:t,variant:s,...a}){return e.jsx("div",{className:m(Ea({variant:s}),t),...a,children:e.jsx("span",{className:"w-full",children:a.children})})}function va(){const{tables:t,selectedTable:s,setSelectedTable:a,setIsCustomQuery:r}=h(),n=o.useMemo(()=>{var d;const c=Number.parseInt(s);return Number.isNaN(c)?0:((d=t[c])==null?void 0:d.count)||0},[t,s]),l=o.useMemo(()=>t.map((c,d)=>e.jsx(nt,{value:`${d}`,children:c.name[0].toUpperCase()+c.name.slice(1)},c.name)),[t]);function i(c){r(!1),a(c)}return e.jsxs("section",{className:"flex grow items-center justify-center gap-1",children:[e.jsxs(ya,{value:s,onValueChange:i,children:[e.jsx(tt,{className:"grow",children:e.jsx(ja,{placeholder:"Select a table"})}),e.jsx(rt,{children:e.jsxs(Na,{children:[e.jsx(ot,{children:"Tables"}),l]})})]}),e.jsx(z,{title:"Rows",className:"hidden min-w-[100px] grow bg-background py-2 text-center text-sm md:block md:min-w-[200px]",variant:"outline",children:e.jsx("span",{className:"w-full text-center",children:n})})]})}const Ra=o.memo(va),Ta={DATE:/DATE|TIMESTAMP/i,BLOB:/^BLOB$/i,TEXT:/CHAR|TEXT|CLOB|VARCHAR/i,INTEGER:/INT/i,REAL:/REAL|FLOAT|DOUBLE|DECIMAL/i,NUMERIC:/NUMERIC/i,BOOLEAN:/BOOL/i},F=(t,s)=>Ta[s].test(t),lt=t=>F(t,"DATE"),Sa=t=>F(t,"BLOB"),Aa=t=>F(t,"TEXT"),La=t=>F(t,"INTEGER"),Da=t=>F(t,"REAL"),Ia=t=>F(t,"NUMERIC"),Fa=t=>F(t,"BOOLEAN"),ka=t=>La(t)||Da(t)||Ia(t),it=_t,ct=Wt,oe=o.forwardRef(({className:t,align:s="start",side:a="bottom",sideOffset:r=4,...n},l)=>e.jsx(Te,{ref:l,align:s,side:a,sideOffset:r,className:m("z-50 w-64 text-balance break-words rounded-md border p-4 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[side=bottom]:slide-in-from-top-1","data-[side=left]:slide-in-from-right-1","data-[side=right]:slide-in-from-left-1","data-[side=top]:slide-in-from-bottom-1","bg-gray-100 dark:bg-gray-700",t),...n}));oe.displayName=Te.displayName;const dt=o.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:m("w-full caption-bottom text-sm",t),...s})}));dt.displayName="Table";const mt=o.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:m("[&_tr]:border-b",t),...s}));mt.displayName="TableHeader";const ut=o.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:m("[&_tr:last-child]:border-0",t),...s}));ut.displayName="TableBody";const Oa=o.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:m("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Oa.displayName="TableFooter";const X=o.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:m("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));X.displayName="TableRow";const ft=o.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:m("h-12 min-w-[150px] px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ft.displayName="TableHead";const Ma=t=>{const s=new Uint8Array(t.match(/.{1,2}/g).map(r=>Number.parseInt(r,16))),a=new Blob([s],{type:"image/jpeg"});return URL.createObjectURL(a)},xt=o.memo(o.forwardRef(({className:t,children:s,dataType:a,...r},n)=>{const l=(a==null?void 0:a.toUpperCase())==="BLOB",i=o.useMemo(()=>typeof s=="string"&&s.length>40?`${s.slice(0,40)}...`:s,[s]);return e.jsx("td",{ref:n,className:m("max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r,children:e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsx("span",{className:"cursor-pointer hover:underline",children:l?e.jsx("span",{className:"italic opacity-40",children:"BLOB"}):i})}),e.jsx(oe,{side:"bottom",align:"start",children:e.jsxs("div",{className:"flex flex-col justify-center gap-1",children:[l&&typeof s=="string"?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:Ma(s),alt:"BLOB content",className:"flex max-h-40 flex-col items-center justify-center gap-2 rounded object-contain",onError:c=>{c.currentTarget.style.display="none"}}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Blob length: ",s.length]})]}):e.jsx("span",{className:"max-w-full break-words",children:s}),e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:a||"Unknown"})]})})]})})}));xt.displayName="TableCell";const Pa=o.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:m("mt-4 text-sm text-muted-foreground",t),...s}));Pa.displayName="TableCaption";function Ba({columnName:t}){const{appendToFilters:s,selectedTable:a,filtersNeedClear:r,setFiltersNeedClear:n}=h(),[l,i]=o.useState("");o.useEffect(()=>{i("")},[a]),o.useEffect(()=>{r&&(i(""),n(!1))},[r,n]);const c=o.useCallback(d=>{const u=d.target.value;i(u),s(t,u)},[s,t]);return e.jsx(re,{value:l,onChange:c,className:"mt-[2px] max-h-7 w-full text-xs",placeholder:"Filter"})}function qa({columnName:t}){const{orderBy:s,setOrderBy:a}=h(),r=o.useCallback(()=>{s.column===t?s.direction==="ASC"?a(t,"DESC"):s.direction==="DESC"&&a(null,"ASC"):a(t,"ASC")},[s,t,a]);return e.jsx("div",{onClick:r,onKeyUp:r,className:"flex items-center",children:s.column===t?s.direction==="ASC"?e.jsx("button",{title:"Descending",type:"button","aria-label":"Sort Descending",children:e.jsx(us,{className:"h-4 w-4"})}):e.jsx("button",{title:"Ascending",type:"button","aria-label":"Sort Ascending",children:e.jsx(fs,{className:"h-4 w-4"})}):e.jsx("button",{title:"Sort column",type:"button","aria-label":"Sort Column",children:e.jsx(xs,{className:"h-4 w-4"})})})}const Ua=o.memo(({columnSchema:t})=>e.jsxs(e.Fragment,{children:[(t==null?void 0:t.isPrimaryKey)&&e.jsx("p",{className:"text-sm font-semibold text-yellow-600",children:"(Primary)"}),(t==null?void 0:t.isForeignKey)&&e.jsx("p",{className:"text-sm font-semibold text-purple-600",children:"(Foreign)"})]})),$a=o.memo(({columnSchema:t})=>{const{type:s,isPrimaryKey:a,isForeignKey:r}=t;if(a)return e.jsx(ps,{className:"h-4 w-4 text-yellow-500"});if(r)return e.jsx(gs,{className:"h-4 w-4 text-purple-500"});if(s){if(Sa(s))return e.jsx(hs,{className:"h-4 w-4 text-green-500"});if(lt(s))return e.jsx(ke,{className:"h-4 w-4 text-blue-500"});if(Aa(s))return e.jsx(bs,{className:"h-4 w-4 text-indigo-500"});if(ka(s))return e.jsx(ys,{className:"h-4 w-4 text-red-500"});if(Fa(s))return e.jsx(Ns,{className:"h-4 w-4 text-pink-500"})}return e.jsx(js,{className:"h-4 w-4 text-gray-500"})}),Qa=o.memo(({columnName:t,columnSchema:s})=>e.jsxs(ft,{className:"bg-gray-100 py-2 dark:bg-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qa,{columnName:t}),e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1",children:[e.jsx("span",{className:"max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:t}),s&&e.jsx($a,{columnSchema:s})]})}),e.jsxs(oe,{className:"w-64",children:[e.jsxs("div",{className:"mb-1 flex items-center space-x-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),e.jsx(Ua,{columnSchema:s})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:(s==null?void 0:s.type)||"Unknown"}),(s==null?void 0:s.nullable)&&e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:"NULLABLE"})]})]})]})]}),e.jsx(Ba,{columnName:t})]})),za=o.memo(({value:t,dataType:s})=>{const{dateFormatValue:a}=h(),r=()=>t?s&<(s)&&Y[a]?Y[a].func(t):t:e.jsx("span",{className:"italic text-gray-400",children:"NULL"});return e.jsx(xt,{dataType:s,className:"px-5 py-[11px] text-sm",children:r()})});function Ha({data:t,columns:s,tableName:a,tableSchemas:r}){const{filters:n,setFiltersNeedClear:l,setFilters:i}=h(),c=o.useMemo(()=>e.jsx(mt,{children:e.jsx(X,{children:s.map((f,x)=>e.jsx(Qa,{columnName:f,columnSchema:r[a][f]},x))})}),[s,r,a]),d=o.useMemo(()=>e.jsx(ut,{children:t.map((f,x)=>e.jsx(X,{children:s.map((g,p)=>{var y;return e.jsx(za,{value:f[g],dataType:(y=r[a][g])==null?void 0:y.type},p)})},x))}),[t,s,r,a]),u=o.useCallback(()=>{l(!0),i({})},[l,i]);return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(dt,{children:[c,t.length>0&&d]}),t.length===0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full p-4 text-center font-medium",children:["No data available for ",a]}),Object.keys(n).length>0&&e.jsx(b,{className:"w-full rounded-none",variant:"outline",onClick:u,children:"Clear filters"})]})]})}function Va(){const[t,s]=o.useState(()=>document.body.classList.contains("dark"));return o.useEffect(()=>{const a=new MutationObserver(()=>{s(document.body.classList.contains("dark"))});return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),t}const Ga=["ABORT","ACTION","ADD","AFTER","ALL","ALTER","ANALYZE","AND","AS","ASC","ATTACH","AUTOINCREMENT","BEFORE","BEGIN","BETWEEN","BY","CASCADE","CASE","CAST","CHECK","COLLATE","COLUMN","COMMIT","CONFLICT","CONSTRAINT","CREATE","CROSS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATABASE","DEFAULT","DEFERRABLE","DEFERRED","DELETE","DESC","DETACH","DISTINCT","DROP","EACH","ELSE","END","ESCAPE","EXCEPT","EXCLUSIVE","EXISTS","EXPLAIN","FAIL","FOR","FOREIGN","FROM","FULL","GLOB","GROUP","HAVING","IF","IGNORE","IMMEDIATE","IN","INDEX","INDEXED","INITIALLY","INNER","INSERT","INSTEAD","INTERSECT","INTO","IS","ISNULL","JOIN","KEY","LEFT","LIKE","LIMIT","MATCH","NATURAL","NO","NOT","NOTNULL","NULL","OF","OFFSET","ON","OR","ORDER","OUTER","PLAN","PRAGMA","PRIMARY","QUERY","RAISE","RECURSIVE","REFERENCES","REGEXP","REINDEX","RELEASE","RENAME","REPLACE","RESTRICT","RIGHT","ROLLBACK","ROW","SAVEPOINT","SELECT","SET","TABLE","TEMP","TEMPORARY","THEN","TO","TRANSACTION","TRIGGER","UNION","UNIQUE","UPDATE","USING","VACUUM","VALUES","VIEW","VIRTUAL","WHEN","WHERE","WITH","WITHOUT"];function _a({columnNames:t}){const{customQuery:s,setCustomQuery:a,tables:r}=h(),n=Va(),l=o.useCallback(d=>{const u=d.matchBefore(/\w*/);if(!u||u.from===u.to&&!d.explicit)return null;const f=[...Ga.map(x=>({label:x,type:"keyword"})),...r.map(x=>({label:x.name,type:"table"})),...t.map(x=>({label:x,type:"column"}))];return{from:u.from,to:u.to,options:f}},[r,t]),i=o.useCallback(d=>{a(d)},[a]),c=o.useMemo(()=>[Os,Ms(),Ps({override:[l]})],[l]);return e.jsx(Bs,{value:s,height:"126px",extensions:c,onChange:i,className:"rounded-md border",theme:n?qs:"light"})}const Wa=o.memo(Ra),Ka=o.memo(aa);function Ya(){const{tables:t,selectedTable:s,tableSchemas:a,queryError:r,setQueryError:n,rowPerPageOrAuto:l,isCustomQuery:i,customQuery:c,setIsCustomQuery:d,setCustomQuery:u,expandPage:f,setExpandPage:x,filters:g,setFilters:p,databaseData:y}=h(),{page:N,setPage:w,rowsPerPage:C}=Js(l),S=o.useMemo(()=>{var k;return(k=t[Number.parseInt(s)])==null?void 0:k.name},[t,s]),{data:D,columns:E,isQueryLoading:A,handleCustomQuery:P}=Xs(S,C,N),[v,H]=o.useState([]);o.useEffect(()=>{E.length>0&&H(E)},[E]);const j=o.useCallback(()=>{n(null),u(""),d(!1)},[d,n,u]),R=o.useCallback(()=>{function k(U){try{return Lt(U,{language:"sqlite",useTabs:!1,keywordCase:"upper",tabWidth:2,expressionWidth:100,linesBetweenQueries:1})}catch{return U}}const ne=k(c);u(ne)},[c,u]);o.useEffect(()=>{w(0),p({})},[s]),o.useEffect(()=>{w(0)},[g]);const B=o.useMemo(()=>e.jsx(Zs,{type:"single",collapsible:!0,className:"w-full rounded-lg bg-background px-3",children:e.jsxs(qe,{value:"item-1",children:[e.jsx(Ue,{className:"text-xs",children:"Execute Query"}),e.jsxs($e,{className:"flex flex-col gap-[6px]",children:[e.jsx("div",{className:"flex-grow",children:e.jsx(_a,{columnNames:v})}),e.jsxs("div",{className:"flex flex-row gap-1 md:gap-2",children:[e.jsx(b,{className:"grow",variant:"secondary",onClick:P,title:"Run custom query",children:e.jsx(ws,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:j,title:"Remove query",children:e.jsx(Cs,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:R,title:"Format SQL",children:e.jsx(Oe,{className:"h-5 w-5"})})]})]})]})}),[P,j,R,N,v]),q=o.useMemo(()=>A?e.jsxs(K,{type:"loading",children:["Loading ",S]}):e.jsx("div",{className:"mb-[40px] overflow-hidden rounded-lg border border-gray-200 dark:border dark:border-gray-700",children:e.jsx(Ha,{data:D,columns:v.length>0?v:E,tableName:S,tableSchemas:a})}),[A,D,E,S,a,v]),V=o.useMemo(()=>e.jsx(Ka,{}),[]);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 pb-8",children:[e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[y.name,", (",y.sizeAsString,")"]}),e.jsxs("section",{className:"rounded-lg bg-gray-100 p-4 shadow-sm dark:bg-gray-700",children:[e.jsxs("div",{className:"mb-[5px] flex items-center justify-between gap-[6px] pb-[3px]",children:[e.jsx(Wa,{}),e.jsxs("div",{className:"g-1 flex items-center justify-center gap-1",children:[V,e.jsx(b,{className:"hidden expand:block",onClick:()=>x(!f),title:"Toggle page size",children:f?e.jsx(Es,{className:"h-5 w-5"}):e.jsx(vs,{className:"h-5 w-5"})}),e.jsx(et,{}),e.jsx(xa,{})]})]}),B,r&&e.jsx("p",{className:"mt-2 text-center text-sm text-red-500 dark:text-red-400",children:r})]}),q,!i&&e.jsx(ba,{page:N,setPage:w,rowsPerPage:C})]})})}const Xa=o.memo(Ya),Ja={"application/vnd.sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/x-sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/octet-stream":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sql":[".sql"],"application/x-sql":[".sql"],"text/x-sql":[".sql"],"text/sql":[".sql"],"text/x-sqlite3":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite3-dump":[".sql"],"text/x-sqlite-dump":[".sql"],"text/sqlite-dump":[".sql"]};function Za(){const{loadDatabaseBytes:t,setDatabaseData:s}=h(),[a,r]=o.useState([]),n=o.useCallback(async(u,f)=>{if(f.length>0){const x=f.flatMap(g=>g.errors);r(x);return}if(u.length>0)try{const x=u[0],g=new Uint8Array(await x.arrayBuffer());s({name:x.name,size:x.size}),await t(g)}catch(x){return x instanceof Error?L(x.message,{position:"bottom-right"}):L("Failed to load database",{position:"bottom-right"})}},[t,s]),{getRootProps:l,getInputProps:i,isDragActive:c}=Us({onDrop:n,multiple:!1,accept:Ja}),d=o.useMemo(()=>e.jsx("div",{className:"flex w-full items-center justify-between gap-2",children:e.jsxs("div",{...l(),className:`flex w-full grow transform cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed bg-gray-100/50 p-6 transition-colors duration-300 ease-in-out hover:bg-secondary dark:bg-gray-700/50 ${c?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-primary py-12 dark:border-gray-700"}`,children:[e.jsx("input",{id:"file-upload",...i()}),e.jsx("label",{htmlFor:"file-upload",className:"sr-only",children:"Upload SQLite File"}),e.jsxs("div",{className:"text-center text-sm md:text-base",children:[e.jsx("span",{className:"hidden sm:block lg:text-lg",children:"Drag and drop file here, or click to select one"}),e.jsx("div",{className:"block sm:hidden",children:e.jsx("span",{className:"text-lg font-medium",children:"Click to select a SQLite file"})})]})]})}),[l,i,c]);return e.jsxs("section",{className:"mx-auto w-full",children:[d,e.jsx(er,{errors:a})]})}const er=o.memo(({errors:t})=>(o.useEffect(()=>{if(t)for(const s of t)L(s.message,{position:"bottom-right"})},[t]),null));function tr(){return e.jsx("header",{className:"rounded bg-gradient-to-r shadow-md dark:from-gray-800 dark:to-indigo-900",children:e.jsx("div",{className:"mx-auto max-w-4xl px-4 py-8 sm:py-12",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold sm:text-3xl",children:"SQLite Viewer"}),e.jsx("p",{className:"max-w-md text-sm sm:text-base",children:"Explore and analyze your SQLite databases directly in your browser"})]})})})}function sr(){return e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"rounded bg-gradient-to-r py-6 shadow-md dark:from-gray-800 dark:to-indigo-900 md:py-10",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsx("div",{children:e.jsxs("div",{className:"grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(M,{icon:Rs,title:"Browser Based",description:"No installation required. Access and analyze your SQLite databases directly in your web browser."}),e.jsx(M,{icon:Ts,title:"Lightning Fast",description:"Powered by WebAssembly (WASM) for near-native performance, even with large databases."}),e.jsx(M,{icon:Ss,title:"100% Secure",description:"Your data never leaves your device. All processing happens client-side, ensuring complete privacy."}),e.jsx(M,{icon:Me,title:"Customizable Interface",description:"Different themes and settings. Adjust the look and feel of your interface to suit your preferences and workflow."}),e.jsx(M,{icon:As,title:"Offline Capable",description:"Work on your databases without an internet connection. Perfect for sensitive data or remote work."}),e.jsx(M,{icon:Ls,title:"PWA Support",description:"Install the app on your desktop or mobile device for a genuine native experience. Enjoy robust offline functionality."})]})})})}),e.jsx("div",{className:"pb-[72px] md:pb-0"})]})}function M({icon:t,title:s,description:a}){return e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(t,{className:"h-6 w-6 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"mt-1 text-sm",children:a})]})]})}const ar=Kt,rr=Yt,pt=o.forwardRef(({className:t,...s},a)=>e.jsx(Se,{className:m("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));pt.displayName=Se.displayName;const gt=o.forwardRef(({className:t,...s},a)=>e.jsxs(rr,{children:[e.jsx(pt,{}),e.jsx(Ae,{ref:a,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));gt.displayName=Ae.displayName;const ht=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col space-y-2",t),...s});ht.displayName="AlertDialogHeader";const bt=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});bt.displayName="AlertDialogFooter";const yt=o.forwardRef(({className:t,...s},a)=>e.jsx(Le,{ref:a,className:m("text-lg font-semibold",t),...s}));yt.displayName=Le.displayName;const Nt=o.forwardRef(({className:t,...s},a)=>e.jsx(De,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Nt.displayName=De.displayName;const jt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ie,{ref:a,className:m(se(),t),...s}));jt.displayName=Ie.displayName;const wt=o.forwardRef(({className:t,...s},a)=>e.jsx(Fe,{ref:a,className:m(se({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));wt.displayName=Fe.displayName;const or=o.memo(gt);function nr({showDialog:t,setShowDialog:s,onConfirm:a}){const r=o.useCallback(()=>{s(!1)},[s]);return e.jsx(ar,{open:t,onOpenChange:s,children:e.jsxs(or,{children:[e.jsxs(ht,{children:[e.jsx(yt,{children:"Use Proxy to Load Database?"}),e.jsx(Nt,{children:"We couldn't load the database from the provided URL due to CORS restrictions. Would you like to try using a proxy?"})]}),e.jsx("div",{className:"font-semibold text-yellow-600 md:text-left",children:"Warning: Using the proxy will route your database traffic through cors.eu.org."}),e.jsxs(bt,{children:[e.jsx(wt,{onClick:r,children:"Cancel"}),e.jsx(jt,{onClick:a,children:"Use Proxy"})]})]})})}const lr=/^(https?:\/\/(?:www\.)?[a-zA-Z0-9-]{1,256}\.[a-zA-Z]{2,6}(?:\/[^\s]*)?)$/i,ir="https://cors.eu.org";function cr(){const{db:t,isLoading:s,loadDatabaseBytes:a,setDatabaseData:r}=h(),[n,l]=o.useState(null),[i,c]=o.useState(!1),[d,u]=o.useState(null),[f,x]=o.useState(!1),g=o.useRef(!1),p=o.useCallback(async(N,w=!1)=>{if(!lr.test(N)){l("Invalid URL");return}try{x(!0);const C=w?`${ir}/${encodeURIComponent(N)}`:N,S=await fetch(C);if(!S.ok)throw new Error("URL not found or invalid");const D=await S.blob(),E=new File([D],"database.sqlite"),A=new Uint8Array(await E.arrayBuffer());r({name:E.name,size:E.size}),await a(A),l(null)}catch(C){w?l(`Error while fetching, ${C instanceof Error?C.message:String(C)}`):(u(N),c(!0))}finally{x(!1)}},[a,r]);o.useEffect(()=>{if(g.current)return;const w=new URLSearchParams(window.location.search).get("url");w&&(p(decodeURIComponent(w)),g.current=!0)},[p]);const y=o.useCallback(()=>{d&&(p(d,!0),c(!1))},[d,p]);return s||f?e.jsxs(K,{type:"loading",children:[f?"Fetching":"Loading"," SQLite file"]}):n&&!t?e.jsx(K,{type:"error",children:n}):e.jsx(e.Fragment,{children:i&&e.jsx(nr,{showDialog:i,setShowDialog:c,onConfirm:y},"proxy-message")})}function dr(){return e.jsx("footer",{className:"fixed bottom-0 left-0 right-0 border-t bg-background shadow-md",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between py-4 md:py-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sms hidden sm:block",children:"No file will be uploaded to server. Using JavaScript, sql.js"}),e.jsx("p",{className:"text-sm sm:hidden",children:"No file uploads to server."})]}),e.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-2 text-blue-500",title:"Star on GitHub",children:[e.jsx(Ds,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium hover:underline",children:"Star us on GitHub"})]})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx(et,{})})]})})})}const mr=o.memo(Xa),ur=o.memo(Za),fr=o.memo(cr);function xr(){const{db:t,expandPage:s}=h();return e.jsxs("main",{className:`mx-auto flex h-screen flex-col ${t?"gap-3":"gap-4"} p-4 ${s?"w-full":"container"}`,children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(tr,{})," ",e.jsx(ur,{})," ",e.jsx(fr,{}),e.jsx(sr,{}),e.jsx(dr,{})]}),t&&e.jsx(mr,{isDatabaseLoaded:t})]})}const pr=({...t})=>e.jsx(Is,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-gray-100 p-2 dark:group-[.toaster]:bg-gray-700 text-lg p-4 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t});Tt.createRoot(document.getElementById("root")).render(e.jsxs(Rt.StrictMode,{children:[e.jsx(xr,{}),e.jsx(pr,{})]})); diff --git a/assets/index-CCxazG49.js.gz b/assets/index-CCxazG49.js.gz new file mode 100644 index 0000000..483be27 Binary files /dev/null and b/assets/index-CCxazG49.js.gz differ diff --git a/assets/index-Dhbsy5TC.js b/assets/index-Dhbsy5TC.js deleted file mode 100644 index f661717..0000000 --- a/assets/index-Dhbsy5TC.js +++ /dev/null @@ -1,7 +0,0 @@ -import{r as o,j as e,R as T}from"./react-DmpIMwDM.js";import{c as Rt}from"./react-dom-Cjr6YfK8.js";import{c as Tt}from"./zustand-BpWCCnYR.js";import{i as St}from"./sql.js-Ch_tM77n.js";import{F as ue}from"./file-saver-DhbZvGod.js";import{f as At}from"./sql-formatter-BoZ82dp4.js";import{I as Lt,H as It,c as fe,d as xe,e as Dt,S as Ft,f as kt,g as pe,h as Ot,i as Mt,j as ge,k as he,l as be,m as Pt,n as ye,o as Bt,p as Ne,q as je,r as qt,s as we,V as Ut,L as Ce,t as Ee,u as Qt,v as $t,w as ve,x as Ht,G as zt,y as Vt,z as Re,A as Gt,B as _t,E as Te,F as Se,J as Ae,K as Le,M as Ie,N as De,Q as Wt,U as Kt}from"./@radix-ui-BQVY8FyZ.js";import{c as Yt}from"./clsx-B-dksMZM.js";import{t as Xt}from"./tailwind-merge-BkWO730n.js";import{C as Z,L as Jt,I as Zt,a as es,T as ts,F as ss,b as as,R as rs,c as Fe,P as ke,S as Oe,d as os,M as ns,e as ls,f as is,g as cs,h as ds,A as ms,i as us,j as fs,K as xs,k as ps,l as gs,m as hs,H as bs,n as ys,o as Ns,p as js,q as ws,r as Cs,s as Es,G as vs,Z as Rs,t as Ts,u as Ss,v as As,w as Ls}from"./lucide-react-S8ZAjIB-.js";import{c as ee}from"./class-variance-authority-Bb4qSo10.js";import{J as A,T as Is}from"./sonner-CxG_nbEz.js";import{D as w}from"./vaul-OrZLygqJ.js";import{p as Me,i as Pe,f as Ds,a as Fs}from"./date-fns-BAPXOope.js";import{G as ks,I as Os,t as Ms}from"./@codemirror-SM3v-hs2.js";import{R as Ps,n as Bs}from"./@uiw-Cmr0UBwL.js";import{u as qs}from"./react-dropzone-D-IBOhIS.js";import"./attr-accept-BWI1aNlo.js";import"./scheduler-CzFDRTuY.js";import"./use-sync-external-store-ByYeed7R.js";import"./nearley-CG12bGQB.js";import"./aria-hidden-DQ5UC2Eg.js";import"./react-remove-scroll-BOyN_WUU.js";import"./tslib-CuZy2iRz.js";import"./react-remove-scroll-bar-DZjhPxUV.js";import"./react-style-singleton-CpxBwIWS.js";import"./get-nonce-C-Z93AgS.js";import"./use-sidecar-D8_hMcUG.js";import"./use-callback-ref-DRzK4jWO.js";import"./@floating-ui-Bob4LHZu.js";import"./@lezer-C0_A0N7l.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";import"./@babel-BjXSgPXB.js";import"./prop-types-psm7UO16.js";import"./file-selector-CBHVlu32.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=a(n);fetch(n.href,l)}})();const Us="/sql.wasm";let _;const Qs=async()=>(_||(_=await St({locateFile:()=>Us})),_),$s=async t=>{try{const s=await Qs();return new s.Database(t)}catch(s){throw console.error("Failed to load database:",s),s}},te=t=>{try{const s=t.prepare("SELECT name FROM sqlite_master WHERE type='table';"),a=[];for(;s.step();)a.push(s.get()[0]);return s.free(),a}catch{throw new Error("Invalid database file")}},Hs=(t,s)=>{try{const a={},r=t.prepare(`PRAGMA table_info("${s}");`);for(;r.step();){const l=r.getAsObject();a[l.name]={type:l.type?l.type.toUpperCase():l.type,isPrimaryKey:l.pk===1,isForeignKey:!1,nullable:l.notnull===0}}r.free();const n=t.prepare(`PRAGMA foreign_key_list("${s}");`);for(;n.step();){const l=n.getAsObject();a[l.from]&&(a[l.from].isForeignKey=!0)}return n.free(),a}catch(a){throw console.error(`Failed to get schema for table "${s}":`,a),a}},le=t=>{if(t.length===0)return{data:[],columns:[]};const{columns:s,values:a}=t[0];return{data:a.map(n=>Object.fromEntries(s.map((l,i)=>[l,n[i]]))),columns:s}},zs=t=>{try{const s=t.export(),a=new Blob([s],{type:"application/x-sqlite3"});ue.saveAs(a,"database.sqlite")}catch(s){throw console.error("Failed to export database:",s),s}},Vs=(t,s)=>{const a=t.map(n=>`"${n}"`).join(","),r=s.map(n=>t.map(l=>`"${n[l]??""}"`).join(","));return[a,...r].join(` -`)},se=(t,s,a)=>{try{const r=s.prepare(t),n=r.getColumnNames(),l=[];for(;r.step();){const c=r.getAsObject();l.push(c)}if(r.free(),l.length===0)throw new Error(`Query "${t}" returned no results.`);const i=Vs(n,l),d=new Blob([i],{type:"text/csv;charset=utf-8;"});ue.saveAs(d,`${a}.csv`)}catch(r){throw console.error(`Failed to get CSV for query "${t}":`,r),r}},Gs=(t,s)=>{const r=te(t)[s],n=`SELECT * FROM "${r}"`;se(n,t,r)},_s=t=>{const s=te(t);for(const a of s)try{const r=`SELECT * FROM "${a}"`;se(r,t,a)}catch(r){throw console.error(`Failed to get CSV for table "${a}":`,r),r}},Ws=(t,s)=>{se(s,t,"custom_query")},h=Tt((t,s)=>({db:null,isLoading:!1,loadDatabaseBytes:async a=>{t({isLoading:!0});try{const r=await $s(a),n=te(r),l=await Promise.all(n.map(async c=>{const u=r.exec(`SELECT COUNT(*) FROM "${c}"`),f=Number.parseInt(u[0].values[0][0],10),p=await Hs(r,c);return{name:c,count:f,schema:p}})),i=l.map(({name:c,count:u})=>({name:c,count:u})),d=l.reduce((c,{name:u,schema:f})=>(c[u]=f,c),{});t({db:r,tables:i,tableSchemas:d,isLoading:!1})}catch(r){throw t({isLoading:!1}),r}},tables:[],setTables:a=>t({tables:a}),selectedTable:"0",setSelectedTable:a=>t({selectedTable:a}),tableSchemas:{},customQuery:"",setIsCustomQuery:a=>t({isCustomQuery:a}),setCustomQuery:a=>t({customQuery:a}),isCustomQuery:!1,queryError:null,setQueryError:a=>t({queryError:a}),query:a=>{const{db:r}=s();return r?r.exec(a):(console.warn("Database is not loaded."),[])},rowPerPageOrAuto:"auto",setRowPerPageOrAuto:a=>t({rowPerPageOrAuto:a}),queryHistory:[],unShiftToQueryHistory:a=>t(r=>({queryHistory:[a,...r.queryHistory]})),expandPage:!1,setExpandPage:a=>t({expandPage:a}),dateFormatValue:"formatDateFormatted",setDateFormatValue:a=>t({dateFormatValue:a}),filters:{},setFilters:a=>t({filters:a}),appendToFilters:(a,r)=>t(n=>({filters:{...n.filters,[a]:r}})),filtersNeedClear:!1,setFiltersNeedClear:a=>t({filtersNeedClear:a}),totalRows:0,setTotalRows:a=>t({totalRows:a}),orderBy:{column:null,direction:"ASC"},setOrderBy:(a,r)=>t({orderBy:{column:a,direction:r}})}));function Ks(t,s,a){const{db:r,setQueryError:n,setIsCustomQuery:l,query:i,unShiftToQueryHistory:d,customQuery:c,setCustomQuery:u,filters:f,totalRows:p,setTotalRows:x,orderBy:y,selectedTable:g,tables:N}=h(),[C,E]=o.useState([]),[k,v]=o.useState([]),[O,L]=o.useState(!0),S=o.useMemo(()=>Object.fromEntries(Object.entries(f).filter(([,j])=>j!=="")),[f]),I=o.useMemo(()=>Object.entries(S).map(([j,R])=>`LOWER(${j}) LIKE LOWER('%${R}%')`).join(" AND "),[S]);o.useEffect(()=>{if(!r||!t)return;(async()=>{L(!0);try{const R=`PRAGMA table_info("${t}");`,M=i(R)[0].values.map(D=>({name:D[1],type:D[2]})).map(D=>D.type.toUpperCase()==="BLOB"?`hex(${D.name}) as ${D.name}`:D.name).join(", "),V=`SELECT COUNT(*) as count FROM "${t}"${I?` WHERE ${I}`:""}`,wt=i(V)[0].values[0][0];x(wt);let P=`SELECT - ${M} -FROM "${t}"`;I&&(P+=` -WHERE ${I}`),y.column&&(P+=` -ORDER BY "${y.column}" ${y.direction}`),P+=` -LIMIT ${s} OFFSET ${a};`;const Ct=i(P),{data:Et,columns:vt}=le(Ct);v(vt),E(Et),n(null),u(P),d(P)}catch(R){R instanceof Error&&n(R.message)}finally{L(!1)}})()},[r,t,a,s,I,y,i,n,u,d,x]);const q=o.useCallback(()=>{if(c.trim()===""){n(null);return}L(!0);try{const j=N[Number.parseInt(g)].name,R=i(c.replace("@",`"${j}"`)),{data:U,columns:Q}=le(R);v(Q),E(U),l(!0),n(null)}catch(j){j instanceof Error&&n(j.message)}finally{L(!1)}},[c,i,n,l,N,g]);return{data:C,columns:k,customQuery:c,setCustomQuery:u,isQueryLoading:O,handleCustomQuery:q,totalRows:p}}function Ys(t){const{setIsCustomQuery:s}=h(),[a,r]=o.useState(0);o.useEffect(()=>{r(0),s(!1)},[s]);const n=o.useMemo(()=>{if(t!=="auto")return t;const l=window.innerHeight,u=Math.min(2e3,40+l*.03),f=Math.max(1,Math.floor(l/u));return Math.min(Math.max(f,5),50)},[t]);return{page:a,setPage:r,rowsPerPage:n}}function m(...t){return Xt(Yt(t))}const Xs=Dt,Be=o.forwardRef(({className:t,...s},a)=>e.jsx(Lt,{ref:a,className:m("border-b",t),...s}));Be.displayName="AccordionItem";const qe=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(It,{className:"flex",children:e.jsxs(fe,{ref:r,className:m("flex flex-1 items-center justify-between py-3 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));qe.displayName=fe.displayName;const Ue=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(xe,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:m("pb-4 pt-0",t),children:s})}));Ue.displayName=xe.displayName;const ae=ee("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),b=o.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},l)=>{const i=r?Ft:"button";return e.jsx(i,{className:m(ae({variant:s,size:a,className:t})),ref:l,...n})});b.displayName="Button";const Js=o.memo(Jt);function Y({type:t,children:s,className:a=""}){let r,n;switch(t){case"error":r=e.jsx(ts,{className:"mr-3 h-6 w-6 text-red-500"}),n="bg-red-100 text-red-800 border-l-4 border-red-500";break;case"loading":{r=e.jsx(Js,{className:"mr-3 h-6 w-6 animate-spin text-blue-500"}),n="bg-blue-100 text-blue-800 border-l-4 border-blue-500";break}case"success":r=e.jsx(es,{className:"mr-3 h-6 w-6 text-green-500"}),n="bg-green-100 text-green-800 border-l-4 border-green-500";break;case"info":r=e.jsx(Zt,{className:"mr-3 h-6 w-6 text-yellow-500"}),n="bg-yellow-100 text-yellow-800 border-l-4 border-yellow-500";break;default:r=null,n=""}return e.jsxs("div",{className:`flex items-center rounded-lg p-4 shadow-md ${n} ${a}`,children:[r,e.jsx("span",{className:"font-medium",children:s})]})}const Zs=Ot,ea=Mt,Qe=o.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(kt,{children:e.jsx(pe,{ref:n,align:s,sideOffset:a,className:m("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Qe.displayName=pe.displayName;function ta(){const{selectedTable:t,customQuery:s,db:a}=h(),r=o.useMemo(()=>a&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx($,{onClick:()=>{try{zs(a)}catch{A.error("Failed to download database")}},label:"Export as SQLite",title:"Download database as SQLite"}),e.jsx($,{onClick:()=>{try{Gs(a,Number.parseInt(t))}catch{A.error("Failed to export selected table as CSV")}},label:"Export selected table as CSV"}),e.jsx($,{onClick:()=>{try{_s(a)}catch{A.error("Failed to export all tables as CSV")}},label:"Export all tables as CSV"}),e.jsx($,{onClick:()=>{try{Ws(a,s)}catch{A.error("Failed to export custom query as CSV")}},label:"Export custom query as CSV",title:"Export the result of the custom query as CSV"})]}),[a,t,s]);return e.jsxs(Zs,{children:[e.jsx(ea,{asChild:!0,children:e.jsx(b,{title:"Open export options",children:e.jsx(ss,{className:"h-5 w-5"})})}),e.jsx(Qe,{align:"end",className:"w-80",children:r})]})}function $({onClick:t,label:s,className:a,title:r}){return e.jsx(b,{className:a,onClick:t,title:r??s,children:e.jsx("span",{className:"ml-2",children:s})})}const $e=(t,s)=>localStorage.getItem(t)||s,He=(t,s)=>localStorage.setItem(t,s),ie=(t,s)=>{const[a,r]=o.useState(()=>$e(t,s));return o.useEffect(()=>{He(t,a)},[t,a]),[a,r]},ze=({shouldScaleBackground:t=!0,...s})=>e.jsx(w.Root,{shouldScaleBackground:t,...s});ze.displayName="Drawer";const sa=w.Trigger,aa=w.Portal,ra=w.Close,Ve=o.forwardRef(({className:t,...s},a)=>e.jsx(w.Overlay,{ref:a,className:m("fixed inset-0 z-50 bg-black/80",t),...s}));Ve.displayName=w.Overlay.displayName;const Ge=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(aa,{children:[e.jsx(Ve,{}),e.jsxs(w.Content,{ref:r,className:m("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",t),...a,children:[e.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),s]})]}));Ge.displayName="DrawerContent";const _e=({className:t,...s})=>e.jsx("div",{className:m("grid gap-1.5 p-4 text-center sm:text-left",t),...s});_e.displayName="DrawerHeader";const We=({className:t,...s})=>e.jsx("div",{className:m("mt-auto flex flex-col gap-2 pb-4",t),...s});We.displayName="DrawerFooter";const Ke=o.forwardRef(({className:t,...s},a)=>e.jsx(w.Title,{ref:a,className:m("text-lg font-semibold leading-none tracking-tight",t),...s}));Ke.displayName=w.Title.displayName;const Ye=o.forwardRef(({className:t,...s},a)=>e.jsx(w.Description,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Ye.displayName=w.Description.displayName;const W=t=>s=>{const a=Me(s);return Pe(a)?Ds(a,t):s},oa=t=>{const s=Me(t);return Pe(s)?Fs(s,{addSuffix:!0}):t},X={formatDateRelative:{label:"Over 56 years ago",func:oa},formatDateFormatted:{label:"January 9th, 1968",func:W("MMMM do, yyyy")},formatDateLong:{label:"1968/09/01",func:W("yyyy/MM/dd")},formatDateShort:{label:"01/09/1968",func:W("MM/dd/yyyy")}},na=ee("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xe=o.forwardRef(({className:t,...s},a)=>e.jsx(ge,{ref:a,className:m(na(),t),...s}));Xe.displayName=ge.displayName;const re=o.forwardRef(({className:t,...s},a)=>e.jsx(he,{className:m("grid gap-2",t),...s,ref:a}));re.displayName=he.displayName;const Je=o.forwardRef(({className:t,...s},a)=>e.jsx(be,{ref:a,className:m("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Pt,{className:"flex items-center justify-center",children:e.jsx(as,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Je.displayName=be.displayName;const oe=o.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:m("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a}));oe.displayName="Input";const H=({value:t,label:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Je,{value:t,id:`r-${t}`}),e.jsx(Xe,{htmlFor:`r-${t}`,children:s})]}),la=({rowsPerPage:t,onRowsPerPageChange:s})=>{const a=t==="auto";return e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(rs,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Rows Per Page"})]}),e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:[e.jsx(oe,{id:"rowsPerPage",value:a?"":t,onChange:r=>s(r.target.value),placeholder:"Number of rows",type:"number",className:"w-full",autoFocus:!1}),e.jsx(b,{variant:"outline",onClick:()=>s("auto"),className:"w-full whitespace-nowrap",children:"Auto Calculate"})]})]})},ia=({dateFormatValue:t,onDateFormatChange:s})=>e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fe,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Date Format"})]}),e.jsx("div",{className:"h-full rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:e.jsxs(re,{className:"flex h-full flex-col gap-2",name:"dateType",value:t,onValueChange:s,children:[e.jsx(H,{value:"default",label:"Default"}),Object.entries(X).map(([a,{label:r}])=>e.jsx(H,{value:a,label:r},a))]})})]}),ca=({themeColor:t,onThemeColorChange:s,themeColors:a})=>e.jsxs("div",{className:"flex grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Theme Color"})]}),e.jsxs(re,{className:"flex flex-col gap-2 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",name:"themeColor",value:t,onValueChange:s,children:[e.jsx(H,{value:"default",label:"Default"}),a.map(r=>e.jsx(H,{value:r,label:r[0].toUpperCase()+r.slice(1)},r))]})]}),da="rowsPerPage",ce="dateFormat",ma="theme-color",de=["nord","zinc"];function ua(){const{setRowPerPageOrAuto:t,setIsCustomQuery:s,dateFormatValue:a,setDateFormatValue:r}=h(),[n,l]=ie(da,"auto"),[i,d]=ie(ma,"default"),c=n==="auto";o.useEffect(()=>{t(c?"auto":Number(n))},[n,t,c]),o.useEffect(()=>{r($e(ce,"default"))},[r]),o.useEffect(()=>{var x;for(const y of de)(x=document.body)==null||x.classList.toggle(y,y===i)},[i]);const u=o.useCallback(x=>{s(!1),x==="auto"||Number(x)>0?l(x):A.error("Please provide a positive number of rows per page or set it to auto.")},[s,l]),f=o.useCallback(x=>{r(x),He(ce,x)},[r]),p=o.useCallback(x=>{d(x)},[d]);return e.jsxs(ze,{children:[e.jsx(sa,{asChild:!0,children:e.jsx(b,{className:"grow",title:"Open settings drawer",children:e.jsx(Oe,{className:"h-5 w-5"})})}),e.jsxs(Ge,{children:[e.jsxs(_e,{className:"hidden",children:[e.jsx(Ke,{children:"Settings"}),e.jsx(Ye,{children:"Change settings."})]}),e.jsxs("div",{className:"mx-auto flex w-full max-w-sm flex-col gap-3",children:[e.jsx(la,{rowsPerPage:n,onRowsPerPageChange:u}),e.jsx(ca,{themeColor:i,onThemeColorChange:p,themeColors:de}),e.jsx(ia,{dateFormatValue:a,onDateFormatChange:f}),e.jsx(We,{children:e.jsx(ra,{asChild:!0,children:e.jsx(b,{variant:"outline",children:"Cancel"})})})]})]})]},"settings-drawer")}const K="theme-mode",me="animate-circular-reveal";function Ze(){const[t,s]=o.useState(()=>{const l=localStorage.getItem(K),i=window.matchMedia("(prefers-color-scheme: dark)").matches;return l||(i?"dark":"light")}),a=o.useCallback(l=>{s(l),document.body.classList.remove("light","dark"),document.body.classList.add(l),localStorage.setItem(K,l),document.body.classList.add(me),setTimeout(()=>{document.body.classList.remove(me)},500)},[]);o.useEffect(()=>{const l=d=>{localStorage.getItem(K)||a(d.matches?"dark":"light")},i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",l),a(t),()=>{i.removeEventListener("change",l)}},[a,t]);const r=o.useCallback(()=>{a(t==="light"?"dark":"light")},[t,a]);return o.useMemo(()=>e.jsx(b,{className:"relative grow",onClick:r,title:t==="dark"?"Enable light mode":"Enable dark mode",children:t==="dark"?e.jsx(os,{className:"h-5 w-5"}):e.jsx(ns,{className:"h-5 w-5"})}),[t,r])}const fa=T.memo(ls),xa=T.memo(is);function pa({page:t,setPage:s,rowsPerPage:a}){const{totalRows:r}=h(),n=o.useMemo(()=>Math.ceil(r/a),[r,a]),l=o.useMemo(()=>Math.ceil(t/a)+1,[t,a]),i=l1,c=o.useCallback(()=>{i&&s(f=>f+a)},[i,a,s]),u=o.useCallback(()=>{d&&s(f=>f-a)},[d,a,s]);return e.jsx("section",{className:"fixed bottom-2 left-1/2 z-10 w-[270px] -translate-x-1/2 transform",children:e.jsxs("div",{className:"flex justify-between gap-2 rounded border bg-secondary p-[6px]",children:[e.jsx(b,{onClick:u,title:"Previous page",disabled:!d,children:e.jsx(fa,{className:"h-4 w-4"})}),e.jsxs("span",{className:"flex items-center justify-center text-sm",children:["Page ",l," of ",n]}),e.jsx(b,{onClick:c,title:"Next page",disabled:!i,children:e.jsx(xa,{className:"h-4 w-4"})})]})})}const ga=Ht,ha=zt,ba=Vt,ya=o.memo(Z),et=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ye,{ref:r,className:m("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(Bt,{asChild:!0,children:e.jsx(ya,{className:"h-4 w-4 opacity-50"})})]}));et.displayName=ye.displayName;const tt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ne,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(cs,{className:"h-4 w-4"})}));tt.displayName=Ne.displayName;const st=o.forwardRef(({className:t,...s},a)=>e.jsx(je,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Z,{className:"h-4 w-4"})}));st.displayName=je.displayName;const at=o.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(qt,{children:e.jsxs(we,{ref:n,className:m("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(tt,{}),e.jsx(Ut,{className:m("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(st,{})]})}));at.displayName=we.displayName;const rt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ce,{ref:a,className:m("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));rt.displayName=Ce.displayName;const ot=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ee,{ref:r,className:m("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Qt,{children:e.jsx(ds,{className:"h-4 w-4"})})}),e.jsx($t,{children:s})]}));ot.displayName=Ee.displayName;const Na=o.forwardRef(({className:t,...s},a)=>e.jsx(ve,{ref:a,className:m("-mx-1 my-1 h-px bg-muted",t),...s}));Na.displayName=ve.displayName;const ja=ee("inline-flex items-center rounded border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function z({className:t,variant:s,...a}){return e.jsx("div",{className:m(ja({variant:s}),t),...a,children:e.jsx("span",{className:"w-full",children:a.children})})}function wa(){const{tables:t,selectedTable:s,setSelectedTable:a,setIsCustomQuery:r}=h(),n=o.useMemo(()=>{var c;const d=Number.parseInt(s);return Number.isNaN(d)?0:((c=t[d])==null?void 0:c.count)||0},[t,s]),l=o.useMemo(()=>t.map((d,c)=>e.jsx(ot,{value:`${c}`,children:d.name[0].toUpperCase()+d.name.slice(1)},d.name)),[t]);function i(d){r(!1),a(d)}return e.jsxs("section",{className:"flex grow items-center justify-center gap-1",children:[e.jsxs(ga,{value:s,onValueChange:i,children:[e.jsx(et,{className:"grow",children:e.jsx(ba,{placeholder:"Select a table"})}),e.jsx(at,{children:e.jsxs(ha,{children:[e.jsx(rt,{children:"Tables"}),l]})})]}),e.jsx(z,{title:"Rows",className:"hidden min-w-[100px] grow bg-background py-2 text-center text-sm md:block md:min-w-[200px]",variant:"outline",children:e.jsx("span",{className:"w-full text-center",children:n})})]})}const Ca={DATE:/DATE|TIMESTAMP/i,BLOB:/^BLOB$/i,TEXT:/CHAR|TEXT|CLOB|VARCHAR/i,INTEGER:/INT/i,REAL:/REAL|FLOAT|DOUBLE|DECIMAL/i,NUMERIC:/NUMERIC/i,BOOLEAN:/BOOL/i},F=(t,s)=>Ca[s].test(t),nt=t=>F(t,"DATE"),Ea=t=>F(t,"BLOB"),va=t=>F(t,"TEXT"),Ra=t=>F(t,"INTEGER"),Ta=t=>F(t,"REAL"),Sa=t=>F(t,"NUMERIC"),Aa=t=>F(t,"BOOLEAN"),La=t=>Ra(t)||Ta(t)||Sa(t),lt=Gt,it=_t,ne=o.forwardRef(({className:t,align:s="start",side:a="bottom",sideOffset:r=4,...n},l)=>e.jsx(Re,{ref:l,align:s,side:a,sideOffset:r,className:m("z-50 w-64 text-balance break-words rounded-md border p-4 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[side=bottom]:slide-in-from-top-1","data-[side=left]:slide-in-from-right-1","data-[side=right]:slide-in-from-left-1","data-[side=top]:slide-in-from-bottom-1","bg-gray-100 dark:bg-gray-700",t),...n}));ne.displayName=Re.displayName;const ct=o.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:m("w-full caption-bottom text-sm",t),...s})}));ct.displayName="Table";const dt=o.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:m("[&_tr]:border-b",t),...s}));dt.displayName="TableHeader";const mt=o.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:m("[&_tr:last-child]:border-0",t),...s}));mt.displayName="TableBody";const Ia=o.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:m("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Ia.displayName="TableFooter";const J=o.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:m("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));J.displayName="TableRow";const ut=o.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:m("h-12 min-w-[150px] px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ut.displayName="TableHead";const Da=t=>{const s=new Uint8Array(t.match(/.{1,2}/g).map(r=>Number.parseInt(r,16))),a=new Blob([s],{type:"image/jpeg"});return URL.createObjectURL(a)},ft=o.memo(o.forwardRef(({className:t,children:s,dataType:a,...r},n)=>{const l=(a==null?void 0:a.toUpperCase())==="BLOB",i=o.useMemo(()=>typeof s=="string"&&s.length>40?`${s.slice(0,40)}...`:s,[s]);return e.jsx("td",{ref:n,className:m("max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r,children:e.jsxs(lt,{children:[e.jsx(it,{asChild:!0,children:e.jsx("span",{className:"cursor-pointer hover:underline",children:l?e.jsx("span",{className:"italic opacity-40",children:"BLOB"}):i})}),e.jsx(ne,{side:"bottom",align:"start",children:e.jsxs("div",{className:"flex flex-col justify-center gap-1",children:[l&&typeof s=="string"?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:Da(s),alt:"BLOB content",className:"flex max-h-40 flex-col items-center justify-center gap-2 rounded object-contain",onError:d=>{d.currentTarget.style.display="none"}}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Blob length: ",s.length]})]}):e.jsx("span",{className:"max-w-full break-words",children:s}),e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:a||"Unknown"})]})})]})})}));ft.displayName="TableCell";const Fa=o.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:m("mt-4 text-sm text-muted-foreground",t),...s}));Fa.displayName="TableCaption";function ka({columnName:t}){const{appendToFilters:s,selectedTable:a,filtersNeedClear:r,setFiltersNeedClear:n}=h(),[l,i]=o.useState("");o.useEffect(()=>{i("")},[a]),o.useEffect(()=>{r&&(i(""),n(!1))},[r]);const d=o.useCallback(c=>{const u=c.target.value;i(u),s(t,u)},[s,t]);return e.jsx(oe,{value:l,onChange:d,className:"mt-[2px] max-h-7 w-full text-xs",placeholder:"Filter"})}function Oa({columnName:t}){const{orderBy:s,setOrderBy:a}=h(),r=o.useCallback(()=>{s.column===t?s.direction==="ASC"?a(t,"DESC"):s.direction==="DESC"&&a(null,"ASC"):a(t,"ASC")},[s,t,a]);return e.jsx("div",{onClick:r,onKeyUp:r,className:"flex items-center",children:s.column===t?s.direction==="ASC"?e.jsx("button",{title:"Descending",type:"button","aria-label":"Sort Descending",children:e.jsx(ms,{className:"h-4 w-4"})}):e.jsx("button",{title:"Ascending",type:"button","aria-label":"Sort Ascending",children:e.jsx(us,{className:"h-4 w-4"})}):e.jsx("button",{title:"Sort column",type:"button","aria-label":"Sort Column",children:e.jsx(fs,{className:"h-4 w-4"})})})}const Ma=T.memo(({columnSchema:t})=>e.jsxs(e.Fragment,{children:[(t==null?void 0:t.isPrimaryKey)&&e.jsx("p",{className:"text-sm font-semibold text-yellow-600",children:"(Primary)"}),(t==null?void 0:t.isForeignKey)&&e.jsx("p",{className:"text-sm font-semibold text-purple-600",children:"(Foreign)"})]})),Pa=T.memo(({columnSchema:t})=>{const{type:s,isPrimaryKey:a,isForeignKey:r}=t;if(a)return e.jsx(xs,{className:"h-4 w-4 text-yellow-500"});if(r)return e.jsx(ps,{className:"h-4 w-4 text-purple-500"});if(s){if(Ea(s))return e.jsx(gs,{className:"h-4 w-4 text-green-500"});if(nt(s))return e.jsx(Fe,{className:"h-4 w-4 text-blue-500"});if(va(s))return e.jsx(hs,{className:"h-4 w-4 text-indigo-500"});if(La(s))return e.jsx(bs,{className:"h-4 w-4 text-red-500"});if(Aa(s))return e.jsx(ys,{className:"h-4 w-4 text-pink-500"})}return e.jsx(Ns,{className:"h-4 w-4 text-gray-500"})}),Ba=T.memo(({columnName:t,columnSchema:s})=>e.jsxs(ut,{className:"bg-gray-100 py-2 dark:bg-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oa,{columnName:t}),e.jsxs(lt,{children:[e.jsx(it,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1",children:[e.jsx("span",{className:"max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:t}),s&&e.jsx(Pa,{columnSchema:s})]})}),e.jsxs(ne,{className:"w-64",children:[e.jsxs("div",{className:"mb-1 flex items-center space-x-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),e.jsx(Ma,{columnSchema:s})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:(s==null?void 0:s.type)||"Unknown"}),(s==null?void 0:s.nullable)&&e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:"NULLABLE"})]})]})]})]}),e.jsx(ka,{columnName:t})]})),qa=T.memo(({value:t,dataType:s})=>{const{dateFormatValue:a}=h(),r=()=>t?s&&nt(s)&&X[a]?X[a].func(t):t:e.jsx("span",{className:"italic text-gray-400",children:"NULL"});return e.jsx(ft,{dataType:s,className:"px-5 py-[11px] text-sm",children:r()})});function Ua({data:t,columns:s,tableName:a,tableSchemas:r}){const{filters:n,setFiltersNeedClear:l,setFilters:i}=h(),d=o.useMemo(()=>e.jsx(dt,{children:e.jsx(J,{children:s.map((f,p)=>e.jsx(Ba,{columnName:f,columnSchema:r[a][f]},p))})}),[s,r,a]),c=o.useMemo(()=>e.jsx(mt,{children:t.map((f,p)=>e.jsx(J,{children:s.map((x,y)=>{var g;return e.jsx(qa,{value:f[x],dataType:(g=r[a][x])==null?void 0:g.type},y)})},p))}),[t,s,r,a]),u=o.useCallback(()=>{l(!0),i({})},[l,i]);return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(ct,{children:[d,t.length>0&&c]}),t.length===0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full p-4 text-center font-medium",children:["No data available for ",a]}),Object.keys(n).length>0&&e.jsx(b,{className:"w-full rounded-none",variant:"outline",onClick:u,children:"Clear filters"})]})]})}function Qa(){const[t,s]=o.useState(()=>document.body.classList.contains("dark"));return o.useEffect(()=>{const a=new MutationObserver(()=>{s(document.body.classList.contains("dark"))});return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),t}const $a=["ABORT","ACTION","ADD","AFTER","ALL","ALTER","ANALYZE","AND","AS","ASC","ATTACH","AUTOINCREMENT","BEFORE","BEGIN","BETWEEN","BY","CASCADE","CASE","CAST","CHECK","COLLATE","COLUMN","COMMIT","CONFLICT","CONSTRAINT","CREATE","CROSS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATABASE","DEFAULT","DEFERRABLE","DEFERRED","DELETE","DESC","DETACH","DISTINCT","DROP","EACH","ELSE","END","ESCAPE","EXCEPT","EXCLUSIVE","EXISTS","EXPLAIN","FAIL","FOR","FOREIGN","FROM","FULL","GLOB","GROUP","HAVING","IF","IGNORE","IMMEDIATE","IN","INDEX","INDEXED","INITIALLY","INNER","INSERT","INSTEAD","INTERSECT","INTO","IS","ISNULL","JOIN","KEY","LEFT","LIKE","LIMIT","MATCH","NATURAL","NO","NOT","NOTNULL","NULL","OF","OFFSET","ON","OR","ORDER","OUTER","PLAN","PRAGMA","PRIMARY","QUERY","RAISE","RECURSIVE","REFERENCES","REGEXP","REINDEX","RELEASE","RENAME","REPLACE","RESTRICT","RIGHT","ROLLBACK","ROW","SAVEPOINT","SELECT","SET","TABLE","TEMP","TEMPORARY","THEN","TO","TRANSACTION","TRIGGER","UNION","UNIQUE","UPDATE","USING","VACUUM","VALUES","VIEW","VIRTUAL","WHEN","WHERE","WITH","WITHOUT"];function Ha({columnNames:t}){const{customQuery:s,setCustomQuery:a,tables:r}=h(),n=Qa(),l=o.useCallback(c=>{const u=c.matchBefore(/\w*/);if(!u||u.from===u.to&&!c.explicit)return null;const f=[...$a.map(p=>({label:p,type:"keyword"})),...r.map(p=>({label:p.name,type:"table"})),...t.map(p=>({label:p,type:"column"}))];return{from:u.from,to:u.to,options:f}},[r,t]),i=o.useCallback(c=>{a(c)},[a]),d=o.useMemo(()=>[ks,Os(),Ms({override:[l]})],[l]);return e.jsx(Ps,{value:s,height:"126px",extensions:d,onChange:i,className:"rounded-md border",theme:n?Bs:"light"})}const za=T.memo(wa),Va=T.memo(ta);function Ga(){const{tables:t,selectedTable:s,tableSchemas:a,queryError:r,setQueryError:n,rowPerPageOrAuto:l,isCustomQuery:i,customQuery:d,setIsCustomQuery:c,setCustomQuery:u,expandPage:f,setExpandPage:p,filters:x,setFilters:y}=h(),{page:g,setPage:N,rowsPerPage:C}=Ys(l),E=o.useMemo(()=>{var M;return(M=t[Number.parseInt(s)])==null?void 0:M.name},[t,s]),{data:k,columns:v,isQueryLoading:O,handleCustomQuery:L}=Ks(E,C,g),[S,I]=o.useState([]);o.useEffect(()=>{v.length>0&&I(v)},[v]);const q=o.useCallback(()=>{n(null),u(""),c(!1)},[c,n,u]),j=o.useCallback(()=>{function M(G){try{return At(G,{language:"sqlite",useTabs:!1,keywordCase:"upper",tabWidth:2,expressionWidth:100,linesBetweenQueries:1})}catch{return G}}const V=M(d);u(V)},[d]);o.useEffect(()=>{N(0),y({})},[s]),o.useEffect(()=>{N(0)},[x]);const R=o.useMemo(()=>e.jsx(Xs,{type:"single",collapsible:!0,className:"w-full rounded-lg bg-background px-3",children:e.jsxs(Be,{value:"item-1",children:[e.jsx(qe,{className:"text-sm",children:"Execute Query"}),e.jsxs(Ue,{className:"flex flex-col gap-[6px]",children:[e.jsx("div",{className:"flex-grow",children:e.jsx(Ha,{columnNames:S})}),e.jsxs("div",{className:"flex flex-row gap-1 md:gap-2",children:[e.jsx(b,{className:"grow",variant:"secondary",onClick:L,title:"Run custom query",children:e.jsx(js,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:q,title:"Remove query",children:e.jsx(ws,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:j,title:"Format SQL",children:e.jsx(ke,{className:"h-5 w-5"})})]})]})]})}),[L,q,j,g,S]),U=o.useMemo(()=>O?e.jsxs(Y,{type:"loading",children:["Loading ",E]}):e.jsx("div",{className:"mb-[40px] overflow-hidden rounded-lg border border-gray-200 dark:border dark:border-gray-700",children:e.jsx(Ua,{data:k,columns:S.length>0?S:v,tableName:E,tableSchemas:a})}),[O,k,v,E,a,S]),Q=o.useMemo(()=>e.jsx(Va,{}),[]);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 pb-8",children:[e.jsxs("section",{className:"rounded-lg bg-gray-100 p-4 shadow-sm dark:bg-gray-700",children:[e.jsxs("div",{className:"mb-[5px] flex items-center justify-between gap-[6px]",children:[e.jsx(za,{}),e.jsxs("div",{className:"g-1 flex items-center justify-center gap-1",children:[Q,e.jsx(b,{className:"hidden expand:block",onClick:()=>p(!f),title:"Toggle page size",children:f?e.jsx(Cs,{className:"h-5 w-5"}):e.jsx(Es,{className:"h-5 w-5"})}),e.jsx(Ze,{}),e.jsx(ua,{})]})]}),R,r&&e.jsx("p",{className:"mt-2 text-center text-sm text-red-500 dark:text-red-400",children:r})]}),U,!i&&e.jsx(pa,{page:g,setPage:N,rowsPerPage:C})]})})}const _a={"application/vnd.sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/x-sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/octet-stream":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sql":[".sql"],"application/x-sql":[".sql"],"text/x-sql":[".sql"],"text/sql":[".sql"],"text/x-sqlite3":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite3-dump":[".sql"],"text/x-sqlite-dump":[".sql"],"text/sqlite-dump":[".sql"]};function Wa(){const{loadDatabaseBytes:t}=h(),[s,a]=o.useState([]),r=o.useCallback(async(c,u)=>{if(u.length>0){const f=u.flatMap(p=>p.errors);a(f);return}if(c.length>0)try{const f=new Uint8Array(await c[0].arrayBuffer());await t(f)}catch(f){return f instanceof Error?A(f.message,{position:"bottom-right"}):A("Failed to load database",{position:"bottom-right"})}},[t]),{getRootProps:n,getInputProps:l,isDragActive:i}=qs({onDrop:r,multiple:!1,accept:_a}),d=o.useMemo(()=>e.jsx("div",{className:"flex w-full items-center justify-between gap-2",children:e.jsxs("div",{...n(),className:`flex w-full grow transform cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed bg-gray-100/50 p-6 transition-colors duration-300 ease-in-out hover:bg-secondary dark:bg-gray-700/50 ${i?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-primary py-12 dark:border-gray-700"}`,children:[e.jsx("input",{id:"file-upload",...l()}),e.jsx("label",{htmlFor:"file-upload",className:"sr-only",children:"Upload SQLite File"}),e.jsxs("div",{className:"text-center text-sm md:text-base",children:[e.jsx("span",{className:"hidden sm:block lg:text-lg",children:"Drag and drop file here, or click to select one"}),e.jsx("div",{className:"block sm:hidden",children:e.jsx("span",{className:"text-lg font-medium",children:"Click to select a SQLite file"})})]})]})}),[n,l,i]);return e.jsxs("section",{className:"mx-auto w-full",children:[d,e.jsx(Ka,{errors:s})]})}const Ka=T.memo(({errors:t})=>(o.useEffect(()=>{if(t)for(const s of t)A(s.message,{position:"bottom-right"})},[t]),null));function Ya(){return e.jsx("header",{className:"rounded bg-gradient-to-r shadow-md dark:from-gray-800 dark:to-indigo-900",children:e.jsx("div",{className:"mx-auto max-w-4xl px-4 py-8 sm:py-12",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold sm:text-3xl",children:"SQLite Viewer"}),e.jsx("p",{className:"max-w-md text-sm sm:text-base",children:"Explore and analyze your SQLite databases directly in your browser"})]})})})}function Xa(){return e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"rounded bg-gradient-to-r py-6 shadow-md dark:from-gray-800 dark:to-indigo-900 md:py-10",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsx("div",{children:e.jsxs("div",{className:"grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(B,{icon:vs,title:"Browser Based",description:"No installation required. Access and analyze your SQLite databases directly in your web browser."}),e.jsx(B,{icon:Rs,title:"Lightning Fast",description:"Powered by WebAssembly (WASM) for near-native performance, even with large databases."}),e.jsx(B,{icon:Ts,title:"100% Secure",description:"Your data never leaves your device. All processing happens client-side, ensuring complete privacy."}),e.jsx(B,{icon:Oe,title:"Customizable Interface",description:"Different themes and settings. Adjust the look and feel of your interface to suit your preferences and workflow."}),e.jsx(B,{icon:Ss,title:"Offline Capable",description:"Work on your databases without an internet connection. Perfect for sensitive data or remote work."}),e.jsx(B,{icon:As,title:"PWA Support",description:"Install the app on your desktop or mobile device for a genuine native experience. Enjoy robust offline functionality."})]})})})}),e.jsx("div",{className:"pb-[72px] md:pb-0"})]})}function B({icon:t,title:s,description:a}){return e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(t,{className:"h-6 w-6 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"mt-1 text-sm",children:a})]})]})}const Ja=Wt,Za=Kt,xt=o.forwardRef(({className:t,...s},a)=>e.jsx(Te,{className:m("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));xt.displayName=Te.displayName;const pt=o.forwardRef(({className:t,...s},a)=>e.jsxs(Za,{children:[e.jsx(xt,{}),e.jsx(Se,{ref:a,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));pt.displayName=Se.displayName;const gt=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col space-y-2",t),...s});gt.displayName="AlertDialogHeader";const ht=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});ht.displayName="AlertDialogFooter";const bt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ae,{ref:a,className:m("text-lg font-semibold",t),...s}));bt.displayName=Ae.displayName;const yt=o.forwardRef(({className:t,...s},a)=>e.jsx(Le,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));yt.displayName=Le.displayName;const Nt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ie,{ref:a,className:m(ae(),t),...s}));Nt.displayName=Ie.displayName;const jt=o.forwardRef(({className:t,...s},a)=>e.jsx(De,{ref:a,className:m(ae({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));jt.displayName=De.displayName;const er=o.memo(pt);function tr({showDialog:t,setShowDialog:s,onConfirm:a}){const r=o.useCallback(()=>{s(!1)},[s]);return e.jsx(Ja,{open:t,onOpenChange:s,children:e.jsxs(er,{children:[e.jsxs(gt,{children:[e.jsx(bt,{children:"Use Proxy to Load Database?"}),e.jsx(yt,{children:"We couldn't load the database from the provided URL due to CORS restrictions. Would you like to try using a proxy?"})]}),e.jsx("div",{className:"font-semibold text-yellow-600 md:text-left",children:"Warning: Using the proxy will route your database traffic through cors.eu.org."}),e.jsxs(ht,{children:[e.jsx(jt,{onClick:r,children:"Cancel"}),e.jsx(Nt,{onClick:a,children:"Use Proxy"})]})]})})}const sr=/^(https?:\/\/(?:www\.)?[a-zA-Z0-9-]{1,256}\.[a-zA-Z]{2,6}(?:\/[^\s]*)?)$/i,ar="https://cors.eu.org";function rr(){const{db:t,isLoading:s,loadDatabaseBytes:a}=h(),[r,n]=o.useState(null),[l,i]=o.useState(!1),[d,c]=o.useState(null),[u,f]=o.useState(!1),p=o.useRef(!1),x=o.useCallback(async(g,N=!1)=>{if(!sr.test(g)){n("Invalid URL");return}try{f(!0);const C=N?`${ar}/${encodeURIComponent(g)}`:g,E=await fetch(C);if(!E.ok)throw new Error("URL not found or invalid");const k=await E.blob(),v=new File([k],"database.sqlite"),O=new Uint8Array(await v.arrayBuffer());await a(O),n(null)}catch(C){N?n(`Error while fetching, ${C instanceof Error?C.message:String(C)}`):(c(g),i(!0))}finally{f(!1)}},[a]);o.useEffect(()=>{if(p.current)return;const N=new URLSearchParams(window.location.search).get("url");N&&(x(decodeURIComponent(N)),p.current=!0)},[x]);const y=o.useCallback(()=>{d&&(x(d,!0),i(!1))},[d,x]);return s||u?e.jsxs(Y,{type:"loading",children:[u?"Fetching":"Loading"," SQLite file"]}):r&&!t?e.jsx(Y,{type:"error",children:r}):e.jsx(e.Fragment,{children:l&&e.jsx(tr,{showDialog:l,setShowDialog:i,onConfirm:y},"proxy-message")})}function or(){return e.jsx("footer",{className:"fixed bottom-0 left-0 right-0 border-t bg-background shadow-md",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between py-4 md:py-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sms hidden sm:block",children:"No file will be uploaded to server. Using JavaScript, sql.js"}),e.jsx("p",{className:"text-sm sm:hidden",children:"No file uploads to server."})]}),e.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-2 text-blue-500",title:"Star on GitHub",children:[e.jsx(Ls,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium hover:underline",children:"Star us on GitHub"})]})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx(Ze,{})})]})})})}const nr=o.memo(Ga),lr=o.memo(Wa),ir=o.memo(rr);function cr(){const{db:t,expandPage:s}=h();return e.jsxs("main",{className:`mx-auto flex h-screen flex-col ${t?"gap-3":"gap-4"} p-4 ${s?"w-full":"container"}`,children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(Ya,{})," ",e.jsx(lr,{})," ",e.jsx(ir,{}),e.jsx(Xa,{}),e.jsx(or,{})]}),t&&e.jsx(nr,{isDatabaseLoaded:t})]})}const dr=({...t})=>e.jsx(Is,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-gray-100 p-2 dark:group-[.toaster]:bg-gray-700 text-lg p-4 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t});Rt.createRoot(document.getElementById("root")).render(e.jsxs(T.StrictMode,{children:[e.jsx(cr,{}),e.jsx(dr,{})]})); diff --git a/assets/index-Dhbsy5TC.js.gz b/assets/index-Dhbsy5TC.js.gz deleted file mode 100644 index eed10a9..0000000 Binary files a/assets/index-Dhbsy5TC.js.gz and /dev/null differ diff --git a/assets/index-C-kKn6GS.css b/assets/index-DmD-EE65.css similarity index 54% rename from assets/index-C-kKn6GS.css rename to assets/index-DmD-EE65.css index fb588fc..e4c1420 100644 --- a/assets/index-C-kKn6GS.css +++ b/assets/index-DmD-EE65.css @@ -1 +1 @@ -.nord.light{--background: 208 36% 100%;--foreground: 208 51% 1%;--muted: 208 40% 85%;--muted-foreground: 208 10% 35%;--popover: 208 36% 100%;--popover-foreground: 208 51% 1%;--card: 0 0% 99%;--card-foreground: 208 51% 0%;--border: 220 13% 91%;--input: 220 13% 91%;--primary: 208 67% 75%;--primary-foreground: 208 67% 30%;--secondary: 208 15% 91%;--secondary-foreground: 208 15% 31%;--accent: 208 15% 91%;--accent-foreground: 208 15% 31%;--destructive: 4 99% 32%;--destructive-foreground: 4 99% 92%;--ring: 208 67% 90%}.nord.dark{--background: 208 57% 0%;--foreground: 208 21% 99%;--muted: 208 40% 15%;--muted-foreground: 208 10% 65%;--popover: 208 57% 0%;--popover-foreground: 208 21% 99%;--card: 0 0% 1%;--card-foreground: 0 0% 100%;--border: 215 27.9% 16.9%;--input: 215 27.9% 16.9%;--primary: 208 67% 90%;--primary-foreground: 208 67% 30%;--secondary: 208 6% 10%;--secondary-foreground: 208 6% 70%;--accent: 208 6% 10%;--accent-foreground: 208 6% 70%;--destructive: 4 99% 46%;--destructive-foreground: 0 0% 100%;--ring: 208 67% 90%}.zinc.light{--background: 0 0% 100%;--foreground: 240 10% 3.9%;--card: 0 0% 100%;--card-foreground: 240 10% 3.9%;--popover: 0 0% 100%;--popover-foreground: 240 10% 3.9%;--primary: 240 5.9% 10%;--primary-foreground: 0 0% 98%;--secondary: 240 4.8% 95.9%;--secondary-foreground: 240 5.9% 10%;--muted: 240 4.8% 95.9%;--muted-foreground: 240 3.8% 46.1%;--accent: 240 4.8% 95.9%;--accent-foreground: 240 5.9% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 240 5.9% 90%;--input: 240 5.9% 90%;--ring: 240 5.9% 10%}.zinc.dark{--background: 240 10% 3.9%;--foreground: 0 0% 98%;--card: 240 10% 3.9%;--card-foreground: 0 0% 98%;--popover: 240 10% 3.9%;--popover-foreground: 0 0% 98%;--primary: 0 0% 98%;--primary-foreground: 240 5.9% 10%;--secondary: 240 3.7% 15.9%;--secondary-foreground: 0 0% 98%;--muted: 240 3.7% 15.9%;--muted-foreground: 240 5% 64.9%;--accent: 240 3.7% 15.9%;--accent-foreground: 0 0% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 0 0% 98%;--border: 240 3.7% 15.9%;--input: 240 3.7% 15.9%;--ring: 240 4.9% 83.9%}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--scrollbar-track);border-radius:4px}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:4px;-webkit-transition:background .2s ease-in-out;transition:background .2s ease-in-out}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}:root{--scrollbar-track: hsl(var(--secondary));--scrollbar-thumb: hsl(var(--muted-foreground) / .5);--scrollbar-thumb-hover: hsl(var(--muted-foreground) / .7)}.dark{--scrollbar-track: hsl(var(--secondary));--scrollbar-thumb: hsl(var(--muted-foreground) / .5);--scrollbar-thumb-hover: hsl(var(--muted-foreground) / .7)}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-0{right:0}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-\[40px\]{margin-bottom:40px}.mb-\[5px\]{margin-bottom:5px}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-\[2px\]{margin-top:2px}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-7{max-height:1.75rem}.max-h-96{max-height:24rem}.w-10{width:2.5rem}.w-2\.5{width:.625rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-80{width:20rem}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[270px\]{width:270px}.w-full{width:100%}.min-w-\[100px\]{min-width:100px}.min-w-\[150px\]{min-width:150px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.-translate-x-1\/2,.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes circular-reveal{0%{clip-path:circle(0% at 50% 50%)}to{clip-path:circle(150% at 50% 50%)}}.animate-circular-reveal{animation:circular-reveal .3s ease-in-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.gap-\[6px\]{gap:6px}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-100\/50{background-color:#f3f4f680}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.p-\[6px\]{padding:6px}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[11px\]{padding-top:11px;padding-bottom:11px}.pb-4{padding-bottom:1rem}.pb-8{padding-bottom:2rem}.pb-\[72px\]{padding-bottom:72px}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pt-0{padding-top:0}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-current{color:currentColor}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.cm-focused{outline:none!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-1[data-side=bottom]{--tw-enter-translate-y: -.25rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-1[data-side=left]{--tw-enter-translate-x: .25rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-1[data-side=right]{--tw-enter-translate-x: -.25rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-1[data-side=top]{--tw-enter-translate-y: .25rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.dark\:border:is(.dark *){border-width:1px}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:bg-blue-900\/20:is(.dark *){background-color:#1e3a8a33}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.dark\:bg-gray-700\/50:is(.dark *){background-color:#37415180}.dark\:from-gray-800:is(.dark *){--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-indigo-900:is(.dark *){--tw-gradient-to: #312e81 var(--tw-gradient-to-position)}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.group.toaster .dark\:group-\[\.toaster\]\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}@media (min-width: 640px){.sm\:mt-0{margin-top:0}.sm\:block{display:block}.sm\:hidden{display:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-12{padding-top:3rem;padding-bottom:3rem}.sm\:text-left{text-align:left}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 768px){.md\:block{display:block}.md\:min-w-\[200px\]{min-width:200px}.md\:gap-2{gap:.5rem}.md\:py-10{padding-top:2.5rem;padding-bottom:2.5rem}.md\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.md\:pb-0{padding-bottom:0}.md\:text-left{text-align:left}.md\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:text-lg{font-size:1.125rem;line-height:1.75rem}}@media (min-width: 1430px){.expand\:block{display:block}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} +.nord.light{--background: 208 36% 100%;--foreground: 208 51% 1%;--muted: 208 40% 85%;--muted-foreground: 208 10% 35%;--popover: 208 36% 100%;--popover-foreground: 208 51% 1%;--card: 0 0% 99%;--card-foreground: 208 51% 0%;--border: 220 13% 91%;--input: 220 13% 91%;--primary: 208 67% 75%;--primary-foreground: 208 67% 30%;--secondary: 208 15% 91%;--secondary-foreground: 208 15% 31%;--accent: 208 15% 91%;--accent-foreground: 208 15% 31%;--destructive: 4 99% 32%;--destructive-foreground: 4 99% 92%;--ring: 208 67% 90%}.nord.dark{--background: 208 57% 0%;--foreground: 208 21% 99%;--muted: 208 40% 15%;--muted-foreground: 208 10% 65%;--popover: 208 57% 0%;--popover-foreground: 208 21% 99%;--card: 0 0% 1%;--card-foreground: 0 0% 100%;--border: 215 27.9% 16.9%;--input: 215 27.9% 16.9%;--primary: 208 67% 90%;--primary-foreground: 208 67% 30%;--secondary: 208 6% 10%;--secondary-foreground: 208 6% 70%;--accent: 208 6% 10%;--accent-foreground: 208 6% 70%;--destructive: 4 99% 46%;--destructive-foreground: 0 0% 100%;--ring: 208 67% 90%}.zinc.light{--background: 0 0% 100%;--foreground: 240 10% 3.9%;--card: 0 0% 100%;--card-foreground: 240 10% 3.9%;--popover: 0 0% 100%;--popover-foreground: 240 10% 3.9%;--primary: 240 5.9% 10%;--primary-foreground: 0 0% 98%;--secondary: 240 4.8% 95.9%;--secondary-foreground: 240 5.9% 10%;--muted: 240 4.8% 95.9%;--muted-foreground: 240 3.8% 46.1%;--accent: 240 4.8% 95.9%;--accent-foreground: 240 5.9% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 240 5.9% 90%;--input: 240 5.9% 90%;--ring: 240 5.9% 10%}.zinc.dark{--background: 240 10% 3.9%;--foreground: 0 0% 98%;--card: 240 10% 3.9%;--card-foreground: 0 0% 98%;--popover: 240 10% 3.9%;--popover-foreground: 0 0% 98%;--primary: 0 0% 98%;--primary-foreground: 240 5.9% 10%;--secondary: 240 3.7% 15.9%;--secondary-foreground: 0 0% 98%;--muted: 240 3.7% 15.9%;--muted-foreground: 240 5% 64.9%;--accent: 240 3.7% 15.9%;--accent-foreground: 0 0% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 0 0% 98%;--border: 240 3.7% 15.9%;--input: 240 3.7% 15.9%;--ring: 240 4.9% 83.9%}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 210 40% 98%;--primary-foreground: 222.2 47.4% 11.2%;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 212.7 26.8% 83.9}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--scrollbar-track);border-radius:4px}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:4px;-webkit-transition:background .2s ease-in-out;transition:background .2s ease-in-out}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}:root{--scrollbar-track: hsl(var(--secondary));--scrollbar-thumb: hsl(var(--muted-foreground) / .5);--scrollbar-thumb-hover: hsl(var(--muted-foreground) / .7)}.dark{--scrollbar-track: hsl(var(--secondary));--scrollbar-thumb: hsl(var(--muted-foreground) / .5);--scrollbar-thumb-hover: hsl(var(--muted-foreground) / .7)}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-0{right:0}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-\[40px\]{margin-bottom:40px}.mb-\[5px\]{margin-bottom:5px}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-\[2px\]{margin-top:2px}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-7{max-height:1.75rem}.max-h-96{max-height:24rem}.w-10{width:2.5rem}.w-2\.5{width:.625rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-80{width:20rem}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[270px\]{width:270px}.w-full{width:100%}.min-w-\[100px\]{min-width:100px}.min-w-\[150px\]{min-width:150px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.-translate-x-1\/2,.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes circular-reveal{0%{clip-path:circle(0% at 50% 50%)}to{clip-path:circle(150% at 50% 50%)}}.animate-circular-reveal{animation:circular-reveal .3s ease-in-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.gap-\[6px\]{gap:6px}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-yellow-500{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-100\/50{background-color:#f3f4f680}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.p-\[6px\]{padding:6px}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-\[11px\]{padding-top:11px;padding-bottom:11px}.pb-4{padding-bottom:1rem}.pb-8{padding-bottom:2rem}.pb-\[3px\]{padding-bottom:3px}.pb-\[72px\]{padding-bottom:72px}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pt-0{padding-top:0}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-current{color:currentColor}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.cm-focused{outline:none!important}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-1[data-side=bottom]{--tw-enter-translate-y: -.25rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-1[data-side=left]{--tw-enter-translate-x: .25rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-1[data-side=right]{--tw-enter-translate-x: -.25rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-1[data-side=top]{--tw-enter-translate-y: .25rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.dark\:border:is(.dark *){border-width:1px}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:bg-blue-900\/20:is(.dark *){background-color:#1e3a8a33}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.dark\:bg-gray-700\/50:is(.dark *){background-color:#37415180}.dark\:from-gray-800:is(.dark *){--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-indigo-900:is(.dark *){--tw-gradient-to: #312e81 var(--tw-gradient-to-position)}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.group.toaster .dark\:group-\[\.toaster\]\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}@media (min-width: 640px){.sm\:mt-0{margin-top:0}.sm\:block{display:block}.sm\:hidden{display:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-12{padding-top:3rem;padding-bottom:3rem}.sm\:text-left{text-align:left}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 768px){.md\:block{display:block}.md\:min-w-\[200px\]{min-width:200px}.md\:gap-2{gap:.5rem}.md\:py-10{padding-top:2.5rem;padding-bottom:2.5rem}.md\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.md\:pb-0{padding-bottom:0}.md\:text-left{text-align:left}.md\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:text-lg{font-size:1.125rem;line-height:1.75rem}}@media (min-width: 1430px){.expand\:block{display:block}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} diff --git a/assets/index-DmD-EE65.css.gz b/assets/index-DmD-EE65.css.gz new file mode 100644 index 0000000..c036d4a Binary files /dev/null and b/assets/index-DmD-EE65.css.gz differ diff --git a/index.html b/index.html index a1ca3e7..cd89d58 100644 --- a/index.html +++ b/index.html @@ -93,7 +93,7 @@ font-size: 2rem; } - + @@ -121,17 +121,17 @@ - + - + - + - +
diff --git a/index.html.gz b/index.html.gz index 744d6b6..308f388 100644 Binary files a/index.html.gz and b/index.html.gz differ diff --git a/sw.js b/sw.js index 013d495..f492da1 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()})).then((()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s})));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const t=s=>l(s,i),o={module:{uri:i},exports:u,require:t};e[i]=Promise.all(r.map((s=>o[s]||t(s)))).then((s=>(n(...s),u)))}}define(["./workbox-3e911b1d"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/@babel-BjXSgPXB.js",revision:null},{url:"assets/@codemirror-SM3v-hs2.js",revision:null},{url:"assets/@floating-ui-Bob4LHZu.js",revision:null},{url:"assets/@lezer-C0_A0N7l.js",revision:null},{url:"assets/@radix-ui-BQVY8FyZ.js",revision:null},{url:"assets/@uiw-Cmr0UBwL.js",revision:null},{url:"assets/aria-hidden-DQ5UC2Eg.js",revision:null},{url:"assets/attr-accept-BWI1aNlo.js",revision:null},{url:"assets/class-variance-authority-Bb4qSo10.js",revision:null},{url:"assets/clsx-B-dksMZM.js",revision:null},{url:"assets/crelt-C8TCjufn.js",revision:null},{url:"assets/date-fns-BAPXOope.js",revision:null},{url:"assets/detect-node-es-l0sNRNKZ.js",revision:null},{url:"assets/file-saver-DhbZvGod.js",revision:null},{url:"assets/file-selector-CBHVlu32.js",revision:null},{url:"assets/get-nonce-C-Z93AgS.js",revision:null},{url:"assets/index-C-kKn6GS.css",revision:null},{url:"assets/index-Dhbsy5TC.js",revision:null},{url:"assets/lucide-react-S8ZAjIB-.js",revision:null},{url:"assets/nearley-CG12bGQB.js",revision:null},{url:"assets/prop-types-psm7UO16.js",revision:null},{url:"assets/react-DmpIMwDM.js",revision:null},{url:"assets/react-dom-Cjr6YfK8.js",revision:null},{url:"assets/react-dropzone-D-IBOhIS.js",revision:null},{url:"assets/react-remove-scroll-bar-DZjhPxUV.js",revision:null},{url:"assets/react-remove-scroll-BOyN_WUU.js",revision:null},{url:"assets/react-style-singleton-CpxBwIWS.js",revision:null},{url:"assets/scheduler-CzFDRTuY.js",revision:null},{url:"assets/sonner-CxG_nbEz.js",revision:null},{url:"assets/sql-formatter-BoZ82dp4.js",revision:null},{url:"assets/sql.js-Ch_tM77n.js",revision:null},{url:"assets/style-mod-Bc2inJdb.js",revision:null},{url:"assets/tailwind-merge-BkWO730n.js",revision:null},{url:"assets/tslib-CuZy2iRz.js",revision:null},{url:"assets/use-callback-ref-DRzK4jWO.js",revision:null},{url:"assets/use-sidecar-D8_hMcUG.js",revision:null},{url:"assets/use-sync-external-store-ByYeed7R.js",revision:null},{url:"assets/vaul-OrZLygqJ.js",revision:null},{url:"assets/w3c-keyname-Vcq4gwWv.js",revision:null},{url:"assets/zustand-BpWCCnYR.js",revision:null},{url:"index.html",revision:"36e3e02c57d7baef20ad2fe7e8b2f67b"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"sql.wasm",revision:"f6ad6454f4630b310eb8473858eb33bb"},{url:"manifest.webmanifest",revision:"662c9ac5fe5300a257a596b0ad6130ea"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); +if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()})).then((()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s})));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const t=s=>l(s,i),o={module:{uri:i},exports:u,require:t};e[i]=Promise.all(r.map((s=>o[s]||t(s)))).then((s=>(n(...s),u)))}}define(["./workbox-3e911b1d"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/@babel-BjXSgPXB.js",revision:null},{url:"assets/@codemirror-CCjSF3Vf.js",revision:null},{url:"assets/@floating-ui-Bob4LHZu.js",revision:null},{url:"assets/@lezer-DgLl1T_N.js",revision:null},{url:"assets/@radix-ui-BQVY8FyZ.js",revision:null},{url:"assets/@uiw-CvcbIrPa.js",revision:null},{url:"assets/aria-hidden-DQ5UC2Eg.js",revision:null},{url:"assets/attr-accept-BWI1aNlo.js",revision:null},{url:"assets/class-variance-authority-Bb4qSo10.js",revision:null},{url:"assets/clsx-B-dksMZM.js",revision:null},{url:"assets/crelt-C8TCjufn.js",revision:null},{url:"assets/date-fns-BAPXOope.js",revision:null},{url:"assets/detect-node-es-l0sNRNKZ.js",revision:null},{url:"assets/file-saver-DhbZvGod.js",revision:null},{url:"assets/file-selector-CBHVlu32.js",revision:null},{url:"assets/get-nonce-C-Z93AgS.js",revision:null},{url:"assets/index-CCxazG49.js",revision:null},{url:"assets/index-DmD-EE65.css",revision:null},{url:"assets/lucide-react-S8ZAjIB-.js",revision:null},{url:"assets/nearley-CG12bGQB.js",revision:null},{url:"assets/prop-types-psm7UO16.js",revision:null},{url:"assets/react-DmpIMwDM.js",revision:null},{url:"assets/react-dom-Cjr6YfK8.js",revision:null},{url:"assets/react-dropzone-D-IBOhIS.js",revision:null},{url:"assets/react-remove-scroll-bar-DZjhPxUV.js",revision:null},{url:"assets/react-remove-scroll-BOyN_WUU.js",revision:null},{url:"assets/react-style-singleton-CpxBwIWS.js",revision:null},{url:"assets/scheduler-CzFDRTuY.js",revision:null},{url:"assets/sonner-CxG_nbEz.js",revision:null},{url:"assets/sql-formatter-BoZ82dp4.js",revision:null},{url:"assets/sql.js-Ch_tM77n.js",revision:null},{url:"assets/style-mod-Bc2inJdb.js",revision:null},{url:"assets/tailwind-merge-BkWO730n.js",revision:null},{url:"assets/tslib-CuZy2iRz.js",revision:null},{url:"assets/use-callback-ref-DRzK4jWO.js",revision:null},{url:"assets/use-sidecar-D8_hMcUG.js",revision:null},{url:"assets/use-sync-external-store-ByYeed7R.js",revision:null},{url:"assets/vaul-OrZLygqJ.js",revision:null},{url:"assets/w3c-keyname-Vcq4gwWv.js",revision:null},{url:"assets/zustand-BpWCCnYR.js",revision:null},{url:"index.html",revision:"3265eded7b2a6010b85d9f46e35fa47e"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"sql.wasm",revision:"f6ad6454f4630b310eb8473858eb33bb"},{url:"manifest.webmanifest",revision:"662c9ac5fe5300a257a596b0ad6130ea"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));