@otwdesign/db-ui 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/assets.js +1 -1
- package/dist/entry.js +1 -1
- package/package.json +1 -1
package/dist/assets.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const assets = {"index":"<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"otw-db\" content=\"%OTW_DB_CONFIG%\" />\n <meta name=\"color-scheme\" content=\"light dark\" />\n <title>OTW DB</title>\n <script type=\"module\" crossorigin src=\"%OTW_DB_BASE%/assets/index-BVyk1TYR.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"%OTW_DB_BASE%/assets/style-CN-jj026.css\">\n </head>\n <body>\n <div id=\"root\" class=\"otw-db\"></div>\n </body>\n</html>\n","files":{"Editor-Bk4pmv2B.js":{"type":"text/javascript; charset=utf-8","body":"import{n as e,r as t,t as n}from\"./index-BVyk1TYR.js\";var r=[],i=[];(()=>{let e=`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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?i:r).push(n+=e[t])})();function a(e){if(e<768)return!1;for(let t=0,n=r.length;;){let a=t+n>>1;if(e<r[a])n=a;else if(e>=i[a])t=a+1;else return!0;if(t==n)return!1}}function o(e){return e>=127462&&e<=127487}var s=8205;function c(e,t,n=!0,r=!0){return(n?l:u)(e,t,r)}function l(e,t,n){if(t==e.length)return t;t&&f(e.charCodeAt(t))&&p(e.charCodeAt(t-1))&&t--;let r=d(e,t);for(t+=m(r);t<e.length;){let i=d(e,t);if(r==s||i==s||n&&a(i))t+=m(i),r=i;else if(o(i)){let n=0,r=t-2;for(;r>=0&&o(d(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function u(e,t,n){for(;t>1;){let r=l(e,t-2,n);if(r<t)return r;t--}return 0}function d(e,t){let n=e.charCodeAt(t);if(!p(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return f(r)?(n-55296<<10)+(r-56320)+65536:n}function f(e){return e>=56320&&e<57344}function p(e){return e>=55296&&e<56320}function m(e){return e<65536?1:2}var h=class e{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=re(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),_.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=re(this,e,t);let n=[];return this.decompose(e,t,n,0),_.from(n,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),n=this.length-this.scanIdentical(e,-1),r=new b(this),i=new b(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new b(this,e)}iterRange(e,t=this.length){return new x(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new te(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new g(t):_.from(g.split(t,[]))}},g=class e extends h{constructor(e,t=v(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ne(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ee(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=y(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=re(this,t,n);let i=y(this.text,y(r.text,ee(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):_.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`\n`){[e,t]=re(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},_=class e extends h{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=re(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`\n`){[e,t]=re(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new g(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof g&&c&&(n=u[u.length-1])instanceof g&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new g(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};h.empty=new g([``],0);function v(e){let t=-1;for(let n of e)t+=n.length+1;return t}function y(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function ee(e,t,n){return y(e,[``],t,n)}var b=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof g?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof g?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`\n`,this;e--}else if(r instanceof g){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof g?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},x=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new b(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),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!=``}},te=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(h.prototype[Symbol.iterator]=function(){return this.iter()},b.prototype[Symbol.iterator]=x.prototype[Symbol.iterator]=te.prototype[Symbol.iterator]=function(){return this});var ne=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function re(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function S(e,t,n=!0,r=!0){return c(e,t,n,r)}function ie(e){return e>=56320&&e<57344}function ae(e){return e>=55296&&e<56320}function C(e,t){let n=e.charCodeAt(t);if(!ae(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ie(r)?(n-55296<<10)+(r-56320)+65536:n}function oe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function se(e){return e<65536?1:2}var ce=/\\r\\n?|\\n/,le=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(le||={}),ue=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){pe(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:he(this,e)}mapDesc(e,t=!1){return e.empty?this:me(this,e,t)}mapPos(e,t=-1,n=le.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=le.Simple&&c>=e&&(n==le.TrackDel&&r<e&&c>e||n==le.TrackBefore&&r<e||n==le.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},de=class e extends ue{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return pe(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return me(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(h.empty);r.push(a?t.slice(i,i+a):h.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:he(this,e,!0)}map(e,t=!1){return e.empty?this:me(this,e,t,!0)}iterChanges(e,t=!1){pe(this,e,t)}get desc(){return ue.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new ge(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);w(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;w(n,e,t),t>0&&fe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);w(n,e,-1),w(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:ue.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&w(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?h.of(l.split(r||ce)):l:h.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&w(i,e-o,-1),w(i,s-e,d),fe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(h.empty);r[e]=h.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function w(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function fe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(h.empty);e.push(n)}}function pe(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=h.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function me(e,t,n,r=!1){let i=[],a=r?[]:null,o=new ge(e),s=new ge(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);w(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(w(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(w(i,0,o.ins),a&&fe(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;w(i,t,e<o.i?o.ins:0),a&&e<o.i&&fe(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?de.createSet(i,a):ue.create(i);else throw Error(`Mismatched change set lengths`)}function he(e,t,n=!1){let r=[],i=n?[]:null,a=new ge(e),o=new ge(t);for(let e=!1;;)if(a.done&&o.done)return i?de.createSet(r,i):ue.create(r);else if(a.ins==0)w(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)w(r,0,o.ins,e),i&&fe(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;w(r,t,n,e),i&&n&&fe(i,r,o.text)}else o.ins==-1?(w(r,a.off?0:a.len,t,e),i&&fe(i,r,a.textBit(t))):(w(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&fe(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var ge=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?h.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?h.empty:t[n].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)}},_e=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return T.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return T.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!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 RangeError(`Invalid JSON representation for SelectionRange`);return T.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},T=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>_e.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return _e.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?_e.create(t,e,a|32,n):_e.create(e,t,a,n)}static undirectionalRange(e,t){return _e.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function ve(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var ye=0,E=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=ye++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:be),!!t.static,t.enables)}of(e){return new xe([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function be(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var xe=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=ye++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Ce(e,c)){let r=t(e);if(a?!Se(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Ie(o,c);if(this.dependencies.every(t=>t instanceof E?o.facet(t)===e.facet(t):t instanceof Ee?o.field(t,!1)==e.field(t,!1):!0)||(a?Se(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Se(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Ce(e,t){let n=!1;for(let r of t)Fe(e,r)&1&&(n=!0);return n}function we(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Ie(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Fe(e,t);return e.values[o]=s(e),1},update(e,n){if(!Ce(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Ce(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&be(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Te=E.define({static:!0}),Ee=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(ye++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Te).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Te),i=n.facet(Te),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Te.of({field:this,create:e})]}get extension(){return this}},De={lowest:4,low:3,default:2,high:1,highest:0};function Oe(e){return t=>new Ae(t,e)}var ke={highest:Oe(De.highest),high:Oe(De.high),default:Oe(De.default),low:Oe(De.low),lowest:Oe(De.lowest)},Ae=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},je=class e{of(e){return new Me(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Me=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ne=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Pe(t,n,o))e instanceof Ee?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,be(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>we(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Pe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Me&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Me){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ae)a(e.inner,e.prec);else if(e instanceof Ee)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof xe)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,De.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,De.default),r.reduce((e,t)=>e.concat(t))}function Fe(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Ie(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Le=E.define(),Re=E.define({combine:e=>e.some(e=>e),static:!0}),ze=E.define({combine:e=>e.length?e[0]:void 0,static:!0}),Be=E.define(),Ve=E.define(),He=E.define(),Ue=E.define({combine:e=>e.length?e[0]:!1}),We=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ge}},Ge=class{of(e){return new We(this,e)}},Ke=class{constructor(e){this.map=e}of(e){return new D(this,e)}},D=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new Ke(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};D.reconfigure=D.define(),D.appendConfig=D.define();var O=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&ve(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return 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(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};O.time=We.define(),O.userEvent=We.define(),O.addToHistory=We.define(),O.remote=We.define();function qe(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Je(e,t,n){let r,i,a;return n?(r=t.changes,i=de.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:D.mapEffects(e.effects,r).concat(D.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Ye(e,t,n){let r=t.selection,i=et(t.annotations);return t.userEvent&&(i=i.concat(O.userEvent.of(t.userEvent))),{changes:t.changes instanceof de?t.changes:de.of(t.changes||[],n,e.facet(ze)),selection:r&&(r instanceof T?r:T.single(r.anchor,r.head)),effects:et(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Xe(e,t,n){let r=Ye(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=Je(r,Ye(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=O.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Qe(n?Ze(i):i)}function Ze(e){let t=e.startState,n=!0;for(let r of t.facet(Be)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:qe(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=de.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=O.create(t,r,e.selection&&e.selection.map(i),D.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Ve);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof O?i:Array.isArray(i)&&i.length==1&&i[0]instanceof O?i[0]:Xe(t,et(i),!1)}return e}function Qe(e){let t=e.startState,n=t.facet(He),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Je(r,Ye(t,a,e.changes.newLength),!0))}return r==e?e:O.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var $e=[];function et(e){return e==null?$e:Array.isArray(e)?e:[e]}var k=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(k||={}),tt=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,nt;try{nt=RegExp(`[\\\\p{Alphabetic}\\\\p{Number}_]`,`u`)}catch{}function rt(e){if(nt)return nt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||tt.test(n)))return!0}return!1}function it(e){return t=>{if(!/\\S/.test(t))return k.Space;if(rt(t))return k.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return k.Word;return k.Other}}var A=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Fe(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`)}else return Fe(this,n),Ie(this,n)}update(...e){return Xe(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(je.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(D.reconfigure)?(n=null,r=e.value):e.is(D.appendConfig)&&(n=null,r=et(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ne.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Re)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:T.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=et(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=D.mapEffects(a,c).concat(D.mapEffects(et(o.effects),l))}return{changes:r,selection:T.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof de?t:de.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return h.of(t.split(this.facet(e.lineSeparator)||ce))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Fe(this,t),Ie(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Ee&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:T.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ne.resolve(t.extensions||[],new Map),r=t.doc instanceof h?t.doc:h.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||ce)),i=t.selection?t.selection instanceof T?t.selection:T.single(t.selection.anchor,t.selection.head):T.single(0);return ve(i,r.length),n.staticFacet(Re)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`\n`}get readOnly(){return this.facet(Ue)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Le))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return it(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=S(t,a,!1);if(i(t.slice(e,a))!=k.Word)break;a=e}for(;o<r;){let e=S(t,o);if(i(t.slice(o,e))!=k.Word)break;o=e}return a==o?null:T.range(a+n,o+n)}};A.allowMultipleSelections=Re,A.tabSize=E.define({combine:e=>e.length?e[0]:4}),A.lineSeparator=ze,A.readOnly=Ue,A.phrases=E.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),A.languageData=Le,A.changeFilter=Be,A.transactionFilter=Ve,A.transactionExtender=He,je.reconfigure=D.define();function at(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var ot=class{eq(e){return this==e}range(e,t=e){return ct.create(e,t,this)}};ot.prototype.startSide=ot.prototype.endSide=0,ot.prototype.point=!1,ot.prototype.mapMode=le.TrackDel;function st(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var ct=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function lt(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var ut=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return dt(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},j=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(lt)),this.isEmpty)return n.length?e.of(n):this;let s=new ht(this,null,-1).goto(0),c=0,l=[],u=new pt;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value,!1)||l.push(ct.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1,a,o=(e,t,n)=>{a||=new pt,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[dt(r)+dt(n).length,dt(dt(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return gt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return gt.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=mt(a,o,n),c=new vt(a,s,i),l=new vt(o,s,i);n.iterGaps((e,t,n)=>yt(c,e,l,t,n,r)),n.empty&&n.length==0&&yt(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=mt(i,a),s=new vt(i,o,0).goto(n),c=new vt(a,o,0).goto(n);for(;;){if(s.to!=c.to||!bt(s.active,c.active)||s.point&&(!c.point||!st(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new vt(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new pt;for(let r of e instanceof ct?[e]:t?ft(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=dt(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};j.empty=new j([],[],null,-1);function dt(e){return e[e.length-1]}function ft(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(lt(t,r)>0)return e.slice().sort(lt);t=r}return e}j.empty.nextLayer=j.empty;var pt=class e{finishChunk(e){this.chunks.push(new ut(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error(\"Ranges must be added sorted by `from` position and `startSide`\");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(j.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function mt(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var ht=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},gt=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new ht(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)_t(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)_t(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),_t(this.heap,0)}}};function _t(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var vt=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xt(this.active,e),xt(this.activeTo,e),xt(this.activeRank,e),this.minActive=Ct(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;St(this.active,t,n),St(this.activeTo,t,r),St(this.activeRank,t,i),e&&St(e,t,this.cursor.from),this.minActive=Ct(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&xt(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function yt(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&st(e.point,n.point)&&bt(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!bt(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function bt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!st(e[n],t[n]))return!1;return!0}function xt(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function St(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Ct(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function wt(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=S(e,i));return r}function Tt(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=S(e,r)}return r===!0?-1:e.length}for(var Et=`ͼ`,Dt=typeof Symbol>`u`?`__ͼ`:Symbol.for(Et),Ot=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),kt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},At=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\\s*/)}function i(e,t,a,o){let s=[],c=/^@(\\w+)\\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let e=kt[Dt]||1;return kt[Dt]=e+1,Et+e.toString(36)}static mount(e,t,n){let r=e[Ot],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Mt(e,i),r.mount(Array.isArray(t)?t:[t],e)}},jt=new Map,Mt=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=jt.get(n);if(t)return e[Ot]=t;this.sheet=new r.CSSStyleSheet,jt.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Ot]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`\n`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},Nt={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:\"`\",219:`[`,220:`\\\\`,221:`]`,222:`'`},Pt={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`\"`},Ft=typeof navigator<`u`&&/Mac/.test(navigator.platform),It=typeof navigator<`u`&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent),M=0;M<10;M++)Nt[48+M]=Nt[96+M]=String(M);for(var M=1;M<=24;M++)Nt[M+111]=`F`+M;for(var M=65;M<=90;M++)Nt[M]=String.fromCharCode(M+32),Pt[M]=String.fromCharCode(M);for(var Lt in Nt)Pt.hasOwnProperty(Lt)||(Pt[Lt]=Nt[Lt]);function Rt(e){var t=!(Ft&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||It&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Pt:Nt)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function N(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)zt(e,arguments[t]);return e}function zt(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)zt(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var P=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Bt=typeof document<`u`?document:{documentElement:{style:{}}},Vt=/Edge\\/(\\d+)/.exec(P.userAgent),Ht=/MSIE \\d/.test(P.userAgent),Ut=/Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(P.userAgent),Wt=!!(Ht||Ut||Vt),Gt=!Wt&&/gecko\\/(\\d+)/i.test(P.userAgent),Kt=!Wt&&/Chrome\\/(\\d+)/.exec(P.userAgent),qt=`webkitFontSmoothing`in Bt.documentElement.style,Jt=!Wt&&/Apple Computer/.test(P.vendor),Yt=Jt&&(/Mobile\\/\\w+/.test(P.userAgent)||P.maxTouchPoints>2),F={mac:Yt||/Mac/.test(P.platform),windows:/Win/.test(P.platform),linux:/Linux|X11/.test(P.platform),ie:Wt,ie_version:Ht?Bt.documentMode||6:Ut?+Ut[1]:Vt?+Vt[1]:0,gecko:Gt,gecko_version:Gt?+(/Firefox\\/(\\d+)/.exec(P.userAgent)||[0,0])[1]:0,chrome:!!Kt,chrome_version:Kt?+Kt[1]:0,ios:Yt,android:/Android\\b/.test(P.userAgent),webkit:qt,webkit_version:qt?+(/\\bAppleWebKit\\/(\\d+)/.exec(P.userAgent)||[0,0])[1]:0,safari:Jt,safari_version:Jt?+(/\\bVersion\\/(\\d+(\\.\\d+)?)/.exec(P.userAgent)||[0,0])[1]:0,tabSize:Bt.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Xt(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Zt=Object.create(null);function Qt(e,t,n){if(e==t)return!0;e||=Zt,t||=Zt;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function $t(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function en(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function tn(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var nn=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},I=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(I||={}),L=class extends ot{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new rn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new on(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=sn(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new on(e,n,r,t,e.widget||null,!0)}static line(e){return new an(e)}static set(e,t=!1){return j.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};L.none=j.empty;var rn=class e extends L{constructor(e){let{start:t,end:n}=sn(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Xt(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Zt}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Qt(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};rn.prototype.point=!1;var an=class e extends L{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Qt(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};an.prototype.mapMode=le.TrackBefore,an.prototype.point=!0;var on=class e extends L{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?le.TrackBefore:le.TrackAfter:le.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?I.WidgetBefore:I.WidgetAfter:I.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&cn(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};on.prototype.point=!0;function sn(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function cn(e,t){return e==t||!!(e&&t&&e.compare(t))}function ln(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var un=class e extends ot{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Qt(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Zt,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return j.of(e,t)}};un.prototype.startSide=un.prototype.endSide=-1;var R=e=>e.nodeType==1,dn=e=>e.nodeType==3;function fn(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function pn(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function mn(e,t){if(!t.anchorNode)return!1;try{return pn(e,t.anchorNode)}catch{return!1}}function hn(e){return dn(e)?Mn(e,0,e.nodeValue.length).getClientRects():R(e)?e.getClientRects():[]}function gn(e,t,n,r){return n?yn(e,t,n,r,-1)||yn(e,t,n,r,1):!1}function _n(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function vn(e){return R(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(e.nodeName)}function yn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:bn(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!R(n))return!1;t=_n(e)+(i<0?0:1),e=n}else if(R(e)){if(e=e.childNodes[t+(i<0?-1:0)],R(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?bn(e):0}else return!1}}function bn(e){return dn(e)?e.nodeValue.length:e.childNodes.length}function xn(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Sn(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Cn(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function wn(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(R(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=Sn(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=Cn(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Tn(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(R(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var En=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?bn(t):0),n,Math.min(e.focusOffset,n?bn(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Dn(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)R(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function On(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var kn=null;F.safari&&F.safari_version>=26&&(kn=!1);function An(e){if(e.setActive)return e.setActive();if(kn)return e.focus(kn);let t=Dn(e);e.focus(kn==null?{get preventScroll(){return kn={preventScroll:!0},!0}}:void 0),kn||(kn=!1,On(t))}var jn;function Mn(e,t,n=t){let r=jn||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function Nn(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Pn(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Fn(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,bn(n));;)if(r){if(!R(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=bn(n))}else if(n==e)return!0;else r=_n(n),n=n.parentNode}function In(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Ln(e,t){for(let n=e,r=t;;)if(dn(n)&&r>0)return{node:n,offset:r};else if(R(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=bn(n)}else if(n.parentNode&&!vn(n))r=_n(n),n=n.parentNode;else return null}function Rn(e,t){for(let n=e,r=t;;)if(dn(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(R(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!vn(n))r=_n(n)+1,n=n.parentNode;else return null}var zn=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,_n(t),n)}static after(t,n){return new e(t.parentNode,_n(t)+1,n)}},z=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(z||={}),Bn=z.LTR,Vn=z.RTL;function Hn(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var Un=Hn(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Wn=Hn(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),Gn=Object.create(null),Kn=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Gn[t]=n,Gn[n]=-t}function qn(e){return e<=247?Un[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Wn[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Jn=/[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/,Yn=class{get dir(){return this.level%2?Vn:Bn}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function Xn(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Xn(r.inner,i.inner))return!1}return!0}var B=[];function Zn(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=qn(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),B[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=B[e];if(i==128)e<s-1&&t==B[e+1]&&t&24?i=B[e]=t:B[e]=256;else if(i==64){let i=e+1;for(;i<s&&B[i]==64;)i++;let a=e&&t==8||i<n&&B[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)B[t]=a;e=i-1}else i==8&&r==1&&(B[e]=1);t=i,i&7&&(r=i)}}}function Qn(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=Gn[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(Kn[e+1]==-r){let n=Kn[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(B[t]=B[Kn[e]]=r),s=e;break}}else if(Kn.length==189)break;else Kn[s++]=t,Kn[s++]=n,Kn[s++]=c}else if((o=B[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Kn[t+2];if(n&2)break;if(e)Kn[t+2]|=2;else{if(n&4)break;Kn[t+2]|=4}}}}}function $n(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=B[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(B[o]==256)o++;else break;let l=a==1,u=l==((o<t?B[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),B[--t]=u;c=o}else a=o,c++}}}function er(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=B[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(B[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Yn(c,m.from,f)),tr(e,m.direction==Bn==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?B[p]!=s:B[p]==s))break;else p++;d?er(e,c,p,r+1,i,d,o):c<p&&o.push(new Yn(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=B[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(B[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Yn(m.to,c,f)),tr(e,m.direction==Bn==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?B[p-1]!=s:B[p-1]==s))break;else p--;d?er(e,p,c,r+1,i,d,o):p<c&&o.push(new Yn(p,c,f)),c=p}}function tr(e,t,n,r,i,a,o){let s=t%2?2:1;Zn(e,i,a,r,s),Qn(e,i,a,r,s),$n(i,a,r,s),er(e,i,a,t,n,r,o)}function nr(e,t,n){if(!e)return[new Yn(0,0,+(t==Vn))];if(t==Bn&&!n.length&&!Jn.test(e))return rr(e.length);if(n.length)for(;e.length>B.length;)B[B.length]=256;let r=[],i=t==Bn?0:1;return tr(e,i,i,n,0,e.length,r),r}function rr(e){return[new Yn(0,e,0)]}var ir=``;function ar(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=Yn.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=S(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),ir=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?T.cursor(e.to,1):T.cursor(e.from,-1);if(u.level+ +!i<s.level)return T.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return T.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function or(e,t,n){for(let r=t;r<n;r++){let t=qn(e.charCodeAt(r));if(t==1)return Bn;if(t==2||t==4)return Vn}}var sr=E.define(),cr=E.define(),lr=E.define(),ur=E.define(),dr=E.define(),fr=E.define(),pr=E.define(),mr=E.define(),hr=E.define(),gr=E.define({combine:e=>e.some(e=>e)}),_r=E.define({combine:e=>e.some(e=>e)}),vr=E.define(),yr=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(T.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},br=D.define({map:(e,t)=>e.map(t)}),xr=D.define();function Sr(e,t,n){let r=e.facet(ur);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var Cr=E.define({combine:e=>!e.length||e[0]}),wr=0,Tr=E.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),V=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Tr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Tr.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(wr++,t,r,i,e=>{let t=[];return o&&t.push(kr.of(t=>{let n=t.plugin(e);return n?o(n):L.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Er=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Sr(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Sr(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Sr(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Dr=E.define(),Or=E.define(),kr=E.define(),Ar=E.define(),jr=E.define(),Mr=E.define(),Nr=E.define();function Pr(e,t){let n=e.state.facet(Nr);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return j.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),Fr(t.text,i)}function Fr(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=or(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=z.LTR}Fr(e,n.inner)}return t}var Ir=E.define();function Lr(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(Ir)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var Rr=E.define(),zr=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},Br=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=de.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new zr(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Vr=[],H=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Vr}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&$t(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=_n(this.dom),r=this.length?e>0:t>0;return new zn(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Wr)return e;return null}static get(e){return e.cmTile}},Hr=class extends H{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=Ur(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=Ur(r);this.length=a}};function Ur(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Wr=class extends Hr{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=H.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof Gr)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},Gr=class e extends Hr{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Kr=class e extends Hr{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return n&&r||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&Jr(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):qr(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new zn(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new zn(e.dom,0);e==n.tile&&(a=!0)}}return new zn(this.dom,0)}};function qr(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=hn(t);return n[n.length-1]||null}function Jr(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var Yr=class e extends Hr{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Xr=class e extends H{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?F.chrome||F.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=Mn(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return F.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:xn(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Zr=class e extends H{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return xn(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return xn(n,!r)}}get overrideDOMText(){if(!this.length)return h.empty;let{root:e}=this;if(!e)return h.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Qr=class extends H{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return h.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:xn(r,t>0==n)}},$r=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},ei=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},ti=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new Xr(a.dom,a.text+e);t.parent=i}else i.append(r||Xr.of(e,this.cache.find(Xr)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?di(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Yr&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(di(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&H.get(n.dom)&&(e=di(n.dom));let t=Yr.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=H.get(e.text);i&&this.cache.reused.set(i,2);let a=new Xr(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=ci;let n=Kr.start(e,t||this.cache.find(Kr)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof Yr&&a.mark.eq(i))n=a,t--;else{let e=Yr.of(i,this.cache.find(Yr,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!oi(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(F.ios&&oi(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(pi,0,32)||new Zr(pi.toDOM(),0,pi,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new ei(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof Gr&&n.wrapper.eq(t.wrapper))e=n;else{let n=Gr.of(t.wrapper,this.cache.find(Gr,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Qr,void 0,1);return n&&(n.flags=t),n||new Qr(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},ni=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},ri=[Zr,Kr,Xr,Yr,Qr,Gr,Wr];for(let e=0;e<ri.length;e++)ri[e].bucket=e;var ii=class{constructor(e){this.view=e,this.buckets=ri.map(()=>[]),this.index=ri.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Zr(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},ai=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new ii(e),this.text=new ni(e.state.doc),this.builder=new ti(this.cache,new Wr(e,e.contentDOM),j.iter(n)),this.cache.reused.set(t,2),this.old=new $r(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=ui(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Zr.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Qr)this.cache.add(e);else if(e instanceof Yr)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Yr&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof Yr&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=j.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof on){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?fi.block:fi.inline),c=si(a),l=this.cache.findWidget(i,t-e,c)||Zr.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=li(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=H.get(r);if(r==this.view.contentDOM)break;e instanceof Yr?t.push(e):e?.isLine()?n=e:e instanceof Gr||(r.nodeName==`DIV`&&!n?n=new Kr(r,ci):n||t.push(Yr.of(new rn({tagName:r.nodeName.toLowerCase(),attributes:tn(r)}),r)))}return n?{line:n,marks:t}:null}};function oi(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function si(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var ci={class:`cm-line`};function li(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&Xt(n,e),r&&(e.class+=` `+r)),e}function ui(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Yr&&t.push(r.mark)}return t}function di(e){let t=H.get(e);return t&&t.setDOM(e.cloneNode()),e}var fi=class extends nn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};fi.inline=new fi(`span`),fi.block=new fi(`div`);var pi=new class extends nn{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},mi=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=L.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Wr(e,e.contentDOM),this.updateInner([new zr(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Ti(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?vi(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new zr(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(F.ie||F.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=xi(i,this.decorations,e.changes);o.length&&(t=zr.extendWithRanges(t,o));let s=Ci(a,this.blockWrappers,e.changes);return s.length&&(t=zr.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new ai(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&H.get(t.text)&&r.cache.reused.set(H.get(t.text),2),this.tile=r.run(e,t),hi(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=F.chrome||F.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Ei&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(xr)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(Cr)||n.tabIndex>-1)&&mn(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),F.gecko&&s.empty&&!this.hasComposition&&gi(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new zn(e,0),o=!0}let u=this.view.observer.selectionRange;!o&&u.focusNode&&(gn(c.node,c.offset,u.anchorNode,u.anchorOffset)&&gn(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore(()=>{F.android&&F.chrome&&n.contains(u.focusNode)&&wi(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=fn(this.view.root);if(e){if(s.empty){if(F.gecko){let e=yi(c.node,c.offset);if(e&&e!=3){let t=(e==1?Ln:Rn)(c.node,c.offset);t&&(c=new zn(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new zn(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new zn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&gn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=fn(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=bn(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!H.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Ei?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=S(e.text,t);if(n==t)return null;let r=Mn(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==z.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof Gr)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?hn(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?z.RTL:z.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=hn(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=hn(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(L.replace({widget:new Ei(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return L.set(e)}updateDeco(){let e=1,t=this.view.state.facet(kr).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(jr).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(j.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Ar).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(vr))try{if(t(this.view,e.range,e))return!0}catch(e){Sr(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Lr(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(wn(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==z.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=Dn(e.dom);e.dom.scrollIntoView({block:`nearest`}),On(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){hi(this.tile)}};function hi(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)hi(n,t)}}function gi(e){return R(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function _i(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Ln(n.focusNode,n.focusOffset),i=Rn(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=H.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=H.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function vi(e,t,n){let r=_i(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\\n\\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new zr(c.mapPos(a),c.mapPos(o),a,o),text:i}}function yi(e,t){return R(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var bi=class{constructor(){this.changes=[]}compareRange(e,t){ln(e,t,this.changes)}comparePoint(e,t){ln(e,t,this.changes)}boundChange(e){ln(e,e,this.changes)}};function xi(e,t,n){let r=new bi;return j.compare(e,t,n,r),r.changes}var Si=class{constructor(){this.changes=[]}compareRange(e,t){ln(e,t,this.changes)}comparePoint(){}boundChange(e){ln(e,e,this.changes)}};function Ci(e,t,n){let r=new Si;return j.compare(e,t,n,r),r.changes}function wi(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(R(n)&&n.contentEditable==`false`)return!0;return!1}function Ti(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Ei=class extends nn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Di(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return T.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=S(i.text,a,!1):s=S(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=S(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=S(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return T.undirectionalRange(o+i.from,s+i.from)}function Oi(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Tt(o,a,e.state.tabSize)}function ki(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==I.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function Ai(e,t,n,r){let i=ki(e,t.head,t.assoc||-1),a=!r||i.type!=I.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==z.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return T.cursor(o.pos,o.assoc)}return T.cursor(n?i.to:i.from,n?1:-1)}function ji(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=ar(i,a,o,s,n),l=ir;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`\n`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?T.cursor(i.from,-1):T.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Mi(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==k.Space&&(i=t),i==t}}function Ni(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return T.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=Ri(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return T.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return T.cursor(i.pos,i.assoc,void 0,o)}}function Pi(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function Fi(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=Pi(e,i.from,0);t!=i.from&&(a=T.cursor(t,-1))}else{let t=Pi(e,i.from,-1),n=Pi(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?T.undirectionalRange(i.from,i.to):T.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?T.create(n,t.mainIndex):t}function Ii(e,t,n){let r=Pi(e.state.facet(Mr).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:T.cursor(r,r<n.from?1:-1)}var Li=class{constructor(e,t){this.pos=e,this.assoc=t}};function Ri(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new Li(0,1);if(c>e.viewState.docHeight)return new Li(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==I.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==I.Text){let t=Oi(e,i,l,o,s);return new Li(t,t==l.from?1:-1)}}if(l.type!=I.Text)return c<(l.top+l.bottom)/2?new Li(l.from,1):new Li(l.to,-1);let u=e.docView.lineAt(l.from,2);return u&&u.length==l.length||(u=e.docView.lineAt(l.from,-2)),new zi(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var zi=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Yn.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Yn.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==z.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==z.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=S(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return Mn(e.dom,i,a).getClientRects()});return r.after?new Li(n[r.i+1],-1):new Li(n[r.i],1)}scanTile(e,t){if(!e.length)return new Li(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(R(n.dom)?n.dom:Mn(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Li(n[r.i+1],-1):new Li(a,1)}},Bi=``,Vi=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(A.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bi}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=H.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=H.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:vn(r))||vn(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Ui(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=H.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else dn(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():R(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(dn(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Hi(e,n.node,n.offset)?t:0))}};function Hi(e,t,n){for(;;){if(!t||n<bn(t))return!1;if(t==e)return!0;n=_n(t)+1,t=t.parentNode}}function Ui(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=H.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var Wi=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Gi=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Ki(e.docView.tile,t,n,0))){let t=i||a?[]:Zi(e),n=new Vi(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Qi(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!pn(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!pn(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((F.ios||F.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;a!=0&&a!=1&&t!=0||o!=0&&o!=-1&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(T.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=T.create([T.cursor(n,r)])}else this.newSel=T.single(r,n)}}};function Ki(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return Ki(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function qi(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||F.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,Bi),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:h.of(t.text.slice(a.from-e,u).split(Bi))}:(d=Xi(l,t.text,s-e,c))&&(F.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==``&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:h.of(t.text.slice(d.from,d.toB).split(Bi))})}else r&&(!e.hasFocus&&i.facet(Cr)||$i(r,a))&&(r=null);if(!n&&!r)return!1;if((F.mac||F.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=T.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:h.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:F.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`\n `&&e.lineWrapping&&(r&&=T.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:h.of([` `])}),n)return Ji(e,n,r,o);if(r&&!$i(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=Fi(i.facet(Mr).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Ji(e,t,n,r=-1){if(F.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(F.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&Nn(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&Nn(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Nn(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Yi(e,t,n);return e.state.facet(fr).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Yi(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=Pi(i.facet(Mr).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:T.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&_i(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?T.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function Xi(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function Zi(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new Wi(n,r)),(i!=n||a!=r)&&t.push(new Wi(i,a))),t}function Qi(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?T.create([T.cursor(r+t,-1)]):T.single(n+t,r+t)}function $i(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var ea=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=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.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,F.safari&&e.contentDOM.addEventListener(`input`,()=>null),F.gecko&&Ia(e.contentDOM.ownerDocument)}handleEvent(e){ma(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ra(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,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&&oa.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),F.android&&F.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(F.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(ia.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||aa.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&F.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ta(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Nn(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:F.safari&&!F.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!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 ta(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function na(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Sr(n.state,e)}}}function ra(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(na(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(na(t.value,r))}}for(let e in ha)n(e).handlers.push(ha[e]);for(let e in U)n(e).observers.push(U[e]);return t}var ia=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],aa=`dthko`,oa=[16,17,18,20,91,92,224,225],sa=6;function ca(e){return Math.max(0,e)*.7+8}function la(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var ua=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Tn(e.contentDOM),this.atoms=e.state.facet(Mr).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(A.allowMultipleSelections)&&da(e,t),this.dragging=pa(e,t)&&Ta(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&&la(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Lr(this.view);e.clientX-s.left<=r+sa?t=-ca(r-e.clientX):e.clientX+s.right>=a-sa&&(t=ca(e.clientX-a)),e.clientY-s.top<=i+sa?n=-ca(i-e.clientY):e.clientY+s.bottom>=o-sa&&(n=ca(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??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)}select(e){let{view:t}=this,n=Fi(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function da(e,t){let n=e.state.facet(sr);return n.length?n[0](t):F.mac?t.metaKey:t.ctrlKey}function fa(e,t){let n=e.state.facet(cr);return n.length?n[0](t):F.mac?!t.altKey:!t.ctrlKey}function pa(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=fn(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function ma(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=H.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var ha=Object.create(null),U=Object.create(null),ga=F.ie&&F.ie_version<15||F.ios&&F.webkit_version<604;function _a(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),ya(e,n.value)},50)}function va(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function ya(e,t){t=va(e.state,mr,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(ja!=null&&n.selection.ranges.every(e=>e.empty)&&ja==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:T.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:T.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}U.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,F.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},U.wheel=U.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ha.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),U.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},U.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},U.touchend=(e,t)=>{e.inputState.touchActive=!1},ha.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(lr))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Ea(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ua(e,t,n,r)),r&&e.observer.ignore(()=>{An(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function ba(e,t,n,r){if(r==1)return T.cursor(t,n);if(r==2)return Di(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,T.undirectionalRange(a,o)}}var xa=F.ie&&F.ie_version<=11,Sa=null,Ca=0,wa=0;function Ta(e){if(!xa)return e.detail;let t=Sa,n=wa;return Sa=e,wa=Date.now(),Ca=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Ca+1)%3:1}function Ea(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Ta(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=ba(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=ba(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?T.range(i,a,l.assoc):T.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=Da(i,s.pos))?c:o?i.addRange(l):T.create([l])}}}function Da(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return T.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}ha.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=T.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,va(e.state,hr,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},ha.dragend=e=>(e.inputState.draggedContent=null,!1);function Oa(e,t,n,r){if(n=va(e.state,mr,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&fa(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}ha.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&Oa(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return Oa(e,t,n,!0),!0}return!1},ha.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ga?null:t.clipboardData;return n?(ya(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(_a(e),!1)};function ka(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function Aa(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:va(e,hr,t.join(e.lineBreak)),ranges:n,linewise:r}}var ja=null;ha.copy=ha.cut=(e,t)=>{if(!mn(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Aa(e.state);if(!n&&!i)return!1;ja=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=ga?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(ka(e,n),!1)};var Ma=We.define();function Na(e,t){let n=[];for(let r of e.facet(pr)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Ma.of(!0)}):null}function Pa(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Na(e.state,t);n?e.dispatch(n):e.update([])}},10)}U.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Pa(e)},U.blur=e=>{e.observer.clearSelectionRange(),Pa(e)},U.compositionstart=U.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},U.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,F.chrome&&F.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},U.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ha.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return Ji(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(F.chrome&&F.android&&(n=ia.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return F.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),F.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>U.compositionend(e,t),20),!1};var Fa=new Set;function Ia(e){Fa.has(e)||(Fa.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var La=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Ra=!1;function za(){Ra=!1}var Ba=class{constructor(e){this.lineWrapping=e,this.doc=h.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return La.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=La.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},Va=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Ha=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?I.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof on?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},W=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(W||={}),Ua=.001,Wa=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ua&&(Ra=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,W.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,W.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,W.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=$a.build(n.setDoc(a),e,l,u);i=Ga(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new Ja(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Xa(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function Ga(e,t){return e==t?e:(e.constructor!=t.constructor&&(Ra=!0),t)}Wa.prototype.size=1;var Ka=L.replace({}),qa=class extends Wa{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Ha(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Ha(r,0,n,this.spaceAbove,Ka):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,W.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ja=class e extends qa{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Ha(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Ya&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ya?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Wa.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,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:``})`}},Ya=class e extends Wa{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new Ha(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new Ha(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==W.ByHeight)return this.blockAt(e,n,r,i);if(t==W.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Ha(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new Ha(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new Ha(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return Wa.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=Ua&&(s=-2);let c=new Ja(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Wa.of(r);return(s<0||Math.abs(c.height-this.height)>=Ua||Math.abs(s-this.heightMetrics(t,n).perLine)>=Ua)&&(Ra=!0),Ga(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Xa=class extends Wa{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==W.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==W.ByPosNoHeight?W.ByPosNoHeight:W.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,W.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&Za(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Za(i,e)}return Wa.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Wa.of(this.break?[e,null,t]:[e,t]):(this.left=Ga(this.left,e),this.right=Ga(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,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function Za(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Ya&&(r=e[t+1])instanceof Ya&&e.splice(t-1,3,new Ya(n.length+1+r.length))}var Qa=5,$a=class e{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 e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ja?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ja(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new qa(a,r,n)):(a||i||r>=Qa)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ja(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ya(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ja)return e;let t=new Ja(0,-1,0);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+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ja)&&!this.isCovered?this.nodes.push(new Ja(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof Ja&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return j.spans(n,r,i,a,0),a.finish(r)}};function eo(e,t,n){let r=new to;return j.compare(e,t,n,r,0),r.changes}var to=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&ln(e,t,this.changes,5)}};function no(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(R(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function ro(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function io(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var ao=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return L.replace({widget:new oo(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},oo=class extends nn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},so=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=mo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=z.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Or).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Ba(n),this.stateDeco=ho(t),this.heightMap=Wa.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle.setDoc(t.doc),[new zr(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=L.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new co(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?mo:go.get(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(_o(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ho(this.state);let r=e.changedRanges,i=zr.extendWithRanges(r,eo(n,this.stateDeco,e?e.changes:de.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);za(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Ra)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_r)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?z.RTL:z.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Cn(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=Tn(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=In(this.scrollParent||e.win);let m=(this.printing?io:no)(t,this.paddingTop),g=m.top-this.pixelViewport.top,_=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(s=!0)),!this.inView&&!this.scrollTarget&&!ro(e.dom))return 0;let y=o.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,y/o),t),a&&(e.docView.minWidth=0,c|=16)}g>0&&_>0?l=Math.max(g,_):g<0&&_<0&&(l=Math.min(g,_)),za();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Wa.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle,[new zr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Va(n.from,i))}Ra&&(c|=2)}let ee=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return ee&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||ee)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new co(r.lineAt(a-n*1e3,W.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,W.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,W.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new co(r.lineAt(o-500,W.ByHeight,i,0,0).from,r.lineAt(o+n+500,W.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new co(this.heightMap.lineAt(n,W.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,W.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,W.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,W.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new ao(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=z.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=po(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(T.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new ao(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=I.Text)return;let i=lo(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=fo(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=uo(i,n),l=uo(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=fo(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=uo(i,f),l=uo(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=fo(r,n)-fo(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){ao.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=L.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];j.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||_o(this.heightMap.lineAt(e,W.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)||_o(this.heightMap.lineAt(this.scaler.fromDOM(e),W.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return _o(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}},co=class{constructor(e,t){this.from=e,this.to=t}};function lo(e,t,n){let r=[],i=e,a=0;return j.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function uo({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function fo(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function po(e,t){for(let n of e)if(t(n))return n}var mo={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function ho(e){let t=e.facet(kr).filter(e=>typeof e!=`function`),n=e.facet(jr).filter(e=>typeof e!=`function`);return n.length&&t.push(j.join(n)),t}var go=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,W.ByPos,t,0,0).top,o=n.lineAt(r,W.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return mo;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function _o(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Ha(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>_o(e,t)):e._content)}var vo=E.define({combine:e=>e.join(` `)}),yo=E.define({combine:e=>e.indexOf(!0)>-1}),bo=At.newName(),xo=At.newName(),So=At.newName(),Co={\"&light\":`.`+xo,\"&dark\":`.`+So};function wo(e,t,n){return new At(t,{finish(t){return/&/.test(t)?t.replace(/&\\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var To=wo(`.`+bo,{\"&\":{position:`relative !important`,boxSizing:`border-box`,\"&.cm-focused\":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},\".cm-scroller\":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},\".cm-content\":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,\"&[contenteditable=true]\":{WebkitUserModify:`read-write-plaintext-only`}},\".cm-lineWrapping\":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},\"&light .cm-content\":{caretColor:`black`},\"&dark .cm-content\":{caretColor:`white`},\".cm-line\":{display:`block`,padding:`0 2px 0 6px`},\".cm-layer\":{userSelect:`none`,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:`#ddd`},\".cm-selectionHandle\":{backgroundColor:`currentColor`,width:`1.5px`},\".cm-selectionHandle-start::before, .cm-selectionHandle-end::before\":{content:`\"\"`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},\".cm-selectionHandle-start::before\":{top:`-8px`},\".cm-selectionHandle-end::before\":{bottom:`-8px`},\".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`,zIndex:200},\".cm-gutters-before\":{insetInlineStart:0},\".cm-gutters-after\":{insetInlineEnd:0},\"&light .cm-gutters\":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,\"&.cm-gutters-before\":{borderRightWidth:`1px`},\"&.cm-gutters-after\":{borderLeftWidth:`1px`}},\"&dark .cm-gutters\":{backgroundColor:`#333338`,color:`#ccc`},\".cm-gutter\":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},\".cm-gutterElement\":{boxSizing:`border-box`},\".cm-lineNumbers .cm-gutterElement\":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},\"&light .cm-activeLineGutter\":{backgroundColor:`#e2f2ff`},\"&dark .cm-activeLineGutter\":{backgroundColor:`#222227`},\".cm-panels\":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},\"&light .cm-panels\":{backgroundColor:`#f5f5f5`,color:`black`},\".cm-panels-top\":{top:`0`},\".cm-panels-bottom\":{bottom:`0`},\"&light .cm-panels-top\":{borderBottom:`1px solid #ddd`},\"&light .cm-panels-bottom\":{borderTop:`1px solid #ddd`},\"&dark .cm-panels\":{backgroundColor:`#333338`,color:`white`},\".cm-dialog\":{padding:`2px 19px 4px 6px`,position:`relative`,\"& label\":{fontSize:`80%`}},\".cm-dialog-close\":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},\".cm-tab\":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},\".cm-widgetBuffer\":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},\".cm-placeholder\":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},\".cm-highlightSpace\":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},\".cm-highlightTab\":{backgroundImage:`url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"20\"><path stroke=\"%23888\" stroke-width=\"1\" fill=\"none\" d=\"M1 10H196L190 5M190 15L196 10M197 4L197 16\"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},\".cm-trailingSpace\":{backgroundColor:`#ff332255`},\".cm-button\":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},\"&light .cm-button\":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,\"&:active\":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},\"&dark .cm-button\":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,\"&:active\":{backgroundImage:`linear-gradient(#111, #333)`}},\".cm-textfield\":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},\"&light .cm-textfield\":{backgroundColor:`white`},\"&dark .cm-textfield\":{border:`1px solid #555`,backgroundColor:`inherit`}},Co),Eo={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Do=F.ie&&F.ie_version<=11,Oo=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new En,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 e of t)this.queue.push(e);(F.ie&&F.ie_version<=11||F.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&F.android&&e.constructor.EDIT_CONTEXT!==!1&&!(F.chrome&&F.chrome_version<126)&&(this.editContext=new Mo(e),e.state.facet(Cr)&&(e.contentDOM.editContext=this.editContext.editContext)),Do&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),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,n)=>t!=e[n]))){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:n}=this,r=this.selectionRange;if(n.state.facet(Cr)?n.root.activeElement!=this.dom:!mn(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(F.ie&&F.ie_version<=11||F.android&&F.chrome)&&!n.state.selection.main.empty&&r.focusNode&&gn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=fn(e.root);if(!t)return!1;let n=F.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&jo(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=mn(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Fn(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(R(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,Eo),Do&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Do&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Nn(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&e!=`Enter`||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&mn(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Gi(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=qi(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=ko(t,e.previousSibling||e.target.previousSibling,-1),r=ko(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}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(Cr)!=e.state.facet(Cr)&&(e.view.contentDOM.editContext=e.state.facet(Cr)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.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 ko(e,t,n){for(;t;){let r=H.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function Ao(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return gn(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function jo(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ao(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?Ao(e,n):null}var Mo=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=Xi(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=T.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));$i(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:h.of(n.text.slice(l.from,l.toB).split(`\n`))};if((F.mac||F.android)&&u.from==a-1&&/^\\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:h.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Ji(e,u,T.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\\\p{Alphabetic}\\\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(L.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:xr.of(L.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=fn(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},G=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,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&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Pn(e.parent)||document,this.viewState=new so(this,e.state||A.create(e)),e.scrollTo&&e.scrollTo.is(br)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(e=>new Er(e));for(let e of this.plugins)e.update(this);this.observer=new Oo(this),this.inputState=new ea(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mi(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof O?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Ma))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Na(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(A.phrases)!=this.state.facet(A.phrases))return this.setState(a);i=Br.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new yr(t.empty?t:T.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(br)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Fo.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Rr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(vo)!=i.state.facet(vo)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(dr))try{e(i)}catch(e){Sr(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!qi(this,u)&&l.force&&Nn(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw 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 e of this.plugins)e.destroy(this);this.viewState=new so(this,e),this.plugins=e.facet(Tr).map(e=>new Er(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new mi(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(Tr),n=e.state.facet(Tr);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Er(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Sr(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(In(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return Sr(this.state,e),Po}}),u=Br.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=Po)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){Sr(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(F.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(dr))e(t)}get themeClasses(){return bo+` `+(this.state.facet(yo)?So:xo)+` `+this.state.facet(vo)}updateAttrs(){let e=Io(this,Dr,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(Cr)?`true`:`false`,class:`cm-content`,style:`${F.tabSize}: ${this.state.tabSize}`,role:`textbox`,\"aria-multiline\":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Io(this,Or,t);let n=this.observer.ignore(()=>{let n=en(this.contentDOM,this.contentAttrs,t),r=en(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Rr);let t=this.state.facet(e.cspNonce);At.mount(this.root,this.styleModules.concat(To).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==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,n){return Ii(this,e,ji(this,e,t,n))}moveByGroup(e,t){return Ii(this,e,ji(this,e,t,t=>Mi(this,e.head,t)))}visualLineSide(e,t){return t?T.cursor(e.to,1):T.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return Ai(this,e,t,n)}moveVertically(e,t,n){return Ii(this,e,Ni(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Ri(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Ri(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[Yn.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==z.RTL)}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(gr)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>No)return rr(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Xn(r.isolates,n=Pr(this,e))))return r.order;n||=Pr(this,e);let r=nr(e.text,t,n);return this.bidiCache.push(new Fo(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||F.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{An(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.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return br.of(new yr(typeof e==`number`?T.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return br.of(new yr(T.cursor(n.from),`start`,`start`,n.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 V.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return V.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=At.newName(),r=[vo.of(n),Rr.of(wo(`.${n}`,e))];return t&&t.dark&&r.push(yo.of(!0)),r}static baseTheme(e){return ke.lowest(Rr.of(wo(`.`+bo,e,Co)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&H.get(t)||H.get(e))?.root?.view||null}};G.styleModule=Rr,G.inputHandler=fr,G.clipboardInputFilter=mr,G.clipboardOutputFilter=hr,G.scrollHandler=vr,G.focusChangeEffect=pr,G.perLineTextDirection=gr,G.exceptionSink=ur,G.updateListener=dr,G.editable=Cr,G.mouseSelectionStyle=lr,G.dragMovesSelection=cr,G.clickAddsSelectionRange=sr,G.decorations=kr,G.blockWrappers=Ar,G.outerDecorations=jr,G.atomicRanges=Mr,G.bidiIsolatedRanges=Nr,G.cursorScrollMargin=E.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),G.scrollMargins=Ir,G.darkTheme=yo,G.cspNonce=E.define({combine:e=>e.length?e[0]:``}),G.contentAttributes=Or,G.editorAttributes=Dr,G.lineWrapping=G.contentAttributes.of({class:`cm-lineWrapping`}),G.announce=D.define();var No=4096,Po={},Fo=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:z.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Io(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&Xt(a,n)}return n}var Lo=F.mac?`mac`:F.windows?`win`:F.linux?`linux`:`key`;function Ro(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function zo(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var Bo=ke.default(G.domEventHandlers({keydown(e,t){return Yo(Uo(t.state),e,t,`editor`)}})),Vo=E.define({enables:Bo}),Ho=new WeakMap;function Uo(e){let t=e.facet(Vo),n=Ho.get(t);return n||Ho.set(t,n=qo(t.reduce((e,t)=>e.concat(t),[]))),n}function Wo(e,t,n){return Yo(Uo(e.state),t,e,n)}var Go=null,Ko=4e3;function qo(e,t=Lo){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>Ro(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Go={view:t,prefix:n,scope:e};return setTimeout(()=>{Go==r&&(Go=null)},Ko),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Jo))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var Jo=null;function Yo(e,t,n,r){Jo=t;let i=Rt(t),a=se(C(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Go&&Go.view==n&&Go.scope==r&&(o=Go.prefix+` `,oa.indexOf(t.keyCode)<0&&(c=!0,Go=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+zo(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(F.windows&&t.ctrlKey&&t.altKey)&&!(F.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Nt[t.keyCode])&&p!=i?(d(f[o+zo(p,t,!0)])||t.shiftKey&&(m=Pt[t.keyCode])!=i&&m!=p&&d(f[o+zo(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+zo(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Jo=null,s}var Xo=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(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(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Zo(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return $o(t,n,r)}};function Zo(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==z.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Qo(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function $o(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==z.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Zo(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=ki(e,r,1),m=ki(e,i,-1),h=p.type==I.Text?p:null,g=m.type==I.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=Qo(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=Qo(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):ee(p,!1),r=g?y(null,n.to,g):ee(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==I.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Xo(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==z.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function ee(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function es(e,t){return e.constructor==t.constructor&&e.eq(t)}var ts=class{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(ns)!=e.state.facet(ns)&&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,n=e.facet(ns);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!es(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,F.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},ns=E.define();function rs(e){return[V.define(t=>new ts(t,e)),ns.of(e)]}var is=!F.ios,as=E.define({combine(e){return at(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function os(e={}){return[as.of(e),cs,us,fs,_r.of(!0)]}function ss(e){return e.startState.facet(as)!=e.state.facet(as)}var cs=rs({above:!0,markers(e){let{state:t}=e,n=t.facet(as),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&F.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:T.cursor(i.head,i.assoc);for(let i of Xo.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=ss(e);return n&&ls(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){ls(t.state,e)},class:`cm-cursorLayer`});function ls(e,t){t.style.animationDuration=e.facet(as).cursorBlinkRate+`ms`}var us=rs({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(is||i!=n))for(let n of Xo.forRange(e,`cm-selectionBackground`,i))t.push(n);if(F.ios&&!n.empty&&e.state.facet(as).iosSelectionHandles){for(let r of Xo.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,T.cursor(n.from,1)))t.push(r);for(let r of Xo.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,T.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||ss(e)},class:`cm-selectionLayer`}),ds=F.gecko&&F.gecko_version==153?`#ffffff01`:`transparent`,fs=ke.highest(G.theme({\".cm-line\":{...is?{\"& ::selection, &::selection\":{backgroundColor:`${ds} !important`}}:{},caretColor:`transparent !important`},\".cm-content\":{caretColor:`transparent !important`,\"& :focus\":{caretColor:`initial !important`,...is?{\"&::selection, & ::selection\":{backgroundColor:`Highlight !important`}}:{}}}}));/x/.unicode;function ps(){return hs}var ms=L.line({class:`cm-activeLine`}),hs=V.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(ms.range(i.from)),t=i.from)}return L.set(n)}},{decorations:e=>e.decorations}),gs=class extends nn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?hn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=xn(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function _s(e){let t=V.fromClass(class{constructor(t){this.view=t,this.placeholder=e?L.set([L.widget({widget:new gs(e),side:1}).range(0)]):L.none}get decorations(){return this.view.state.doc.length?L.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,G.contentAttributes.of({\"aria-placeholder\":e})]:t}var vs=`-10000px`,ys=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function bs(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function xs(e){let{left:t,right:n}=bs(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Ss=E.define({combine:e=>({position:F.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||xs})}),Cs=new WeakMap,ws=V.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Ss);this.position=t.position,this.parent=t.parent,this.classes=e.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 ys(e,Os,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.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 e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Ss);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=vs,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(F.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=bs(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=Lr(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Ss).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=vs;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Cs.get(c)??d.bottom-d.top,g=c.offset||Ds,_=this.view.textDirection==z.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let ee=(y?u.top-n.top:n.bottom-u.bottom)-p;if(ee<h&&c.resize!==!1){if(ee<this.view.defaultLineHeight){l.style.top=vs;continue}Cs.set(c,h),l.style.height=(h=ee)/i+`px`}else l.style.height&&(l.style.height=``);let b=y?u.top-h-p-g.y:u.bottom+p+g.y,x=v+m;if(c.overlap!==!0)for(let e of a)e.left<x&&e.right>v&&e.top<b+h&&e.bottom>b&&(b=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(b-e.parent.top)/i+`px`,Ts(l,(v-e.parent.left)/r)):(l.style.top=b/i+`px`,Ts(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:b,right:x,bottom:b+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.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 e of this.manager.tooltipViews)e.dom.style.top=vs}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ts(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var Es=G.baseTheme({\".cm-tooltip\":{zIndex:500,boxSizing:`border-box`},\"&light .cm-tooltip\":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},\"&light .cm-tooltip-section:not(:first-child)\":{borderTop:`1px solid #bbb`},\"&dark .cm-tooltip\":{backgroundColor:`#333338`,color:`white`},\".cm-tooltip-arrow\":{height:`7px`,width:`14px`,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`}}}),Ds={x:0,y:0},Os=E.define({enables:[ws,Es]});function ks(e,t){let n=e.plugin(ws);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var As=E.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function js(e,t){let n=e.plugin(Ms),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var Ms=V.fromClass(class{constructor(e){this.input=e.state.facet(Fs),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(As);this.top=new Ns(e,!0,t.topContainer),this.bottom=new Ns(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(As);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ns(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ns(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Fs);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>G.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),Ns=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,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(),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`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Ps(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ps(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 Ps(e){let t=e.nextSibling;return e.remove(),t}var Fs=E.define({enables:Ms});function Is(e,t){let n,r=new Promise(e=>n=e),i=e=>Vs(e,t,n);e.state.field(Rs,!1)?e.dispatch({effects:zs.of(i)}):e.dispatch({effects:D.appendConfig.of(Rs.init(()=>[i]))});let a=Bs.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Rs).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function Ls(e,t){let n=e.state.field(Rs,!1)||[];for(let r of n){let n=js(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var Rs=Ee.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(zs)?e=[n.value].concat(e):n.is(Bs)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Fs.computeN([e],t=>t.field(e))}),zs=D.define(),Bs=D.define();function Vs(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=N(`form`),t.input){let e=N(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(N(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(N(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),s(null)):e.keyCode==13&&(e.preventDefault(),s(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),s(t)})}let a=N(`div`,r,N(`button`,{onclick:()=>s(null),\"aria-label\":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);let o=typeof t.focus==`string`?r.querySelector(t.focus):t.focus?r.querySelector(`input`)||r.querySelector(`button`):null;function s(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{o&&(`select`in o?o.select():`focus`in o&&o.focus())},destroy:()=>n(null)}}var Hs=class extends ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Hs.prototype.elementClass=``,Hs.prototype.toDOM=void 0,Hs.prototype.mapMode=le.TrackBefore,Hs.prototype.startSide=Hs.prototype.endSide=-1,Hs.prototype.point=!0;var Us=E.define(),Ws=E.define(),Gs=E.define(),Ks=E.define({combine:e=>e.some(e=>e)});function qs(e){let t=[Js];return e&&e.fixed===!1&&t.push(Ks.of(!0)),t}var Js=V.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(Gs).map(t=>new Qs(e,t)),this.fixed=!e.state.facet(Ks);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Ks)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=j.iter(this.view.state.facet(Us),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Zs(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==I.Text&&t){Xs(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==I.Text){Xs(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Gs),n=e.state.facet(Gs),r=e.docChanged||e.heightChanged||e.viewportChanged||!j.eq(e.startState.facet(Us),e.state.facet(Us),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new Qs(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>G.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==z.LTR?{left:r,right:i}:{right:r,left:i}})});function Ys(e){return Array.isArray(e)?e:[e]}function Xs(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var Zs=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=j.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new $s(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Xs(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;(r.length!=0||a.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(Ws)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Qs=class{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 n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=Ys(t.markers(e)),t.initialSpacer&&(this.spacer=new $s(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=Ys(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!j.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},$s=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),ec(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function ec(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var tc=E.define(),nc=E.define(),rc=E.define({combine(e){return at(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),ic=class extends Hs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function ac(e,t){return e.state.facet(rc).formatNumber(t,e.state)}var oc=Gs.compute([rc],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(tc)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new ic(ac(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(nc)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(rc)!=e.state.facet(rc),initialSpacer(e){return new ic(ac(e,cc(e.state.doc.lines)))},updateSpacer(e,t){let n=ac(t.view,cc(t.view.state.doc.lines));return n==e.number?e:new ic(n)},domEventHandlers:e.facet(rc).domEventHandlers,side:`before`}));function sc(e={}){return[rc.of(e),qs(),oc]}function cc(e){let t=9;for(;t<e;)t=t*10+9;return t}var lc=new class extends Hs{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},uc=Us.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(lc.range(i)))}return j.of(t)});function dc(){return uc}var fc=1024,pc=0,mc=class{constructor(e,t){this.from=e,this.to=t}},K=class{constructor(e={}){this.id=pc++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=_c.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};K.closedBy=new K({deserialize:e=>e.split(` `)}),K.openedBy=new K({deserialize:e=>e.split(` `)}),K.group=new K({deserialize:e=>e.split(` `)}),K.isolate=new K({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),K.contextHash=new K({perNode:!0}),K.lookAhead=new K({perNode:!0}),K.mounted=new K({perNode:!0});var hc=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[K.mounted.id]}},gc=Object.create(null),_c=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):gc,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(K.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(K.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};_c.none=new _c(``,Object.create(null),0,8);var vc=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new _c(e.name,r,e.id,e.flags):e)}return new e(n)}},yc=new WeakMap,bc=new WeakMap,q;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(q||={});var J=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=hc.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new Pc(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new Pc(yc.get(this)||this.topNode);return r.moveTo(e,t),yc.set(this,r._tree),r}get topNode(){return new Ec(this,0,0,null)}resolve(e,t=0){let n=wc(yc.get(this)||this.topNode,e,t,!1);return yc.set(this,n),n}resolveInner(e,t=0){let n=wc(bc.get(this)||this.topNode,e,t,!0);return bc.set(this,n),n}resolveStack(e,t=0){return Nc(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&q.IncludeAnonymous)>0;for(let e=this.cursor(a|q.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:zc(_c.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(_c.none,t,n,r)))}static build(e){return Ic(e)}};J.empty=new J(_c.none,[],[],0);var xc=class e{constructor(e,t){this.buffer=e,this.index=t}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 e(this.buffer,this.index)}},Sc=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return _c.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(Cc(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function Cc(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function wc(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof Ec&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:q.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Ec&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var Tc=class{cursor(e=0){return new Pc(this,e)}getChild(e,t=null,n=null){let r=Dc(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Dc(this,e,t,n)}resolve(e,t=0){return wc(this,e,t,!1)}resolveInner(e,t=0){return wc(this,e,t,!0)}matchContext(e){return Oc(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},Ec=class e extends Tc{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&q.EnterBracketed&&l instanceof J&&(d=hc.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||Cc(i,r,u,u+l.length)){if(l instanceof Sc){if(a&q.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Ac(new kc(o,l,t,u),null,e)}else if(a&q.IncludeAnonymous||!l.type.isAnonymous||Fc(l)){let s;if(!(a&q.IgnoreMounts)&&(s=hc.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&q.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&q.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&q.IgnoreOverlays)&&(i=hc.get(this._tree))&&i.overlay){let a=t-this.from,o=r&q.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 Dc(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function Oc(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var kc=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Ac=class e extends Tc{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&q.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new J(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function jc(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof Ec&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Mc(i,n)}var Mc=class{constructor(e,t){this.heads=e,this.node=t}get next(){return jc(this.heads)}};function Nc(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Ec?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=hc.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Ec(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(wc(o,t,n,!1))}}return i?jc(i):r}var Pc=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~q.EnterBracketed,e instanceof Ec)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Ec?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&q.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&q.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&q.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&q.IncludeAnonymous||e instanceof Sc||!e.type.isAnonymous||Fc(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new Ac(this.buffer,t,this.stack[e]);return this.bufferNode=new Ac(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return Oc(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return Oc(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function Fc(e){return e.children.some(e=>e instanceof Sc||!e.type.isAnonymous||Fc(e))}function Ic(e){let{buffer:t,nodeSet:n,maxBufferLength:r=fc,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new xc(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,ee){let{id:b,start:x,end:te,size:ne}=o,re=l,S=c;if(ne<0){if(o.next(),ne==-1){let t=i[b];_.push(t),v.push(x-e);return}if(ne==-3){c=b;return}if(ne==-4){l=b;return}throw RangeError(`Unrecognized record size: ${ne}`)}let ie=s[b],ae,C,oe=x-e;if(te-x<=r&&(C=h(o.pos-t,y))){let t=new Uint16Array(C.size-C.skip),r=o.pos-C.size,i=t.length;for(;o.pos>r;)i=g(C.start,t,i);ae=new Sc(t,te-C.start,n),oe=C.start-e}else{let e=o.pos-ne;o.next();let t=[],s=[],c=b>=a?b:-1,h=0,g=te,_=re;for(;o.pos>e;)c>=0&&o.id==c&&o.size>=0?(o.end<=g-r&&(p(t,s,x,h,o.end,g,c,_,S),h=t.length,g=o.end,_=l),o.next()):ee>2500?d(x,e,t,s):(c>=0&&o.size==-1&&i[o.id].type==n.types[c]&&(h<t.length&&p(t,s,x,h,o.end,g,c,_,S),h=t.length+1,g=o.start,_=l),u(x,e,t,s,c,ee+1));if(c>=0&&h>0&&h<t.length&&p(t,s,x,h,x,g,c,_,S),t.reverse(),s.reverse(),c>-1&&h>0){let e=f(ie,S);ae=zc(ie,t,s,0,t.length,0,te-x,e,e)}else ae=m(ie,t,s,te-x,re-te,S)}_.push(ae),v.push(oe)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new Sc(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof J){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(K.lookAhead))&&(a=r[o]+s.length+c-i)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[K.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[K.lookAhead,i];o=o?[e].concat(o):[e]}return new J(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new J(s[e.topID],_.reverse(),v.reverse(),y)}var Lc=new WeakMap;function Rc(e,t){if(!e.isAnonymous||t instanceof Sc||t.type!=e)return 1;let n=Lc.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof J)){n=1;break}n+=Rc(e,r)}Lc.set(t,n)}return n}function zc(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=Rc(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=Rc(e,t[s]);for(s++;s<i;s++){let n=Rc(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(zc(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var Bc=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},Vc=class{startParse(e,t,n){return typeof e==`string`&&(e=new Hc(e)),n=n?n.length?n.map(e=>new mc(e.from,e.to)):[new mc(0,0)]:[new mc(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},Hc=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new K({perNode:!0});var Uc=0,Wc=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Uc++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Kc(e);return e=>e.modified.indexOf(t)>-1?e:Kc.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Gc=0,Kc=class e{constructor(e){this.name=e,this.instances=[],this.id=Gc++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&qc(n,e.modified));if(r)return r;let i=[],a=new Wc(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Jc(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function qc(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Jc(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Yc(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`\"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new Zc(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Xc.add(t)}var Xc=new K({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new Zc(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Zc=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Zc.empty=new Zc([],2,null);function Qc(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function $c(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function el(e,t,n,r=0,i=e.length){let a=new tl(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var tl=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=nl(e)||Zc.empty,u=$c(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(K.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function nl(e){let t=e.type.prop(Xc);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Y=Wc.define,rl=Y(),il=Y(),al=Y(il),ol=Y(il),sl=Y(),cl=Y(sl),ll=Y(sl),ul=Y(),dl=Y(ul),fl=Y(),pl=Y(),ml=Y(),hl=Y(ml),gl=Y(),X={comment:rl,lineComment:Y(rl),blockComment:Y(rl),docComment:Y(rl),name:il,variableName:Y(il),typeName:al,tagName:Y(al),propertyName:ol,attributeName:Y(ol),className:Y(il),labelName:Y(il),namespace:Y(il),macroName:Y(il),literal:sl,string:cl,docString:Y(cl),character:Y(cl),attributeValue:Y(cl),number:ll,integer:Y(ll),float:Y(ll),bool:Y(sl),regexp:Y(sl),escape:Y(sl),color:Y(sl),url:Y(sl),keyword:fl,self:Y(fl),null:Y(fl),atom:Y(fl),unit:Y(fl),modifier:Y(fl),operatorKeyword:Y(fl),controlKeyword:Y(fl),definitionKeyword:Y(fl),moduleKeyword:Y(fl),operator:pl,derefOperator:Y(pl),arithmeticOperator:Y(pl),logicOperator:Y(pl),bitwiseOperator:Y(pl),compareOperator:Y(pl),updateOperator:Y(pl),definitionOperator:Y(pl),typeOperator:Y(pl),controlOperator:Y(pl),punctuation:ml,separator:Y(ml),bracket:hl,angleBracket:Y(hl),squareBracket:Y(hl),paren:Y(hl),brace:Y(hl),content:ul,heading:dl,heading1:Y(dl),heading2:Y(dl),heading3:Y(dl),heading4:Y(dl),heading5:Y(dl),heading6:Y(dl),contentSeparator:Y(ul),list:Y(ul),quote:Y(ul),emphasis:Y(ul),strong:Y(ul),link:Y(ul),monospace:Y(ul),strikethrough:Y(ul),inserted:Y(),deleted:Y(),changed:Y(),invalid:Y(),meta:gl,documentMeta:Y(gl),annotation:Y(gl),processingInstruction:Y(gl),definition:Wc.defineModifier(`definition`),constant:Wc.defineModifier(`constant`),function:Wc.defineModifier(`function`),standard:Wc.defineModifier(`standard`),local:Wc.defineModifier(`local`),special:Wc.defineModifier(`special`)};for(let e in X){let t=X[e];t instanceof Wc&&(t.name=e)}Qc([{tag:X.link,class:`tok-link`},{tag:X.heading,class:`tok-heading`},{tag:X.emphasis,class:`tok-emphasis`},{tag:X.strong,class:`tok-strong`},{tag:X.keyword,class:`tok-keyword`},{tag:X.atom,class:`tok-atom`},{tag:X.bool,class:`tok-bool`},{tag:X.url,class:`tok-url`},{tag:X.labelName,class:`tok-labelName`},{tag:X.inserted,class:`tok-inserted`},{tag:X.deleted,class:`tok-deleted`},{tag:X.literal,class:`tok-literal`},{tag:X.string,class:`tok-string`},{tag:X.number,class:`tok-number`},{tag:[X.regexp,X.escape,X.special(X.string)],class:`tok-string2`},{tag:X.variableName,class:`tok-variableName`},{tag:X.local(X.variableName),class:`tok-variableName tok-local`},{tag:X.definition(X.variableName),class:`tok-variableName tok-definition`},{tag:X.special(X.variableName),class:`tok-variableName2`},{tag:X.definition(X.propertyName),class:`tok-propertyName tok-definition`},{tag:X.typeName,class:`tok-typeName`},{tag:X.namespace,class:`tok-namespace`},{tag:X.className,class:`tok-className`},{tag:X.macroName,class:`tok-macroName`},{tag:X.propertyName,class:`tok-propertyName`},{tag:X.operator,class:`tok-operator`},{tag:X.comment,class:`tok-comment`},{tag:X.meta,class:`tok-meta`},{tag:X.invalid,class:`tok-invalid`},{tag:X.punctuation,class:`tok-punctuation`}]);var _l=new K;function vl(e){return E.define({combine:e?t=>t.concat(e):void 0})}var yl=new K,bl=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,A.prototype.hasOwnProperty(`tree`)||Object.defineProperty(A.prototype,\"tree\",{get(){return Z(this)}}),this.parser=t,this.extension=[jl.of(this),A.languageData.of((e,t,n)=>{let r=xl(e,t,n),i=r.type.prop(_l);if(!i)return[];let a=e.facet(i),o=r.type.prop(yl);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return xl(e,t,n).type.prop(_l)==this.data}findRegions(e){let t=e.facet(jl);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(_l)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(K.mounted);if(i){if(i.tree.prop(_l)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof J&&r(i,e.positions[n]+t)}};return r(Z(e),0),n}get allowsNesting(){return!0}};bl.setState=D.define();function xl(e,t,n){let r=e.facet(jl),i=Z(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,q.ExcludeBuffers|q.EnterBracketed))e.type.isTop&&(i=e);return i}var Sl=class e extends bl{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=vl(t.languageData);return new e(n,t.parser.configure({props:[_l.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function Z(e){let t=e.field(bl.state,!1);return t?t.tree:J.empty}var Cl=class{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 n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},wl=null,Tl=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],J.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Cl(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=J.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(Bc.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=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(Bc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wl;wl=this;try{return e()}finally{wl=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=El(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=Bc.applyChanges(r,e),i=J.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=El(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Vc{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=wl;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new J(_c.none,[],[],a-i)},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 wl}};function El(e,t,n){return Bc.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var Dl=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Tl.create(t.facet(jl).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};bl.state=Ee.define({create:Dl.init,update(e,t){for(let e of t.effects)if(e.is(bl.setState))return e.value;return t.startState.facet(jl)==t.state.facet(jl)?e.apply(t):Dl.init(t.state)}});var Ol=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(Ol=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var kl=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,Al=V.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(bl.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(bl.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Ol(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(bl.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!kl?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>kl&&kl()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:bl.setState.of(new Dl(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Sr(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),jl=E.define({combine(e){return e.length?e[0]:null},enables:e=>[bl.state,Al,G.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{\"data-language\":n.name}:{}})]}),Ml=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Nl=E.define(),Pl=E.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function Fl(e){let t=e.facet(Pl);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Il(e,t){let n=``,r=e.tabSize,i=e.facet(Pl)[0];if(i==`\t`){for(;t>=r;)n+=`\t`,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function Ll(e,t){e instanceof A&&(e=new Rl(e));for(let n of e.state.facet(Nl)){let r=n(e,t);if(r!==void 0)return r}let n=Z(e.state);return n.length>=t?Bl(e,n,t):null}var Rl=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Fl(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\\S|$/))),i}countColumn(e,t=e.length){return wt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},zl=new K;function Bl(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return Vl(r,e,n)}function Vl(e,t,n){for(let r=e;r;r=r.next){let e=Ul(r.node);if(e)return e(Gl.create(t,n,r))}return 0}function Hl(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Ul(e){let t=e.type.prop(zl);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(K.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Jl(e,!0,1,void 0,n&&!Hl(e)?t.from:void 0)}return e.parent==null?Wl:null}function Wl(){return 0}var Gl=class e extends Rl{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}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 n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Kl(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Vl(this.context.next,this.base,this.pos)}};function Kl(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function ql(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Jl(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?ql(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function Yl({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Xl=new K,Zl=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=At.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof bl?e=>e.prop(_l)==a.data:a?e=>e==a:void 0,this.style=Qc(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new At(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},Ql=E.define(),$l=E.define({combine(e){return e.length?[e[0]]:null}});function eu(e){let t=e.facet(Ql);return t.length?t:e.facet($l)}function tu(e,t){let n=[ru],r;return e instanceof Zl&&(e.module&&n.push(G.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push($l.of(e)):r?n.push(Ql.computeN([G.darkTheme],t=>t.facet(G.darkTheme)==(r==`dark`)?[e]:[])):n.push(Ql.of(e)),n}var nu=class{constructor(e){this.markCache=Object.create(null),this.tree=Z(e.state),this.decorations=this.buildDeco(e,eu(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Z(e.state),n=eu(e.state),r=n!=eu(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return L.none;let n=new pt;for(let{from:r,to:i}of e.visibleRanges)el(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=L.mark({class:r})))},r,i);return n.finish()}},ru=ke.high(V.fromClass(nu,{decorations:e=>e.decorations}));X.meta,X.link,X.heading,X.emphasis,X.strong,X.strikethrough,X.keyword,X.atom,X.bool,X.url,X.contentSeparator,X.labelName,X.literal,X.inserted,X.string,X.deleted,X.regexp,X.escape,X.string,X.variableName,X.variableName,X.typeName,X.namespace,X.className,X.variableName,X.macroName,X.propertyName,X.comment,X.invalid;var iu=G.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:`#328c8252`},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:`#bb555544`}}),au=1e4,ou=`()[]{}`,su=E.define({combine(e){return at(e,{afterCursor:!0,brackets:ou,maxScanDistance:au,renderMatch:uu})}}),cu=L.mark({class:`cm-matchingBracket`}),lu=L.mark({class:`cm-nonmatchingBracket`});function uu(e){let t=[],n=e.matched?cu:lu;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function du(e){let t=[],n=e.facet(su);for(let r of e.selection.ranges){if(!r.empty)continue;let i=_u(e,r.head,-1,n)||r.head>0&&_u(e,r.head-1,1,n)||n.afterCursor&&(_u(e,r.head,1,n)||r.head<e.doc.length&&_u(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return L.set(t,!0)}var fu=[V.fromClass(class{constructor(e){this.paused=!1,this.decorations=du(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=du(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),iu];function pu(e={}){return[su.of(e),fu]}var mu=new K;function hu(e,t,n){let r=e.prop(t<0?K.openedBy:K.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function gu(e){let t=e.type.prop(mu);return t?t(e.node):e}function _u(e,t,n,r={}){let i=r.maxScanDistance||au,a=r.brackets||ou,o=Z(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=hu(r.type,n,a);if(i&&r.from<r.to){let o=gu(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return vu(e,t,n,r,o,i,a)}}return yu(e,t,n,o,s.type,i,a)}function vu(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=gu(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(hu(u.type,n,o))l++;else if(hu(u.type,-n,o)){if(l==0){let e=gu(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function yu(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var bu=Object.create(null),xu=[_c.none],Su=[],Cu=Object.create(null),wu=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])wu[e]=Eu(bu,t);function Tu(e,t){Su.indexOf(e)>-1||(Su.push(e),console.warn(t))}function Eu(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||X[n];r?typeof r==`function`?t.length?t=t.map(r):Tu(n,`Modifier ${n} used at start of tag`):t.length?Tu(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Tu(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=Cu[i];if(a)return a.id;let o=Cu[i]=_c.define({id:xu.length,name:r,props:[Yc({[r]:n})]});return xu.push(o),o.id}z.RTL,z.LTR;var Du=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Z(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),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Pu(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Ou(e){let t=Object.keys(e).join(``),n=/\\w/.test(t);return n&&(t=t.replace(/\\w/g,``)),`[${n?`\\\\w`:``}${t.replace(/[^\\w\\s]/g,`\\\\$&`)}]`}function ku(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Ou(t)+Ou(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Au(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\\w+$/.test(e.label))?[/\\w*$/,/\\w+$/]:ku(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ju(e,t){return n=>{for(let t=Z(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var Mu=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Nu(e){return e.selection.main.from}function Pu(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var Fu=We.define();function Iu(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:T.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Lu=new WeakMap;function Ru(e){if(!Array.isArray(e))return e;let t=Lu.get(e);return t||Lu.set(e,t=Au(e)),t}var zu=D.define(),Bu=D.define(),Vu=class{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<e.length;){let n=C(e,t),r=se(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(C(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=C(e,0),i=se(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=C(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=se(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=C(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=oe(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=se(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?se(C(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Hu=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},Q=E.define({combine(e){return at(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Wu,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Uu(e(n),t(n)),optionClass:(e,t)=>n=>Uu(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Uu(e,t){return e?t?e+` `+t:e:t}function Wu(e,t,n,r,i,a){let o=e.textDirection==z.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var Gu=D.define();function Ku(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function qu(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var Ju=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(Q);this.optionContent=Ku(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=qu(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:Gu.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Q).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bu.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=qu(r.length,i,e.state.facet(Q).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);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;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=qu(t.options.length,t.selected,this.view.state.facet(Q).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>Sr(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&Xu(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(Q).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function Yu(e,t){return n=>new Ju(n,e,t)}function Xu(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function Zu(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function Qu(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(Q);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Mu(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Hu(n):new Vu(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Mu(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):Zu(e.completion)>Zu(c)&&(s[s.length-1]=e),c=e.completion}return s}var $u=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,id(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=Qu(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(Q).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,id(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:pd,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ed=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(ad,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Q),i=(r.override||n.languageDataAt(`autocomplete`,Nu(n)).map(Ru)).map(e=>(this.active.find(t=>t.source==e)||new sd(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(ud));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!td(i,this.active)||o?a=$u.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new sd(e.source,0):e));for(let e of t.effects)e.is(Gu)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?nd:rd}};function td(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var nd={\"aria-autocomplete\":`list`},rd={};function id(e,t){let n={\"aria-autocomplete\":`list`,\"aria-haspopup\":`listbox`,\"aria-controls\":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var ad=[];function od(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Fu);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var sd=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=od(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(zu))i=new e(i.source,1,n.value);else if(n.is(Bu))i=new e(i.source,0);else if(n.is(ud))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Nu(e.state))}},cd=class e extends sd{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Nu(t.state);if(o>a||!r||n&2&&(Nu(t.startState)==this.from||o<this.limit))return new sd(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return ld(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Du(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??Nu(t.state)):new sd(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new sd(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ld(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Pu(e,!0).test(i)}var ud=D.define({map(e,t){return e.map(e=>e.map(t))}}),dd=Ee.define({create(){return ed.start()},update(e,t){return e.update(t)},provide:e=>[Os.from(e,e=>e.tooltip),G.contentAttributes.from(e,e=>e.attrs)]});function fd(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(dd).active.find(e=>e.source==t.source);return r instanceof cd&&(typeof n==`string`?e.dispatch({...Iu(e.state,n,r.from,r.to),annotations:Fu.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var pd=Yu(dd,fd);function md(e,t=`option`){return n=>{let r=n.state.field(dd,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Q).interactionDelay)return!1;let i=1,a;t==`page`&&(a=ks(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:Gu.of(s)}),!0}}var hd=e=>{let t=e.state.field(dd,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Q).interactionDelay?!1:fd(e,t.open.options[t.open.selected])},gd=e=>e.state.field(dd,!1)?(e.dispatch({effects:zu.of(!0)}),!0):!1,_d=e=>{let t=e.state.field(dd,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Bu.of(null)}),!0)},vd=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},yd=50,bd=1e3,xd=V.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(dd).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(dd),n=e.state.facet(Q);if(!e.selectionSet&&!e.docChanged&&e.startState.field(dd)==t)return;let r=e.transactions.some(e=>{let t=od(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>yd&&Date.now()-n.time>bd){for(let e of n.context.abortListeners)try{e()}catch(e){Sr(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(zu)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(dd);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Q).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Du(t,Nu(t),e.explicit,this.view),r=new vd(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Bu.of(null)}),Sr(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Q).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Q),n=this.view.state.field(dd);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=Nu(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new cd(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new sd(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ud.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(dd,!1);if(t&&t.tooltip&&this.view.state.facet(Q).closeOnBlur){let n=t.open&&ks(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Bu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:zu.of(!1)}),20),this.composing=0}}}),Sd=typeof navigator==`object`&&/Win/.test(navigator.platform),Cd=ke.highest(G.domEventHandlers({keydown(e,t){let n=t.state.field(dd,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!e.key||e.key.length>1||e.ctrlKey&&!(Sd&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&fd(t,r),!1}})),wd=G.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`,cursor:`pointer`},\".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`}}}),Td={brackets:[`(`,`[`,`{`,`'`,`\"`],before:`)]}:;>`,stringPrefixes:[]},Ed=D.define({map(e,t){return t.mapPos(e,-1,le.TrackAfter)??void 0}}),Dd=new class extends ot{};Dd.startSide=1,Dd.endSide=-1;var Od=Ee.define({create(){return j.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Ed)&&(e=e.update({add:[Dd.range(n.value,n.value+1)]}));return e}});function kd(){return[Pd,Od]}var Ad=`()[]{}<>«»»«[]{}`;function jd(e){for(let t=0;t<16;t+=2)if(Ad.charCodeAt(t)==e)return Ad.charAt(t+1);return oe(e<128?e:e+1)}function Md(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Td}var Nd=typeof navigator==`object`&&/Android\\b/.test(navigator.userAgent),Pd=G.inputHandler.of((e,t,n,r)=>{if((Nd?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&se(C(r,0))==1||t!=i.from||n!=i.to)return!1;let a=Id(e.state,r);return a?(e.dispatch(a),!0):!1}),Fd=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Md(e,e.selection.main.head).brackets||Td.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=zd(e.doc,t.head);for(let i of n)if(i==r&&Rd(e.doc,t.head)==jd(C(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:T.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function Id(e,t){let n=Md(e,e.selection.main.head),r=n.brackets||Td.brackets;for(let i of r){let a=jd(C(i,0));if(t==i)return a==i?Hd(e,i,r.indexOf(i+i+i)>-1,n):Bd(e,i,a,n.before||Td.before);if(t==a&&Ld(e,e.selection.main.from))return Vd(e,i,a)}return null}function Ld(e,t){let n=!1;return e.field(Od).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Rd(e,t){let n=e.sliceString(t,t+2);return n.slice(0,se(C(n,0)))}function zd(e,t){let n=e.sliceString(t-2,t);return se(C(n,0))==n.length?n:n.slice(1)}function Bd(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Ed.of(a.to+t.length),range:T.range(a.anchor+t.length,a.head+t.length)};let o=Rd(e.doc,a.head);return!o||/\\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Ed.of(a.head+t.length),range:T.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function Vd(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&Rd(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:T.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function Hd(e,t,n,r){let i=r.stringPrefixes||Td.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Ed.of(r.to+t.length),range:T.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=Rd(e.doc,o),c;if(s==t){if(Ud(e,o))return{changes:{insert:t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};if(Ld(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:T.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=Gd(e,o-2*t.length,i))>-1&&Ud(e,c))return{changes:{insert:t+t+t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=k.Word&&Gd(e,o,i)>-1&&!Wd(e,o,t,i))return{changes:{insert:t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function Ud(e,t){let n=Z(e).resolveInner(t+1);return n.parent&&n.from==t}function Wd(e,t,n,r){let i=Z(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function Gd(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=k.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=k.Word)return n}return-1}function Kd(e={}){return[Cd,dd,Q.of(e),xd,Jd,wd]}var qd=[{key:`Ctrl-Space`,run:gd},{mac:\"Alt-`\",run:gd},{mac:`Alt-i`,run:gd},{key:`Escape`,run:_d},{key:`ArrowDown`,run:md(!0)},{key:`ArrowUp`,run:md(!1)},{key:`PageDown`,run:md(!0,`page`)},{key:`PageUp`,run:md(!1,`page`)},{key:`Enter`,run:hd}],Jd=ke.highest(Vo.computeN([Q],e=>e.facet(Q).defaultKeymap?[qd]:[])),Yd=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ef(e.state,n.from);return r.line?Zd(e):r.block?$d(e):!1};function Xd(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Zd=Xd(of,0),Qd=Xd(af,0),$d=Xd((e,t)=>af(e,t,rf(t)),0);function ef(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var tf=50;function nf(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-tf,r),o=e.sliceDoc(i,i+tf),s=/\\s*$/.exec(a)[0].length,c=/^\\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+tf),d=e.sliceDoc(i-tf,i));let f=/^\\s*/.exec(u)[0].length,p=/\\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\\s/.test(d.charAt(m-1))}}:null}function rf(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:i.to})}return t}function af(e,t,n=t.selection.ranges){let r=n.map(e=>ef(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>nf(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function of(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=ef(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var sf=We.define(),cf=We.define(),lf=E.define(),uf=E.define({combine(e){return at(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),df=Ee.define({create(){return Af.empty},update(e,t){let n=t.state.facet(uf),r=t.annotation(sf);if(r){let i=vf.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?yf(o,o.length,n.minDepth,i):Tf(o,t.startState.selection),new Af(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(cf);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(O.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=vf.fromTransaction(t),o=t.annotation(O.time),s=t.annotation(O.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new Af(e.done.map(vf.fromJSON),e.undone.map(vf.fromJSON))}});function ff(e={}){return[df,uf.of(e),G.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?mf:e.inputType==`historyRedo`?hf:null;return n?(e.preventDefault(),n(t)):!1}})]}function pf(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(df,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var mf=pf(0,!1),hf=pf(1,!1),gf=pf(0,!0),_f=pf(1,!0),vf=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&de.fromJSON(t.changes),[],t.mapped&&ue.fromJSON(t.mapped),t.startSelection&&T.fromJSON(t.startSelection),t.selectionsAfter.map(T.fromJSON))}static fromTransaction(t,n){let r=Cf;for(let e of t.startState.facet(lf)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Cf)}static selection(t){return new e(void 0,Cf,void 0,void 0,t)}};function yf(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function bf(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function xf(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Sf(e,t){return e.length?t.length?e.concat(t):e:t}var Cf=[],wf=200;function Tf(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-wf));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),yf(e,e.length-1,1e9,n.setSelAfter(r)))}return[vf.selection([t])]}function Ef(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Df(e,t){if(!e.length)return e;let n=e.length,r=Cf;for(;n;){let i=Of(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[vf.selection(r)]:Cf}function Of(e,t,n){let r=Sf(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Cf,n);if(!e.changes)return vf.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new vf(i,D.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var kf=/^(input\\.type|delete)($|\\.)/,Af=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||kf.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,bf(s.changes,t.changes))||r==`input.type.compose`)?yf(o,o.length-1,i.minDepth,new vf(t.changes.compose(s.changes),Sf(D.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Cf)):yf(o,o.length,i.minDepth,t),new e(o,Cf,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Cf;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\\.)/.test(r)&&xf(a[a.length-1],t)?this:new e(Tf(this.done,t),this.undone,n,r)}addMapping(t){return new e(Df(this.done,t),Df(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:sf.of({side:e,rest:Ef(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Cf:r.slice(0,r.length-1);return i.mapped&&(n=Df(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:sf.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};Af.empty=new Af(Cf,Cf);var jf=[{key:`Mod-z`,run:mf,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:hf,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:hf,preventDefault:!0},{key:`Mod-u`,run:gf,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:_f,preventDefault:!0}];function Mf(e,t){return T.create(e.ranges.map(t),e.mainIndex)}function Nf(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Pf({state:e,dispatch:t},n){let r=Mf(e.selection,n);return!r.eq(e.selection,!0)&&(t(Nf(e,r)),!0)}function Ff(e,t){return T.cursor(t?e.to:e.from)}function If(e,t){return Pf(e,n=>n.empty?e.moveByChar(n,t):Ff(n,t))}function $(e){return e.textDirectionAt(e.state.selection.main.head)==z.LTR}var Lf=e=>If(e,!$(e)),Rf=e=>If(e,$(e));function zf(e,t){return Pf(e,n=>n.empty?e.moveByGroup(n,t):Ff(n,t))}var Bf=e=>zf(e,!$(e)),Vf=e=>zf(e,$(e));typeof Intl<`u`&&Intl.Segmenter;function Hf(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Uf(e,t,n){let r=Z(e).resolveInner(t.head),i=n?K.closedBy:K.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Hf(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?_u(e,r.from,1):_u(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,T.cursor(s,n?-1:1)}var Wf=e=>Pf(e,t=>Uf(e.state,t,!$(e))),Gf=e=>Pf(e,t=>Uf(e.state,t,$(e)));function Kf(e,t){return Pf(e,n=>{if(!n.empty)return Ff(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var qf=e=>Kf(e,!1),Jf=e=>Kf(e,!0);function Yf(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(G.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Xf(e,t){let n=Yf(e),{state:r}=e,i=Mf(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Ff(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=G.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(Nf(r,i),{effects:a}),!0}var Zf=e=>Xf(e,!1),Qf=e=>Xf(e,!0);function $f(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=T.cursor(r.from+n))}return i}var ep=e=>Pf(e,t=>$f(e,t,!0)),tp=e=>Pf(e,t=>$f(e,t,!1)),np=e=>Pf(e,t=>$f(e,t,!$(e))),rp=e=>Pf(e,t=>$f(e,t,$(e))),ip=e=>Pf(e,t=>e.moveToLineBoundary(t,!1,!1)),ap=e=>Pf(e,t=>e.moveToLineBoundary(t,!0,!1));function op(e,t,n){let r=!1,i=Mf(e.selection,t=>{let i=_u(e,t.head,-1)||_u(e,t.head,1)||t.head>0&&_u(e,t.head-1,1)||t.head<e.doc.length&&_u(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?T.range(t.anchor,a):T.cursor(a)});return r?(t(Nf(e,i)),!0):!1}var sp=({state:e,dispatch:t})=>op(e,t,!1);function cp(e,t,n){let r=Mf(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=T.range(e.head,e.anchor));let r=n(e);return T.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(Nf(e.state,r)),!0)}function lp(e,t){return cp(e,t,n=>e.moveByChar(n,t))}var up=e=>lp(e,!$(e)),dp=e=>lp(e,$(e));function fp(e,t){return cp(e,t,n=>e.moveByGroup(n,t))}var pp=e=>fp(e,!$(e)),mp=e=>fp(e,$(e)),hp=e=>{let t=!$(e);return cp(e,t,n=>Uf(e.state,n,t))},gp=e=>{let t=$(e);return cp(e,t,n=>Uf(e.state,n,t))};function _p(e,t){return cp(e,t,n=>e.moveVertically(n,t))}var vp=e=>_p(e,!1),yp=e=>_p(e,!0);function bp(e,t){return cp(e,t,n=>e.moveVertically(n,t,Yf(e).height))}var xp=e=>bp(e,!1),Sp=e=>bp(e,!0),Cp=e=>cp(e,!0,t=>$f(e,t,!0)),wp=e=>cp(e,!1,t=>$f(e,t,!1)),Tp=e=>{let t=!$(e);return cp(e,t,n=>$f(e,n,t))},Ep=e=>{let t=$(e);return cp(e,t,n=>$f(e,n,t))},Dp=e=>cp(e,!1,t=>T.cursor(e.lineBlockAt(t.head).from)),Op=e=>cp(e,!0,t=>T.cursor(e.lineBlockAt(t.head).to)),kp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:0})),!0),Ap=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.doc.length})),!0),jp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:0})),!0),Mp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Np=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Pp=({state:e,dispatch:t})=>{let n=$p(e).map(({from:t,to:n})=>T.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:T.create(n),userEvent:`select`})),!0},Fp=({state:e,dispatch:t})=>{let n=Mf(e.selection,t=>{let n=Z(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return T.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(Nf(e,n)),!0)};function Ip(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(Nf(n,T.create(i,i.length-1))),!0)}var Lp=e=>Ip(e,!1),Rp=e=>Ip(e,!0),zp=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=T.create([n.main]):n.main.empty||(r=T.create([T.cursor(n.main.head)])),r?(t(Nf(e,r)),!0):!1};function Bp(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Vp(e,o,!1)):o>i&&(n=`delete.forward`,o=Vp(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Vp(e,i,!1),a=Vp(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:T.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?G.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Vp(e,t,n){if(e instanceof G)for(let r of e.state.facet(G.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Hp=(e,t,n)=>Bp(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \\t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==`\t`)return i-1;let e=wt(s,a.tabSize)%Fl(a)||Fl(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=S(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\\ufe00-\\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=S(o.text,c-o.from,!1,!1)+o.from);return c}),Up=e=>Hp(e,!1,!0),Wp=e=>Hp(e,!0,!1),Gp=(e,t)=>Bp(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=S(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Kp=e=>Gp(e,!1),qp=e=>Gp(e,!0),Jp=e=>Bp(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Yp=e=>Bp(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Xp=e=>Bp(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Zp=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:h.of([``,``])},range:T.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Qp=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:S(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:S(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:T.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function $p(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function em(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of $p(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(T.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(T.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:T.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var tm=({state:e,dispatch:t})=>em(e,t,!1),nm=({state:e,dispatch:t})=>em(e,t,!0);function rm(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of $p(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var im=({state:e,dispatch:t})=>rm(e,t,!1),am=({state:e,dispatch:t})=>rm(e,t,!0),om=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes($p(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Mf(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function sm(e,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Z(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(K.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var cm=um(!1),lm=um(!0);function um(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&sm(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Rl(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Ll(s,r);for(c??=wt(/^\\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,Il(t,c)];return o&&l.push(Il(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:h.of(l)},range:T.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function dm(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:T.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var fm=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Rl(e,{overrideIndentation:e=>n[e]??-1}),i=dm(e,(t,i,a)=>{let o=Ll(r,t.from);if(o==null)return;/\\S/.test(t.text)||(o=0);let s=/^\\s*/.exec(t.text)[0],c=Il(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},pm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(dm(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Pl)})}),{userEvent:`input.indent`})),!0),mm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(dm(e,(t,n)=>{let r=/^\\s*/.exec(t.text)[0];if(!r)return;let i=wt(r,e.tabSize),a=0,o=Il(e,Math.max(0,i-Fl(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),hm=e=>(e.setTabFocusMode(),!0),gm=[{key:`Ctrl-b`,run:Lf,shift:up,preventDefault:!0},{key:`Ctrl-f`,run:Rf,shift:dp},{key:`Ctrl-p`,run:qf,shift:vp},{key:`Ctrl-n`,run:Jf,shift:yp},{key:`Ctrl-a`,run:ip,shift:Dp},{key:`Ctrl-e`,run:ap,shift:Op},{key:`Ctrl-d`,run:Wp},{key:`Ctrl-h`,run:Up},{key:`Ctrl-k`,run:Jp},{key:`Ctrl-Alt-h`,run:Kp},{key:`Ctrl-o`,run:Zp},{key:`Ctrl-t`,run:Qp},{key:`Ctrl-v`,run:Qf}],_m=[{key:`ArrowLeft`,run:Lf,shift:up,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Bf,shift:pp,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:np,shift:Tp,preventDefault:!0},{key:`ArrowRight`,run:Rf,shift:dp,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Vf,shift:mp,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:rp,shift:Ep,preventDefault:!0},{key:`ArrowUp`,run:qf,shift:vp,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:kp,shift:jp},{mac:`Ctrl-ArrowUp`,run:Zf,shift:xp},{key:`ArrowDown`,run:Jf,shift:yp,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Ap,shift:Mp},{mac:`Ctrl-ArrowDown`,run:Qf,shift:Sp},{key:`PageUp`,run:Zf,shift:xp},{key:`PageDown`,run:Qf,shift:Sp},{key:`Home`,run:tp,shift:wp,preventDefault:!0},{key:`Mod-Home`,run:kp,shift:jp},{key:`End`,run:ep,shift:Cp,preventDefault:!0},{key:`Mod-End`,run:Ap,shift:Mp},{key:`Enter`,run:cm,shift:cm},{key:`Mod-a`,run:Np},{key:`Backspace`,run:Up,shift:Up,preventDefault:!0},{key:`Delete`,run:Wp,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Kp,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:qp,preventDefault:!0},{mac:`Mod-Backspace`,run:Yp,preventDefault:!0},{mac:`Mod-Delete`,run:Xp,preventDefault:!0}].concat(gm.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),vm=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Wf,shift:hp},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Gf,shift:gp},{key:`Alt-ArrowUp`,run:tm},{key:`Shift-Alt-ArrowUp`,run:im},{key:`Alt-ArrowDown`,run:nm},{key:`Shift-Alt-ArrowDown`,run:am},{key:`Mod-Alt-ArrowUp`,run:Lp},{key:`Mod-Alt-ArrowDown`,run:Rp},{key:`Escape`,run:zp},{key:`Mod-Enter`,run:lm},{key:`Alt-l`,mac:`Ctrl-l`,run:Pp},{key:`Mod-i`,run:Fp,preventDefault:!0},{key:`Mod-[`,run:mm},{key:`Mod-]`,run:pm},{key:`Mod-Alt-\\\\`,run:fm},{key:`Shift-Mod-k`,run:om},{key:`Shift-Mod-\\\\`,run:sp},{key:`Mod-/`,run:Yd},{key:`Alt-A`,mac:`Ctrl-A`,run:Qd},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:hm}].concat(_m),ym={key:`Tab`,run:pm,shift:mm},bm=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new xm(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Sm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new xm(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},xm=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Sm=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},Cm=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 e(this.stack,this.pos,this.index)}};function wm(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var Tm=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Em=new Tm,Dm=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=Em,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Em,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},Om=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;jm(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};Om.prototype.contextual=Om.prototype.fallback=Om.prototype.extend=!1;var km=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?wm(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(jm(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};km.prototype.contextual=Om.prototype.fallback=Om.prototype.extend=!1;var Am=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function jm(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||Nm(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function Mm(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function Nm(e,t,n,r){let i=Mm(n,r,t);return i<0||Mm(n,r,e)<i}var Pm=typeof process<`u`&&/\\bparse\\b/.test({}.LOG),Fm=null;function Im(e,t,n){let r=e.cursor(q.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var Lm=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Im(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Im(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;if(e<this.safeFrom)return null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(i instanceof J){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(K.lookAhead))||t+r<this.fragment.to)&&(n&&(this.lastRepeat=i,this.lastRepeatPos=a),a==e))return i}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},Rm=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Tm)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if((!n||c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new Tm,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Tm,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=Um(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(Um(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(Um(o,s+1),t,n,r))}return r}},zm=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Dm(t,r),this.tokens=new Rm(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[bm.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new Lm(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&Wm(r);if(e)return Pm&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw Pm&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return Pm&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}tryReuse(e,t,n,r){if(!n)return null;let i=e.curContext&&e.curContext.tracker.strict,a=i?e.curContext.hash:0;for(;n;){let o=this.parser.nodeSet.types[n.type.id]==n.type?this.parser.getGoto(e.state,n.type.id):-1;if(o>-1&&n.length&&(!i||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof J&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=Pm?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos<r&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,r,this.fragments.nodeAt(r),!1);if(t)return Pm&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(t.type.id)})`),!0}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),Pm&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;o<s.length;){let c=s[o++],l=s[o++],u=s[o++],d=o==s.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(c,l,p?p.start:f.pos,u),Pm&&console.log(a+this.stackID(f)+` (via ${c&65536?`reduce of ${i.getName(c&65535)}`:`shift`} for ${i.getName(l)} @ ${r}${f==e?``:`, split`})`),d)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Bm(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=Pm?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),Pm&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(Pm&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)Pm&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))Pm&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),Pm&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),Bm(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),J.build({buffer:Cm.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Fm||=new WeakMap).get(e);return t||Fm.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Bm(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var Vm=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},Hm=class e extends Vc{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=K[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new vc(t.map((t,i)=>_c.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=fc;let a=wm(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Gm),this.states=wm(e.states,Uint32Array),this.data=wm(e.stateData),this.goto=wm(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new Om(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new zm(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=Um(n,i+2)];else if(n[i+1]==2)return Um(n,i+2);else break}if(a==t||a==0)return Um(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=Um(this.data,n+2);else break}r=t(Um(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=Um(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=Gm(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new Vm(e,n,r)}static deserialize(t){return new e(t)}};function Um(e,t){return e[t]|e[t+1]<<16}function Wm(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function Gm(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var Km=36,qm=1,Jm=2,Ym=3,Xm=4,Zm=5,Qm=6,$m=7,eh=8,th=9,nh=10,rh=11,ih=12,ah=13,oh=14,sh=15,ch=16,lh=17,uh=18,dh=19,fh=20,ph=21,mh=22,hh=23,gh=24;function _h(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function vh(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function yh(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function bh(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function xh(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function Sh(e,t){for(;e.next==95||_h(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Ch(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),yh(e,t,!1)}else Sh(e)}function wh(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function Th(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function Eh(e){for(;!(e.next<0||e.next==10);)e.advance()}function Dh(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var Oh=` \t\\r\n`;function kh(e,t,n){let r=Object.create(null);r.true=r.false=Zm,r.null=r.unknown=Qm;for(let t of e.split(` `))t&&(r[t]=fh);for(let e of t.split(` `))e&&(r[e]=ph);for(let e of(n||``).split(` `))e&&(r[e]=gh);return r}var Ah=`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `,jh=`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,Mh={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`\"`,caseInsensitiveIdentifiers:!1,words:kh(jh,Ah)};function Nh(e,t,n,r){let i={};for(let t in Mh)i[t]=(e.hasOwnProperty(t)?e:Mh)[t];return t&&(i.words=kh(t,n||``,r)),i}function Ph(e){return new Am(t=>{let{next:n}=t;if(t.advance(),Dh(n,Oh)){for(;Dh(t.next,Oh);)t.advance();t.acceptToken(Km)}else if(n==36&&e.doubleDollarQuotedStrings){let e=Sh(t,``);t.next==36&&(t.advance(),bh(t,e),t.acceptToken(Ym))}else if(n==39||n==34&&e.doubleQuotedStrings)yh(t,n,e.backslashEscapes),t.acceptToken(Ym);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)Eh(t),t.acceptToken(qm);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))Eh(t),t.acceptToken(qm);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(Jm)}else if((n==101||n==69)&&t.next==39)t.advance(),yh(t,39,!0),t.acceptToken(Ym);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),yh(t,39,e.backslashEscapes),t.acceptToken(Ym);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),yh(t,39,e.backslashEscapes),t.acceptToken(Ym);break}if(!_h(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!Dh(t.peek(1),Oh)){let e=t.peek(1);t.advance(2),xh(t,e),t.acceptToken(Ym)}else if(Dh(n,e.identifierQuotes))yh(t,n==91?93:n,!1),t.acceptToken(dh);else if(n==40)t.acceptToken($m);else if(n==41)t.acceptToken(eh);else if(n==123)t.acceptToken(th);else if(n==125)t.acceptToken(nh);else if(n==91)t.acceptToken(rh);else if(n==93)t.acceptToken(ih);else if(n==59)t.acceptToken(ah);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),wh(t),t.acceptToken(mh);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(yh(t,n,e.backslashEscapes),t.acceptToken(hh)):(wh(t,n),t.acceptToken(mh))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();vh(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(Xm)}else if(n==46&&t.next>=48&&t.next<=57)Th(t,!0),t.acceptToken(Xm);else if(n==46)t.acceptToken(oh);else if(n>=48&&n<=57)Th(t,!1),t.acceptToken(Xm);else if(Dh(n,e.operatorChars)){for(;Dh(t.next,e.operatorChars);)t.advance();t.acceptToken(sh)}else if(Dh(n,e.specialVar))t.next==n&&t.advance(),Ch(t),t.acceptToken(lh);else if(n==58||n==44)t.acceptToken(ch);else if(_h(n)){let r=Sh(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?uh:e.words[r.toLowerCase()]??uh)}})}var Fh=Ph(Mh),Ih=Hm.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,Fh],topRules:{Script:[0,25]},tokenPrec:0});function Lh(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function Rh(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'\"\\[])(.*)([`'\"\\]])$/.exec(n);return r?r[2]:n}function zh(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function Bh(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)zh(r)&&n.push(Rh(e,r));return n}return[Rh(e,t)]}function Vh(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=Lh(t);if(!zh(r))return n;n.unshift(Rh(e,r)),t=Lh(r)}}function Hh(e,t){let n=Z(e).resolveInner(t,-1),r=Wh(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:Vh(e.doc,Lh(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:Vh(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var Uh=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function Wh(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&zh(t.nextSibling))o=Rh(e,t.nextSibling);else if(n&&Uh.has(n))break;else a&&zh(t)&&(o=Rh(e,t));o&&(r||=Object.create(null),r[o]=Bh(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function Gh(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Kh=/^\\w*$/,qh=/^[`'\"\\[]?\\w*[`'\"\\]]?$/;function Jh(e){return e.self&&typeof e.self.label==`string`}var Yh=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(Xh(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.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`?Xh(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Jh(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\\\?\\./g,e=>e==`.`?`\\0`:e).split(`\\0`),a=this;Jh(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\\\\./g,`.`));a.addNamespace(n)}}};function Xh(e,t,n,r){return RegExp(`^[a-z_][a-z_\\\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+Zh(n)}}function Zh(e){return e===`[`?`]`:e}function Qh(e,t,n,r,i,a){let o=new Yh(a?.spec.identifierQuotes?.[0]||`\"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=Hh(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=Zh(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:Gh(t,r,u),validFor:qh}}return{from:n,options:u,validFor:Kh}}}function $h(e){return e==ph?`type`:e==fh?`keyword`:`variable`}function eg(e,t,n){return ju([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],Au(Object.keys(e).map(r=>n(t?r.toUpperCase():r,$h(e[r])))))}var tg=Ih.configure({props:[zl.add({Statement:Yl()}),Xl.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),Yc({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})]}),ng=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=Nh(t,t.keywords,t.types,t.builtin),r=Sl.define({name:`sql`,parser:tg.configure({tokenizers:[{from:Fh,to:Ph(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`\"`,\"`\"]}}});return new e(n,r,t)}};function rg(e,t){return{label:e,type:t,boost:-1}}function ig(e,t=!1,n){return eg(e.dialect.words,t,n||rg)}function ag(e){return e.schema?Qh(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||cg):()=>null}function og(e){return e.schema?(e.dialect||cg).language.data.of({autocomplete:ag(e)}):[]}function sg(e={}){let t=e.dialect||cg;return new Ml(t.language,[og(e),t.language.data.of({autocomplete:ig(t,e.upperCaseKeywords,e.keywordCompletion)})])}var cg=ng.define({}),lg=ng.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:\"+-*/<>=~!@#%^&|`?\",specialVar:``,keywords:jh+`abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes`,types:Ah+`bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml`}),ug=`accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`,dg=Ah+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed`,fg=`charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee`,pg=ng.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:\"`\",keywords:jh+`group_concat `+ug,types:dg,builtin:fg}),mg=ng.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:\"`\",keywords:jh+`always generated groupby_concat hard persistent shutdown soft virtual `+ug,types:dg,builtin:fg}),hg=ng.define({keywords:jh+`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:Ah+`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:`@:?$`}),gg=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,_g=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(gg(e)):gg,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 C(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=oe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=se(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(_g.prototype[Symbol.iterator]=function(){return this});var vg={from:-1,to:-1,match:/.*/.exec(``),precise:!0},yg=`gm`+(/x/.unicode==null?``:`u`),bg=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=vg,/\\\\[sWDnr]|\\n|\\r|\\[\\^/.test(t))return new Cg(e,t,n,r,i);this.re=new RegExp(t,yg+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Tg(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Tg(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},xg=new WeakMap,Sg=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=xg.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return xg.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),xg.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Cg=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=vg,this.matchPos=Tg(e,r),this.re=new RegExp(t,yg+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Sg.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=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 e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Tg(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Sg.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(bg.prototype[Symbol.iterator]=Cg.prototype[Symbol.iterator]=function(){return this});function wg(e){try{return new RegExp(e,yg),!0}catch{return!1}}function Tg(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Eg=e=>{let t=Ls(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=Is(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=T.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,G.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Dg={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Og=E.define({combine(e){return at(e,Dg,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function kg(e){let t=[Fg,Pg];return e&&t.push(Og.of(e)),t}var Ag=L.mark({class:`cm-selectionMatch`}),jg=L.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Mg(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=k.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=k.Word)}function Ng(e,t,n,r){return e(t.sliceDoc(n,n+1))==k.Word&&e(t.sliceDoc(r-1,r))==k.Word}var Pg=V.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Og),{state:n}=e,r=n.selection;if(r.ranges.length>1)return L.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return L.none;let e=n.wordAt(i.head);if(!e)return L.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return L.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Mg(o,n,i.from,i.to)&&Ng(o,n,i.from,i.to)))return L.none}else if(a=n.sliceDoc(i.from,i.to),!a)return L.none}let s=[];for(let r of e.visibleRanges){let e=new _g(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Mg(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(jg.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Ag.range(r,a)),s.length>t.maxMatches))return L.none}}return L.set(s)}},{decorations:e=>e.decorations}),Fg=G.baseTheme({\".cm-selectionMatch\":{backgroundColor:`#99ff7780`},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:`transparent`}}),Ig=({state:e,dispatch:t})=>{let{selection:n}=e,r=T.create(n.ranges.map(t=>e.wordAt(t.head)||T.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function Lg(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new _g(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new _g(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Rg=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Ig({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Lg(e,r);return i?(t(e.update({selection:e.selection.addRange(T.range(i.from,i.to),!1),effects:G.scrollIntoView(i.to)})),!0):!1},zg=E.define({combine(e){return at(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new y_(e),scrollToMatch:e=>G.scrollIntoView(e)})}}),Bg=class{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||wg(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\\\([nrt\\\\])/g,(e,t)=>t==`n`?`\n`:t==`r`?`\\r`:t==`t`?`\t`:`\\\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Zg(this):new Gg(this)}getCursor(e,t=0,n){let r=e.doc?e:A.create({doc:e});return n??=r.doc.length,this.regexp?qg(this,r,t,n):Ug(this,r,t,n)}},Vg=class{constructor(e){this.spec=e}};function Hg(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function Ug(e,t,n,r){let i;return e.wholeWord&&(i=Wg(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Hg(e.test,t,i)),new _g(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Wg(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(Jg(i,n-a))!=k.Word||t(Yg(i,n-a))!=k.Word)&&(t(Yg(i,r-a))!=k.Word||t(Jg(i,r-a))!=k.Word))}var Gg=class extends Vg{constructor(e){super(e)}nextMatch(e,t,n){let r=Ug(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Ug(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Ug(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Ug(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Ug(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Kg(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function qg(e,t,n,r){let i;return e.wholeWord&&(i=Xg(t.charCategorizer(t.selection.main.head))),e.test&&(i=Kg(e.test,t,i)),new bg(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Jg(e,t){return e.slice(S(e,t,!1),t)}function Yg(e,t){return e.slice(t,S(e,t))}function Xg(e){return(t,n,r)=>!r[0].length||(e(Jg(r.input,r.index))!=k.Word||e(Yg(r.input,r.index))!=k.Word)&&(e(Yg(r.input,r.index+r[0].length))!=k.Word||e(Jg(r.input,r.index+r[0].length))!=k.Word)}var Zg=class extends Vg{nextMatch(e,t,n){let r=qg(this.spec,e,n,e.doc.length).next();return r.done&&(r=qg(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=qg(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\\$([$&]|\\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=qg(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=qg(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},Qg=D.define(),$g=D.define(),e_=Ee.define({create(e){return new t_(p_(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Qg)?e=new t_(n.value.create(),e.panel):n.is($g)&&(e=new t_(e.query,n.value?f_:null));return e},provide:e=>Fs.from(e,e=>e.panel)}),t_=class{constructor(e,t){this.query=e,this.panel=t}},n_=L.mark({class:`cm-searchMatch`}),r_=L.mark({class:`cm-searchMatch cm-searchMatch-selected`}),i_=V.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(e_))}update(e){let t=e.state.field(e_);(t!=e.startState.field(e_)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return L.none;let{view:n}=this,r=new pt;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?r_:n_)})}return r.finish()}},{decorations:e=>e.decorations});function a_(e){return t=>{let n=t.state.field(e_,!1);return n&&n.query.spec.valid?e(t,n):g_(t)}}var o_=a_((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=T.single(r.from,r.to),a=e.state.facet(zg);return e.dispatch({selection:i,effects:[C_(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),h_(e),!0}),s_=a_((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=T.single(i.from,i.to),o=e.state.facet(zg);return e.dispatch({selection:a,effects:[C_(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),h_(e),!0}),c_=a_((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:T.create(n.map(e=>T.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),l_=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new _g(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(T.range(t.value.from,t.value.to))}return t(e.update({selection:T.create(a,o),userEvent:`select.search.matches`})),!0},u_=a_((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(G.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=T.single(o.from,o.to).map(d),u.push(C_(e,o)),u.push(n.facet(zg).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),d_=a_((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:G.announce.of(r),userEvent:`input.replace.all`}),!0});function f_(e){return e.state.facet(zg).createPanel(e)}function p_(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(zg);return new Bg({search:t?.literal??i.literal?r:r.replace(/\\n/g,`\\\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function m_(e){let t=js(e,f_);return t&&t.dom.querySelector(`[main-field]`)}function h_(e){let t=m_(e);t&&t==e.root.activeElement&&t.select()}var g_=e=>{let t=e.state.field(e_,!1);if(t&&t.panel){let n=m_(e);if(n&&n!=e.root.activeElement){let r=p_(e.state,t.query.spec);r.valid&&e.dispatch({effects:Qg.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[$g.of(!0),t?Qg.of(p_(e.state,t.query.spec)):D.appendConfig.of(T_)]});return!0},__=e=>{let t=e.state.field(e_,!1);if(!t||!t.panel)return!1;let n=js(e,f_);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:$g.of(!1)}),!0},v_=[{key:`Mod-f`,run:g_,scope:`editor search-panel`},{key:`F3`,run:o_,shift:s_,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:o_,shift:s_,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:__,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:l_},{key:`Mod-Alt-g`,run:Eg},{key:`Mod-d`,run:Rg,preventDefault:!0}],y_=class{constructor(e){this.view=e;let t=this.query=e.state.field(e_).query.spec;this.commit=this.commit.bind(this),this.searchField=N(`input`,{value:t.search,placeholder:b_(e,`Find`),\"aria-label\":b_(e,`Find`),class:`cm-textfield`,name:`search`,form:``,\"main-field\":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=N(`input`,{value:t.replace,placeholder:b_(e,`Replace`),\"aria-label\":b_(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=N(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=N(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=N(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return N(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=N(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>o_(e),[b_(e,`next`)]),n(`prev`,()=>s_(e),[b_(e,`previous`)]),n(`select`,()=>c_(e),[b_(e,`all`)]),N(`label`,null,[this.caseField,b_(e,`match case`)]),N(`label`,null,[this.reField,b_(e,`regexp`)]),N(`label`,null,[this.wordField,b_(e,`by word`)]),...e.state.readOnly?[]:[N(`br`),this.replaceField,n(`replace`,()=>u_(e),[b_(e,`replace`)]),n(`replaceAll`,()=>d_(e),[b_(e,`replace all`)])],N(`button`,{name:`close`,onclick:()=>__(e),\"aria-label\":b_(e,`close`),type:`button`},[`×`])])}commit(){let e=new Bg({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:Qg.of(e)}))}keydown(e){Wo(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?s_:o_)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),u_(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Qg)&&!e.value.eq(this.query)&&this.setQuery(e.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(zg).top}};function b_(e,t){return e.state.phrase(t)}var x_=30,S_=/[\\s\\.,:;?!]/;function C_(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-x_),o=Math.min(i,n+x_),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<x_;e++)if(!S_.test(s[e+1])&&S_.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-x_;e--)if(!S_.test(s[e-1])&&S_.test(s[e])){s=s.slice(0,e);break}}return G.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var w_=G.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`}}),T_=[e_,ke.low(i_),w_],E_=t(e(),1),D_=n(),O_=Zl.define([{tag:X.keyword,color:`var(--accent)`,fontWeight:`600`},{tag:[X.string,X.special(X.string)],color:`#2e9e62`},{tag:[X.number,X.bool,X.null],color:`#d9822b`},{tag:[X.comment,X.lineComment,X.blockComment],color:`var(--text-faint)`,fontStyle:`italic`},{tag:[X.typeName,X.standard(X.name)],color:`#9b51e0`},{tag:X.operator,color:`var(--text-dim)`}]),k_=G.theme({\"&\":{backgroundColor:`var(--bg)`,color:`var(--text)`},\".cm-content\":{caretColor:`var(--text)`,padding:`6px 0`},\".cm-gutters\":{backgroundColor:`var(--bg-chrome)`,color:`var(--text-faint)`,border:`none`},\".cm-activeLine\":{backgroundColor:`var(--bg-hover)`},\".cm-activeLineGutter\":{backgroundColor:`var(--bg-hover)`},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground\":{backgroundColor:`var(--selection) !important`},\".cm-tooltip\":{backgroundColor:`var(--bg)`,border:`1px solid var(--border)`},\".cm-tooltip-autocomplete ul li[aria-selected]\":{backgroundColor:`var(--accent)`,color:`var(--accent-text)`}}),A_={postgres:lg,mysql:pg,mariadb:mg,sqlite:hg};function j_({value:e,onChange:t,onRun:n,schema:r,defaultSchema:i,kind:a,label:o}){let s=A_[a]??lg,c=(0,E_.useRef)(null),l=(0,E_.useRef)(null),u=(0,E_.useRef)(new je),d=(0,E_.useRef)({onChange:t,onRun:n});return(0,E_.useEffect)(()=>{d.current={onChange:t,onRun:n}}),(0,E_.useEffect)(()=>{let t=e=>t=>(d.current.onRun(e,t.state.doc.toString(),t.state.selection.main.head),!0),n=new G({parent:c.current,root:c.current.getRootNode(),state:A.create({doc:e,extensions:[ke.highest(Vo.of([{key:`Mod-Enter`,run:t(`current`)},{key:`Shift-Mod-Enter`,run:t(`all`)}])),sc(),dc(),ps(),ff(),os(),pu(),kd(),Kd(),kg(),tu(O_),u.current.of(sg({dialect:s,schema:r,defaultSchema:i,upperCaseKeywords:!0})),Vo.of([...Fd,...vm,...v_,...jf,...qd,ym]),_s(`SELECT * FROM … ⌘↵ runs the statement at the cursor`),G.lineWrapping,G.contentAttributes.of({\"aria-label\":o}),G.updateListener.of(e=>{e.docChanged&&d.current.onChange(e.state.doc.toString())}),k_]})});return l.current=n,()=>n.destroy()},[]),(0,E_.useEffect)(()=>{let t=l.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,E_.useEffect)(()=>{l.current?.dispatch({effects:u.current.reconfigure(sg({dialect:s,schema:r,defaultSchema:i,upperCaseKeywords:!0}))})},[r,i,s]),(0,D_.jsx)(`div`,{className:`editor`,ref:c})}export{j_ as Editor};"},"index-BVyk1TYR.js":{"type":"text/javascript; charset=utf-8","body":"var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var C={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function w(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function re(e,t){return w(e.type,t,e.props)}function ie(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function T(e){var t={\"=\":`=0`,\":\":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\\/+/g;function E(e,t){return typeof e==`object`&&e&&e.key!=null?T(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+E(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(ie(o)&&(o=re(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+E(a,u),c+=se(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+E(a,u++),c+=se(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return se(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function D(e,t,n){if(e==null)return e;var r=[],i=0;return se(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ce(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var le=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ue(e){var t=C.T,n={};n.types=t===null?null:t.types,C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,le)}catch(e){le(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}}function O(e){var t=C.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ue(O.bind(null,e))}var de={map:D,forEach:function(e,t,n){D(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return D(e,function(){t++}),t},toArray:function(e){return D(e,function(e){return e})||[]},only:function(e){if(!ie(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=de,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.addTransitionType=O,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ne.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return w(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ne.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return w(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ie,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ce}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ue,e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,C=-1;function ne(){return g?!0:!(e.unstable_now()-C<te)}function w(){if(g=!1,S){var t=e.unstable_now();C=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(w)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,T=ie.port2;ie.port1.onmessage=w,re=function(){T.postMessage(null)}}else re=function(){_(w,0)};function ae(t,n){ee=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function ee(e,t,n){return e===n||e===t&&(x=e,!0)}function te(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,re=Symbol.for(`react.element`),ie=Symbol.for(`react.transitional.element`),T=Symbol.for(`react.portal`),ae=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),oe=Symbol.for(`react.profiler`),se=Symbol.for(`react.consumer`),D=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),O=Symbol.for(`react.memo`),de=Symbol.for(`react.lazy`),fe=Symbol.for(`react.activity`),pe=Symbol.for(`react.legacy_hidden`),me=Symbol.for(`react.memo_cache_sentinel`),he=Symbol.for(`react.view_transition`),ge=Symbol.for(`react.recoverable`),_e=Symbol.iterator;function ve(e){return typeof e!=`object`||!e?null:(e=_e&&e[_e]||e[`@@iterator`],typeof e==`function`?e:null)}var ye=Symbol.for(`react.client.reference`);function be(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ae:return`Fragment`;case oe:return`Profiler`;case E:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case fe:return`Activity`;case he:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case T:return`Portal`;case D:return e.displayName||`Context`;case se:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case O:return t=e.displayName||null,t===null?be(e.type)||`Memo`:t;case de:t=e._payload,e=e._init;try{return be(e(t))}catch{}}return null}var xe=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function we(e){return{current:e}}function M(e){0>Ce||(e.current=Se[Ce],Se[Ce]=null,Ce--)}function N(e,t){Ce++,Se[Ce]=e.current,e.current=t}var Te=we(null),Ee=we(null),De=we(null),Oe=we(null);function ke(e,t){switch(N(De,t),N(Ee,e),N(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}M(Te),N(Te,e)}function Ae(){M(Te),M(Ee),M(De)}function je(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,N(Oe,e)),t=Te.current;var n=dp(t,e.type);t!==n&&(N(Ee,e),N(Te,n))}function Me(e){Ee.current===e&&(M(Te),M(Ee)),Oe.current===e&&(M(Oe),sh._currentValue=j)}var Ne,Pe;function Fe(e){if(Ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\\n( *(at )?)/);Ne=t&&t[1]||``,Pe=-1<e.stack.indexOf(`\n at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`\n`+Ne+e+Pe}var Ie=!1;function Le(e,t){if(!e||Ie)return``;Ie=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,\"props\",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,\"props\",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,\"props\",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,\"name\",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`\n`),l=s.split(`\n`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`\n`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ie=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Fe(n):``}function Re(e,t){switch(e.tag){case 26:case 27:case 5:return Fe(e.type);case 16:return Fe(`Lazy`);case 13:return e.child!==t&&t!==null?Fe(`Suspense Fallback`):Fe(`Suspense`);case 19:return Fe(`SuspenseList`);case 0:case 15:return Le(e.type,!1);case 11:return Le(e.type.render,!1);case 1:return Le(e.type,!0);case 31:return Fe(`Activity`);case 30:return Fe(`ViewTransition`);default:return``}}function ze(e){try{var t=``,n=null;do t+=Re(e,n),n=e,e=e.return;while(e);return t}catch(e){return`\nError generating stack: `+e.message+`\n`+e.stack}}var Be=Object.prototype.hasOwnProperty,Ve=t.unstable_scheduleCallback,He=t.unstable_cancelCallback,Ue=t.unstable_shouldYield,We=t.unstable_requestPaint,Ge=t.unstable_now,Ke=t.unstable_getCurrentPriorityLevel,qe=t.unstable_ImmediatePriority,Je=t.unstable_UserBlockingPriority,Ye=t.unstable_NormalPriority,Xe=t.unstable_LowPriority,Ze=t.unstable_IdlePriority,Qe=t.log,$e=t.unstable_setDisableYieldValue,et=null,tt=null;function nt(e){if(typeof Qe==`function`&&$e(e),tt&&typeof tt.setStrictMode==`function`)try{tt.setStrictMode(et,e)}catch{}}var rt=Math.clz32?Math.clz32:ot,it=Math.log,at=Math.LN2;function ot(e){return e>>>=0,e===0?32:31-(it(e)/at|0)|0}var st=256,ct=262144,lt=4194304;function ut(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function dt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ut(n))):i=ut(o):i=ut(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ut(n))):i=ut(o)):i=ut(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ft(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-rt(n),i=1<<r;t|=e[r],n&=~i}return t}function mt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ht(){var e=lt;return lt<<=1,!(lt&62914560)&&(lt=4194304),e}function gt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function _t(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-rt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&yt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function yt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-rt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-rt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function xt(e,t){var n=t&-t;return n=n&42?1:St(n),(n&(e.suspendedLanes|t))===0?n:0}function St(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function wt(){var e=A.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function Tt(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var Et=Math.random().toString(36).slice(2),Dt=`__reactFiber$`+Et,Ot=`__reactProps$`+Et,kt=`__reactContainer$`+Et,At=`__reactEvents$`+Et,jt=`__reactListeners$`+Et,Mt=`__reactHandles$`+Et,Nt=`__reactResources$`+Et,Pt=`__reactMarker$`+Et,Ft=`__reactLoad$`+Et;function It(e){delete e[Dt],delete e[Ot],delete e[jt],delete e[Mt]}function Lt(e){var t;if(t=e[Dt])return t;for(var n=e.parentNode;n;){if(t=n[kt]||n[Dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Dt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Rt(e){if(e=e[Dt]||e[kt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function zt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Bt(e){var t=e[Nt];return t||=e[Nt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Vt(e){e[Pt]=!0}function Ht(e){e[Ft]=void 0}var Ut=new Set,Wt={};function Gt(e,t){Kt(e,t),Kt(e+`Capture`,t)}function Kt(e,t){for(Wt[e]=t,e=0;e<t.length;e++)Ut.add(t[e])}var qt=RegExp(`^[:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD][:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\\\\-.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]*$`),Jt={},Yt={};function Xt(e){return Be.call(Yt,e)?!0:Be.call(Jt,e)?!1:qt.test(e)?Yt[e]=!0:(Jt[e]=!0,!1)}var P=!1;function Zt(){var e=P;return P=!1,e}function Qt(e,t,n){if(Xt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function $t(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function en(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function tn(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function nn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function rn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function an(e){if(!e._valueTracker){var t=nn(e)?`checked`:`value`;e._valueTracker=rn(e,t,``+e[t])}}function on(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=nn(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var sn=/[\\n\"\\\\]/g;function cn(e){return e.replace(sn,function(e){return`\\\\`+e.charCodeAt(0).toString(16)+` `})}function ln(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+tn(t)):e.value!==``+tn(t)&&(e.value=``+tn(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):dn(e,tn(n)):o===`number`&&e.value==t?dn(e,tn(e.value)):dn(e,tn(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+tn(s):e.removeAttribute(`name`)}function un(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){an(e);return}n=n==null?``:``+tn(n),t=t==null?n:``+tn(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),an(e)}function dn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function fn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+tn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function pn(e,t,n){t!=null&&(t=``+tn(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+tn(n)}function mn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(xe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=tn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),an(e)}function hn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function _n(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||gn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function vn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,P=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(_n(e,a,r),P=!0)}else for(var o in t)t.hasOwnProperty(o)&&_n(e,o,t[o])}function yn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var bn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),xn=/^[\\u0000-\\u001F ]*j[\\r\\n\\t]*a[\\r\\n\\t]*v[\\r\\n\\t]*a[\\r\\n\\t]*s[\\r\\n\\t]*c[\\r\\n\\t]*r[\\r\\n\\t]*i[\\r\\n\\t]*p[\\r\\n\\t]*t[\\r\\n\\t]*:/i;function Sn(e){return xn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Cn(){}var wn=null;function Tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var En=null,Dn=null;function On(e){var t=Rt(e);if(t&&(e=t.stateNode)){var n=e[Ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(ln(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=\"`+cn(``+t)+`\"][type=\"radio\"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Ot]||null;if(!a)throw Error(i(90));ln(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&on(r)}break a;case`textarea`:pn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&fn(e,!!n.multiple,t,!1)}}}var kn=!1;function An(e,t,n){if(kn)return e(t,n);kn=!0;try{return e(t)}finally{if(kn=!1,(En!==null||Dn!==null)&&(zd(),En&&(t=En,e=Dn,Dn=En=null,On(t),e)))for(t=0;t<e.length;t++)On(e[t])}}function jn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Mn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Nn=!1;if(Mn)try{var Pn={};Object.defineProperty(Pn,\"passive\",{get:function(){Nn=!0}}),window.addEventListener(`test`,Pn,Pn),window.removeEventListener(`test`,Pn,Pn)}catch{Nn=!1}var Fn=null,In=null,Ln=null;function Rn(){if(Ln)return Ln;var e,t=In,n=t.length,r,i=`value`in Fn?Fn.value:Fn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Ln=i.slice(e,1<r?1-r:void 0)}function zn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Bn(){return!0}function Vn(){return!1}function Hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Bn:Vn,this.isPropagationStopped=Vn,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Bn)},persist:function(){},isPersistent:Bn}),t}var Un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wn=Hn(Un),Gn=w({},Un,{view:0,detail:0}),Kn=Hn(Gn),qn,Jn,Yn,Xn=w({},Gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Yn&&(Yn&&e.type===`mousemove`?(qn=e.screenX-Yn.screenX,Jn=e.screenY-Yn.screenY):Jn=qn=0,Yn=e),qn)},movementY:function(e){return`movementY`in e?e.movementY:Jn}}),Zn=Hn(Xn),Qn=Hn(w({},Xn,{dataTransfer:0})),$n=Hn(w({},Gn,{relatedTarget:0})),er=Hn(w({},Un,{animationName:0,elapsedTime:0,pseudoElement:0})),tr=Hn(w({},Un,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),nr=Hn(w({},Un,{data:0})),rr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},ir={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},ar={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function or(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ar[e])?!!t[e]:!1}function sr(){return or}var cr=Hn(w({},Gn,{key:function(e){if(e.key){var t=rr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=zn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?ir[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sr,charCode:function(e){return e.type===`keypress`?zn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?zn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),lr=Hn(w({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ur=Hn(w({},Un,{submitter:0})),dr=Hn(w({},Gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sr})),fr=Hn(w({},Un,{propertyName:0,elapsedTime:0,pseudoElement:0})),pr=Hn(w({},Xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),mr=Hn(w({},Un,{newState:0,oldState:0,source:0})),hr=[9,13,27,32],gr=Mn&&`CompositionEvent`in window,_r=null;Mn&&`documentMode`in document&&(_r=document.documentMode);var vr=Mn&&`TextEvent`in window&&!_r,yr=Mn&&(!gr||_r&&8<_r&&11>=_r),br=` `,xr=!1;function Sr(e,t){switch(e){case`keyup`:return hr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var wr=!1;function Tr(e,t){switch(e){case`compositionend`:return Cr(t);case`keypress`:return t.which===32?(xr=!0,br):null;case`textInput`:return e=t.data,e===br&&xr?null:e;default:return null}}function Er(e,t){if(wr)return e===`compositionend`||!gr&&Sr(e,t)?(e=Rn(),Ln=In=Fn=null,wr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return yr&&t.locale!==`ko`?null:t.data;default:return null}}var Dr={color:!0,date:!0,datetime:!0,\"datetime-local\":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Dr[e.type]:t===`textarea`}function kr(e,t,n,r){En?Dn?Dn.push(r):Dn=[r]:En=r,t=Jf(t,`onChange`),0<t.length&&(n=new Wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Ar=null,jr=null;function Mr(e){Vf(e,0)}function Nr(e){if(on(zt(e)))return e}function Pr(e,t){if(e===`change`)return t}var Fr=!1;if(Mn){var Ir;if(Mn){var Lr=`oninput`in document;if(!Lr){var Rr=document.createElement(`div`);Rr.setAttribute(`oninput`,`return;`),Lr=typeof Rr.oninput==`function`}Ir=Lr}else Ir=!1;Fr=Ir&&(!document.documentMode||9<document.documentMode)}function zr(){Ar&&(Ar.detachEvent(`onpropertychange`,Br),jr=Ar=null)}function Br(e){if(e.propertyName===`value`&&Nr(jr)){var t=[];kr(t,jr,e,Tn(e)),An(Mr,t)}}function Vr(e,t,n){e===`focusin`?(zr(),Ar=t,jr=n,Ar.attachEvent(`onpropertychange`,Br)):e===`focusout`&&zr()}function Hr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Nr(jr)}function Ur(e,t){if(e===`click`)return Nr(t)}function Wr(e,t){if(e===`input`||e===`change`)return Nr(t)}function Gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Kr=typeof Object.is==`function`?Object.is:Gr;function qr(e,t){if(Kr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Be.call(t,i)||!Kr(e[i],t[i]))return!1}return!0}function Jr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xr(e,t){var n=Yr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Yr(n)}}function Zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function $r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ei=Mn&&`documentMode`in document&&11>=document.documentMode,ti=null,ni=null,ri=null,ii=!1;function ai(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ii||ti==null||ti!==Jr(r)||(r=ti,`selectionStart`in r&&$r(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ri&&qr(ri,r)||(ri=r,r=Jf(ni,`onSelect`),0<r.length&&(t=new Wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=ti)))}function oi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var si={animationend:oi(`Animation`,`AnimationEnd`),animationiteration:oi(`Animation`,`AnimationIteration`),animationstart:oi(`Animation`,`AnimationStart`),transitionrun:oi(`Transition`,`TransitionRun`),transitionstart:oi(`Transition`,`TransitionStart`),transitioncancel:oi(`Transition`,`TransitionCancel`),transitionend:oi(`Transition`,`TransitionEnd`)},ci={},li={};Mn&&(li=document.createElement(`div`).style,`AnimationEvent`in window||(delete si.animationend.animation,delete si.animationiteration.animation,delete si.animationstart.animation),`TransitionEvent`in window||delete si.transitionend.transition);function ui(e){if(ci[e])return ci[e];if(!si[e])return e;var t=si[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in li)return ci[e]=t[n];return e}var di=ui(`animationend`),fi=ui(`animationiteration`),pi=ui(`animationstart`),mi=ui(`transitionrun`),hi=ui(`transitionstart`),gi=ui(`transitioncancel`),_i=ui(`transitionend`),vi=new Map,yi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);yi.push(`scrollEnd`);function bi(e,t){vi.set(e,t),Gt(t,[e])}var xi=0;function Si(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=bd.identifierPrefix;var n=xi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function Ci(e){if(e==null||typeof e==`string`)return e;var t=null,n=Od;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function wi(e,t){return e=Ci(e),t=Ci(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Ti=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Ei=[],Di=0,Oi=0;function ki(){for(var e=Di,t=Oi=Di=0;t<e;){var n=Ei[t];Ei[t++]=null;var r=Ei[t];Ei[t++]=null;var i=Ei[t];Ei[t++]=null;var a=Ei[t];if(Ei[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Ni(n,i,a)}}function Ai(e,t,n,r){Ei[Di++]=e,Ei[Di++]=t,Ei[Di++]=n,Ei[Di++]=r,Oi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ji(e,t,n,r){return Ai(e,t,n,r),Pi(e)}function Mi(e,t){return Ai(e,null,null,t),Pi(e)}function Ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-rt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Pi(e){if(50<kd)throw kd=0,Ad=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Fi={};function Ii(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Li(e,t,n,r){return new Ii(e,t,n,r)}function Ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zi(e,t){var n=e.alternate;return n===null?(n=Li(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Bi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Vi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ri(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case fe:return e=Li(31,n,t,a),e.elementType=fe,e.lanes=o,e;case ae:return Hi(n.children,a,o,t);case E:s=8,a|=24;break;case oe:return e=Li(12,n,t,a|2),e.elementType=oe,e.lanes=o,e;case le:return e=Li(13,n,t,a),e.elementType=le,e.lanes=o,e;case ue:return e=Li(19,n,t,a),e.elementType=ue,e.lanes=o,e;case pe:case he:return e=a|32,e=Li(30,n,t,e),e.elementType=he,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case D:s=10;break a;case se:s=9;break a;case ce:s=11;break a;case O:s=14;break a;case de:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Li(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Hi(e,t,n,r){return e=Li(7,e,r,t),e.lanes=n,e}function Ui(e,t,n){return e=Li(6,e,null,t),e.lanes=n,e}function Wi(e){var t=Li(18,null,null,0);return t.stateNode=e,t}function Gi(e,t,n){return t=Li(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ki=new WeakMap;function qi(e,t){if(typeof e==`object`&&e){var n=Ki.get(e);return n===void 0?(t={value:e,source:t,stack:ze(t)},Ki.set(e,t),t):n}return{value:e,source:t,stack:ze(t)}}var Ji=[],Yi=0,Xi=null,Zi=0,Qi=[],$i=0,ea=null,ta=1,na=``;function ra(e,t){Ji[Yi++]=Zi,Ji[Yi++]=Xi,Xi=e,Zi=t}function ia(e,t,n){Qi[$i++]=ta,Qi[$i++]=na,Qi[$i++]=ea,ea=e;var r=ta;e=na;var i=32-rt(r)-1;r&=~(1<<i),n+=1;var a=32-rt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ta=1<<32-rt(t)+i|n<<i|r,na=a+e}else ta=1<<a|n<<i|r,na=e}function aa(e){e.return!==null&&(ra(e,1),ia(e,1,0))}function oa(e){for(;e===Xi;)Xi=Ji[--Yi],Ji[Yi]=null,Zi=Ji[--Yi],Ji[Yi]=null;for(;e===ea;)ea=Qi[--$i],Qi[$i]=null,na=Qi[--$i],Qi[$i]=null,ta=Qi[--$i],Qi[$i]=null}function sa(e,t){Qi[$i++]=ta,Qi[$i++]=na,Qi[$i++]=ea,ta=t.id,na=t.overflow,ea=e}var ca=null,F=null,I=!1,la=null,ua=!1,da=Error(i(519));function fa(e){throw va(qi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),da}function pa(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Dt]=e,t[Ot]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<zf.length;n++)Q(zf[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),un(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),mn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ep(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=Cn),t=!0):t=!1,t||fa(e,!0)}function ma(e){for(ca=e.return;ca;)switch(ca.tag){case 5:case 31:case 13:ua=!1;return;case 27:case 3:ua=!0;return;default:ca=ca.return}}function ha(e){if(e!==ca)return!1;if(!I)return ma(e),I=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&F&&fa(e),ma(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));F=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));F=dm(e)}else t===27?(t=F,Sp(e.type)?(e=um,um=null,F=e):F=t):F=ca?lm(e.stateNode.nextSibling):null;return!0}function ga(){F=ca=null,I=!1}function _a(){var e=la;return e!==null&&(pd===null?pd=e:pd.push.apply(pd,e),la=null),e}function va(e){la===null?la=[e]:la.push(e)}var ya=we(null),ba=null,xa=null;function Sa(e,t,n){N(ya,t._currentValue),t._currentValue=n}function Ca(e){e._currentValue=ya.current,M(ya)}function wa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ta(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),wa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),wa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),wa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ea(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Kr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Oe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&Ta(t,e,n,r),t.flags|=262144,e!==null}function Da(e){for(e=e.firstContext;e!==null;){if(!Kr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Oa(e){ba=e,xa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ka(e){return ja(ba,e)}function Aa(e,t){return ba===null&&Oa(e),ja(e,t)}function ja(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},xa===null){if(e===null)throw Error(i(308));xa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else xa=xa.next=t;return n}var Ma=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Na=t.unstable_scheduleCallback,Pa=t.unstable_NormalPriority,Fa={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ia(){return{controller:new Ma,data:new Map,refCount:0}}function La(e){e.refCount--,e.refCount===0&&Na(Pa,function(){e.controller.abort()})}function Ra(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var za=null;function Ba(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Va=null,Ha=0,Ua=0,Wa=null;function Ga(e,t){if(Va===null){var n=Va=[];Ha=0,Ua=Pf(),Wa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ha++,t.then(Ka,Ka),t}function Ka(){if(--Ha===0&&(za=null,Va!==null)){Wa!==null&&(Wa.status=`fulfilled`);var e=Va;Va=null,Ua=0,Wa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function qa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ja=k.S;k.S=function(e,t){if(gd=Ge(),typeof t==`object`&&t&&typeof t.then==`function`&&Ga(e,t),za!==null)for(var n=bf;n!==null;)Ra(n,za),n=n.next;if(n=e.types,n!==null){for(var r=bf;r!==null;)Ra(r,n),r=r.next;if(Ua!==0){r=za,r===null&&(r=za=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ja!==null&&Ja(e,t)};var Ya=we(null);function Xa(){var e=Ya.current;return e===null?G.pooledCache:e}function Za(e,t){t===null?N(Ya,Ya.current):N(Ya,t.pool)}function Qa(){var e=Xa();return e===null?null:{parent:Fa._currentValue,pool:e}}var $a=Error(i(460)),eo=Error(i(474)),to=Error(i(542)),no={then:function(){}};function ro(e){return e=e.status,e===`fulfilled`||e===`rejected`}function io(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Cn,Cn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,co(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(Cn,Cn);else{if(e=G,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,co(e),e}throw oo=t,$a}}function ao(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(oo=e,$a):e}}var oo=null;function so(){if(oo===null)throw Error(i(459));var e=oo;return oo=null,e}function co(e){if(e===$a||e===to)throw Error(i(483))}var lo=null,uo=0;function fo(e){var t=uo;return uo+=1,lo===null&&(lo=[]),io(lo,e,t)}function po(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function mo(e,t){throw t.$$typeof===re?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ho(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=zi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ui(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ae?(e=d(e,t,n.props.children,r,n.key),po(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===de&&ao(i)===t.type)?(t=a(t,n.props),po(t,n),t.return=e,t):(t=Vi(n.type,n.key,n.props,null,e.mode,r),po(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Gi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Hi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ui(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case ie:return n=Vi(t.type,t.key,t.props,null,e.mode,n),po(n,t),n.return=e,n;case T:return t=Gi(t,e.mode,n),t.return=e,t;case de:return t=ao(t),f(e,t,n)}if(xe(t)||ve(t))return t=Hi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,fo(t),n);if(t.$$typeof===D)return f(e,Aa(e,t),n);mo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case ie:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case de:return n=ao(n),p(e,t,n,r)}if(xe(n)||ve(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,fo(n),r);if(n.$$typeof===D)return p(e,t,Aa(e,n),r);mo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case ie:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case de:return r=ao(r),m(e,t,n,r,i)}if(xe(r)||ve(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,fo(r),i);if(r.$$typeof===D)return m(e,t,n,Aa(t,r),i);mo(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),I&&ra(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return I&&ra(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),I&&ra(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),I&&ra(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&ra(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),I&&ra(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ae&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case ie:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ae){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),po(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===de&&ao(l)===r.type){n(e,r.sibling),c=a(r,o.props),po(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ae?(c=Hi(o.props.children,e.mode,c,o.key),po(c,o),c.return=e,e=c):(c=Vi(o.type,o.key,o.props,null,e.mode,c),po(c,o),c.return=e,e=c)}return s(e);case T:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Gi(o,e.mode,c),c.return=e,e=c}return s(e);case de:return o=ao(o),_(e,r,o,c)}if(xe(o))return h(e,r,o,c);if(ve(o)){if(l=ve(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,fo(o),c);if(o.$$typeof===D)return _(e,r,Aa(e,o),c);mo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{uo=0;var i=_(e,t,n,r);return lo=null,i}catch(t){if(t===$a||t===to)throw t;var a=Li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var go=ho(!0),_o=ho(!1),vo=!1;function yo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function So(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Pi(e),Ni(e,null,n),t}return Ai(e,r,t,n),Pi(e)}function Co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bt(e,n)}}function wo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var To=!1;function Eo(){if(To){var e=Wa;if(e!==null)throw e}}function Do(e,t,n,r){To=!1;var i=e.updateQueue;vo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Ua&&(To=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=w({},d,f);break a;case 2:vo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function Oo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function ko(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Oo(n[e],t)}var Ao=we(null),jo=we(0);function Mo(e,t){e=od,N(jo,e),N(Ao,t),od=e|t.baseLanes}function No(){N(jo,od),N(Ao,Ao.current)}function Po(){od=jo.current,M(Ao),M(jo)}var Fo=we(null),Io=null;function Lo(e){var t=e.alternate;N(Ho,Ho.current&1),N(Fo,e),Io===null&&(t===null||Ao.current!==null||t.memoizedState!==null)&&(Io=e)}function Ro(e){N(Ho,Ho.current),N(Fo,e),Io===null&&(Io=e)}function zo(e){e.tag===22?(N(Ho,Ho.current),N(Fo,e),Io===null&&(Io=e)):Bo()}function Bo(){N(Ho,Ho.current),N(Fo,Fo.current)}function Vo(e){M(Fo),Io===e&&(Io=null),M(Ho)}var Ho=we(0);function Uo(e,t){N(Fo,Fo.current),N(Ho,t)}function Wo(e){M(Ho),M(Fo),Io===e&&(Io=null)}function Go(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ko=0,L=null,R=null,qo=null,Jo=!1,Yo=!1,Xo=!1,Zo=0,Qo=0,$o=null,es=0;function z(){throw Error(i(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Kr(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,i,a){return Ko=a,L=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?vc:yc,Xo=!1,a=n(r,i),Xo=!1,Yo&&(a=is(t,n,r,i)),rs(e),a}function rs(e){k.H=_c;var t=R!==null&&R.next!==null;if(Ko=0,qo=R=L=null,Jo=!1,Qo=0,$o=null,t)throw Error(i(300));e===null||Ic||(e=e.dependencies,e!==null&&Da(e)&&(Ic=!0))}function is(e,t,n,r){L=e;var a=0;do{if(Yo&&($o=null),Qo=0,Yo=!1,25<=a)throw Error(i(301));if(a+=1,qo=R=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=bc,o=t(n,r)}while(Yo);return o}function as(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(R===null?null:R.memoizedState)!==e&&(L.flags|=1024),t}function os(){var e=Zo!==0;return Zo=0,e}function ss(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function cs(e){if(Jo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Jo=!1}Ko=0,qo=R=L=null,Yo=!1,Qo=Zo=0,$o=null}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qo===null?L.memoizedState=qo=e:qo=qo.next=e,qo}function B(){if(R===null){var e=L.alternate;e=e===null?null:e.memoizedState}else e=R.next;var t=qo===null?L.memoizedState:qo.next;if(t!==null)qo=t,R=e;else{if(e===null)throw L.alternate===null?Error(i(467)):Error(i(310));R=e,e={memoizedState:R.memoizedState,baseState:R.baseState,baseQueue:R.baseQueue,queue:R.queue,next:null},qo===null?L.memoizedState=qo=e:qo=qo.next=e}return qo}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Qo;return Qo+=1,$o===null&&($o=[]),e=io($o,e,t),t=L,(qo===null?t.memoizedState:qo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?vc:yc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===ge)return;if(e.$$typeof===D)return ka(e)}throw Error(i(438,String(e)))}function ps(e){var t=null,n=L.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=L.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=us(),L.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=me;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(B(),R,e)}function gs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Ko&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ua&&(d=!0);else if((Ko&p)===p){u=u.next,p===Ua&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,L.lanes|=p,sd|=p;f=u.action,Xo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,L.lanes|=f,sd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Kr(o,e.memoizedState)&&(Ic=!0,d&&(n=Wa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function _s(e){var t=B(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Kr(o,t.memoizedState)||(Ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vs(e,t,n){var r=L,a=B(),o=I;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Kr((R||a).memoizedState,n);if(s&&(a.memoizedState=n,Ic=!0),a=a.queue,Us(xs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||qo!==null&&!!(qo.memoizedState.tag&1),Rs(e?9:8,{destroy:void 0},bs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,G===null)throw Error(i(349));o||Ko&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=L.updateQueue,t===null?(t=us(),L.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,Ss(t)&&Cs(e)}function xs(e,t,n){return n(function(){Ss(t)&&Cs(e)})}function Ss(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Kr(e,n)}catch{return!0}}function Cs(e){var t=Mi(e,2);t!==null&&Pd(t,e,2)}function ws(e){var t=ls();if(typeof e==`function`){var n=e;if(e=n(),Xo){nt(!0);try{n()}finally{nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,gs(e,R,typeof r==`function`?r:ms)}function Es(e,t,n,r,a){if(mc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};o.types=a===null?null:a.types,k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(I){var n=G.formState;if(n!==null){a:{var r=L;if(I){if(F){b:{for(var i=F,a=ua;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){F=lm(i.nextSibling),r=i.data===`F!`;break a}}fa(r)}r=!1}r&&(t=n[0])}}return n=ls(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=dc.bind(null,L,r),r.dispatch=n,r=ws(!1),a=pc.bind(null,L,!1,r.queue),r=ls(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,L,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(B(),R,e)}function Fs(e,t,n){if(t=gs(e,t,Ms)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===$a?to:e}else r=t;t=B();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(L.flags|=2048,Rs(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function Ls(e){var t=B(),n=R;if(n!==null)return Fs(t,n,e);B(),t=t.memoizedState,n=B();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=L.updateQueue,t===null&&(t=us(),L.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return B().memoizedState}function Bs(e,t,n,r){var i=ls();L.flags|=e,i.memoizedState=Rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Vs(e,t,n,r){var i=B();r=r===void 0?null:r;var a=i.memoizedState.inst;R!==null&&r!==null&&ts(r,R.memoizedState.deps)?i.memoizedState=Rs(t,a,n,r):(L.flags|=e,i.memoizedState=Rs(1|t,a,n,r))}function Hs(e,t){Bs(8390656,8,e,t)}function Us(e,t){Vs(2048,8,e,t)}function Ws(e){L.flags|=4;var t=L.updateQueue;if(t===null)t=us(),L.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Gs(e){var t=B().memoizedState;return Ws({ref:t,nextImpl:e}),function(){if(W&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ks(e,t){return Vs(4,2,e,t)}function qs(e,t){return Vs(4,4,e,t)}function Js(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ys(e,t,n){n=n==null?null:n.concat([e]),Vs(4,4,Js.bind(null,t,e),n)}function Xs(){}function Zs(e,t){var n=B();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qs(e,t){var n=B();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&ts(t,r[1]))return r[0];if(r=e(),Xo){nt(!0);try{e()}finally{nt(!1)}}return n.memoizedState=[r,t],r}function $s(e,t,n){return n===void 0||Ko&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Md(),L.lanes|=e,sd|=e,n)}function ec(e,t,n,r){return Kr(n,t)?n:Ao.current===null?!(Ko&106)||Ko&1073741824&&!(q&261930)?(Ic=!0,e.memoizedState=n):(e=Md(),L.lanes|=e,sd|=e,t):(e=$s(e,n,r),Kr(e,t)||(Ic=!0),e)}function tc(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};s.types=o===null?null:o.types,k.T=s,pc(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,qa(c,r),jd(e)):fc(e,t,r,jd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ic(e).queue;tc(e,a,t,j,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:j,baseState:j,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:j},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},jd())}function oc(){return ka(sh)}function sc(){return B().memoizedState}function cc(){return B().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=xo(n);var r=So(t,e,n);r!==null&&(Pd(r,t,n),Co(r,t,n)),t={cache:Ia()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=ji(e,t,n,r),n!==null&&(Pd(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,jd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Kr(s,o))return Ai(e,t,i,0),G===null&&ki(),!1}catch{}if(n=ji(e,t,i,r),n!==null)return Pd(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(i(479))}else t=ji(e,n,r,2),t!==null&&Pd(t,e,2)}function mc(e){var t=e.alternate;return e===L||t!==null&&t===L}function hc(e,t){Yo=Jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bt(e,n)}}var _c={readContext:ka,use:fs,useCallback:z,useContext:z,useEffect:z,useImperativeHandle:z,useLayoutEffect:z,useInsertionEffect:z,useMemo:z,useReducer:z,useRef:z,useState:z,useDebugValue:z,useDeferredValue:z,useTransition:z,useSyncExternalStore:z,useId:z,useHostTransitionStatus:z,useFormState:z,useActionState:z,useOptimistic:z,useMemoCache:z,useCacheRefresh:z,useEffectEvent:z},vc={readContext:ka,use:fs,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:ka,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=ls();t=t===void 0?null:t;var r=e();if(Xo){nt(!0);try{e()}finally{nt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ls();if(n!==void 0){var i=n(t);if(Xo){nt(!0);try{n(t)}finally{nt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=dc.bind(null,L,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(ls(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,L,e.queue,!0,!1),ls().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=L,a=ls();if(I){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),G===null)throw Error(i(349));q&127||ys(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=ls(),t=G.identifierPrefix;if(I){var n=na,r=ta;n=(r&~(1<<32-rt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Zo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=es++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=ls();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,L,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return ls().memoizedState=lc.bind(null,L)},useEffectEvent:function(e){var t=ls(),n={impl:e};return t.memoizedState=n,function(){if(W&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},yc={readContext:ka,use:fs,useCallback:Zs,useContext:ka,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:hs,useRef:zs,useState:function(){return hs(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){return ec(B(),R.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=B().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(B(),R,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs},bc={readContext:ka,use:fs,useCallback:Zs,useContext:ka,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:_s,useRef:zs,useState:function(){return _s(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){var n=B();return R===null?$s(n,e,t):ec(n,R.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=B().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){var n=B();return R===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,R,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs};function xc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=jd(),i=xo(r);i.payload=t,n!=null&&(i.callback=n),t=So(e,i,r),t!==null&&(Pd(t,e,r),Co(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=jd(),i=xo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=So(e,i,r),t!==null&&(Pd(t,e,r),Co(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=jd(),r=xo(n);r.tag=2,t!=null&&(r.callback=t),t=So(e,r,n),t!==null&&(Pd(t,e,n),Co(t,e,n))}};function Cc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!qr(n,r)||!qr(i,a):!0}function wc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Sc.enqueueReplaceState(t,t.state,null)}function Tc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ec(e){Ti(e)}function Dc(e){console.error(e)}function Oc(e){Ti(e)}function kc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function jc(e,t,n){return n=xo(n),n.tag=3,n.payload={element:null},n.callback=function(){kc(e,t)},n}function Mc(e){return e=xo(e),e.tag=3,e}function Nc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ac(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ac(t,n,r),typeof i!=`function`&&(yd===null?yd=new Set([this]):yd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Pc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ea(t,n,a,!0),n=Fo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Io===null?Kd():n.alternate===null&&Y===0&&(Y=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===no?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),mf(e,r,a)),!1;case 22:return n.flags|=65536,r===no?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),mf(e,r,a)),!1}throw Error(i(435,n.tag))}return mf(e,r,a),Kd(),!1}if(I)return t=Fo.current,t===null?(r!==da&&(t=Error(i(423),{cause:r}),va(qi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=qi(r,n),a=jc(e.stateNode,r,a),wo(e,a),Y!==4&&(Y=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==da&&(e=Error(i(422),{cause:r}),va(qi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=qi(o,n),fd===null?fd=[o]:fd.push(o),Y!==4&&(Y=2),t===null)return!0;r=qi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=jc(n.stateNode,r,e),wo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(yd===null||!yd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Mc(a),Nc(a,e,n,r),wo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Fc=Error(i(461)),Ic=!1;function Lc(e,t,n,r){t.child=e===null?_o(t,null,n,r):go(t,e.child,n,r)}function Rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Oa(t),r=ns(e,t,n,o,a,i),s=os(),e!==null&&!Ic?(ss(e,t,i),fl(e,t,i)):(I&&s&&aa(t),t.flags|=1,Lc(e,t,r,i),t.child)}function zc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Bc(e,t,a,r,i)):(e=Vi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!pl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?qr:n,n(o,r)&&e.ref===t.ref)return fl(e,t,i)}return t.flags|=1,e=zi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(qr(a,r)&&e.ref===t.ref){if(Ic=!1,t.pendingProps=r=a,pl(e,i))e.flags&131072&&(Ic=!0);else return t.lanes=e.lanes,fl(e,t,i)}}return Jc(e,t,n,r,i)}function Vc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Za(t,a===null?null:a.cachePool),a===null?No():Mo(t,a),zo(t);else return r=t.lanes=536870912,Uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Za(t,null),No(),Bo()):(Za(t,a.cachePool),Mo(t,a),Bo(),t.memoizedState=null);return Lc(e,t,i,n),t.child}function Hc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Uc(e,t,n,r,i){var a=Xa();return a=a===null?null:{parent:Fa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Za(t,null),No(),zo(t),e!==null&&Ea(e,t,r,!0),t.childLanes=i,null}function Wc(e,t){return t=rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Gc(e,t,n){return go(t,e.child,null,n),e=Wc(t,t.pendingProps),e.flags|=2,Vo(t),t.memoizedState=null,e}function Kc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(I){if(r.mode===`hidden`)return e=Wc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Hc(null,e);if(Ro(t),(e=F)?(e=am(e,ua),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Wi(e),n.return=t,t.child=n,ca=t,F=null)):e=null,e===null)throw fa(t);return t.lanes=536870912,null}return Wc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ro(t),a){if(t.flags&256)t.flags&=-257,t=Gc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Ic||Ea(e,t,n,!1),a=(n&e.childLanes)!==0,Ic||a){if(Ao.current===null){if(r=G,r!==null&&(s=xt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Mi(e,s),Pd(r,e,s),Fc;Kd()}t=Gc(e,t,n)}else e=o.treeContext,F=lm(s.nextSibling),ca=t,I=!0,la=null,ua=!1,e!==null&&sa(t,e),t=Wc(t,r),t.flags|=134221824;return t}return e=zi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Jc(e,t,n,r,i){return Oa(t),n=ns(e,t,n,r,void 0,i),r=os(),e!==null&&!Ic?(ss(e,t,i),fl(e,t,i)):(I&&r&&aa(t),t.flags|=1,Lc(e,t,n,i),t.child)}function Yc(e,t,n,r,i,a){return Oa(t),t.updateQueue=null,n=is(t,r,n,i),rs(e),r=os(),e!==null&&!Ic?(ss(e,t,a),fl(e,t,a)):(I&&r&&aa(t),t.flags|=1,Lc(e,t,n,a),t.child)}function Xc(e,t,n,r,i){if(Oa(t),t.stateNode===null){var a=Fi,o=n.contextType;typeof o==`object`&&o&&(a=ka(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Sc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},yo(t),o=n.contextType,a.context=typeof o==`object`&&o?ka(o):Fi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(xc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Sc.enqueueReplaceState(a,a.state,null),Do(t,r,a,i),Eo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Tc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Fi,typeof u==`object`&&u&&(o=ka(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&wc(t,a,r,o),vo=!1;var f=t.memoizedState;a.state=f,Do(t,r,a,i),Eo(),l=t.memoizedState,s||f!==l||vo?(typeof d==`function`&&(xc(t,n,d,r),l=t.memoizedState),(c=vo||Cc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,bo(e,t),o=t.memoizedProps,u=Tc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Fi,typeof l==`object`&&l&&(c=ka(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&wc(t,a,r,c),vo=!1,f=t.memoizedState,a.state=f,Do(t,r,a,i),Eo();var p=t.memoizedState;o!==d||f!==p||vo||e!==null&&e.dependencies!==null&&Da(e.dependencies)?(typeof s==`function`&&(xc(t,n,s,r),p=t.memoizedState),(u=vo||Cc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Da(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,qc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=go(t,e.child,null,i),t.child=go(t,null,n,i)):Lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=fl(e,t,i),e}function Zc(e,t,n,r){return ga(),t.flags|=256,Lc(e,t,n,r),t.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $c(e){return{baseLanes:e,cachePool:Qa()}}function el(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ud),e}function tl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ho.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(I){if(i?Lo(t):Bo(),(e=F)?(e=am(e,ua),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Wi(e),n.return=t,t.child=n,ca=t,F=null)):e=null,e===null)throw fa(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Bo(),i=t.mode,a=rl({mode:`hidden`,children:a},i),r=Hi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=$c(n),r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(null,r)):(Lo(t),nl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return al(e,t,a,o,r,c,s,n)}return i?(Bo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=zi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Hi(i,a,n,null),i.flags|=2):i=zi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Hc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=$c(n):(a=i.cachePool,a===null?a=Qa():(s=Fa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(e.child,r)):(Lo(t),n=e.child,e=n.sibling,n=zi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function nl(e,t){return t=rl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function rl(e,t){return e=Li(22,e,null,t),e.lanes=0,e}function il(e,t,n){return go(t,e.child,null,n),e=nl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function al(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Lo(t),t.flags&=-257,il(e,t,c)):t.memoizedState===null?(Bo(),o=a.fallback,s=t.mode,a=rl({mode:`visible`,children:a.children},s),o=Hi(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,go(t,e.child,null,c),a=t.child,a.memoizedState=$c(c),a.childLanes=el(e,r,c),t.memoizedState=Qc,Hc(null,a)):(Bo(),t.child=e.child,t.flags|=128,null);if(Lo(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,va({value:a,source:null,stack:null})),il(e,t,c)}if(Ic||Ea(e,t,c,!1),r=(c&e.childLanes)!==0,Ic||r){if(Ao.current!==null)return il(e,t,c);if(r=G,r!==null&&(a=xt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Mi(e,a),Pd(r,e,a),Fc;return om(o)||Kd(),il(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,F=lm(o.nextSibling),ca=t,I=!0,la=null,ua=!1,e!==null&&sa(t,e),t=nl(t,a.children),t.flags|=134221824,t)}function ol(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),wa(e.return,t,n)}function sl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Go(n)===null&&(t=e),e=e.sibling}return t}function cl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ll(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ul(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ho.current;if(t.flags&128)return Uo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Uo(t,o),i===`backwards`&&e!==null?(ll(e),Lc(e,t,r,n),ll(e)):Lc(e,t,r,n),r=I?Zi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ol(e,n,t);else if(e.tag===19)ol(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ll(t)),cl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Go(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}cl(t,!0,n,null,a,r);break;case`together`:cl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),cl(t,!1,i,n,a,r)}return t.child}function dl(e,t,n){var r=t.pendingProps;return Sa(t,t.type,r.value),Lc(e,t,r.children,n),t.child}function fl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ea(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=zi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=zi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Da(e)))}function ml(e,t,n){switch(t.tag){case 3:ke(t,t.stateNode.containerInfo),Sa(t,Fa,e.memoizedState.cache),ga();break;case 27:case 5:je(t);break;case 4:ke(t,t.stateNode.containerInfo);break;case 10:Sa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ro(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Lo(t),t.flags|=128,null;r=Ea(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?tl(e,t,n):(Lo(t),e=fl(e,t,n),e===null?null:e.sibling)}Lo(t);break;case 19:if(t.flags&128)return ul(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ea(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ul(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Uo(t,Ho.current),r)break;return null;case 22:return t.lanes=0,Vc(e,t,n,t.pendingProps);case 24:Sa(t,Fa,e.memoizedState.cache)}return fl(e,t,n)}function hl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ic=!0;else{if(!pl(e,n)&&!(t.flags&128))return Ic=!1,ml(e,t,n);Ic=!!(e.flags&131072)}}else Ic=!1,I&&t.flags&1048576&&ia(t,Zi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ao(t.elementType),t.type=e,typeof e==`function`)Ri(e)?(r=Tc(e,r),t.tag=1,t=Xc(null,t,e,r,n)):(t.tag=0,t=Jc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ce){t.tag=11,t=Rc(null,t,e,r,n);break a}if(a===O){t.tag=14,t=zc(null,t,e,r,n);break a}if(a===D){t.tag=10,t.type=e,t=dl(null,t,n);break a}}throw t=be(e)||e,Error(i(306,t,``))}}return t;case 0:return Jc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Tc(r,t.pendingProps),Xc(e,t,r,a,n);case 3:a:{if(ke(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,bo(e,t),Do(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Sa(t,Fa,r),r!==o.cache&&Ta(t,[Fa],n,!0),Eo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Zc(e,t,r,n);break a}if(r!==a){a=qi(Error(i(424)),t),va(a),t=Zc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(F=lm(e.firstChild),ca=t,I=!0,la=null,ua=!0,n=_o(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ga(),r===a){t=fl(e,t,n);break a}Lc(e,t,r,n)}t=t.child}return t;case 26:return qc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:I||(t.stateNode=fp(t.type,t.pendingProps,De.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return je(t),e===null&&I&&(r=t.stateNode=hm(t.type,t.pendingProps,De.current),ca=t,ua=!0,a=F,Sp(t.type)?(um=a,F=lm(r.firstChild)):F=a),Lc(e,t,t.pendingProps.children,n),qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&I&&((a=r=F)&&(r=rm(r,t.type,t.pendingProps,ua),r===null?a=!1:(t.stateNode=r,ca=t,F=lm(r.firstChild),ua=!1,a=!0)),a||fa(t)),je(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ns(e,t,as,null,null,n),sh._currentValue=a),qc(e,t),Lc(e,t,r,n),t.child;case 6:return e===null&&I&&((e=n=F)&&(n=im(n,t.pendingProps,ua),n===null?e=!1:(t.stateNode=n,ca=t,F=null,e=!0)),e||fa(t)),null;case 13:return tl(e,t,n);case 4:return ke(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=go(t,null,r,n):Lc(e,t,r,n),t.child;case 11:return Rc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,qc(e,t),Lc(e,t,r,n),t.child;case 8:return Lc(e,t,t.pendingProps.children,n),t.child;case 12:return Lc(e,t,t.pendingProps.children,n),t.child;case 10:return dl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Oa(t),a=ka(a),r=r(a),t.flags|=1,Lc(e,t,r,n),t.child;case 14:return zc(e,t,t.type,t.pendingProps,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 19:return ul(e,t,n);case 31:return Kc(e,t,n);case 22:return Vc(e,t,n,t.pendingProps);case 24:return Oa(t),r=ka(Fa),e===null?(a=Xa(),a===null&&(a=G,o=Ia(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},yo(t),Sa(t,Fa,a)):((e.lanes&n)!==0&&(bo(e,t),Do(t,null,null,n),Eo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Sa(t,Fa,r),r!==a.cache&&Ta(t,[Fa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Sa(t,Fa,r))),Lc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:I&&aa(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:qc(e,t),Lc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function gl(e){e.flags|=4}function _l(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ud())e.flags|=8192;else throw oo=no,eo}}else e.flags&=-16777217}function vl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Ud())e.flags|=8192;else throw oo=no,eo}}function yl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ht(),e.lanes|=t,dd|=t)}function bl(e,t){if(!I)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function V(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function xl(e,t,n){var r=t.pendingProps;switch(oa(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return V(t),null;case 1:return V(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ca(Fa),Ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ha(t)?gl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,_a())),V(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(gl(t),o===null?(V(t),_l(t,a,null,r,n)):(V(t),vl(t,o))):o?o===e.memoizedState?(V(t),t.flags&=-16777217):(gl(t),V(t),vl(t,o)):(e=e.memoizedProps,e!==r&&gl(t),V(t),_l(t,a,e,r,n)),null;case 27:if(Me(t),n=De.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return V(t),t.subtreeFlags&=-33554433,null}e=Te.current,ha(t)?pa(t,e):(e=hm(a,r,n),t.stateNode=e,gl(t))}return V(t),t.subtreeFlags&=-33554433,null;case 5:if(Me(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return V(t),t.subtreeFlags&=-33554433,null}if(o=Te.current,ha(t))pa(t,o);else{var s=lp(De.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Dt]=t,o[Ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&gl(t)}}return V(t),t.subtreeFlags&=-33554433,_l(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=De.current,ha(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ca,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Dt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||fa(t,!0)}else e=lp(e).createTextNode(r),e[Dt]=t,t.stateNode=e}return V(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ha(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Dt]=t}else ga(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),e=!1}else n=_a(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Vo(t),t):(Vo(t),null);if(t.flags&128)throw Error(i(558))}return V(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ha(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Dt]=t}else ga(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),a=!1}else a=_a(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Vo(t),t):(Vo(t),null)}return Vo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yl(t,t.updateQueue),V(t),null);case 4:return Ae(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,V(t),null;case 10:return Ca(t.type),V(t),null;case 19:if(Wo(t),r=t.memoizedState,r===null)return V(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)bl(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Go(e),o!==null){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Bi(n,e),n=n.sibling;return Uo(t,Ho.current&1|2),I&&ra(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ge()>_d&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Go(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!I)return V(t),null}else 2*Ge()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ge(),e.sibling=null,o=Ho.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||I?Uo(t,o):(n=o,N(Fo,t),N(Ho,n),Io===null&&(Io=t)),I&&ra(t,r.treeForkCount),e}return V(t),null;case 22:case 23:return Vo(t),Po(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(V(t),t.subtreeFlags&6&&(t.flags|=8192)):V(t),n=t.updateQueue,n!==null&&yl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&M(Ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ca(Fa),V(t),null;case 25:return null;case 30:return t.flags|=33554432,V(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(oa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ca(Fa),Ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Me(t),null;case 31:if(t.memoizedState!==null){if(Vo(t),t.alternate===null)throw Error(i(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Vo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ga()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Wo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ae(),null;case 10:return Ca(t.type),null;case 22:case 23:return Vo(t),Po(),e!==null&&M(Ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ca(Fa),null;case 25:return null;default:return null}}function Cl(e,t){switch(oa(t),t.tag){case 3:Ca(Fa),Ae();break;case 26:case 27:case 5:Me(t);break;case 4:Ae();break;case 31:t.memoizedState!==null&&Vo(t);break;case 13:Vo(t);break;case 19:Wo(t);break;case 10:Ca(t.type);break;case 22:case 23:Vo(t),Po(),e!==null&&M(Ya);break;case 24:Ca(Fa)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ko(t,n)}catch(t){Z(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Si(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&em(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&tm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[Ot]=t}catch(t){Z(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Cn)),Al(e,r),P=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),P=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[Dt]=e,t[Ot]=n}catch(t){Z(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Hl=!0,Tp(o,ql===0?t:t+`_`+ql,n),ql++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Xl(e.child,t),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=wi(t.default,t.share),t!==`none`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=Si(r,n),a=wi(r.default,n.paired?r.share:r.enter);a===`none`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Nd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=wi(n.default,n.share);if(a!==`none`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Nd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=Si(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=wi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Nd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Nd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Si(t,e.stateNode);t=wi(t.default,t.update),e.flags&=-5,t!==`none`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=Si(n,r),a=wi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Nd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,H=!1,cu=!1,lu=!1,uu=typeof WeakSet==`function`?WeakSet:Set,du=null,fu=!1,pu=!1,mu=!1,hu=!1;function gu(e,t,n){if(e=e.containerInfo,sp=gh,e=Qr(e),$r(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,du=t,t=n?9270:1024;du!==null;){if(e=du,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),_u(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),_u(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),_u(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,du=r):(n&&tu(e),_u(n))}}Ul=null}function _u(e){for(;du!==null;){var t=du,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Tc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){Z(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=Si(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=wi(a.default,a.update),a!==`none`&&Jl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,du=r;break}du=t.return}}function vu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Lu(e,n),r&4&&wl(5,n);break;case 1:if(Lu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Z(n,n.return,e)}else{var i=Tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Z(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(Lu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{ko(e,t)}catch(e){Z(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:Lu(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:Lu(e,n);break;case 31:Lu(e,n),r&4&&Eu(e,n);break;case 13:Lu(e,n),r&4&&Du(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=_f.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||H;t=su,i=H,su=r,(H=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),zu(e,n,r)):Lu(e,n),su=t,H=i}break;case 30:Lu(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:Lu(e,n)}}function yu(e,t){for(e=e.child;e!==null;)bu(e,t),e=e.sibling}function bu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){Z(e,e.return,t)}xu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,P=!0}catch(t){Z(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){Z(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&yu(e,t);break;default:yu(e,t)}}function xu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:bu(n,r);break a;case 22:n.memoizedState===null&&xu(n,r);break a;default:xu(n,r)}}e=e.sibling}}function Su(e){var t=e.alternate;t!==null&&(e.alternate=null,Su(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&It(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var U=null,Cu=!1;function wu(e,t,n){for(n=n.child;n!==null;)Tu(e,t,n),n=n.sibling}function Tu(e,t,n){if(tt&&typeof tt.onCommitFiberUnmount==`function`)try{tt.onCommitFiberUnmount(et,n)}catch{}switch(n.tag){case 26:H||kl(n,t),wu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!H&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:H||kl(n,t),Ml(n);var r=U,i=Cu;Sp(n.type)&&(U=n.stateNode,Cu=!1),wu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),U=r,Cu=i;break;case 5:H||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=U,i=Cu,U=null,wu(e,t,n),U=r,Cu=i,U!==null){if(Cu)try{(U.nodeType===9?U.body:U.nodeName===`HTML`?U.ownerDocument.body:U).removeChild(n.stateNode),P=!0}catch(e){Z(n,t,e)}else try{U.removeChild(n.stateNode),P=!0}catch(e){Z(n,t,e)}}break;case 18:U!==null&&(Cu?(e=U,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(U,n.stateNode));break;case 4:r=U,i=Cu,U=n.stateNode.containerInfo,Cu=!0,wu(e,t,n),U=r,Cu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),H||Tl(4,n,t),wu(e,t,n);break;case 1:H||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),wu(e,t,n);break;case 21:wu(e,t,n);break;case 22:H=(r=H)||n.memoizedState!==null,wu(e,t,n),H=r;break;case 30:kl(n,t),wu(e,t,n);break;case 7:H||kl(n,t),wu(e,t,n);break;default:wu(e,t,n)}}function Eu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){Z(t,t.return,e)}}}function Du(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){Z(t,t.return,e)}}function Ou(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new uu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new uu),t;default:throw Error(i(435,e.tag))}}function ku(e,t){var n=Ou(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=vf.bind(null,e,t);t.then(r,r)}})}function Au(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){U=l.stateNode,Cu=!1;break a}break;case 5:U=l.stateNode,Cu=!1;break a;case 3:case 4:U=l.stateNode.containerInfo,Cu=!0;break a}l=l.return}if(U===null)throw Error(i(160));Tu(s,c,o),U=null,Cu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mu(t,e,n),t=t.sibling}var ju=null;function Mu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Au(t,e,n),Nu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),a&64&&su&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=ju,Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(su)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Pt]||r[Dt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[Dt]=e,Vt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Dt]=e,Vt(r),t=r}e.stateNode=t}}else su||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||H||t.parentNode.removeChild(t)):a.count--,n===null?su||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=cu,cu=!1,Au(t,e,n),cu=o,Nu(e),a&512&&(H||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{hn(t,``),P=!0}catch(t){Z(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(lu=!0);break;case 6:if(Au(t,e,n),Nu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,P=!0}catch(t){Z(e,e.return,t)}}break;case 3:if(P=!1,Wm=null,o=ju,ju=bm(t.containerInfo),Au(t,e,n),ju=o,Nu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){Z(e,e.return,t)}lu&&(lu=!1,Pu(e)),P=!1;break;case 4:a=cu,cu=su,r=Zt(),o=ju,ju=bm(e.stateNode.containerInfo),Au(t,e,n),Nu(e),ju=o,P&&pu&&(mu=!0),P=r,cu=a;break;case 12:Au(t,e,n),Nu(e);break;case 31:Au(t,e,n),Nu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 13:Au(t,e,n),Nu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(hd=Ge()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=H,u=cu;su=c||o,cu=u||o,H=l||s,Au(t,e,n),H=l,cu=u,su=c,Nu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||H||(t=s||H,n=su,r=H,su=o||su,H=t,Ru(e,2),su=n,H=r),!o&&cu||yu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ku(e,n))));break;case 19:Au(t,e,n),Nu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 30:a&512&&(H||r===null||kl(r,r.return)),a=Zt(),o=pu,s=(n&335544064)===n,c=e.memoizedProps,pu=s&&wi(c.default,c.update)!==`none`,Au(t,e,n),Nu(e),s&&r!==null&&P&&(e.flags|=4),pu=o,P=a;break;case 21:break;case 7:a&512&&(H||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Au(t,e,n),Nu(e)}}function Nu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(hn(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){Z(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Pu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Fu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Iu(t,e),t=t.sibling;else ou(t,!1)}function Iu(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(hu=fu=!1,Kl(),Fu(t,e),!fu&&!mu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),hu=!0}Gl=null;break;case 5:Fu(t,e);break;case 4:r=fu,fu=!1,Fu(t,e),fu&&(mu=!0),fu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Fu(t,e):Ql(e,!1));break;case 30:r=fu,i=Kl(),fu=!1,Fu(t,e),fu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=Si(a,o),o=Si(n.memoizedProps,o);var s=wi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Nd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),fu=e.flags&32?!0:r;break;default:Fu(t,e)}}function Lu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)vu(e,t.alternate,t),t=t.sibling}function Ru(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),Ru(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),Ru(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Ru(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||H||i.parentNode.removeChild(i),Ru(n,r);break;case 22:n.memoizedState===null&&Ru(n,r);break;case 30:kl(n,n.return),Ru(n,r);break;case 7:kl(n,n.return);default:Ru(n,r)}e=e.sibling}}function zu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:zu(i,a,n),wl(4,a);break;case 1:if(zu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Z(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Oo(l[i],c)}catch(e){Z(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),zu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||Km(bm(c.ownerDocument),a.type,c),zu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:zu(i,a,n);break;case 31:zu(i,a,n),s&&o&4&&Eu(i,a);break;case 13:zu(i,a,n),s&&o&4&&Du(i,a);break;case 22:a.memoizedState===null&&zu(i,a,n),Ol(a,a.return);break;case 30:zu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:zu(i,a,n)}t=t.sibling}}function Bu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&La(n))}function Vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&La(e))}function Hu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Uu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Uu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Hu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Hu(e,t,n,r);break;case 3:Hu(e,t,n,r),i&&hu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&La(a)));break;case 12:if(a&2048){Hu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){Z(t,t.return,e)}}else Hu(e,t,n,r);break;case 31:Hu(e,t,n,r);break;case 13:Hu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ru(t),o._visibility&2?Hu(e,t,n,r):(o._visibility|=2,Wu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Hu(e,t,n,r):Gu(e,t)),a&2048&&Bu(s,t);break;case 24:Hu(e,t,n,r),a&2048&&Vu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Hu(e,t,n,r);break;default:Hu(e,t,n,r)}}function Wu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Wu(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Wu(a,o,s,c,i)):u._visibility&2?Wu(a,o,s,c,i):Gu(a,o),i&&l&2048&&Bu(o.alternate,o);break;case 24:Wu(a,o,s,c,i),i&&l&2048&&Vu(o.alternate,o);break;default:Wu(a,o,s,c,i)}t=t.sibling}}function Gu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Gu(n,r),i&2048&&Bu(r.alternate,r);break;case 24:Gu(n,r),i&2048&&Vu(r.alternate,r);break;default:Gu(n,r)}t=t.sibling}}var Ku=8192;function qu(e,t,n){if(e.subtreeFlags&Ku)for(e=e.child;e!==null;)Ju(e,t,n),e=e.sibling}function Ju(e,t,n){switch(e.tag){case 26:qu(e,t,n),e.flags&Ku&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,ju,e.memoizedState,e.memoizedProps));break;case 5:qu(e,t,n),e.flags&Ku&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=ju;ju=bm(e.stateNode.containerInfo),qu(e,t,n),ju=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ku,Ku=16777216,qu(e,t,n),Ku=r):qu(e,t,n));break;case 30:if((e.flags&Ku)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}qu(e,t,n);break;default:qu(e,t,n)}}function Yu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Xu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,$u(r,e)}Yu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zu(e),e=e.sibling}function Zu(e){switch(e.tag){case 0:case 11:case 15:Xu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Xu(e);break;case 12:Xu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Qu(e)):Xu(e);break;default:Xu(e)}}function Qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,$u(r,e)}Yu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),Qu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Qu(t));break;default:Qu(t)}e=e.sibling}}function $u(e,t){for(;du!==null;){var n=du;switch(n.tag){case 0:case 11:case 15:Tl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:La(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,du=r;else a:for(n=e;du!==null;){r=du;var i=r.sibling,a=r.return;if(Su(r),r===n){du=null;break a}if(i!==null){i.return=a,du=i;break a}du=a}}}var ed={getCacheForType:function(e){var t=ka(Fa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ka(Fa).controller.signal}},td=typeof WeakMap==`function`?WeakMap:Map,W=0,G=null,K=null,q=0,J=0,nd=null,rd=!1,id=!1,ad=!1,od=0,Y=0,sd=0,cd=0,ld=0,ud=0,dd=0,fd=null,pd=null,md=!1,hd=0,gd=0,_d=1/0,vd=null,yd=null,X=0,bd=null,xd=null,Sd=0,Cd=0,wd=null,Td=null,Ed=null,Dd=null,Od=null,kd=0,Ad=null;function jd(){return W&2&&q!==0?q&-q:k.T===null?wt():Pf()}function Md(){if(ud===0){if(!(q&536870912)||I){var e=ct;ct<<=1,!(ct&3932160)&&(ct=262144),ud=e}else ud=536870912}return e=Fo.current,e!==null&&(e.flags|=32),ud}function Nd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(Si(e.memoizedProps,n))),Dd===null&&(Dd=[]),Dd.push(t.bind(null,r))}}function Pd(e,t,n){(e===G&&(J===2||J===9)||e.cancelPendingCommit!==null)&&(Vd(e,0),Rd(e,q,ud,!1)),_t(e,n),W&2&&e===G||(e===G&&(!(W&2)&&(cd|=n),Y===4&&Rd(e,q,ud,!1)),Ef(e))}function Fd(e,t,n){if(W&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ft(e,t),a=r?Yd(e,t):qd(e,t,!0),o=r;do{if(a===0){id&&!r&&Rd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Ld(n))a=qd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=fd;var l=c.current.memoizedState.isDehydrated;if(l&&(Vd(c,s).flags|=256),s=qd(c,s,!1),s!==2&&s!==6){if(ad&&!l){c.errorRecoveryDisabledLanes|=o,cd|=o,a=4;break a}o=pd,pd=a,o!==null&&(pd===null?pd=o:pd.push.apply(pd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Vd(e,0),Rd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Rd(r,t,ud,!rd);break a;case 2:pd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=hd+300-Ge(),10<a)){if(Rd(r,t,ud,!rd),dt(r,0,!0)!==0)break a;Sd=t,r.timeoutHandle=gp(Id.bind(null,r,n,pd,vd,md,t,ud,cd,dd,rd,o,`Throttled`,-0,0),a);break a}Id(r,n,pd,vd,md,t,ud,cd,dd,rd,o,null,-0,0)}break}}while(1);Ef(e)}function Id(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Cn},Ul=null,Ju(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?hd-Ge():(a&4194048)===a?gd-Ge():0,m=eh(d,m),m!==null)?(Sd=a,e.cancelPendingCommit=m(nf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Rd(e,a,o,!l)):nf(e,t,a,n,r,i,o,s,c,l,u,d)}function Ld(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Kr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rd(e,t,n,r){t=pt(e,t),t&=~ld,t&=~cd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-rt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&yt(e,n,t)}function zd(){return W&6?!0:(Df(0,!1),!1)}function Bd(){if(K!==null){if(J===0)var e=K.return;else e=K,xa=ba=null,cs(e),lo=null,uo=0,e=K;for(;e!==null;)Cl(e.alternate,e),e=e.return;K=null}}function Vd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Sd=0,Bd(),G=e,K=n=zi(e.current,null),q=t,J=0,nd=null,rd=!1,id=ft(e,t),ad=!1,dd=ud=ld=cd=sd=Y=0,pd=fd=null,md=!1,od=pt(e,t),ki(),n}function Hd(e,t){L=null,k.H=_c,t===$a||t===to?(t=so(),J=3):t===eo?(t=so(),J=4):J=t===Fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,nd=t,K===null&&(Y=1,kc(e,qi(t,e.current)))}function Ud(){var e=Fo.current;return e===null?!0:(q&4194048)===q?Io===null:(q&62914560)===q||q&536870912?e===Io:!1}function Wd(){var e=k.H;return k.H=_c,e===null?_c:e}function Gd(){var e=k.A;return k.A=ed,e}function Kd(){Y=4,rd||(q&4194048)!==q&&Fo.current!==null||(id=!0),!(sd&134217727)&&!(cd&134217727)||G===null||Rd(G,q,ud,!1)}function qd(e,t,n){var r=W;W|=2;var i=Wd(),a=Gd();(G!==e||q!==t)&&(vd=null,Vd(e,t)),t=!1;var o=Y;a:do try{if(J!==0&&K!==null){var s=K,c=nd;switch(J){case 8:Bd(),o=6;break a;case 3:case 2:case 9:case 6:Fo.current===null&&(t=!0);var l=J;if(J=0,nd=null,$d(e,s,c,l),n&&id){o=0;break a}break;default:l=J,J=0,nd=null,$d(e,s,c,l)}}Jd(),o=Y;break}catch(t){Hd(e,t)}while(1);return t&&e.shellSuspendCounter++,xa=ba=null,W=r,k.H=i,k.A=a,K===null&&(G=null,q=0,ki()),o}function Jd(){for(;K!==null;)Zd(K)}function Yd(e,t){var n=W;W|=2;var r=Wd(),a=Gd();G!==e||q!==t?(vd=null,_d=Ge()+500,Vd(e,t)):id=ft(e,t);a:do try{if(J!==0&&K!==null){t=K;var o=nd;b:switch(J){case 1:J=0,nd=null,$d(e,t,o,1);break;case 2:case 9:if(ro(o)){J=0,nd=null,Qd(t);break}t=function(){J!==2&&J!==9||G!==e||(J=7),Ef(e)},o.then(t,t);break a;case 3:J=7;break a;case 4:J=5;break a;case 7:ro(o)?(J=0,nd=null,Qd(t)):(J=0,nd=null,$d(e,t,o,7));break;case 5:var s=null;switch(K.tag){case 26:s=K.memoizedState;case 5:case 27:var c=K;if(s?Ym(s):c.stateNode.complete){J=0,nd=null;var l=c.sibling;if(l!==null)K=l;else{var u=c.return;u===null?K=null:(K=u,ef(u))}break b}}J=0,nd=null,$d(e,t,o,5);break;case 6:J=0,nd=null,$d(e,t,o,6);break;case 8:Bd(),Y=6;break a;default:throw Error(i(462))}}Xd();break}catch(t){Hd(e,t)}while(1);return xa=ba=null,k.H=r,k.A=a,W=n,K===null?(G=null,q=0,ki(),Y):0}function Xd(){for(;K!==null&&!Ue();)Zd(K)}function Zd(e){var t=hl(e.alternate,e,od);e.memoizedProps=e.pendingProps,t===null?ef(e):K=t}function Qd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Yc(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=Yc(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:cs(t);var r=t;r===ca&&(I?(ma(r),r.tag===5&&r.stateNode!=null&&(F=r.stateNode)):(ma(r),I=!0));default:Cl(n,t),t=K=Bi(t,od),t=hl(n,t,od)}e.memoizedProps=e.pendingProps,t===null?ef(e):K=t}function $d(e,t,n,r){xa=ba=null,cs(t),lo=null,uo=0;var i=t.return;try{if(Pc(e,i,t,n,q)){Y=1,kc(e,qi(n,e.current)),K=null;return}}catch(t){if(i!==null)throw K=i,t;Y=1,kc(e,qi(n,e.current)),K=null;return}t.flags&32768?(I||r===1?e=!0:id||q&536870912?e=!1:(rd=e=!0,(r===2||r===9||r===3||r===6)&&(r=Fo.current,r!==null&&r.tag===13&&(r.flags|=16384))),tf(t,e)):ef(t)}function ef(e){var t=e;do{if(t.flags&32768){tf(t,rd);return}e=t.return;var n=xl(t.alternate,t,od);if(n!==null){K=n;return}if(t=t.sibling,t!==null){K=t;return}K=t=e}while(t!==null);Y===0&&(Y=5)}function tf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,K=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){K=e;return}K=e=n}while(e!==null);Y=6,K=null}function nf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do df();while(X!==0);if(W&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===G&&(K=G=null,q=0),xd=t,bd=e,Sd=n,wd=a,Td=r,rf(e,t,n,s,c,l,f)}}function rf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Cd=s,s|=Oi,vt(e,n,s,r,i,a),Dd=null,(n&335544064)===n?(Od=Ba(e),r=10262):(Od=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,yf(Ye,function(){return ff(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=k.T,k.T=null,i=A.p,A.p=2,a=W,W|=4;try{gu(e,t,n)}finally{W=a,A.p=i,k.T=r}}X=1,Hl?Ed=Mp(o,e.containerInfo,Od,sf,cf,of,lf,ff,af,null,null):(sf(),cf(),lf())}function af(e){if(X!==0){var t=bd.onRecoverableError;t(e,{componentStack:null})}}function of(){X===3&&(X=0,Iu(xd,bd),X=4)}function sf(){if(X===1){X=0;var e=bd,t=xd,n=Sd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=k.T,k.T=null;var i=A.p;A.p=2;var a=W;W|=4;try{pu=mu=!1,Mu(t,e,n),n=cp;var o=Qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Zr(s.ownerDocument.documentElement,s)){if(c!==null&&$r(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Xr(s,h),v=Xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{W=a,A.p=i,k.T=r}}e.current=t,X=2}}function cf(){if(X===2){X=0;var e=bd,t=xd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=W;W|=4;try{vu(e,t.alternate,t)}finally{W=i,A.p=r,k.T=n}}X=3}}function lf(){if(X===4||X===3){X=0;var e=Ed;Ed=null,We();var t=bd,n=xd,r=Sd,i=Td,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?X=5:(X=0,xd=bd=null,uf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(yd=null),Ct(r),n=n.stateNode,tt&&typeof tt.onCommitFiberRoot==`function`)try{tt.onCommitFiberRoot(et,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=k.T,a=A.p,A.p=2,k.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{k.T=n,A.p=a}}if(i=Dd,o=Od,Od=null,i!==null&&(Dd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Sd&3&&df(),Ef(t),a=t.pendingLanes,r&261930&&a&42?t===Ad?kd++:(kd=0,Ad=t):(kd=0,Ad=null),Df(0,!1)}}function uf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,La(t)))}function df(){return Ed!==null&&(Ed.skipTransition(),Ed=null),sf(),cf(),lf(),ff()}function ff(){if(X!==5)return!1;var e=bd,t=Cd;Cd=0;var n=Ct(Sd),r=k.T,a=A.p;try{A.p=32>n?32:n,k.T=null,n=wd,wd=null;var o=bd,s=Sd;if(X=0,xd=bd=null,Sd=0,W&6)throw Error(i(331));var c=W;if(W|=4,Zu(o.current),Uu(o,o.current,s,n),W=c,Df(0,!1),tt&&typeof tt.onPostCommitFiberRoot==`function`)try{tt.onPostCommitFiberRoot(et,o)}catch{}return!0}finally{A.p=a,k.T=r,uf(e,t)}}function pf(e,t,n){t=qi(n,t),t=jc(e.stateNode,t,2),e=So(e,t,2),e!==null&&(_t(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=qi(n,e),n=Mc(2),r=So(t,n,2),r!==null&&(Nc(n,r,t,e),_t(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new td;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>Ge()-hd?W&2?ld|=n:Vd(e,0):ld|=n,dd===q&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=ht()),e=Mi(e,t),e!==null&&(_t(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return Ve(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-rt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=q,a=dt(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ft(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=Ge(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-rt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=mt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=G,n=q,n=dt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(J===2||J===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&He(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ft(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&He(r),Ct(n)){case 2:case 8:n=Je;break;case 32:n=Ye;break;case 268435456:n=Ze;break;default:n=Ye}return r=jf.bind(null,e),n=Ve(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&He(r),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,t){if(X!==0&&X!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(df()&&e.callbackNode!==n)return null;var r=q;return r=dt(e,e===G?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Fd(e,r,t),Af(e,Ge()),e.callbackNode!=null&&e.callbackNode===n?jf.bind(null,e):null)}function Mf(e,t){if(df())return null;Fd(e,t,!0)}function Nf(){bp(function(){W&6?Ve(qe,Of):kf()})}function Pf(){if(Tf===0){var e=Ua;e===0&&(e=st,st<<=1,!(st&261888)&&(st=256)),Tf=e}return Tf}function Ff(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Sn(e)}function If(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ff((i[Ot]||null).action),o=r.submitter;o&&(t=(t=o[Ot]||null)?Ff(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Tf!==0){var e=new FormData(i,o);rc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),rc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Lf=0;Lf<yi.length;Lf++){var Rf=yi[Lf];bi(Rf.toLowerCase(),`on`+(Rf[0].toUpperCase()+Rf.slice(1)))}bi(di,`onAnimationEnd`),bi(fi,`onAnimationIteration`),bi(pi,`onAnimationStart`),bi(`dblclick`,`onDoubleClick`),bi(`focusin`,`onFocus`),bi(`focusout`,`onBlur`),bi(mi,`onTransitionRun`),bi(hi,`onTransitionStart`),bi(gi,`onTransitionCancel`),bi(_i,`onTransitionEnd`),Kt(`onMouseEnter`,[`mouseout`,`mouseover`]),Kt(`onMouseLeave`,[`mouseout`,`mouseover`]),Kt(`onPointerEnter`,[`pointerout`,`pointerover`]),Kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var zf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Bf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(zf));function Vf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ti(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ti(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[At];n===void 0&&(n=t[At]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Ut.forEach(function(t){t!==`selectionchange`&&(Bf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!Nn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Lt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}An(function(){var r=a,i=Tn(n),s=[];a:{var c=vi.get(e);if(c!==void 0){var l=Wn,u=e;switch(e){case`keypress`:if(zn(n)===0)break a;case`keydown`:case`keyup`:l=cr;break;case`focusin`:u=`focus`,l=$n;break;case`focusout`:u=`blur`,l=$n;break;case`beforeblur`:case`afterblur`:l=$n;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Zn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=dr;break;case di:case fi:case pi:l=er;break;case _i:l=fr;break;case`scroll`:case`scrollend`:l=Kn;break;case`wheel`:l=pr;break;case`copy`:case`cut`:case`paste`:l=tr;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=lr;break;case`submit`:l=ur;break;case`toggle`:case`beforetoggle`:l=mr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=jn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==wn&&(u=n.relatedTarget||n.fromElement)&&(Lt(u)||u[kt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Lt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Zn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=lr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:zt(c),h=l==null?u:zt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Lt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?ne(c,l,Yf):null,c!==null&&Xf(s,u,c,d,!1),l!==null&&f!==null&&Xf(s,f,l,d,!0)))}a:{if(c=r?zt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Pr;else if(Or(c)){if(Fr)_=Wr;else{_=Hr;var v=Vr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&yn(r.elementType)&&(_=Pr):_=Ur;if(_&&=_(e,r)){kr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?zt(r):window,e){case`focusin`:(Or(v)||v.contentEditable===`true`)&&(ti=v,ni=r,ri=null);break;case`focusout`:ri=ni=ti=null;break;case`mousedown`:ii=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ii=!1,ai(s,n,i);break;case`selectionchange`:if(ei)break;case`keydown`:case`keyup`:ai(s,n,i)}var y;if(gr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else wr?Sr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(yr&&n.locale!==`ko`&&(wr||b!==`onCompositionStart`?b===`onCompositionEnd`&&wr&&(y=Rn()):(Fn=i,In=`value`in Fn?Fn.value:Fn.textContent,wr=!0)),v=Jf(r,b),0<v.length&&(b=new nr(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=Cr(n),y!==null&&(b.data=y)))),(y=vr?Tr(e,n):Er(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new nr(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),If(s,e,r,n,i)}Vf(s,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=jn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=jn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=jn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=jn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\\r\\n?/g,Qf=/\\u0000|\\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`\n`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||hn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&hn(e,``+r);else return;break;case`className`:$t(e,`class`,r);break;case`tabIndex`:$t(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:$t(e,n,r);break;case`style`:vn(e,r,o);return;case`data`:if(t!==`object`){$t(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Sn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Sn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Cn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Sn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Qt(e,`popover`,r);break;case`xlinkActuate`:en(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:en(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:en(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:en(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:en(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:en(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=bn.get(n)||n,Qt(e,n,r);else return}P=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:vn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)hn(e,r);else if(typeof r==`number`||typeof r==`bigint`)hn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=Cn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Ot]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}P=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Qt(e,n,r)}return}P=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,o,s,n,null)}}a&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:$(e,t,r,d,n,null)}}un(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&fn(e,!!r,n,!0):fn(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:$(e,t,s,c,n,null)}mn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<zf.length;r++)Q(zf[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,u,r,n,null)}return;default:if(yn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(P=!0),o=m;break;case`name`:m!==f&&(P=!0),a=m;break;case`checked`:m!==f&&(P=!0),u=m;break;case`defaultChecked`:m!==f&&(P=!0),d=m;break;case`value`:m!==f&&(P=!0),s=m;break;case`defaultValue`:m!==f&&(P=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}ln(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||$(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(P=!0),p=o;break;case`defaultValue`:o!==l&&(P=!0),c=o;break;case`multiple`:o!==l&&(P=!0),s=o;default:o!==l&&$(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?fn(e,!!n,n?[]:``,!1):fn(e,!!n,t,!0)):fn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(P=!0),p=a;break;case`defaultValue`:a!==o&&(P=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&$(e,t,s,a,r,o)}pn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(P=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(yn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[Dt]=r,n[Ot]=t,np(n,e,t),Vt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Lt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ne(n,a,C),t===null?t=!1:(h(t,!0,ee,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ne(r,a,C),t===null?t=!1:(h(t,!0,te,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),It(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&$(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===Cn&&(e.onclick=null),It(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);It(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=A.d;A.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=zd();return e||t}function Cm(e){var t=Rt(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=cn(t);i=`link[rel=\"`+e+`\"][href=\"`+i+`\"]`,typeof n==`string`&&(i+=`[crossorigin=\"`+n+`\"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Vt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel=\"preload\"][as=\"`+cn(t)+`\"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset=\"`+cn(n.imageSrcSet)+`\"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes=\"`+cn(n.imageSizes)+`\"]`)):i+=`[href=\"`+cn(e)+`\"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Ft]=!0,o.onload=o.onerror=function(){Ht(o)}),Vt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel=\"modulepreload\"][as=\"`+cn(r)+`\"][href=\"`+cn(e)+`\"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=w({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Vt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Bt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,\"data-precedence\":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Vt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Bt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Vt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Bt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Vt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=De.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Bt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Bt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Bt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href=\"`+cn(e)+`\"`}function Fm(e){return`link[rel=\"stylesheet\"][`+e+`]`}function Im(e){return w({},e,{\"data-precedence\":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel=\"preload\"][as=\"style\"][`+t+`]`)){if(!0!==t[Ft]){r.loading=1;return}}else t=e.createElement(`link`),t[Ft]=!0,t.onload=t.onerror=Ht.bind(null,t),np(t,`link`,n),Vt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src=\"`+cn(e)+`\"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~=\"`+cn(n.href)+`\"]`);if(r)return t.instance=r,Vt(r),r;var a=w({},n,{\"data-href\":n.href,\"data-precedence\":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Vt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Vt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Vt(a),a):(r=n,(a=vm.get(o))&&(r=w({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Vt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel=\"stylesheet\"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Pt]||a[Dt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Vt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:D,Provider:null,Consumer:null,_currentValue:j,_currentValue2:j,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.hiddenUpdates=gt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Li(3,null,null,t),e.current=a,a.stateNode=e,t=Ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},yo(a),e}function uh(e){return e?(e=Fi,e):Fi}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=xo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=So(e,r,t),n!==null&&(Pd(n,e,t),Co(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Mi(e,67108864);t!==null&&Pd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=jd();t=St(t);var n=Mi(e,t);n!==null&&Pd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,yh(e,t,n,r)}finally{A.p=a,k.T=i}}function vh(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,yh(e,t,n,r)}finally{A.p=a,k.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Rt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ut(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-rt(o);s.entanglements[1]|=c,o&=~c}Ef(a),!(W&6)&&(_d=Ge()+500,Df(0,!1))}}break;case 31:case 13:s=Mi(a,2),s!==null&&Pd(s,a,2),zd(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=Tn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ke()){case qe:return 2;case Je:return 8;case Ye:case Xe:return 32;case Ze:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Rt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Tt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Tt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);wn=r,n.target.dispatchEvent(r),wn=null}else return t=Rt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Rt(n);a!==null&&(e.splice(t,3),t-=3,rc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ot]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ot]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,jd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),zd(),t[kt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=wt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(i(527,Kh,`19.3.1`));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{et=Jh.inject(qh),tt=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ec,s=Dc,c=Oc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[kt]=t.current,Wf(e),new Wh(t)}})),g=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g(),y=class extends Error{status;code;sqlState;position;detail;hint;constructor(e,t,n,r,i,a,o){super(n),this.status=e,this.code=t,this.sqlState=r,this.position=i,this.detail=a,this.hint=o,this.name=`ApiError`}};function b(e=document){let t=e.querySelector(`meta[name=\"otw-db\"]`)?.getAttribute(`content`);return!t||t.startsWith(`%`)?{api:`/api`}:JSON.parse(t)}function x(e,t,n){let r=e=>new URLSearchParams(e).toString();function i(e,t){return n?t===void 0?[`${e}${e.includes(`?`)?`&`:`?`}${r({database:n})}`,t]:[e,{...t,database:n}]:[e,t]}function a(t,n,r){return fetch(`${e.api}${t}`,{method:n===void 0?`GET`:`POST`,headers:{\"x-db-admin\":`1`,...n===void 0?{}:{\"content-type\":`application/json`}},body:n===void 0?void 0:JSON.stringify(n),credentials:`same-origin`,signal:r})}async function o(e,t,n){let r=await a(e,t,n);if(!r.ok)throw await s(r);return await r.json()}async function s(e){let n=await e.json().catch(()=>({}));e.status===401&&t();let r=n.error;return new y(e.status,r?.code??`failed`,r?.message??`The server answered ${e.status}.`,r?.sqlState,r?.position,r?.detail,r?.hint)}function c(e,t,n){let[r,a]=i(e,t);return o(r,a,n)}let l={forDatabase:n=>x(e,t,n??void 0),connections:()=>o(`/connections`).then(e=>e.connections),databases:e=>o(`/databases?${r({connection:e})}`),info:e=>c(`/info?${r({connection:e})}`).then(e=>e.info),tables:e=>c(`/tables?${r({connection:e})}`).then(e=>e.tables),table:(e,t,n)=>c(`/table?${r({connection:e,schema:t,name:n})}`).then(e=>e.table),rows:(e,t)=>c(`/rows`,e,t),count:(e,t)=>c(`/count`,e,t).then(e=>e.count),query:(e,t,n,r)=>c(`/query`,{connection:e,sql:t,queryId:n},r),apply:e=>c(`/apply`,e),exportTable:async e=>{let t=await a(...i(`/export`,e));if(!t.ok)throw await s(t);let n=t.headers.get(`content-disposition`)??``,r=/filename=\"([^\"]+)\"/.exec(n)?.[1]??`${e.table}.${e.format}`;return{blob:await t.blob(),filename:r}},cancel:e=>o(`/cancel`,{queryId:e}).then(e=>e.canceled),backupOptions:e=>c(`/backup-options?${r({connection:e})}`),backup:async e=>{let t=await a(...i(`/backup`,e));if(!t.ok)throw await s(t);let n=t.headers.get(`content-disposition`)??``,r=/filename=\"([^\"]+)\"/.exec(n)?.[1]??`backup`;return{blob:await t.blob(),filename:r}},restorePlan:(e,t)=>c(`/restore-plan`,{connection:e,header:t}),restore:async(e,t,n,r,i,a)=>l.restoreRun(e,await l.restoreUpload(e,t,n,i),r,a),restoreUpload:async(t,n,a,o)=>{let{upload:l,chunkBytes:u}=await c(`/restore-start`,{connection:t,size:n.size,kind:a,name:n.name??`backup`});try{for(let a=0,c=0;c<n.size;a+=1){let d=n.slice(c,c+u),[f]=i(`/restore-chunk?${r({connection:t,upload:l,seq:String(a)})}`);await S(async()=>{let t=await fetch(`${e.api}${f}`,{method:`POST`,headers:{\"x-db-admin\":`1`,\"content-type\":`application/octet-stream`},body:d,credentials:`same-origin`});if(!t.ok)throw await s(t)}),c+=d.size,o(c)}}catch(e){throw await c(`/restore-discard`,{connection:t,upload:l}).catch(()=>{}),e}return l},restoreRun:async(e,t,n,r)=>{let o=await a(...i(`/restore-run`,{connection:e,upload:t,confirm:n}));if(!o.ok)throw await s(o);let c=null;for await(let e of ee(o))c=e,r(c);if(!c)throw new y(500,`failed`,`The restore stopped without saying how it went.`);return c},restoreDiscard:(e,t)=>c(`/restore-discard`,{connection:e,upload:t})};return l}async function S(e){for(let t=1;;t+=1)try{return await e()}catch(e){if(!(!(e instanceof y)||e.status>=500)||t===3)throw e;await new Promise(e=>setTimeout(e,500*t))}}async function*ee(e){let t=e.body.pipeThrough(new TextDecoderStream).getReader(),n=``;for(;;){let{done:e,value:r}=await t.read();r&&(n+=r);let i;for(;(i=n.indexOf(`\n`))!==-1;){let e=n.slice(0,i).trim();n=n.slice(i+1),e&&(yield JSON.parse(e))}if(e)break}n.trim()&&(yield JSON.parse(n))}var te=e=>{try{return decodeURIComponent(e)}catch{return null}};function C(e){let t=e.replace(/^#/,``),n=t.indexOf(`/`);return{connection:te(n===-1?t:t.slice(0,n))??``,database:n===-1?null:te(t.slice(n+1))||null}}function ne({connection:e,database:t}){if(!e)return``;let n=encodeURIComponent(e);return t?`${n}/${encodeURIComponent(t)}`:n}function w(e,t){return t?`${e}/${t}`:e}var re=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ie=o(((e,t)=>{t.exports=re()})),T=ie(),ae={table:`M2.5 3.5h11v9h-11z M2.5 6.5h11 M6.5 6.5v6`,view:`M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z M8 6.2a1.8 1.8 0 1 1 0 3.6 1.8 1.8 0 0 1 0-3.6z`,stack:`M8 2.5l5.5 2.75L8 8 2.5 5.25z M2.5 8L8 10.75 13.5 8 M2.5 10.75L8 13.5l5.5-2.75`,play:`M5 3.5l7 4.5-7 4.5z`,stop:`M4.5 4.5h7v7h-7z`,plus:`M8 3.5v9 M3.5 8h9`,minus:`M3.5 8h9`,refresh:`M12.5 5.5A5 5 0 1 0 13 9 M12.5 2.5v3h-3`,sidebar:`M2.5 3.5h11v9h-11z M6 3.5v9`,panel:`M2.5 3.5h11v9h-11z M10 3.5v9`,console:`M2.5 3.5h11v9h-11z M5 7l2 1.5L5 10 M8.5 10h2.5`,search:`M7 3a4 4 0 1 1 0 8 4 4 0 0 1 0-8z M10 10l3.5 3.5`,close:`M4.5 4.5l7 7 M11.5 4.5l-7 7`,left:`M10 3.5L5.5 8l4.5 4.5`,right:`M6 3.5l4.5 4.5L6 12.5`,down:`M4 6.5l4 4 4-4`,backup:`M8 2.5v7 M5.5 7l2.5 2.5L10.5 7 M2.5 10v3.5h11V10`,filter:`M2.5 3.5h11L9.5 8.5v4l-3-1.5v-2.5z`,sql:`M5.5 5L3 8l2.5 3 M10.5 5L13 8l-2.5 3 M9 4l-2 8`,key:`M10 2.5a3.5 3.5 0 1 1-2.6 5.9L3.5 12.3v1.2H2.3v-1.2l3.9-3.9A3.5 3.5 0 0 1 10 2.5z`,lock:`M4.5 7.5h7v5.5h-7z M6 7.5V5.5a2 2 0 0 1 4 0v2`,database:`M3 4c0-1.1 2.2-1.5 5-1.5s5 .4 5 1.5v8c0 1.1-2.2 1.5-5 1.5s-5-.4-5-1.5z M3 4c0 1.1 2.2 1.5 5 1.5s5-.4 5-1.5 M3 8c0 1.1 2.2 1.5 5 1.5s5-.4 5-1.5`,switch:`M3 5.5h9.5L10 3 M13 10.5H3.5L6 13`,history:`M2.5 8a5.5 5.5 0 1 0 1.6-3.9 M2.5 2.5v2.5H5 M8 5v3l2 1.5`,save:`M3 2.5h8l2 2v9H3z M5.5 2.5v3h4v-3 M5 13.5v-4h6v4`};function E({name:e,size:t=16,label:n}){return(0,T.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,role:n?`img`:void 0,\"aria-label\":n,\"aria-hidden\":!n||void 0,children:(0,T.jsx)(`path`,{d:ae[e]})})}function oe(e){return e===`view`?`view`:e===`materialized-view`?`stack`:`table`}var se={postgres:`Pg`,mysql:`My`,sqlite:`Lt`},D={postgres:`PostgreSQL`,mysql:`MySQL`,sqlite:`SQLite`};function ce({connections:e,onOpen:t}){let[n,r]=(0,_.useState)(``),i=n.trim().toLowerCase(),a=e.filter(e=>!i||e.label.toLowerCase().includes(i)||e.name.includes(i)||e.tag?.includes(i));return(0,T.jsx)(`div`,{className:`connections`,children:(0,T.jsxs)(`div`,{className:`connections-card`,children:[(0,T.jsxs)(`div`,{className:`connections-head`,children:[(0,T.jsx)(E,{name:`database`,size:28}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{children:`OTW DB`}),(0,T.jsx)(`p`,{children:e.length===1?`1 connection`:`${e.length} connections`})]})]}),e.length>6&&(0,T.jsx)(`div`,{className:`connections-search`,children:(0,T.jsx)(`input`,{className:`input`,type:`search`,\"aria-label\":`Search connections`,placeholder:`Search for connection…`,value:n,onChange:e=>r(e.target.value),autoFocus:!0})}),(0,T.jsxs)(`ul`,{className:`connections-list`,\"aria-label\":`Connections`,children:[!e.length&&(0,T.jsxs)(`li`,{className:`tree-empty`,children:[`No connections yet. Set `,(0,T.jsx)(`code`,{children:`DB_ADMIN_<NAME>_URL`}),` on the server.`]}),a.map((n,r)=>{let i=n.capabilities!==null,a=n.tag?`tag-${n.tag}`:``;return(0,T.jsx)(`li`,{className:a,children:(0,T.jsxs)(`button`,{type:`button`,className:`connection`,\"aria-label\":n.label,\"aria-describedby\":`connection-${n.name}`,\"aria-disabled\":!i,autoFocus:r===0&&e.length<=6,onClick:()=>i&&t(n),children:[(0,T.jsx)(`span`,{className:`kind-badge`,children:se[n.kind]??`?`}),(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`div`,{className:`connection-name`,children:n.label}),(0,T.jsxs)(`div`,{className:`connection-meta`,id:`connection-${n.name}`,children:[D[n.kind],n.label!==n.name&&` · ${n.name}`,!i&&` · not supported yet`]})]}),(0,T.jsxs)(`span`,{className:`connection-tags`,children:[n.access===`read`&&(0,T.jsx)(E,{name:`lock`,size:13,label:`Read-only`}),n.tag&&(0,T.jsx)(`span`,{className:`pill`,children:n.tag})]})]})},n.name)})]})]})})}var le={tabs:[],active:null,queries:0},ue=(e,t)=>`table:${e}.${t}`;function O(e,t){switch(t.type){case`open-table`:{let n=ue(t.schema,t.table);if(e.tabs.some(e=>e.id===n))return{...e,active:n};let r={id:n,kind:`table`,schema:t.schema,table:t.table};return{...e,tabs:[...e.tabs,r],active:n}}case`new-query`:{let n=e.queries+1,r=`query:${n}`,i={id:r,kind:`query`,title:`Query ${n}`,sql:t.sql??``};return{tabs:[...e.tabs,i],active:r,queries:n}}case`close`:{let n=e.tabs.findIndex(e=>e.id===t.id);if(n===-1)return e;let r=e.tabs.filter(e=>e.id!==t.id),i=e.active===t.id?r[n]?.id??r[n-1]?.id??null:e.active;return{...e,tabs:r,active:i}}case`activate`:return e.tabs.some(e=>e.id===t.id)?{...e,active:t.id}:e;case`cycle`:{if(!e.tabs.length)return e;let n=(e.tabs.findIndex(t=>t.id===e.active)+t.by+e.tabs.length)%e.tabs.length;return{...e,active:e.tabs[n].id}}case`edit-sql`:return{...e,tabs:e.tabs.map(e=>e.id===t.id&&e.kind===`query`?{...e,sql:t.sql}:e)}}}function de(e,t=pe()){try{let n=t?.getItem(`otw-db:tabs:${e}`);if(!n)return le;let r=JSON.parse(n);return!Array.isArray(r.tabs)||typeof r.queries!=`number`?le:r}catch{return le}}function fe(e,t,n=pe()){try{n?.setItem(`otw-db:tabs:${e}`,JSON.stringify(t))}catch{}}function pe(){try{return globalThis.localStorage}catch{return}}var me=200,he=e=>`otw-db:history:${e}`;function ge(e,t=pe()){try{let n=JSON.parse(t?.getItem(he(e))??`[]`);return Array.isArray(n)?n:[]}catch{return[]}}function _e(e,t,n=pe()){let r=[{sql:t,at:new Date().toISOString()},...ge(e,n).filter(e=>e.sql!==t)].slice(0,me);try{n?.setItem(he(e),JSON.stringify(r))}catch{}return r}var ve=(0,_.createContext)(null);function ye(){let e=(0,_.useContext)(ve);if(!e)throw Error(`useWorkspace() is for components inside a workspace.`);return e}var be=`-- otw-db backup `,xe=1048576;async function k(e){let t=new Uint8Array(await e.slice(0,5).arrayBuffer());if(new TextDecoder().decode(t)===`PGDMP`)return{kind:`pg_dump`};let n=t[0]===31&&t[1]===139,r;try{r=await A(n?e.stream().pipeThrough(new DecompressionStream(`gzip`)):e.stream())}catch{return{kind:`unknown`,reason:`The file can’t be read: it may be damaged.`}}if(r===null||!r.startsWith(be))return{kind:`unknown`,reason:`This isn’t a backup made here: choose a .sql.gz from Back up, or a .dump from pg_dump.`};try{return{kind:`sql`,header:JSON.parse(r.slice(17))}}catch{return{kind:`unknown`,reason:`The backup’s first line is damaged.`}}}async function A(e){let t=new TextDecoderStream,n=e.pipeThrough(t).getReader(),r=``;try{for(;;){let{done:e,value:t}=await n.read();t&&(r+=t);let i=r.indexOf(`\n`);if(i!==-1)return r.slice(0,i);if(e||r.length>xe)return null}}finally{await n.cancel().catch(()=>{})}}var j={csv:`CSV`,json:`JSON`,sql:`SQL INSERTs`};function Se({formats:e,onExport:t}){let[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!e.composedPath().includes(i.current)&&r(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[n]),(0,T.jsxs)(`div`,{style:{position:`relative`},ref:i,onKeyDown:e=>e.key===`Escape`&&r(!1),children:[(0,T.jsx)(`button`,{type:`button`,className:`button`,\"aria-haspopup\":`menu`,\"aria-expanded\":n,onClick:()=>r(e=>!e),children:`Export`}),n&&(0,T.jsx)(`div`,{className:`menu`,role:`menu`,\"aria-label\":`Export as`,children:e.map(e=>(0,T.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(!1),t(e)},children:j[e]},e))})]})}function Ce(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function we({api:e,connection:t,onRestored:n,onClose:r}){let[i,a]=(0,_.useState)(`backup`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let n=!0;return e.backupOptions(t.name).then(e=>n&&s(e),e=>n&&l(e)),()=>{n=!1}},[e,t.name]);let p=()=>{!u&&!f.current&&r()};return(0,T.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&p(),children:(0,T.jsxs)(`div`,{className:`dialog backup`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Back up and restore`,onKeyDown:e=>e.key===`Escape`&&p(),children:[(0,T.jsx)(`div`,{className:`tabs`,role:`tablist`,\"aria-label\":`Back up or restore`,children:[`backup`,`restore`].map(e=>(0,T.jsx)(`button`,{type:`button`,role:`tab`,id:`backup-tab-${e}`,\"aria-selected\":i===e,\"aria-controls\":`backup-panel-${e}`,disabled:u,onClick:()=>a(e),children:e===`backup`?`Back up`:`Restore`},e))}),c&&(0,T.jsx)(`div`,{className:`dialog-body`,children:(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:c.message})}),!o&&!c&&(0,T.jsx)(`div`,{className:`dialog-body muted`,children:`Loading…`}),o&&i===`backup`&&(0,T.jsx)(M,{api:e,connection:t,options:o,busy:u,setBusy:d,onClose:p}),o&&i===`restore`&&(0,T.jsx)(N,{api:e,connection:t,options:o,setBusy:e=>{f.current=e,d(e)},busy:u,onRestored:n,onClose:p}),!o&&(0,T.jsx)(`div`,{className:`dialog-actions`,children:(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:p,children:`Close`})})]})})}function M({api:e,connection:t,options:n,busy:r,setBusy:i,onClose:a}){let[o,s]=(0,_.useState)(()=>new Set(n.schemas.filter(e=>e.selected).map(e=>e.name))),[c,l]=(0,_.useState)(`sql`),[u,d]=(0,_.useState)(null),f=n.notIncluded.filter(e=>e.schema===null||o.has(e.schema)),p=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m=async()=>{i(!0),d(null);try{let r=n.schemas.filter(e=>o.has(e.name)).map(e=>e.name),{blob:i,filename:s}=await e.backup({connection:t.name,schemas:r,format:c});Ce(i,s),a()}catch(e){d(e.message)}finally{i(!1)}};return(0,T.jsxs)(`div`,{role:`tabpanel`,id:`backup-panel-backup`,\"aria-labelledby\":`backup-tab-backup`,children:[(0,T.jsxs)(`div`,{className:`dialog-body`,children:[(0,T.jsxs)(`p`,{className:`muted`,children:[n.database,` on `,n.server]}),(0,T.jsxs)(`fieldset`,{className:`choices`,children:[(0,T.jsx)(`legend`,{children:`Schemas`}),n.schemas.map(e=>(0,T.jsxs)(`label`,{children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:o.has(e.name),disabled:r,onChange:()=>p(e.name)}),(0,T.jsx)(`span`,{children:e.name}),(0,T.jsxs)(`span`,{className:`muted`,children:[e.tables===1?`1 table`:`${e.tables.toLocaleString()} tables`,e.mine?``:` · owner ${e.owner}`]})]},e.name))]}),(0,T.jsxs)(`fieldset`,{className:`choices`,children:[(0,T.jsx)(`legend`,{children:`Format`}),(0,T.jsxs)(`label`,{children:[(0,T.jsx)(`input`,{type:`radio`,name:`backup-format`,checked:c===`sql`,disabled:r,onChange:()=>l(`sql`)}),(0,T.jsx)(`span`,{children:`SQL backup (.sql.gz)`}),(0,T.jsx)(`span`,{className:`muted`,children:`restores here, or with psql`})]}),(0,T.jsxs)(`label`,{title:n.pgDump.available?void 0:n.pgDump.reason,children:[(0,T.jsx)(`input`,{type:`radio`,name:`backup-format`,checked:c===`pg_dump`,disabled:r||!n.pgDump.available,onChange:()=>l(`pg_dump`)}),(0,T.jsx)(`span`,{children:`pg_dump (.dump)`}),(0,T.jsx)(`span`,{className:`muted`,children:n.pgDump.available?`restores with pg_restore`:n.pgDump.reason})]})]}),n.exclusive&&(0,T.jsx)(`div`,{className:`notice warning`,children:`This is the site’s embedded database: the site waits while the backup is taken.`}),c===`sql`&&f.length>0&&(0,T.jsxs)(`div`,{className:`notice warning`,children:[`Not in the backup: `,f.map(e=>e.what).join(`; `),`. Use pg_dump for those.`]}),u&&(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:u})]}),(0,T.jsxs)(`div`,{className:`dialog-actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`button`,disabled:r,onClick:a,children:`Cancel`}),(0,T.jsx)(`button`,{type:`button`,className:`button primary`,disabled:r||o.size===0,onClick:()=>void m(),children:r?`Backing up…`:`Download backup`})]})]})}function N({api:e,connection:t,options:n,busy:r,setBusy:i,onRestored:a,onClose:o}){let[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)({step:`idle`}),[b,x]=(0,_.useState)(null),S=()=>{b&&e.restoreDiscard(t.name,b).catch(()=>{}),x(null)},ee=async n=>{if(S(),c(n),u(null),f(null),m(null),y({step:`idle`}),!n)return;let r=await k(n);if(u(r),r.kind===`sql`)try{f(await e.restorePlan(t.name,r.header))}catch(e){m(e.message)}},te=l?.kind===`pg_dump`?`pg_dump`:`sql`,C=(d?.blocked.length??0)>0,ne=n.restore.allowed&&s!==null&&l!==null&&l.kind!==`unknown`&&(l.kind===`pg_dump`?n.pgRestore.available:d!==null&&!C)&&h===n.database&&(v.step===`idle`||b!==null),w=async()=>{if(s){i(!0);try{let n=b;n||=(y({step:`uploading`,sent:0}),await e.restoreUpload(t.name,s,te,e=>y({step:`uploading`,sent:e}))),y({step:`restoring`,statements:0});let r=await e.restoreRun(t.name,n,h,e=>{e.type===`progress`&&y({step:`restoring`,statements:e.statements})});r.type===`done`?(x(null),y({step:`done`,result:r}),a()):r.type===`error`&&(x(r.error.code===`busy`?n:null),y({step:`failed`,message:r.error.message}))}catch(e){x(null),y({step:`failed`,message:e.message})}finally{i(!1)}}};return(0,T.jsxs)(`div`,{role:`tabpanel`,id:`backup-panel-restore`,\"aria-labelledby\":`backup-tab-restore`,children:[(0,T.jsx)(`div`,{className:`dialog-body`,children:n.restore.allowed?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`file-choice`,children:[(0,T.jsx)(`span`,{children:`Backup file`}),(0,T.jsx)(`input`,{type:`file`,accept:`.gz,.sql,.dump,application/gzip,application/sql`,disabled:r,onChange:e=>void ee(e.target.files?.[0]??null)})]}),l?.kind===`unknown`&&(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:l.reason}),l?.kind===`sql`&&(0,T.jsxs)(`p`,{className:`muted`,children:[`Backup of `,l.header.database,` (`,l.header.server,`), made`,` `,new Date(l.header.createdAt).toLocaleString(),`: `,l.header.schemas.join(`, `),`.`]}),l?.kind===`pg_dump`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{className:`muted`,children:[`pg_dump archive, `,Oe(s?.size??0),`.`]}),!n.pgRestore.available&&(0,T.jsxs)(`div`,{className:`notice`,role:`alert`,children:[n.pgRestore.reason,` Restore it with pg_restore from a machine that has it.`]})]}),p&&(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:p}),d&&(0,T.jsx)(Te,{plan:d,database:n.database}),l?.kind===`sql`&&l.header.notIncluded.length>0&&(0,T.jsxs)(`div`,{className:`notice warning`,children:[`The backup didn’t hold: `,l.header.notIncluded.join(`; `),`.`]}),n.exclusive&&l&&l.kind!==`unknown`&&(0,T.jsx)(`div`,{className:`notice warning`,children:`This is the site’s embedded database: the site waits while it’s restored.`}),l&&l.kind!==`unknown`&&(!C||l.kind===`pg_dump`)&&(0,T.jsxs)(`label`,{className:`confirm`,children:[(0,T.jsxs)(`span`,{children:[`Type `,(0,T.jsx)(`strong`,{children:n.database}),` to replace what it holds`]}),(0,T.jsx)(`input`,{className:`input`,\"aria-label\":`Database name, to confirm`,value:h,disabled:r||v.step===`done`,autoComplete:`off`,spellCheck:!1,onChange:e=>g(e.target.value)})]}),(0,T.jsx)(Ee,{phase:v,total:s?.size??0})]}):(0,T.jsx)(`div`,{className:`notice warning`,children:`Restoring needs write access, and this connection is read-only.`})}),(0,T.jsxs)(`div`,{className:`dialog-actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`button`,disabled:r,onClick:()=>{S(),o()},children:v.step===`done`?`Close`:`Cancel`}),n.restore.allowed&&(0,T.jsx)(`button`,{type:`button`,className:`button danger`,disabled:!ne||r,onClick:()=>void w(),children:r?`Restoring…`:b?`Try again`:`Restore`})]})]})}function Te({plan:e,database:t}){return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`replaces`,children:[(0,T.jsxs)(`p`,{children:[`Replaces in `,t,`:`]}),(0,T.jsx)(`ul`,{children:e.schemas.map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`strong`,{children:e.schema}),` `,e.exists?(0,T.jsxs)(`span`,{className:`muted`,children:[De(e.tables,`table`),`, `,De(e.views,`view`),`,`,` `,De(e.functions,`function`),e.rows>0&&`, about ${De(e.rows,`row`)}`]}):(0,T.jsx)(`span`,{className:`muted`,children:`new here`})]},e.schema))})]}),e.blocked.length>0&&(0,T.jsxs)(`div`,{className:`notice`,role:`alert`,children:[`Restoring would also drop what the backup can’t bring back:`,(0,T.jsx)(`ul`,{children:e.blocked.map(e=>(0,T.jsx)(`li`,{children:e},e))}),`Back up those schemas too, or remove what’s listed here.`]}),e.missingRoles.length>0&&(0,T.jsxs)(`div`,{className:`notice warning`,children:[`These roles aren’t on this server: `,e.missingRoles.join(`, `),`. Their grants will be skipped, and a policy made for the other roles it names (or skipped, when it names no other).`]}),e.warnings.map(e=>(0,T.jsx)(`div`,{className:`notice warning`,children:e},e))]})}function Ee({phase:e,total:t}){switch(e.step){case`idle`:return null;case`uploading`:return(0,T.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,T.jsx)(`progress`,{max:t||1,value:e.sent}),`Uploading `,Oe(e.sent),` of `,Oe(t),`…`]});case`restoring`:return(0,T.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,T.jsx)(`progress`,{}),`Restoring: `,De(e.statements,`statement`),` run…`]});case`done`:return(0,T.jsxs)(`div`,{className:`notice success`,role:`status`,children:[`Restored`,e.result.tables?` ${De(e.result.tables,`table`)} and ${De(e.result.rows,`row`)}`:``,` `,`in`,` `,(e.result.durationMs/1e3).toLocaleString(void 0,{maximumFractionDigits:1}),` `,`s. If an app uses this database, restart it: it may keep what it read before.`]});case`failed`:return(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:e.message})}}function De(e,t){return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function Oe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})} MB`}function ke(e,t){let n=0;for(let r of t.toLowerCase()){if(n=e.toLowerCase().indexOf(r,n),n===-1)return!1;n++}return!0}function Ae(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>ke(t(e),r)).sort((e,n)=>Number(!t(e).toLowerCase().startsWith(r))-Number(!t(n).toLowerCase().startsWith(r))).slice(0,50)}function je({tables:e,onOpen:t,onClose:n}){let[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(null);(0,_.useEffect)(()=>{s.current?.focus()},[]);let c=Ae(e,e=>e.name,r),l=c[Math.min(a,c.length-1)];return(0,T.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,T.jsxs)(`div`,{className:`dialog palette`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Open anything`,children:[(0,T.jsx)(`input`,{ref:s,className:`input`,\"aria-label\":`Table name`,placeholder:`Open table…`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`Escape`?n():e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(e+1,c.length-1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(e-1,0))):e.key===`Enter`&&l&&t(l)}}),(0,T.jsxs)(`ul`,{role:`listbox`,\"aria-label\":`Tables`,children:[c.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,role:`option`,\"aria-selected\":e===l,onMouseEnter:()=>o(c.indexOf(e)),onClick:()=>t(e),children:[(0,T.jsx)(E,{name:oe(e.kind),size:14}),e.name,(0,T.jsx)(`span`,{className:`schema`,children:e.schema})]})},`${e.schema}.${e.name}`)),!c.length&&(0,T.jsx)(`li`,{className:`tree-empty`,children:`No table matches.`})]})]})})}function Me({api:e,connection:t,open:n,onOpen:r,onClose:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{p.current?.focus()},[]),(0,_.useEffect)(()=>{let n=!0;return e.databases(t).then(e=>{n&&o(e)},e=>{n&&c(e)}),()=>{n=!1}},[e,t]);let m=Ae(a?.databases??[],e=>e,l),h=m[Math.min(d,m.length-1)],g=e=>r(e===a?.current?null:e);return(0,T.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,T.jsxs)(`div`,{className:`dialog palette`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Open database`,children:[(0,T.jsx)(`input`,{ref:p,className:`input`,\"aria-label\":`Database name`,placeholder:`Open database…`,value:l,onChange:e=>{u(e.target.value),f(0)},onKeyDown:e=>{e.key===`Escape`?i():e.key===`ArrowDown`?(e.preventDefault(),f(e=>Math.min(e+1,m.length-1))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>Math.max(e-1,0))):e.key===`Enter`&&h!==void 0&&g(h)}}),(0,T.jsxs)(`ul`,{role:`listbox`,\"aria-label\":`Databases`,children:[m.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,role:`option`,\"aria-selected\":e===h,\"aria-current\":e===n||void 0,onMouseEnter:()=>f(m.indexOf(e)),onClick:()=>g(e),children:[(0,T.jsx)(E,{name:`database`,size:14}),e,e===n&&(0,T.jsx)(`span`,{className:`schema`,children:`open`})]})},e)),s&&(0,T.jsx)(`li`,{className:`tree-empty`,role:`alert`,children:s.message}),!a&&!s&&(0,T.jsx)(`li`,{className:`tree-empty`,children:`Loading…`}),a&&!m.length&&(0,T.jsx)(`li`,{className:`tree-empty`,children:`No database matches.`})]})]})})}function Ne({tabs:e,active:t,onActivate:n,onClose:r,kinds:i}){return e.length?(0,T.jsx)(`div`,{className:`tabbar`,role:`tablist`,\"aria-label\":`Open tabs`,children:e.map(e=>{let a=e.kind===`table`?e.table:e.title;return(0,T.jsxs)(`div`,{className:`tab`,role:`tab`,tabIndex:0,\"aria-selected\":e.id===t,title:e.kind===`table`?`${e.schema}.${e.table}`:e.title,onClick:()=>n(e.id),onAuxClick:t=>t.button===1&&r(e.id),onKeyDown:t=>t.key===`Enter`&&n(e.id),children:[(0,T.jsx)(E,{name:e.kind===`query`?`sql`:oe(i.get(`${e.schema}.${e.table}`)??`table`),size:13}),(0,T.jsx)(`span`,{className:`title`,children:a}),(0,T.jsx)(`button`,{type:`button`,className:`icon-button close`,\"aria-label\":`Close ${a}`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,T.jsx)(E,{name:`close`,size:12})})]},e.id)})}):null}function Pe({row:e}){return(0,T.jsxs)(`aside`,{className:`panel`,\"aria-label\":`Row`,children:[(0,T.jsx)(`div`,{className:`panel-head`,children:`Row`}),e?(0,T.jsx)(`dl`,{className:`fields`,children:e.columns.map((t,n)=>(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`dt`,{children:[t.name,` `,(0,T.jsx)(`span`,{className:`type`,children:t.type})]}),(0,T.jsx)(`dd`,{children:e.values[n]??(0,T.jsx)(`span`,{className:`null`,children:`NULL`})})]},`${t.name}-${n}`))}):(0,T.jsx)(`div`,{className:`tree-empty`,children:`Select a row to see its fields.`})]})}function Fe({entries:e}){let t=(0,_.useRef)(null);return(0,_.useEffect)(()=>{t.current?.scrollIntoView({block:`nearest`})},[e]),(0,T.jsxs)(`div`,{className:`console`,role:`log`,\"aria-label\":`Console`,children:[e.map((e,t)=>(0,T.jsxs)(`div`,{className:`console-entry${e.error?` failed`:``}`,children:[(0,T.jsx)(`span`,{className:`time`,children:e.at.toLocaleTimeString()}),(0,T.jsxs)(`span`,{className:`sql`,children:[e.statement,e.error&&` — ${e.error}`]}),(0,T.jsx)(`span`,{className:`took`,children:e.durationMs===void 0?``:`${e.durationMs} ms`})]},t)),(0,T.jsx)(`div`,{ref:t})]})}function Ie({icon:e,label:t,shortcut:n,pressed:r,onClick:i}){return(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":t,\"aria-pressed\":r,title:n?`${t} (${n})`:t,onClick:i,children:(0,T.jsx)(E,{name:e})})}function Le(e){let t=[],n=0,r=0,i=r=>{let i=e.slice(n,r),a=i.length-i.trimStart().length,o=i.trim();o&&!Be(o)&&t.push({text:o,from:n+a,to:n+a+o.length})};for(;r<e.length;){let t=e[r],a=e[r+1];if(t===`-`&&a===`-`){let t=e.indexOf(`\n`,r);r=t===-1?e.length:t+1}else if(t===`/`&&a===`*`)r=ze(e,r);else if(t===`'`){let t=/[eE]/.test(e[r-1]??``)&&!/[\\w$]/.test(e[r-2]??``);r=Re(e,r,`'`,t)}else if(t===`\"`)r=Re(e,r,`\"`,!1);else if(t===`$`){let t=/^\\$([A-Za-z_][A-Za-z0-9_]*)?\\$/.exec(e.slice(r));if(t&&!/[\\w$]/.test(e[r-1]??``)){let n=e.indexOf(t[0],r+t[0].length);r=n===-1?e.length:n+t[0].length}else r++}else t===`;`&&(i(r),n=r+1),r++}return i(e.length),t}function Re(e,t,n,r){let i=t+1;for(;i<e.length;)if(r&&e[i]===`\\\\`)i+=2;else if(e[i]===n){if(e[i+1]===n)i+=2;else return i+1}else i++;return e.length}function ze(e,t){let n=0,r=t;for(;r<e.length;)if(e[r]===`/`&&e[r+1]===`*`)n++,r+=2;else if(e[r]===`*`&&e[r+1]===`/`){if(n--,r+=2,n===0)return r}else r++;return e.length}function Be(e){let t=0;for(;t<e.length;)if(/\\s/.test(e[t]))t++;else if(e.startsWith(`--`,t)){let n=e.indexOf(`\n`,t);t=n===-1?e.length:n+1}else if(e.startsWith(`/*`,t))t=ze(e,t);else return!1;return!0}function Ve(e,t){let n=null;for(let r of e){if(t>=r.from&&t<=r.to)return r;r.to<t&&(n=r)}return n??e[0]??null}var He=/^\\s*(?:with\\b[\\s\\S]*?\\b)?(insert|update|delete|merge|truncate|drop|alter|create|grant|revoke|comment|vacuum|reindex|cluster|refresh|copy|call|do|lock|import|security)\\b/i;function Ue(e){return He.test(We(e))}function We(e){let t=e.trimStart();for(;;)if(t.startsWith(`--`)){let e=t.indexOf(`\n`);t=e===-1?``:t.slice(e+1).trimStart()}else if(t.startsWith(`/*`))t=t.slice(ze(t,0)).trimStart();else return t}function Ge(e){return`${e.map(qe).join(`,`)}\\r\\n`}function Ke(e){return`${e.map(Je).join(`,`)}\\r\\n`}function qe(e){return e===null?``:e===``?`\"\"`:Je(e)}function Je(e){return/[\",\\r\\n]|^\\s|\\s$/.test(e)?`\"${e.replaceAll(`\"`,`\"\"`)}\"`:e}function Ye(e,t){let n={};return e.forEach((e,r)=>Object.defineProperty(n,e,{value:t[r]??null,enumerable:!0,writable:!0,configurable:!0})),n}function Xe(e,t){return Ke(e)+t.map(Ge).join(``)}function Ze(e,t){return`${JSON.stringify(t.map(t=>Ye(e,t)),null,2)}\\n`}function Qe({title:e,children:t,confirmLabel:n,danger:r,busy:i,onConfirm:a,onCancel:o}){let s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=(s.current?.getRootNode()??document).activeElement;return s.current?.focus(),()=>e?.focus()},[]),(0,T.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&o(),children:(0,T.jsxs)(`div`,{className:`dialog`,role:`alertdialog`,\"aria-modal\":`true`,\"aria-label\":e,onKeyDown:e=>{e.key===`Escape`&&o()},children:[(0,T.jsxs)(`div`,{className:`dialog-body`,children:[(0,T.jsx)(`h2`,{children:e}),t]}),(0,T.jsxs)(`div`,{className:`dialog-actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:o,children:`Cancel`}),(0,T.jsx)(`button`,{ref:s,type:`button`,className:`button ${r?`danger`:`primary`}`,disabled:i,onClick:a,children:n})]})]})})}var $e=m();function et(e){return typeof e==`object`?e.key:e}function tt(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function nt(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function rt(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var it=(e,t)=>Math.abs(e-t)<1.01,at=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function ot({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var st=e=>e===`smooth`||e===`smoothFinishing`;function ct({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!st(n.phase)&&!it(t,n.lastTargetOffset)&&!it(t,r())&&e!==`clampedEcho`}var lt=40;function ut(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<lt;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<lt;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function dt(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<lt;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var ft,pt=()=>{if(ft!==void 0)return ft;if(typeof navigator>`u`)return ft=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ft=!0;let e=navigator.maxTouchPoints;return ft=navigator.platform===`MacIntel`&&e!==void 0&&e>0},mt,ht=()=>mt===void 0?mt=pt()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):mt,gt=()=>!pt()||ht(),_t={capture:!0,passive:!0},vt=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,_t),e.addEventListener(`touchend`,n,_t),e.addEventListener(`touchcancel`,n,_t),()=>{e.removeEventListener(`touchstart`,t,_t),e.removeEventListener(`touchend`,n,_t),e.removeEventListener(`touchcancel`,n,_t),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},yt=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},bt=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},xt=e=>e,St=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},Ct=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(yt(n)),!r.ResizeObserver)return()=>{};let a=bt(r),o=new r.ResizeObserver(()=>{let t=()=>{i(yt(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},wt={passive:!0},Tt=typeof window>`u`||`onscrollend`in window,Et=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&Tt,o=0,s=a?null:at(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,wt),a&&r.addEventListener(`scrollend`,u,wt),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},Dt=(e,t)=>Et(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Ot=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},kt=(e,{adjustments:t=0,behavior:n},r)=>{var i;let{scrollElement:a,options:o}=r,s=e+t,c=o.horizontal&&o.isRtl&&a!==null&&`ownerDocument`in a;(i=a?.scrollTo)==null||i.call(a,{[o.horizontal?`left`:`top`]:c?-s:s,behavior:n})},At=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,jt=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function Mt(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var Nt=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new vt({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&dt(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=!1,r=!1,i=new Set,a=()=>{if(e)return e;let r=this.targetWindow;if(!r||!r.ResizeObserver)return null;let i=t=bt(r);return e=new r.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(o)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)i.schedule(t);else{n=!0;try{t()}finally{n=!1}}})},o=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var n;(n=a())==null||n.disconnect(),t?.cancel(),i.clear(),r=!1,e=null,t=null},observe:o=>{let s=a();s&&(n?(i.add(o),r||(r=!0,t?.schedule(()=>{r=!1,i.forEach(t=>{t.isConnected&&e?.observe(t,{box:`border-box`})}),i.clear()}))):s.observe(o,{box:`border-box`}))},unobserve:e=>{var t;i.delete(e),(t=a())==null||t.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:xt,rangeExtractor:St,onChange:()=>{},measureElement:Ot,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>et(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||Mt(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=nt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:ct({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||ut(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?jt(this.scrollState)&&!it(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>ot({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=At(t,e.index!=null&&it(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(pt()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=nt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=nt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=tt(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=nt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes,this._getLayoutTotalSize()+this.options.scrollMargin],(e,t,n,r,i)=>{if(e.length===0||t===0)return this.range=null,null;let a=Math.max(i-t,0);return this.range=It(e,t,Math.min(n,a),r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=nt(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!jt(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!jt(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!jt(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=nt(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return rt(t[Pt(0,t.length-1,r?e=>n[e*2]:e=>rt(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a),c=()=>this.options.horizontal?r.clientHeight:r.clientWidth,l=c();if(i.setProperty(a,`hidden`,`important`),c()!==l){i.setProperty(a,o,s);return}let u={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=u,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===u&&(this._momentumStop=null,u.restore()&&u.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.getMeasurements()[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(pt()&&this._iosGesture.dragging())&&e!==null&&!it(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&it(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=jt(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&>()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:At(n,e.index!=null&&it(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},Pt=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Ft(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function It(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=Ft(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=Pt(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Lt=typeof document<`u`?_.useLayoutEffect:_.useEffect;function Rt({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=_.useReducer(e=>e+1,0)[1],a=_.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=_.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,$e.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=_.useState(()=>{let e=new Nt(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),Lt(()=>d._didMount(),[]),Lt(()=>(s(d),d._willUpdate())),Lt(()=>{l(d)}),d}function zt(e){return Rt({observeElementRect:Ct,observeElementOffset:Dt,scrollToFn:kt,...e})}var Bt=24,Vt=26,Ht=52,Ut=64,Wt=360,Gt=300;function Kt({columns:e,rows:t,firstRow:n=1,sort:r,onSort:i,selected:a,onSelect:o,label:s,onEdit:c,onDeleteRow:l,lockedColumns:u,rowState:d,cellState:f}){let p=(0,_.useRef)(null),[m,h]=(0,_.useState)(null),g=(0,_.useRef)(null),v=e=>{g.current=e,h(e)},[y,b]=(0,_.useState)(()=>Yt(e,t)),x=`${e.map(e=>e.name).join(`\\0`)}\\u0000${t.length>0}`,[S,ee]=(0,_.useState)(x);S!==x&&(ee(x),b(Yt(e,t)));let te=zt({count:t.length,getScrollElement:()=>p.current,estimateSize:()=>Bt,overscan:12}),C=zt({horizontal:!0,count:e.length,getScrollElement:()=>p.current,estimateSize:e=>y[e]??120,overscan:4});(0,_.useEffect)(()=>{C.measure()},[y,C]);let ne=Ht+C.getTotalSize(),w=C.getVirtualItems();function re(n){let r={row:Math.max(0,Math.min(t.length-1,n.row)),col:Math.max(0,Math.min(e.length-1,n.col))};o(r),te.scrollToIndex(r.row),C.scrollToIndex(r.col)}let ie=e=>!!c&&!u?.has(e.col)&&d?.(e.row)!==`deleted`;function ae(e,n){ie(e)&&v({cell:e,draft:n??t[e.row]?.[e.col]??``})}function E(e,n){let r=g.current;if(!r)return;let{cell:i}=r;v(null),e!==void 0&&e!==(t[i.row]?.[i.col]??null)&&c?.(i,e),n&&re(n),p.current?.focus()}function oe(e){if(!m)return;e.stopPropagation();let{row:t,col:n}=m.cell,r=e.currentTarget.value;e.key===`Enter`?(e.preventDefault(),E(r,{row:t+1,col:n})):e.key===`Tab`?(e.preventDefault(),E(r,{row:t,col:n+(e.shiftKey?-1:1)})):e.key===`Escape`?(e.preventDefault(),E(void 0)):e.key===`Backspace`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),E(null))}function se(n){if(!t.length||!e.length)return;let r=a??{row:0,col:0},i=n.metaKey||n.ctrlKey;if(c&&a){if(n.key===`Enter`||n.key===`F2`){n.preventDefault(),ae(a);return}if(n.key===`Backspace`&&i){n.preventDefault(),ie(a)&&c(a,null);return}if((n.key===`Delete`||n.key===`Backspace`)&&l){n.preventDefault(),l(a.row);return}if(n.key.length===1&&!i&&!n.altKey){n.preventDefault(),ae(a,n.key);return}}let o=Math.max(1,Math.floor((p.current?.clientHeight??240)/Bt)-1),s={ArrowUp:{row:r.row-1,col:r.col},ArrowDown:{row:r.row+1,col:r.col},ArrowLeft:{row:r.row,col:r.col-1},ArrowRight:{row:r.row,col:r.col+1},PageUp:{row:r.row-o,col:r.col},PageDown:{row:r.row+o,col:r.col},Home:{row:n.metaKey||n.ctrlKey?0:r.row,col:0},End:{row:n.metaKey||n.ctrlKey?t.length-1:r.row,col:e.length-1}}[n.key];if(s)n.preventDefault(),re(s);else if(n.key===`c`&&(n.metaKey||n.ctrlKey)&&a){let e=t[a.row]?.[a.col];n.preventDefault(),navigator.clipboard?.writeText(e??`NULL`)}}function D(e,t){t.preventDefault(),t.stopPropagation();let n=t.clientX,r=y[e]??120,i=t=>{let i=Math.max(Ut,r+t.clientX-n);b(t=>t.map((t,n)=>n===e?i:t))},a=()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)}return(0,T.jsx)(`div`,{ref:p,className:`grid`,role:`grid`,\"aria-label\":s,\"aria-rowcount\":t.length+1,\"aria-colcount\":e.length,tabIndex:0,onKeyDown:se,children:(0,T.jsxs)(`div`,{className:`grid-inner`,style:{width:ne,height:Vt+te.getTotalSize()},children:[(0,T.jsxs)(`div`,{className:`grid-head`,role:`row`,\"aria-rowindex\":1,style:{width:ne},children:[(0,T.jsx)(`div`,{className:`head-cell number-cell`,style:{width:Ht}}),w.map(t=>{let n=e[t.index],a=r?.column===n.name?r:null;return(0,T.jsxs)(`div`,{className:`head-cell`,role:`columnheader`,\"aria-colindex\":t.index+1,\"aria-sort\":a?a.descending?`descending`:`ascending`:`none`,title:`${n.name} (${n.type})`,style:{left:Ht+t.start,width:t.size},onClick:i?()=>i(n.name):void 0,children:[(0,T.jsx)(`span`,{children:n.name}),a&&(0,T.jsx)(`span`,{\"aria-hidden\":!0,children:a.descending?`↓`:`↑`}),(0,T.jsx)(`span`,{className:`type`,children:n.type}),(0,T.jsx)(`span`,{className:`resize`,onMouseDown:e=>D(t.index,e)})]},t.key)})]}),te.getVirtualItems().map(r=>{let i=t[r.index],s=a?.row===r.index,c=d?.(r.index);return(0,T.jsxs)(`div`,{className:`grid-row${s?` selected`:``}${c?` ${c}`:``}`,role:`row`,\"aria-rowindex\":r.index+2,\"aria-selected\":s,style:{top:Vt+r.start,width:ne},children:[(0,T.jsx)(`div`,{className:`cell number-cell`,style:{width:Ht},children:n+r.index}),w.map(t=>m?.cell.row===r.index&&m.cell.col===t.index?(0,T.jsx)(`input`,{className:`cell-editor`,\"aria-label\":`Edit ${e[t.index].name}`,style:{left:Ht+t.start,width:t.size},defaultValue:m.draft,autoFocus:!0,onFocus:e=>e.currentTarget.setSelectionRange(e.currentTarget.value.length,e.currentTarget.value.length),onKeyDown:oe,onBlur:e=>E(e.currentTarget.value)},t.key):(0,T.jsx)(qt,{value:i[t.index]??null,state:f?.(r.index,t.index)??null,left:Ht+t.start,width:t.size,column:t.index,selected:s&&a?.col===t.index,onClick:()=>{o({row:r.index,col:t.index}),p.current?.focus()},onDoubleClick:()=>ae({row:r.index,col:t.index})},t.key))]},r.key)})]})})}function qt({value:e,state:t,left:n,width:r,column:i,selected:a,onClick:o,onDoubleClick:s}){return(0,T.jsx)(`div`,{className:`cell${a?` selected`:``}${t?` ${t}`:``}`,role:`gridcell`,\"aria-colindex\":i+1,\"aria-selected\":a,style:{left:n,width:r},onClick:o,onDoubleClick:s,children:t===\"default\"?(0,T.jsx)(`span`,{className:`null`,children:`DEFAULT`}):e===null?(0,T.jsx)(`span`,{className:`null`,children:`NULL`}):Jt(e)})}function Jt(e){let t=e.indexOf(`\n`),n=t===-1?e:e.slice(0,t);return n.length>Gt?`${n.slice(0,Gt)}…`:t===-1?n:`${n} …`}function Yt(e,t){let n=t.slice(0,50);return e.map((e,t)=>{let r=e.name.length+e.type.length*.8+3,i=n.reduce((e,n)=>Math.max(e,Math.min(n[t]?.length??4,60)),0);return Math.round(Math.max(Ut,Math.min(Wt,Math.max(r,i)*7+18)))})}function Xt(e){let t,n;return{get loaded(){return n},load(){return t??=e().then(e=>n=e,e=>{throw t=void 0,e}),t}}}var P=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Zt=function(e,t){return new URL(e,t).href},Qt={},$t=function(e){return e.pathname.endsWith(`.css`)},en=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},tn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Zt(t,n);let r=s(t),i=$t(r);return en(Qt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:P,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},nn=Xt(()=>tn(()=>import(`./Editor-Bk4pmv2B.js`).then(e=>e.Editor),[],import.meta.url));function rn(e){let[t,n]=(0,_.useState)(()=>nn.loaded),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(t||r)return;let e=!0;return nn.load().then(t=>e&&n(()=>t),()=>e&&i(!0)),()=>{e=!1}},[t,r]),t?(0,T.jsx)(t,{...e}):r?(0,T.jsxs)(`div`,{className:`editor message`,role:`alert`,children:[`The editor didn’t load.`,` `,(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>i(!1),children:`Try again`})]}):(0,T.jsx)(`div`,{className:`editor`,\"aria-busy\":`true`})}var an=0,on=()=>`q${Date.now().toString(36)}${(an++).toString(36)}`;function sn({id:e,sql:t,onChange:n,schema:r,defaultSchema:i,kind:a,active:o,onHistory:s}){let{api:c,connection:l,scope:u,log:d,showRow:f}=ye(),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(0),[v,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(null),[ee,te]=(0,_.useState)(null),[C,ne]=(0,_.useState)(45),w=(0,_.useRef)(null),re=(0,_.useRef)(!1);(0,_.useEffect)(()=>()=>{re.current=!0},[]);function ie(e,t,n){if(v)return;let r=Le(t),i=e===`all`?r:[Ve(r,n)].filter(e=>e!==null);i.length&&(l.tag===`production`&&l.access===`write`&&i.some(e=>Ue(e.text))?S(i):ae(i))}async function ae(e){let t=[];m([]),g(0),te(null);for(let n of e){let e=on();b(e);let r=performance.now();try{let r=await c.query(l.name,n.text,e);t.push({statement:n,result:r}),d({statement:n.text,durationMs:r.durationMs})}catch(e){let i=e instanceof y?e:new y(0,`failed`,e.message);t.push({statement:n,error:i}),d({statement:n.text,durationMs:Math.round(performance.now()-r),error:i.message});break}finally{_e(u,n.text)}if(re.current)return;m([...t])}re.current||(m(t),g(t.length-1),b(null),s())}async function oe(){v&&await c.cancel(v)}let se=p[h],D=se?.result;(0,_.useEffect)(()=>{if(!o)return;let e=D&&ee?D.rows[ee.row]:void 0;f(e&&D?{columns:D.columns,values:e}:null)},[o,D,ee,f]);function ce(e){e.preventDefault();let t=w.current.getBoundingClientRect(),n=e=>ne(Math.max(15,Math.min(85,(e.clientY-t.top)/t.height*100))),r=()=>{window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)}return(0,T.jsxs)(`div`,{className:`tab-body`,hidden:!o,children:[l.warning&&(0,T.jsx)(`div`,{className:`notice warning`,role:`note`,children:l.warning}),(0,T.jsxs)(`div`,{className:`query`,ref:w,style:{\"--editor\":`${C}%`},children:[(0,T.jsx)(rn,{value:t,onChange:n,onRun:ie,schema:r,defaultSchema:i,kind:a,label:`SQL editor ${e}`}),(0,T.jsx)(`div`,{className:`splitter`,role:`separator`,\"aria-orientation\":`horizontal`,onMouseDown:ce}),(0,T.jsxs)(`div`,{className:`results`,children:[p.length>1&&(0,T.jsx)(`div`,{className:`results-tabs`,role:`tablist`,\"aria-label\":`Results`,children:p.map((e,t)=>(0,T.jsxs)(`button`,{type:`button`,role:`tab`,className:`button`,\"aria-selected\":t===h,onClick:()=>{g(t),te(null)},children:[e.error?`⚠ `:``,`Result `,t+1]},t))}),se?.error&&(0,T.jsx)(cn,{outcome:se,sql:t}),D&&D.columns.length>0&&(0,T.jsx)(Kt,{label:`Result`,columns:D.columns,rows:D.rows,selected:ee,onSelect:te}),D&&!D.columns.length&&(0,T.jsxs)(`div`,{className:`message`,role:`status`,children:[D.command,D.affectedRows!==null&&` · ${D.affectedRows.toLocaleString()} rows affected`,` `,`· `,D.durationMs,` ms`]}),!p.length&&!v&&(0,T.jsx)(`div`,{className:`message`,children:`Results show here. ⌘↵ runs the statement at the cursor, ⇧⌘↵ all of them.`})]})]}),(0,T.jsxs)(`div`,{className:`bottombar`,children:[v?(0,T.jsxs)(`button`,{type:`button`,className:`button danger`,onClick:oe,children:[(0,T.jsx)(E,{name:`stop`,size:12}),` Cancel`]}):(0,T.jsx)(`span`,{children:l.access===`read`?`Read-only connection`:``}),(0,T.jsx)(`span`,{className:`spacer`}),D&&D.columns.length>0&&(0,T.jsx)(Se,{formats:[`csv`,`json`],onExport:e=>{let t=D.columns.map(e=>e.name),n=e===`csv`?Xe(t,D.rows):Ze(t,D.rows);Ce(new Blob([n],{type:`${e===`csv`?`text/csv`:`application/json`};charset=utf-8`}),`result.${e}`)}}),(0,T.jsx)(`span`,{\"aria-live\":`polite`,children:v?`Running…`:D?`${D.rows.length.toLocaleString()} rows${D.truncated?` (cut at the row limit)`:``} · ${D.durationMs} ms`:``})]}),x&&(0,T.jsxs)(Qe,{title:`Run on production?`,confirmLabel:`Run`,danger:!0,onCancel:()=>S(null),onConfirm:()=>{let e=x;S(null),ae(e)},children:[(0,T.jsxs)(`p`,{children:[(0,T.jsx)(`strong`,{children:l.label}),` is tagged production. This may change it:`]}),(0,T.jsx)(`pre`,{children:x.map(e=>e.text).join(`;\n\n`)})]})]})}function cn({outcome:e,sql:t}){let{error:n,statement:r}=e,i=``;if(n?.position){let e=r.from+n.position-1,a=t.slice(0,e);i=` (line ${a.split(`\n`).length}, column ${e-a.lastIndexOf(`\n`)})`}return(0,T.jsxs)(`div`,{className:`notice`,role:`alert`,children:[n.message,i,n.sqlState&&(0,T.jsxs)(`div`,{className:`detail`,children:[`SQLSTATE `,n.sqlState]}),n.detail&&(0,T.jsx)(`div`,{className:`detail`,children:n.detail}),n.hint&&(0,T.jsxs)(`div`,{className:`detail`,children:[`Hint: `,n.hint]})]})}var ln=[{kinds:[`table`,`partitioned-table`],title:`Tables`},{kinds:[`view`],title:`Views`},{kinds:[`materialized-view`],title:`Materialized views`},{kinds:[`foreign-table`],title:`Foreign tables`}];function un({tables:e,schema:t,onSchema:n,current:r,onOpen:i,history:a,onHistory:o}){let[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`items`),d=(0,_.useMemo)(()=>[...new Set((e??[]).map(e=>e.schema))],[e]),f=s.trim().toLowerCase(),p=(e??[]).filter(e=>e.schema===t&&(!f||e.name.toLowerCase().includes(f)));return(0,T.jsxs)(`aside`,{className:`sidebar`,\"aria-label\":`Sidebar`,children:[(0,T.jsxs)(`div`,{className:`sidebar-head`,children:[d.length>1&&(0,T.jsx)(`select`,{className:`select`,\"aria-label\":`Schema`,value:t,onChange:e=>n(e.target.value),children:d.map(e=>(0,T.jsx)(`option`,{children:e},e))}),(0,T.jsx)(`input`,{className:`input`,type:`search`,\"aria-label\":`Search for item`,placeholder:`Search for item…`,value:s,onChange:e=>c(e.target.value)})]}),l===`items`?(0,T.jsxs)(`ul`,{className:`tree`,\"aria-label\":`Items`,children:[e===null&&(0,T.jsx)(`li`,{className:`tree-empty`,children:`Loading…`}),e!==null&&!p.length&&(0,T.jsx)(`li`,{className:`tree-empty`,children:f?`Nothing matches.`:`No tables here.`}),ln.map(e=>{let t=p.filter(t=>e.kinds.includes(t.kind));return t.length?(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`div`,{className:`tree-group`,children:e.title}),(0,T.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0},\"aria-label\":e.title,children:t.map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,className:`tree-item`,\"aria-current\":r?.schema===e.schema&&r.table===e.name,onClick:()=>i(e),title:`${e.schema}.${e.name}`,children:[(0,T.jsx)(E,{name:oe(e.kind),size:14}),(0,T.jsx)(`span`,{className:`name`,children:e.name}),e.estimatedRows!==null&&(0,T.jsx)(`span`,{className:`count`,children:dn(e.estimatedRows)})]})},e.name))})]},e.title):null})]}):(0,T.jsxs)(`ul`,{className:`tree`,\"aria-label\":`History`,children:[!a.length&&(0,T.jsx)(`li`,{className:`tree-empty`,children:`Statements you run show here.`}),a.filter(e=>!f||e.sql.toLowerCase().includes(f)).map(e=>(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,className:`tree-item`,title:e.sql,onClick:()=>o(e.sql),children:[(0,T.jsx)(E,{name:`sql`,size:14}),(0,T.jsx)(`span`,{className:`name`,children:e.sql.replace(/\\s+/g,` `)})]})},e.at+e.sql))]}),(0,T.jsx)(`div`,{className:`sidebar-foot`,children:(0,T.jsxs)(`div`,{className:`segmented`,role:`group`,\"aria-label\":`Sidebar view`,children:[(0,T.jsx)(`button`,{type:`button`,\"aria-pressed\":l===`items`,onClick:()=>u(`items`),children:`Items`}),(0,T.jsx)(`button`,{type:`button`,\"aria-pressed\":l===`history`,onClick:()=>u(`history`),children:`History`})]})})]})}function dn(e){return new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e)}var fn={updates:{},deletes:{},inserts:[],next:1};function pn(e,t,n){if(!e.length)return null;let r={};for(let i of e){let e=n[t.indexOf(i)];if(e==null)return null;mn(r,i,e)}return{id:JSON.stringify(e.map(e=>r[e])),key:r}}function mn(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0})}function hn(e,t){switch(t.type){case`edit`:{let n=e.updates[t.id],r={...n?.values},i={...n?.original},a=Object.hasOwn(i,t.column)?i[t.column]:t.original;t.value===a?(delete r[t.column],delete i[t.column]):(mn(r,t.column,t.value),mn(i,t.column,a));let o={...e.updates};return Object.keys(r).length?o[t.id]={key:t.key,values:r,original:i}:delete o[t.id],{...e,updates:o}}case`edit-new`:return{...e,inserts:e.inserts.map(e=>e.id===t.id?{...e,values:{...e.values,[t.column]:t.value}}:e)};case`add`:return{...e,inserts:[...e.inserts,{id:e.next,values:{}}],next:e.next+1};case`delete`:return{...e,deletes:{...e.deletes,[t.id]:t.key}};case`undelete`:{let n={...e.deletes};return delete n[t.id],{...e,deletes:n}}case`remove-new`:return{...e,inserts:e.inserts.filter(e=>e.id!==t.id)}}}function gn(e){return Object.keys(e.updates).filter(t=>!(t in e.deletes)).length+Object.keys(e.deletes).length+e.inserts.length}function _n(e){let t=Object.values(e.deletes).map(e=>({type:`delete`,key:e})),n=Object.entries(e.updates).filter(([t])=>!(t in e.deletes)).map(([,{key:e,values:t,original:n}])=>({type:`update`,key:e,values:t,original:n})),r=e.inserts.map(({values:e})=>({type:`insert`,values:e}));return[...t,...n,...r]}var vn=[{value:`=`,label:`=`},{value:`<>`,label:`≠`},{value:`<`,label:`<`},{value:`>`,label:`>`},{value:`<=`,label:`≤`},{value:`>=`,label:`≥`},{value:`contains`,label:`Contains`},{value:`not contains`,label:`Not contains`},{value:`starts with`,label:`Starts with`},{value:`ends with`,label:`Ends with`},{value:`in`,label:`In`},{value:`not in`,label:`Not in`},{value:`between`,label:`Between`},{value:`not between`,label:`Not between`},{value:`like`,label:`Like`},{value:`not like`,label:`Not like`},{value:`is null`,label:`Is null`},{value:`is not null`,label:`Is not null`}],yn=e=>e===`is null`||e===`is not null`,bn=e=>e===`between`||e===`not between`,xn=e=>e===`in`||e===`not in`;function Sn(e){return{column:e,operator:`=`,value:``,to:``}}function Cn(e){return e.map(({column:e,operator:t,value:n,to:r})=>yn(t)?{column:e,operator:t}:bn(t)?{column:e,operator:t,value:[n,r]}:xn(t)?{column:e,operator:t,value:n.split(`,`).map(e=>e.trim()).filter(Boolean)}:{column:e,operator:t,value:n})}function wn({columns:e,drafts:t,onChange:n,onApply:r,onClose:i,focusKey:a}){let o=(0,_.useRef)(null);(0,_.useEffect)(()=>{o.current?.focus()},[a]);let s=(e,r)=>n(t.map((t,n)=>n===e?{...t,...r}:t));return(0,T.jsx)(`form`,{className:`filters`,\"aria-label\":`Filters`,onSubmit:e=>{e.preventDefault(),r()},onKeyDown:e=>{e.key===`Escape`&&i()},children:t.map((r,a)=>(0,T.jsxs)(`div`,{className:`filter-row`,children:[(0,T.jsx)(`select`,{className:`select`,\"aria-label\":`Column`,value:r.column,onChange:e=>s(a,{column:e.target.value}),children:e.map(e=>(0,T.jsx)(`option`,{children:e},e))}),(0,T.jsx)(`select`,{className:`select`,\"aria-label\":`Operator`,value:r.operator,onChange:e=>s(a,{operator:e.target.value}),children:vn.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),!yn(r.operator)&&(0,T.jsx)(`input`,{ref:a===0?o:void 0,className:`input value`,\"aria-label\":`Value`,placeholder:xn(r.operator)?`a, b, c`:`Value`,value:r.value,onChange:e=>s(a,{value:e.target.value})}),bn(r.operator)&&(0,T.jsx)(`input`,{className:`input value`,\"aria-label\":`And`,placeholder:`and`,value:r.to,onChange:e=>s(a,{to:e.target.value})}),(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Remove condition`,onClick:()=>n(t.filter((e,t)=>t!==a)),children:(0,T.jsx)(E,{name:`minus`})}),(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Add condition`,onClick:()=>n([...t.slice(0,a+1),Sn(r.column),...t.slice(a+1)]),children:(0,T.jsx)(E,{name:`plus`})}),a===0&&(0,T.jsxs)(`div`,{className:`filter-actions`,children:[(0,T.jsx)(`button`,{type:`submit`,className:`button primary`,children:`Apply`}),(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:i,children:`Clear`})]})]},a))})}function Tn({table:e}){let t=new Set(e.primaryKey);return(0,T.jsxs)(`div`,{className:`structure`,\"aria-label\":`Structure`,children:[e.comment&&(0,T.jsx)(`p`,{children:e.comment}),(0,T.jsxs)(`table`,{\"aria-label\":`Columns`,children:[(0,T.jsx)(`thead`,{children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{children:`#`}),(0,T.jsx)(`th`,{children:`Column`}),(0,T.jsx)(`th`,{children:`Type`}),(0,T.jsx)(`th`,{children:`Nullable`}),(0,T.jsx)(`th`,{children:`Default`}),(0,T.jsx)(`th`,{children:`Generated`}),(0,T.jsx)(`th`,{children:`Comment`})]})}),(0,T.jsx)(`tbody`,{children:e.columns.map((e,n)=>(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`td`,{children:n+1}),(0,T.jsxs)(`td`,{children:[t.has(e.name)&&(0,T.jsx)(E,{name:`key`,size:12,label:`Primary key`}),` `,e.name]}),(0,T.jsx)(`td`,{children:(0,T.jsx)(`code`,{children:e.type})}),(0,T.jsx)(`td`,{children:e.nullable?`YES`:`NO`}),(0,T.jsx)(`td`,{children:e.default!==null&&(0,T.jsx)(`code`,{children:e.default})}),(0,T.jsx)(`td`,{children:e.generated}),(0,T.jsx)(`td`,{children:e.comment})]},e.name))})]}),(0,T.jsx)(En,{title:`Indexes`,items:e.indexes}),(0,T.jsx)(En,{title:`Foreign keys`,items:e.foreignKeys}),(0,T.jsx)(En,{title:`Checks`,items:e.checks})]})}function En({title:e,items:t}){return t.length?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`h2`,{children:e}),(0,T.jsx)(`table`,{\"aria-label\":e,children:(0,T.jsx)(`tbody`,{children:t.map(e=>(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`td`,{style:{width:`30%`},children:e.name}),(0,T.jsx)(`td`,{children:(0,T.jsx)(`code`,{children:e.definition})})]},e.name))})})]}):null}var Dn=[100,300,1e3];function On({schema:e,table:t,summary:n,active:r}){let{api:i,connection:a,log:o,showRow:s,refreshKey:c,filterKey:l}=ye(),[u,d]=(0,_.useState)(`data`),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(0),[ee,te]=(0,_.useState)(300),[C,ne]=(0,_.useState)(null),[w,re]=(0,_.useState)(null),[ie,ae]=(0,_.useState)([]),[oe,se]=(0,_.useState)(null),[D,ce]=(0,_.useState)(null),[le,ue]=(0,_.useState)(0),[O,de]=(0,_.useState)(fn),[fe,pe]=(0,_.useState)([]),[me,he]=(0,_.useState)(null),[ge,_e]=(0,_.useState)(0),ve=`${e}.${t}`;(0,_.useEffect)(()=>{let n=!0;return i.table(a.name,e,t).then(e=>n&&p(e),e=>n&&v(e)),()=>{n=!1}},[i,a.name,e,t,c]);let be=C?[{column:C.column,descending:C.descending}]:f?.primaryKey.map(e=>({column:e}))??[],xe=JSON.stringify({limit:ee,offset:x,order:be,filters:ie,refreshKey:c,saved:ge}),k=f!==null&&y!==xe;(0,_.useEffect)(()=>{if(!f)return;let n=new AbortController,r=JSON.parse(xe),s=kn(ve,r.filters,r.limit,r.offset),c=performance.now();return i.rows({connection:a.name,schema:e,table:t,...r},n.signal).then(e=>{h(e),v(null),ce(null),o({statement:s,durationMs:e.durationMs})},e=>{n.signal.aborted||(v(e),o({statement:s,durationMs:Math.round(performance.now()-c),error:e.message}))}).finally(()=>!n.signal.aborted&&b(xe)),()=>n.abort()},[i,a.name,e,t,ve,f,xe,o]);let A=(0,_.useRef)(l);(0,_.useEffect)(()=>{r&&l!==A.current&&(A.current=l,d(`data`),re(e=>e??[Sn(f?.columns[0]?.name??``)]),ue(e=>e+1))},[r,l,f]);let j=m?.rows??[],we=m?.columns??f?.columns??[],M=we.map(e=>e.name),N=f?.primaryKey??[],Te=a.access===`write`&&N.length>0&&(f?.kind===`table`||f?.kind===`partitioned-table`),Ee=j.map(e=>pn(N,M,e)),De=[...j.map((e,t)=>{let n=Ee[t]&&O.updates[Ee[t].id];return n?M.map((t,r)=>Object.hasOwn(n.values,t)?n.values[t]:e[r]):e}),...O.inserts.map(e=>M.map(t=>Object.hasOwn(e.values,t)?e.values[t]??null:null))],Oe=new Set(M.flatMap((e,t)=>{let n=f?.columns.find(t=>t.name===e);return n?.generated&&n.generated!==`by default`?[t]:[]})),ke=gn(O);(0,_.useEffect)(()=>{if(!r)return;let e=D?De[D.row]:void 0;s(e?{columns:we,values:e}:null)},[r,m,O,f,D,s]);function Ae(e){pe(e=>[...e.slice(-99),O]),de(t=>hn(t,e))}function je(e,t){let n=M[e.col];if(e.row>=j.length){let r=O.inserts[e.row-j.length];r&&Ae({type:`edit-new`,id:r.id,column:n,value:t});return}let r=Ee[e.row];r&&Ae({type:`edit`,...r,column:n,value:t,original:j[e.row][e.col]??null})}function Me(e){if(e>=j.length){let t=O.inserts[e-j.length];t&&Ae({type:`remove-new`,id:t.id});return}let t=Ee[e];t&&Ae(t.id in O.deletes?{type:`undelete`,id:t.id}:{type:`delete`,...t})}function Ne(){Ae({type:`add`}),d(`data`);let e=M.findIndex((e,t)=>!Oe.has(t));ce({row:j.length+O.inserts.length,col:Math.max(0,e)})}function Pe(){ke&&(pe(e=>[...e.slice(-99),O]),de(fn))}let Fe={connection:a.name,schema:e,table:t};async function Ie(){if(ke&&!me)try{let{statements:e}=await i.apply({...Fe,changes:_n(O),dryRun:!0});he({statements:e})}catch(e){v(e)}}async function Le(){if(!me)return;he({...me,saving:!0});let e=performance.now();try{let{statements:t}=await i.apply({...Fe,changes:_n(O)});o({statement:t.join(`;\n`),durationMs:Math.round(performance.now()-e)}),de(fn),pe([]),he(null),_e(e=>e+1)}catch(e){o({statement:`${ke} changes to ${ve}`,error:e.message}),he({...me,saving:!1,error:e})}}async function Re(e){try{let{blob:t,filename:n}=await i.exportTable({...Fe,filters:ie,order:be,format:e});Ce(t,n)}catch(e){v(e)}}(0,_.useEffect)(()=>{if(!r||!Te)return;function e(e){if(!(e.metaKey||e.ctrlKey)||e.defaultPrevented)return;let t=(e.composedPath()[0]??e.target).closest?.(`input, textarea, select, [contenteditable=\"true\"]`);e.key===`s`?(e.preventDefault(),Ie()):e.key===`z`&&!e.shiftKey&&!t&&fe.length&&(e.preventDefault(),de(fe.at(-1)),pe(fe.slice(0,-1)))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});function ze(e){ne(t=>t?.column===e?t.descending?null:{column:e,descending:!0}:{column:e,descending:!1}),S(0)}function Be(e){ae(e?Cn(e):[]),S(0),se(null)}async function Ve(){let n=performance.now();try{se(await i.count({connection:a.name,schema:e,table:t,filters:ie})),o({statement:`SELECT count(*) FROM ${ve}${ie.length?` WHERE …`:``}`,durationMs:Math.round(performance.now()-n)})}catch(e){v(e)}}let He=f?.columns.map(e=>e.name)??[],Ue=oe??(ie.length?null:n?.estimatedRows??null),We=j;return(0,T.jsxs)(`div`,{className:`tab-body`,hidden:!r,children:[w&&u===`data`&&(0,T.jsx)(wn,{columns:He,drafts:w,onChange:e=>e.length?re(e):(re(null),Be(null)),onApply:()=>Be(w),onClose:()=>{re(null),Be(null)},focusKey:le}),g&&(0,T.jsxs)(`div`,{className:`notice`,role:`alert`,children:[g.message,g.detail&&(0,T.jsx)(`div`,{className:`detail`,children:g.detail})]}),u===`structure`?f&&(0,T.jsx)(Tn,{table:f}):(0,T.jsx)(Kt,{label:ve,columns:we,rows:De,firstRow:x+1,sort:C,onSort:ze,selected:D,onSelect:ce,...Te?{onEdit:je,onDeleteRow:Me,lockedColumns:Oe,rowState:e=>e>=j.length?`inserted`:Ee[e]&&Ee[e].id in O.deletes?`deleted`:null,cellState:(e,t)=>{let n=M[t];if(e>=j.length)return Object.hasOwn(O.inserts[e-j.length]?.values??{},n)?`changed`:`default`;let r=Ee[e]&&O.updates[Ee[e].id];return r&&Object.hasOwn(r.values,n)?`changed`:null}}:{}}),(0,T.jsxs)(`div`,{className:`bottombar`,children:[(0,T.jsxs)(`div`,{className:`segmented`,role:`group`,\"aria-label\":`View`,children:[(0,T.jsx)(`button`,{type:`button`,\"aria-pressed\":u===`data`,onClick:()=>d(`data`),children:`Data`}),(0,T.jsx)(`button`,{type:`button`,\"aria-pressed\":u===`structure`,onClick:()=>d(`structure`),children:`Structure`})]}),(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Filter`,\"aria-pressed\":w!==null,onClick:()=>{d(`data`),w?(re(null),Be(null)):re([Sn(He[0]??``)])},children:(0,T.jsx)(E,{name:`filter`})}),Te&&(0,T.jsxs)(`button`,{type:`button`,className:`button`,onClick:Ne,children:[(0,T.jsx)(E,{name:`plus`,size:12}),` Row`]}),ke>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{className:`changes`,\"aria-live\":`polite`,children:ke===1?`1 change`:`${ke} changes`}),(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:Pe,children:`Discard`}),(0,T.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>void Ie(),children:`Commit`})]}),a.access===`write`&&f&&!Te&&(0,T.jsx)(`span`,{title:`Rows are named by their primary key to change them`,children:`Read-only: no primary key`}),(0,T.jsx)(`span`,{className:`spacer`}),(0,T.jsx)(Se,{formats:[`csv`,`json`,`sql`],onExport:Re}),u===`data`&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`span`,{\"aria-live\":`polite`,children:[k?`Loading…`:We.length?`Rows ${(x+1).toLocaleString()}–${(x+We.length).toLocaleString()}`:`No rows`,Ue!==null&&` of ${oe===null?`~`:``}${Ue.toLocaleString()}`]}),(0,T.jsx)(`button`,{type:`button`,className:`button`,onClick:Ve,children:`Count`}),(0,T.jsxs)(`div`,{className:`pager`,children:[(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Previous page`,disabled:x===0,onClick:()=>S(e=>Math.max(0,e-ee)),children:(0,T.jsx)(E,{name:`left`})}),(0,T.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Next page`,disabled:!m?.truncated,onClick:()=>S(e=>e+ee),children:(0,T.jsx)(E,{name:`right`})}),(0,T.jsx)(`select`,{className:`select`,\"aria-label\":`Rows per page`,value:ee,onChange:e=>{te(Number(e.target.value)),S(0)},children:Dn.map(e=>(0,T.jsxs)(`option`,{value:e,children:[e,` rows`]},e))})]}),m&&(0,T.jsxs)(`span`,{children:[m.durationMs,` ms`]})]})]}),me&&(0,T.jsxs)(Qe,{title:a.tag===`production`?`Commit to production?`:`Commit changes?`,confirmLabel:`Commit`,danger:a.tag===`production`,busy:me.saving,onCancel:()=>he(null),onConfirm:()=>void Le(),children:[(0,T.jsxs)(`p`,{children:[me.statements.length===1?`This statement runs`:`These ${me.statements.length} statements run`,` `,`in one transaction: all of them, or none.`]}),(0,T.jsx)(`pre`,{children:me.statements.join(`;\n`)+`;`}),me.error&&(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:me.error.message})]})]})}function kn(e,t,n,r){return`SELECT * FROM ${e}${t.length?` WHERE ${t.map(e=>`${e.column} ${e.operator}${e.value===void 0?``:` …`}`).join(` AND `)}`:``} LIMIT ${n} OFFSET ${r}`}function An(e,t){let n=new Set(e.map(e=>e.schema));return t&&n.has(t)?t:n.has(`public`)?`public`:e[0]?.schema??`public`}var jn=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),Mn=jn?`⌘`:`Ctrl+`;function Nn({api:e,connection:t,database:n,onDatabase:r,onSwitch:i}){let a=(0,_.useMemo)(()=>e.forDatabase(n),[e,n]),o=w(t.name,n),s=t.capabilities?.databases===!0,c=t.capabilities?.backup===!0,[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useReducer)(O,o,de),[b,x]=(0,_.useState)([]),[S,ee]=(0,_.useState)(null),[te,C]=(0,_.useState)(!0),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)(!1),[oe,se]=(0,_.useState)(!1),[D,ce]=(0,_.useState)(!1),[le,ue]=(0,_.useState)(!1),[pe,me]=(0,_.useState)(0),[he,_e]=(0,_.useState)(0),[ye,be]=(0,_.useState)(()=>ge(o));(0,_.useEffect)(()=>{fe(o,v)},[o,v]),(0,_.useEffect)(()=>{let e=!0;return Promise.all([a.info(t.name),a.tables(t.name)]).then(([t,n])=>{e&&(u(t),f(n),m(null),g(e=>e??An(n,t.database)))},t=>e&&m(t)),()=>{e=!1}},[a,t.name,pe]);let xe=(0,_.useCallback)(e=>x(t=>[...t.slice(-499),{at:new Date,...e}]),[]),k=v.tabs.find(e=>e.id===v.active)??null;(0,_.useEffect)(()=>{function e(e){if(e.defaultPrevented)return;let t=jn?e.metaKey:e.ctrlKey,n=e.key.toLowerCase();(()=>{if(t&&n===`e`)y({type:`new-query`});else if(t&&n===`p`)se(!0);else if(t&&n===`k`&&s)ce(!0);else if(t&&!e.shiftKey&&n===`r`)me(e=>e+1);else if(t&&n===`f`&&k?.kind===`table`)_e(e=>e+1);else if(e.altKey&&e.code===`KeyW`&&k)y({type:`close`,id:k.id});else if(t&&e.key===`[`)y({type:`cycle`,by:-1});else if(t&&e.key===`]`)y({type:`cycle`,by:1});else return!1;return!0})()&&e.preventDefault()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k,s]);let A=(0,_.useMemo)(()=>({api:a,connection:t,scope:o,log:xe,showRow:ee,refreshKey:pe,filterKey:he}),[a,t,o,xe,pe,he]),j=(0,_.useMemo)(()=>new Map((d??[]).map(e=>[`${e.schema}.${e.name}`,e])),[d]),Se=(0,_.useMemo)(()=>new Map([...j].map(([e,t])=>[e,t.kind])),[j]),Ce=(0,_.useMemo)(()=>{let e={};for(let t of d??[])(e[t.schema]??={})[t.name]=[];return e},[d]),M=t.tag?`tag-${t.tag}`:``,N=k?.kind===`table`?{schema:k.schema,table:k.table}:null,Te=l?.database??n;return(0,T.jsxs)(ve.Provider,{value:A,children:[(0,T.jsxs)(`div`,{className:`workspace`,children:[(0,T.jsxs)(`header`,{className:`toolbar`,children:[(0,T.jsxs)(`div`,{className:`toolbar-group`,children:[(0,T.jsx)(Ie,{icon:`sidebar`,label:`Sidebar`,pressed:te,onClick:()=>C(e=>!e)}),(0,T.jsx)(Ie,{icon:`switch`,label:`Connections`,onClick:i}),(0,T.jsx)(Ie,{icon:`refresh`,label:`Refresh`,shortcut:`${Mn}R`,onClick:()=>me(e=>e+1)})]}),(0,T.jsxs)(`div`,{className:`status-pill ${M}`,\"aria-label\":`Connection`,title:t.warning??void 0,children:[t.tag&&(0,T.jsx)(`span`,{className:`tag-dot ${M}`,title:t.tag}),(0,T.jsx)(`strong`,{children:l?`${l.product} ${l.version}`:`…`}),(0,T.jsx)(`span`,{className:`sep`,children:`:`}),(0,T.jsx)(`span`,{children:t.label}),(0,T.jsx)(`span`,{className:`sep`,children:`:`}),s?(0,T.jsxs)(`button`,{type:`button`,className:`database-button`,\"aria-haspopup\":`dialog`,title:`Open another database (${Mn}K)`,onClick:()=>ce(!0),children:[Te??`…`,(0,T.jsx)(E,{name:`down`,size:11})]}):(0,T.jsx)(`span`,{children:Te??`…`}),t.access===`read`&&(0,T.jsxs)(`span`,{className:`read-only`,title:`Read-only: writes are refused`,children:[(0,T.jsx)(E,{name:`lock`,size:12}),` read-only`]})]}),(0,T.jsxs)(`div`,{className:`toolbar-group end`,children:[c&&(0,T.jsx)(Ie,{icon:`backup`,label:`Back up and restore`,onClick:()=>ue(!0)}),(0,T.jsx)(Ie,{icon:`sql`,label:`New SQL editor`,shortcut:`${Mn}E`,onClick:()=>y({type:`new-query`})}),(0,T.jsx)(Ie,{icon:`console`,label:`Console`,pressed:ie,onClick:()=>ae(e=>!e)}),(0,T.jsx)(Ie,{icon:`panel`,label:`Row panel`,pressed:ne,onClick:()=>re(e=>!e)})]})]}),(0,T.jsxs)(`div`,{className:`body${te?``:` no-sidebar`}${ne?` with-panel`:``}`,children:[te?(0,T.jsx)(un,{tables:d,schema:h??`public`,onSchema:g,current:N,onOpen:e=>y({type:`open-table`,schema:e.schema,table:e.name}),history:ye,onHistory:e=>y({type:`new-query`,sql:e})}):(0,T.jsx)(`div`,{}),(0,T.jsxs)(`main`,{className:`content`,children:[(0,T.jsx)(Ne,{tabs:v.tabs,active:v.active,kinds:Se,onActivate:e=>y({type:`activate`,id:e}),onClose:e=>y({type:`close`,id:e})}),p&&(0,T.jsx)(`div`,{className:`notice`,role:`alert`,children:p.message}),!v.tabs.length&&(0,T.jsxs)(`div`,{className:`empty`,children:[(0,T.jsx)(`div`,{children:`Open a table from the sidebar, or`}),(0,T.jsxs)(`div`,{children:[`Open anything `,(0,T.jsxs)(`kbd`,{children:[Mn,`P`]}),` · New SQL editor `,(0,T.jsxs)(`kbd`,{children:[Mn,`E`]}),s&&(0,T.jsxs)(T.Fragment,{children:[` `,`· Open database `,(0,T.jsxs)(`kbd`,{children:[Mn,`K`]})]})]})]}),v.tabs.map(e=>e.kind===`table`?(0,T.jsx)(On,{schema:e.schema,table:e.table,summary:j.get(`${e.schema}.${e.table}`),active:e.id===v.active},e.id):(0,T.jsx)(sn,{id:e.id,sql:e.sql,onChange:t=>y({type:`edit-sql`,id:e.id,sql:t}),schema:Ce,defaultSchema:h??`public`,kind:t.kind,active:e.id===v.active,onHistory:()=>be(ge(o))},e.id)),ie&&(0,T.jsx)(Fe,{entries:b})]}),ne?(0,T.jsx)(Pe,{row:S}):(0,T.jsx)(`div`,{})]})]}),D&&(0,T.jsx)(Me,{api:a,connection:t.name,open:l?.database??n,onClose:()=>ce(!1),onOpen:e=>{ce(!1),e!==n&&r(e)}}),le&&(0,T.jsx)(we,{api:a,connection:t,onClose:()=>ue(!1),onRestored:()=>me(e=>e+1)}),oe&&d&&(0,T.jsx)(je,{tables:d,onClose:()=>se(!1),onOpen:e=>{se(!1),y({type:`open-table`,schema:e.schema,table:e.name})}})]})}function Pn({config:e}){let[t,n]=(0,_.useState)(!1),r=(0,_.useMemo)(()=>x(e,()=>n(!0)),[e]),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(()=>C(location.hash));(0,_.useEffect)(()=>{r.connections().then(a,e=>s(e))},[r]),(0,_.useEffect)(()=>{let e=()=>l(C(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let u=e=>{location.hash=ne(e),l(e)};if(t)return(0,T.jsxs)(`div`,{className:`signed-out`,children:[(0,T.jsx)(`h1`,{children:`Sign in to continue`}),e.signInUrl?(0,T.jsx)(`a`,{href:e.signInUrl,children:`Sign in`}):(0,T.jsx)(`p`,{children:`Open the link this server gave you, or sign in to the app it's part of.`})]});if(o)return(0,T.jsxs)(`div`,{className:`signed-out`,children:[(0,T.jsx)(`h1`,{children:`Can't reach the server`}),(0,T.jsx)(`p`,{children:o.message})]});if(!i)return(0,T.jsx)(`div`,{className:`signed-out`,children:`Loading…`});let d=i.find(e=>e.name===c.connection&&e.capabilities);if(d){let e=d.capabilities?.databases?c.database:null;return(0,T.jsx)(Nn,{api:r,connection:d,database:e,onDatabase:e=>u({connection:d.name,database:e}),onSwitch:()=>u({connection:``,database:null})},w(d.name,e))}return(0,T.jsx)(ce,{connections:i,onOpen:e=>u({connection:e.name,database:null})})}function Fn(e,t=b()){let n=(0,v.createRoot)(e);return n.render((0,T.jsx)(_.StrictMode,{children:(0,T.jsx)(Pn,{config:t})})),()=>n.unmount()}var In=class extends HTMLElement{#e=null;connectedCallback(){let e=JSON.parse(this.getAttribute(`config`)??`{}`),t=this.shadowRoot??this.attachShadow({mode:`open`}),n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e.style;let r=document.createElement(`div`);r.className=`otw-db`,t.replaceChildren(n,r),this.#e=Fn(r,e)}disconnectedCallback(){this.#e?.(),this.#e=null}};customElements.get(`otw-db-app`)||customElements.define(`otw-db-app`,In);var Ln=document.getElementById(`root`);Ln&&Fn(Ln);export{u as n,c as r,ie as t};"},"style-CN-jj026.css":{"type":"text/css; charset=utf-8","body":":root,:host{--font:-apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, Roboto, sans-serif;--mono:ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, Consolas, monospace;--text:#1d1d1f;--text-dim:#6e6e73;--text-faint:#a1a1a6;--bg:#fff;--bg-chrome:#f3f3f5;--bg-sidebar:#eeeef1;--bg-hover:#0000000d;--bg-row-alt:#fafafb;--bg-input:#fff;--border:#dcdce0;--border-strong:#c7c7cc;--accent:#2f6feb;--accent-text:#fff;--selection:#dbe7ff;--selection-strong:#2f6feb;--danger:#d93025;--danger-bg:#fdecea;--warning-bg:#fff6e0;--success:#1a7f37;--success-bg:#e6f6ea;--null:#a1a1a6;--changed:#fff1b8;--inserted:#dcf5e3;--deleted:#fde0e0;--shadow:0 8px 30px #0000002e;--tag-local:#2ea44f;--tag-development:#2f80ed;--tag-testing:#9b51e0;--tag-staging:#f2994a;--tag-production:#e5484d;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:dark){:root,:host{--text:#ececef;--text-dim:#9d9da6;--text-faint:#6b6b74;--bg:#1e1e21;--bg-chrome:#2a2a2e;--bg-sidebar:#252528;--bg-hover:#ffffff0f;--bg-row-alt:#222225;--bg-input:#18181a;--border:#38383d;--border-strong:#4a4a50;--accent:#4c8dff;--selection:#23395f;--selection-strong:#4c8dff;--danger:#ff6b61;--danger-bg:#3b1f1d;--warning-bg:#3a3020;--success:#6ad18a;--success-bg:#1d3424;--null:#6b6b74;--changed:#4b4115;--inserted:#183a24;--deleted:#4a2020;--shadow:0 8px 30px #00000080;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{overflow:hidden}.otw-db{height:100%;font:12px/1.4 var(--font);color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased}button,input,select,textarea{font:inherit;color:inherit}.button{border:1px solid var(--border-strong);background:var(--bg-input);cursor:pointer;white-space:nowrap;border-radius:5px;align-items:center;gap:5px;height:24px;padding:0 9px;display:inline-flex}.button:hover{background:var(--bg-hover)}.button:disabled{opacity:.45;cursor:default}.button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}.button.danger{background:var(--danger);border-color:var(--danger);color:#fff}.icon-button{width:26px;height:24px;color:var(--text-dim);cursor:pointer;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;display:inline-flex}.icon-button:hover{background:var(--bg-hover);color:var(--text)}.icon-button[aria-pressed=true]{color:var(--accent)}.icon-button:disabled{opacity:.4;cursor:default}.input,.select{border:1px solid var(--border-strong);background:var(--bg-input);border-radius:5px;outline:none;height:24px;padding:0 7px}.input:focus,.select:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent)}.segmented{border:1px solid var(--border-strong);background:var(--bg-chrome);border-radius:6px;padding:1px;display:inline-flex}.segmented button{cursor:pointer;height:20px;color:var(--text-dim);background:0 0;border:0;border-radius:4px;padding:0 10px}.segmented button[aria-pressed=true]{background:var(--bg-input);color:var(--text);box-shadow:0 1px 2px #0000001f}kbd{font:11px var(--font);color:var(--text-faint)}.tag-dot{background:var(--text-faint);border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.tag-local{--tag:var(--tag-local)}.tag-development{--tag:var(--tag-development)}.tag-testing{--tag:var(--tag-testing)}.tag-staging{--tag:var(--tag-staging)}.tag-production{--tag:var(--tag-production)}.tag-dot[class*=tag-]{background:var(--tag)}.connections{background:var(--bg-chrome);place-items:center;height:100%;display:grid}.connections-card{border:1px solid var(--border);background:var(--bg);width:min(560px,100vw - 32px);max-height:calc(100vh - 64px);box-shadow:var(--shadow);border-radius:10px;flex-direction:column;display:flex;overflow:hidden}.connections-head{border-bottom:1px solid var(--border);align-items:center;gap:10px;padding:16px 18px;display:flex}.connections-head h1{margin:0;font-size:15px;font-weight:600}.connections-head p{color:var(--text-dim);margin:0}.connections-search{border-bottom:1px solid var(--border);padding:10px 18px}.connections-search .input{width:100%}.connections-list{margin:0;padding:6px;list-style:none;overflow:auto}.connection{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:7px;grid-template-columns:34px 1fr auto;align-items:center;gap:10px;width:100%;padding:8px 10px;display:grid}.connection:hover,.connection:focus-visible{background:var(--bg-hover);outline:none}.connection[aria-disabled=true]{opacity:.5;cursor:default}.kind-badge{background:var(--tag,var(--text-faint));color:#fff;border-radius:8px;place-items:center;width:34px;height:34px;font-size:12px;font-weight:700;display:grid}.connection-name{font-size:13px;font-weight:600}.connection-meta{color:var(--text-dim)}.connection-tags{color:var(--text-dim);align-items:center;gap:6px;display:flex}.pill{background:color-mix(in srgb, var(--tag,var(--text-faint)) 16%, transparent);height:18px;color:var(--tag,var(--text-dim));text-transform:capitalize;border-radius:9px;align-items:center;gap:5px;padding:0 7px;font-size:11px;font-weight:600;display:inline-flex}.workspace{grid-template-rows:38px 1fr;height:100%;display:grid}.toolbar{border-bottom:1px solid var(--border);background:var(--bg-chrome);grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;padding:0 8px;display:grid}.toolbar-group{align-items:center;gap:2px;display:flex}.toolbar-group.end{justify-content:flex-end}.status-pill{border:1px solid var(--border);background:color-mix(in srgb, var(--tag,transparent) 14%, var(--bg));white-space:nowrap;border-radius:7px;justify-content:center;align-items:center;gap:8px;min-width:280px;max-width:520px;height:26px;padding:0 12px;display:flex;overflow:hidden}.status-pill strong{font-weight:600}.status-pill .sep{color:var(--text-faint)}.database-button{min-width:0;height:20px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;align-items:center;gap:3px;padding:0 4px 0 6px;display:inline-flex}.database-button:hover,.database-button:focus-visible{background:color-mix(in srgb, var(--text) 10%, transparent)}.database-button svg{color:var(--text-dim)}.status-pill .read-only{color:var(--text-dim);font-size:11px}.body{grid-template-columns:var(--sidebar,240px) 1fr var(--panel,0px);min-height:0;display:grid}.body.no-sidebar{--sidebar:0px}.body.with-panel{--panel:300px}.sidebar{border-right:1px solid var(--border);background:var(--bg-sidebar);flex-direction:column;min-height:0;display:flex;overflow:hidden}.sidebar-head{flex-direction:column;gap:6px;padding:8px;display:flex}.sidebar-head .select,.sidebar-head .input{width:100%}.tree{flex:1;margin:0;padding:0 4px 8px;list-style:none;overflow:auto}.tree-group{color:var(--text-dim);text-transform:uppercase;letter-spacing:.02em;padding:8px 6px 3px;font-size:11px;font-weight:600}.tree-item{text-align:left;cursor:pointer;white-space:nowrap;text-overflow:ellipsis;background:0 0;border:0;border-radius:5px;align-items:center;gap:6px;width:100%;height:22px;padding:0 6px;display:flex;overflow:hidden}.tree-item:hover{background:var(--bg-hover)}.tree-item[aria-current=true]{background:var(--selection)}.tree-item svg{color:var(--text-dim);flex:none}.tree-item .name{text-overflow:ellipsis;overflow:hidden}.tree-item .count{color:var(--text-faint);margin-left:auto;font-size:11px}.tree-empty{color:var(--text-dim);padding:12px 8px}.sidebar-foot{border-top:1px solid var(--border);justify-content:center;padding:6px;display:flex}.content{flex-direction:column;min-width:0;min-height:0;display:flex}.tabbar{border-bottom:1px solid var(--border);background:var(--bg-chrome);scrollbar-width:none;flex:none;height:30px;display:flex;overflow-x:auto}.tab{border:0;border-right:1px solid var(--border);min-width:120px;max-width:220px;color:var(--text-dim);cursor:pointer;white-space:nowrap;background:0 0;align-items:center;gap:6px;padding:0 6px 0 10px;display:flex}.tab .title{text-overflow:ellipsis;text-align:left;flex:1;overflow:hidden}.tab[aria-selected=true]{background:var(--bg);color:var(--text);box-shadow:inset 0 2px 0 var(--accent)}.tab .close{visibility:hidden}.tab:hover .close,.tab[aria-selected=true] .close{visibility:visible}.tab-body{flex-direction:column;flex:1;min-height:0;display:flex}[hidden]{display:none!important}.empty{color:var(--text-dim);text-align:center;flex:1;place-content:center;gap:6px;display:grid}.empty kbd{margin-left:4px}.filters{border-bottom:1px solid var(--border);background:var(--bg-chrome);flex-direction:column;gap:5px;padding:6px 8px;display:flex}.filter-row{align-items:center;gap:5px;display:flex}.filter-row .value{flex:1}.filter-actions{gap:5px;margin-left:auto;display:flex}.bottombar{border-top:1px solid var(--border);background:var(--bg-chrome);height:32px;color:var(--text-dim);flex:none;align-items:center;gap:10px;padding:0 8px;display:flex}.bottombar .spacer{flex:1}.pager{align-items:center;gap:4px;display:flex}.notice{background:var(--danger-bg);color:var(--danger);white-space:pre-wrap;border-radius:6px;margin:8px;padding:8px 10px}.notice.warning{background:var(--warning-bg);color:var(--text)}.notice.success{background:var(--success-bg);color:var(--success)}.notice ul{margin:4px 0;padding-left:18px}.notice .detail{color:var(--text-dim);margin-top:4px}.grid{font-variant-numeric:tabular-nums;outline:none;flex:1;min-height:0;position:relative;overflow:auto}.grid-inner{position:relative}.grid-head{z-index:2;background:var(--bg-chrome);border-bottom:1px solid var(--border);height:26px;position:sticky;top:0}.grid-row{height:24px;position:absolute;left:0}.grid-row:nth-child(2n){background:var(--bg-row-alt)}.cell,.head-cell{border-right:1px solid var(--border);white-space:nowrap;text-overflow:ellipsis;height:100%;padding:0 8px;line-height:24px;position:absolute;top:0;overflow:hidden}.head-cell{cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:4px;font-weight:600;line-height:26px;display:flex}.head-cell .type{color:var(--text-faint);text-overflow:ellipsis;font-size:11px;font-weight:400;overflow:hidden}.head-cell .resize{cursor:col-resize;width:6px;height:100%;position:absolute;top:0;right:-3px}.number-cell{z-index:1;color:var(--text-faint);text-align:right;background:var(--bg-chrome);position:sticky;left:0}.cell.selected{box-shadow:inset 0 0 0 2px var(--selection-strong)}.grid-row.selected .cell{background:var(--selection)}.cell.changed{background:var(--changed)}.grid-row.inserted .cell:not(.number-cell){background:var(--inserted)}.grid-row.deleted .cell:not(.number-cell){background:var(--deleted);color:var(--text-dim);text-decoration:line-through}.cell-editor{z-index:3;border:2px solid var(--selection-strong);background:var(--bg-input);height:100%;font:inherit;outline:none;padding:0 7px;position:absolute;top:0}.menu{z-index:5;border:1px solid var(--border);background:var(--bg);min-width:140px;box-shadow:var(--shadow);border-radius:7px;flex-direction:column;padding:4px;display:flex;position:absolute;bottom:34px}.menu button{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:5px 10px}.menu button:hover,.menu button:focus-visible{background:var(--accent);color:var(--accent-text);outline:none}.changes{color:var(--text);font-weight:600}.cell .null{color:var(--null);font-style:italic}.structure{flex:1;padding:10px 12px;overflow:auto}.structure h2{color:var(--text-dim);text-transform:uppercase;margin:14px 0 6px;font-size:12px;font-weight:600}.structure table{border-collapse:collapse;width:100%}.structure th,.structure td{border-bottom:1px solid var(--border);text-align:left;vertical-align:top;padding:4px 8px}.structure th{color:var(--text-dim);font-weight:500}.structure code{font-family:var(--mono);font-size:11.5px}.query{grid-template-rows:minmax(80px, var(--editor,45%)) 5px 1fr;flex:1;min-height:0;display:grid}.editor{min-height:0;overflow:hidden}.editor .cm-editor{height:100%;font-size:13px}.editor .cm-scroller{font-family:var(--mono)}.editor .cm-editor.cm-focused{outline:none}.splitter{border-top:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--bg-chrome);cursor:row-resize}.results{flex-direction:column;min-height:0;display:flex}.results-tabs{border-bottom:1px solid var(--border);gap:2px;padding:4px 6px;display:flex}.message{color:var(--text-dim);padding:10px 12px}.panel{border-left:1px solid var(--border);background:var(--bg-sidebar);flex-direction:column;min-height:0;display:flex;overflow:hidden}.panel-head{border-bottom:1px solid var(--border);padding:8px 10px;font-weight:600}.fields{flex:1;margin:0;padding:6px 10px;overflow:auto}.fields dt{color:var(--text-dim);margin-top:8px;font-size:11px}.fields dt .type{color:var(--text-faint)}.fields dd{border:1px solid var(--border);background:var(--bg-input);font-family:var(--mono);white-space:pre-wrap;word-break:break-word;border-radius:5px;margin:2px 0 0;padding:4px 6px;font-size:11.5px}.console{border-top:1px solid var(--border);height:150px;font-family:var(--mono);flex:none;font-size:11.5px;overflow:auto}.console-entry{border-bottom:1px solid var(--border);grid-template-columns:70px 1fr auto;gap:8px;padding:2px 8px;display:grid}.console-entry .time,.console-entry .took{color:var(--text-faint)}.console-entry.failed .sql{color:var(--danger)}.overlay{z-index:10;background:#0000002e;justify-content:center;align-items:flex-start;padding-top:12vh;display:flex;position:fixed;inset:0}.dialog{border:1px solid var(--border);background:var(--bg);width:min(520px,100vw - 32px);box-shadow:var(--shadow);border-radius:10px;overflow:hidden}.dialog-body{padding:16px 18px}.dialog-body h2{margin:0 0 6px;font-size:14px}.dialog-body pre{background:var(--bg-chrome);max-height:200px;font-family:var(--mono);white-space:pre-wrap;border-radius:6px;padding:8px;font-size:11.5px;overflow:auto}.dialog-actions{border-top:1px solid var(--border);background:var(--bg-chrome);justify-content:flex-end;gap:8px;padding:10px 18px;display:flex}.palette .input{border:0;border-bottom:1px solid var(--border);width:100%;height:40px;box-shadow:none;border-radius:0;padding:0 14px;font-size:15px}.palette ul{max-height:320px;margin:0;padding:4px;list-style:none;overflow:auto}.palette li button{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;width:100%;padding:6px 10px;display:flex}.palette li button[aria-selected=true]{background:var(--accent);color:var(--accent-text)}.palette li button[aria-selected=true] svg,.palette li button[aria-selected=true] .schema{color:inherit}.palette .schema{color:var(--text-faint);margin-left:auto}.signed-out{text-align:center;height:100%;color:var(--text-dim);place-content:center;gap:8px;display:grid}.signed-out h1{color:var(--text);margin:0;font-size:16px}.dialog.backup{width:min(560px,100vw - 32px)}.backup .tabs{border-bottom:1px solid var(--border);background:var(--bg-chrome);gap:2px;padding:8px 12px 0;display:flex}.backup .tabs button{color:var(--text-dim);cursor:pointer;background:0 0;border:1px solid #0000;border-bottom:0;border-radius:6px 6px 0 0;padding:6px 12px}.backup .tabs button[aria-selected=true]{border-color:var(--border);background:var(--bg);color:var(--text);margin-bottom:-1px}.backup .dialog-body{gap:10px;max-height:min(60vh,520px);display:grid;overflow:auto}.backup .notice,.backup p{margin:0}.muted{color:var(--text-dim)}.choices{border:0;gap:4px;margin:0;padding:0;display:grid}.choices legend{margin-bottom:4px;font-weight:600}.choices label{align-items:center;gap:8px;display:flex}.choices label .muted{text-align:right;margin-left:auto}.file-choice,.confirm{gap:4px;display:grid}.confirm .input{border:1px solid var(--border-strong);background:var(--bg-input);height:26px;font-family:var(--mono);border-radius:5px;padding:0 8px}.replaces ul{margin:4px 0 0;padding-left:18px}.progress{color:var(--text-dim);gap:4px;display:grid}.progress progress{width:100%;accent-color:var(--accent)}\n/*$vite$:1*/"}},"entry":{"script":"index-BVyk1TYR.js","style":"style-CN-jj026.css"}}
|
|
1
|
+
export const assets = {"index":"<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"otw-db\" content=\"%OTW_DB_CONFIG%\" />\n <meta name=\"color-scheme\" content=\"light dark\" />\n <title>OTW DB</title>\n <script type=\"module\" crossorigin src=\"%OTW_DB_BASE%/assets/index-DW5OtN-I.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"%OTW_DB_BASE%/assets/style-DNm72SIS.css\">\n </head>\n <body>\n <div id=\"root\" class=\"otw-db\"></div>\n </body>\n</html>\n","files":{"Editor-C-kA2tCc.js":{"type":"text/javascript; charset=utf-8","body":"import{a as e,i as t,n}from\"./index-DW5OtN-I.js\";var r=[],i=[];(()=>{let e=`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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?i:r).push(n+=e[t])})();function a(e){if(e<768)return!1;for(let t=0,n=r.length;;){let a=t+n>>1;if(e<r[a])n=a;else if(e>=i[a])t=a+1;else return!0;if(t==n)return!1}}function o(e){return e>=127462&&e<=127487}var s=8205;function c(e,t,n=!0,r=!0){return(n?l:u)(e,t,r)}function l(e,t,n){if(t==e.length)return t;t&&f(e.charCodeAt(t))&&p(e.charCodeAt(t-1))&&t--;let r=d(e,t);for(t+=m(r);t<e.length;){let i=d(e,t);if(r==s||i==s||n&&a(i))t+=m(i),r=i;else if(o(i)){let n=0,r=t-2;for(;r>=0&&o(d(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function u(e,t,n){for(;t>1;){let r=l(e,t-2,n);if(r<t)return r;t--}return 0}function d(e,t){let n=e.charCodeAt(t);if(!p(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return f(r)?(n-55296<<10)+(r-56320)+65536:n}function f(e){return e>=56320&&e<57344}function p(e){return e>=55296&&e<56320}function m(e){return e<65536?1:2}var h=class e{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=re(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),_.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=re(this,e,t);let n=[];return this.decompose(e,t,n,0),_.from(n,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),n=this.length-this.scanIdentical(e,-1),r=new b(this),i=new b(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new b(this,e)}iterRange(e,t=this.length){return new x(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new te(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new g(t):_.from(g.split(t,[]))}},g=class e extends h{constructor(e,t=v(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ne(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ee(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=y(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=re(this,t,n);let i=y(this.text,y(r.text,ee(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):_.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`\n`){[e,t]=re(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},_=class e extends h{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=re(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`\n`){[e,t]=re(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new g(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof g&&c&&(n=u[u.length-1])instanceof g&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new g(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};h.empty=new g([``],0);function v(e){let t=-1;for(let n of e)t+=n.length+1;return t}function y(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function ee(e,t,n){return y(e,[``],t,n)}var b=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof g?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof g?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`\n`,this;e--}else if(r instanceof g){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof g?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},x=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new b(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),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!=``}},te=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(h.prototype[Symbol.iterator]=function(){return this.iter()},b.prototype[Symbol.iterator]=x.prototype[Symbol.iterator]=te.prototype[Symbol.iterator]=function(){return this});var ne=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function re(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function S(e,t,n=!0,r=!0){return c(e,t,n,r)}function ie(e){return e>=56320&&e<57344}function ae(e){return e>=55296&&e<56320}function C(e,t){let n=e.charCodeAt(t);if(!ae(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ie(r)?(n-55296<<10)+(r-56320)+65536:n}function oe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function se(e){return e<65536?1:2}var ce=/\\r\\n?|\\n/,le=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(le||={}),ue=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){pe(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:he(this,e)}mapDesc(e,t=!1){return e.empty?this:me(this,e,t)}mapPos(e,t=-1,n=le.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=le.Simple&&c>=e&&(n==le.TrackDel&&r<e&&c>e||n==le.TrackBefore&&r<e||n==le.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},de=class e extends ue{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return pe(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return me(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(h.empty);r.push(a?t.slice(i,i+a):h.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:he(this,e,!0)}map(e,t=!1){return e.empty?this:me(this,e,t,!0)}iterChanges(e,t=!1){pe(this,e,t)}get desc(){return ue.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new ge(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);w(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;w(n,e,t),t>0&&fe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);w(n,e,-1),w(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:ue.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&w(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?h.of(l.split(r||ce)):l:h.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&w(i,e-o,-1),w(i,s-e,d),fe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(h.empty);r[e]=h.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function w(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function fe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(h.empty);e.push(n)}}function pe(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=h.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function me(e,t,n,r=!1){let i=[],a=r?[]:null,o=new ge(e),s=new ge(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);w(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(w(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(w(i,0,o.ins),a&&fe(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;w(i,t,e<o.i?o.ins:0),a&&e<o.i&&fe(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?de.createSet(i,a):ue.create(i);else throw Error(`Mismatched change set lengths`)}function he(e,t,n=!1){let r=[],i=n?[]:null,a=new ge(e),o=new ge(t);for(let e=!1;;)if(a.done&&o.done)return i?de.createSet(r,i):ue.create(r);else if(a.ins==0)w(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)w(r,0,o.ins,e),i&&fe(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;w(r,t,n,e),i&&n&&fe(i,r,o.text)}else o.ins==-1?(w(r,a.off?0:a.len,t,e),i&&fe(i,r,a.textBit(t))):(w(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&fe(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var ge=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?h.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?h.empty:t[n].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)}},_e=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return T.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return T.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!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 RangeError(`Invalid JSON representation for SelectionRange`);return T.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},T=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>_e.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return _e.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?_e.create(t,e,a|32,n):_e.create(e,t,a,n)}static undirectionalRange(e,t){return _e.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function ve(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var ye=0,E=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=ye++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:be),!!t.static,t.enables)}of(e){return new xe([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new xe(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function be(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var xe=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=ye++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Ce(e,c)){let r=t(e);if(a?!Se(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Ie(o,c);if(this.dependencies.every(t=>t instanceof E?o.facet(t)===e.facet(t):t instanceof Ee?o.field(t,!1)==e.field(t,!1):!0)||(a?Se(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Se(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Ce(e,t){let n=!1;for(let r of t)Fe(e,r)&1&&(n=!0);return n}function we(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Ie(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Fe(e,t);return e.values[o]=s(e),1},update(e,n){if(!Ce(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Ce(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&be(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Te=E.define({static:!0}),Ee=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(ye++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Te).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Te),i=n.facet(Te),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Te.of({field:this,create:e})]}get extension(){return this}},De={lowest:4,low:3,default:2,high:1,highest:0};function Oe(e){return t=>new Ae(t,e)}var ke={highest:Oe(De.highest),high:Oe(De.high),default:Oe(De.default),low:Oe(De.low),lowest:Oe(De.lowest)},Ae=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},je=class e{of(e){return new Me(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Me=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ne=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Pe(t,n,o))e instanceof Ee?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,be(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>we(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Pe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Me&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Me){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ae)a(e.inner,e.prec);else if(e instanceof Ee)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof xe)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,De.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,De.default),r.reduce((e,t)=>e.concat(t))}function Fe(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Ie(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Le=E.define(),Re=E.define({combine:e=>e.some(e=>e),static:!0}),ze=E.define({combine:e=>e.length?e[0]:void 0,static:!0}),Be=E.define(),Ve=E.define(),He=E.define(),Ue=E.define({combine:e=>e.length?e[0]:!1}),We=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ge}},Ge=class{of(e){return new We(this,e)}},Ke=class{constructor(e){this.map=e}of(e){return new D(this,e)}},D=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new Ke(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};D.reconfigure=D.define(),D.appendConfig=D.define();var O=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&ve(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return 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(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};O.time=We.define(),O.userEvent=We.define(),O.addToHistory=We.define(),O.remote=We.define();function qe(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Je(e,t,n){let r,i,a;return n?(r=t.changes,i=de.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:D.mapEffects(e.effects,r).concat(D.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Ye(e,t,n){let r=t.selection,i=et(t.annotations);return t.userEvent&&(i=i.concat(O.userEvent.of(t.userEvent))),{changes:t.changes instanceof de?t.changes:de.of(t.changes||[],n,e.facet(ze)),selection:r&&(r instanceof T?r:T.single(r.anchor,r.head)),effects:et(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Xe(e,t,n){let r=Ye(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=Je(r,Ye(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=O.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Qe(n?Ze(i):i)}function Ze(e){let t=e.startState,n=!0;for(let r of t.facet(Be)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:qe(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=de.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=O.create(t,r,e.selection&&e.selection.map(i),D.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Ve);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof O?i:Array.isArray(i)&&i.length==1&&i[0]instanceof O?i[0]:Xe(t,et(i),!1)}return e}function Qe(e){let t=e.startState,n=t.facet(He),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Je(r,Ye(t,a,e.changes.newLength),!0))}return r==e?e:O.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var $e=[];function et(e){return e==null?$e:Array.isArray(e)?e:[e]}var k=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(k||={}),tt=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,nt;try{nt=RegExp(`[\\\\p{Alphabetic}\\\\p{Number}_]`,`u`)}catch{}function rt(e){if(nt)return nt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||tt.test(n)))return!0}return!1}function it(e){return t=>{if(!/\\S/.test(t))return k.Space;if(rt(t))return k.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return k.Word;return k.Other}}var A=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Fe(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`)}else return Fe(this,n),Ie(this,n)}update(...e){return Xe(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(je.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(D.reconfigure)?(n=null,r=e.value):e.is(D.appendConfig)&&(n=null,r=et(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ne.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Re)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:T.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=et(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=D.mapEffects(a,c).concat(D.mapEffects(et(o.effects),l))}return{changes:r,selection:T.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof de?t:de.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return h.of(t.split(this.facet(e.lineSeparator)||ce))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Fe(this,t),Ie(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Ee&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:T.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ne.resolve(t.extensions||[],new Map),r=t.doc instanceof h?t.doc:h.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||ce)),i=t.selection?t.selection instanceof T?t.selection:T.single(t.selection.anchor,t.selection.head):T.single(0);return ve(i,r.length),n.staticFacet(Re)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`\n`}get readOnly(){return this.facet(Ue)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Le))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return it(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=S(t,a,!1);if(i(t.slice(e,a))!=k.Word)break;a=e}for(;o<r;){let e=S(t,o);if(i(t.slice(o,e))!=k.Word)break;o=e}return a==o?null:T.range(a+n,o+n)}};A.allowMultipleSelections=Re,A.tabSize=E.define({combine:e=>e.length?e[0]:4}),A.lineSeparator=ze,A.readOnly=Ue,A.phrases=E.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),A.languageData=Le,A.changeFilter=Be,A.transactionFilter=Ve,A.transactionExtender=He,je.reconfigure=D.define();function at(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var ot=class{eq(e){return this==e}range(e,t=e){return ct.create(e,t,this)}};ot.prototype.startSide=ot.prototype.endSide=0,ot.prototype.point=!1,ot.prototype.mapMode=le.TrackDel;function st(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var ct=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function lt(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var ut=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return dt(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},j=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(lt)),this.isEmpty)return n.length?e.of(n):this;let s=new ht(this,null,-1).goto(0),c=0,l=[],u=new pt;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value,!1)||l.push(ct.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1,a,o=(e,t,n)=>{a||=new pt,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[dt(r)+dt(n).length,dt(dt(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return gt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return gt.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=mt(a,o,n),c=new vt(a,s,i),l=new vt(o,s,i);n.iterGaps((e,t,n)=>yt(c,e,l,t,n,r)),n.empty&&n.length==0&&yt(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=mt(i,a),s=new vt(i,o,0).goto(n),c=new vt(a,o,0).goto(n);for(;;){if(s.to!=c.to||!bt(s.active,c.active)||s.point&&(!c.point||!st(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new vt(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new pt;for(let r of e instanceof ct?[e]:t?ft(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=dt(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};j.empty=new j([],[],null,-1);function dt(e){return e[e.length-1]}function ft(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(lt(t,r)>0)return e.slice().sort(lt);t=r}return e}j.empty.nextLayer=j.empty;var pt=class e{finishChunk(e){this.chunks.push(new ut(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error(\"Ranges must be added sorted by `from` position and `startSide`\");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(j.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function mt(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var ht=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},gt=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new ht(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)_t(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)_t(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),_t(this.heap,0)}}};function _t(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var vt=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=gt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xt(this.active,e),xt(this.activeTo,e),xt(this.activeRank,e),this.minActive=Ct(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;St(this.active,t,n),St(this.activeTo,t,r),St(this.activeRank,t,i),e&&St(e,t,this.cursor.from),this.minActive=Ct(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&xt(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function yt(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&st(e.point,n.point)&&bt(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!bt(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function bt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!st(e[n],t[n]))return!1;return!0}function xt(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function St(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Ct(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function wt(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=S(e,i));return r}function Tt(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=S(e,r)}return r===!0?-1:e.length}for(var Et=`ͼ`,Dt=typeof Symbol>`u`?`__ͼ`:Symbol.for(Et),Ot=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),kt=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},At=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\\s*/)}function i(e,t,a,o){let s=[],c=/^@(\\w+)\\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let e=kt[Dt]||1;return kt[Dt]=e+1,Et+e.toString(36)}static mount(e,t,n){let r=e[Ot],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Mt(e,i),r.mount(Array.isArray(t)?t:[t],e)}},jt=new Map,Mt=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=jt.get(n);if(t)return e[Ot]=t;this.sheet=new r.CSSStyleSheet,jt.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Ot]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`\n`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},Nt={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:\"`\",219:`[`,220:`\\\\`,221:`]`,222:`'`},Pt={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`\"`},Ft=typeof navigator<`u`&&/Mac/.test(navigator.platform),It=typeof navigator<`u`&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent),M=0;M<10;M++)Nt[48+M]=Nt[96+M]=String(M);for(var M=1;M<=24;M++)Nt[M+111]=`F`+M;for(var M=65;M<=90;M++)Nt[M]=String.fromCharCode(M+32),Pt[M]=String.fromCharCode(M);for(var Lt in Nt)Pt.hasOwnProperty(Lt)||(Pt[Lt]=Nt[Lt]);function Rt(e){var t=!(Ft&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||It&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Pt:Nt)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function N(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)zt(e,arguments[t]);return e}function zt(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)zt(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var P=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Bt=typeof document<`u`?document:{documentElement:{style:{}}},Vt=/Edge\\/(\\d+)/.exec(P.userAgent),Ht=/MSIE \\d/.test(P.userAgent),Ut=/Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(P.userAgent),Wt=!!(Ht||Ut||Vt),Gt=!Wt&&/gecko\\/(\\d+)/i.test(P.userAgent),Kt=!Wt&&/Chrome\\/(\\d+)/.exec(P.userAgent),qt=`webkitFontSmoothing`in Bt.documentElement.style,Jt=!Wt&&/Apple Computer/.test(P.vendor),Yt=Jt&&(/Mobile\\/\\w+/.test(P.userAgent)||P.maxTouchPoints>2),F={mac:Yt||/Mac/.test(P.platform),windows:/Win/.test(P.platform),linux:/Linux|X11/.test(P.platform),ie:Wt,ie_version:Ht?Bt.documentMode||6:Ut?+Ut[1]:Vt?+Vt[1]:0,gecko:Gt,gecko_version:Gt?+(/Firefox\\/(\\d+)/.exec(P.userAgent)||[0,0])[1]:0,chrome:!!Kt,chrome_version:Kt?+Kt[1]:0,ios:Yt,android:/Android\\b/.test(P.userAgent),webkit:qt,webkit_version:qt?+(/\\bAppleWebKit\\/(\\d+)/.exec(P.userAgent)||[0,0])[1]:0,safari:Jt,safari_version:Jt?+(/\\bVersion\\/(\\d+(\\.\\d+)?)/.exec(P.userAgent)||[0,0])[1]:0,tabSize:Bt.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Xt(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Zt=Object.create(null);function Qt(e,t,n){if(e==t)return!0;e||=Zt,t||=Zt;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function $t(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function en(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function tn(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var nn=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},I=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(I||={}),L=class extends ot{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new rn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new on(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=sn(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new on(e,n,r,t,e.widget||null,!0)}static line(e){return new an(e)}static set(e,t=!1){return j.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};L.none=j.empty;var rn=class e extends L{constructor(e){let{start:t,end:n}=sn(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Xt(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Zt}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Qt(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};rn.prototype.point=!1;var an=class e extends L{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Qt(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};an.prototype.mapMode=le.TrackBefore,an.prototype.point=!0;var on=class e extends L{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?le.TrackBefore:le.TrackAfter:le.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?I.WidgetBefore:I.WidgetAfter:I.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&cn(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};on.prototype.point=!0;function sn(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function cn(e,t){return e==t||!!(e&&t&&e.compare(t))}function ln(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var un=class e extends ot{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Qt(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Zt,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return j.of(e,t)}};un.prototype.startSide=un.prototype.endSide=-1;var R=e=>e.nodeType==1,dn=e=>e.nodeType==3;function fn(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function pn(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function mn(e,t){if(!t.anchorNode)return!1;try{return pn(e,t.anchorNode)}catch{return!1}}function hn(e){return dn(e)?Mn(e,0,e.nodeValue.length).getClientRects():R(e)?e.getClientRects():[]}function gn(e,t,n,r){return n?yn(e,t,n,r,-1)||yn(e,t,n,r,1):!1}function _n(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function vn(e){return R(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(e.nodeName)}function yn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:bn(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!R(n))return!1;t=_n(e)+(i<0?0:1),e=n}else if(R(e)){if(e=e.childNodes[t+(i<0?-1:0)],R(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?bn(e):0}else return!1}}function bn(e){return dn(e)?e.nodeValue.length:e.childNodes.length}function xn(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Sn(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Cn(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function wn(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(R(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=Sn(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=Cn(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Tn(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(R(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var En=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?bn(t):0),n,Math.min(e.focusOffset,n?bn(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Dn(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)R(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function On(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var kn=null;F.safari&&F.safari_version>=26&&(kn=!1);function An(e){if(e.setActive)return e.setActive();if(kn)return e.focus(kn);let t=Dn(e);e.focus(kn==null?{get preventScroll(){return kn={preventScroll:!0},!0}}:void 0),kn||(kn=!1,On(t))}var jn;function Mn(e,t,n=t){let r=jn||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function Nn(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Pn(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Fn(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,bn(n));;)if(r){if(!R(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=bn(n))}else if(n==e)return!0;else r=_n(n),n=n.parentNode}function In(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Ln(e,t){for(let n=e,r=t;;)if(dn(n)&&r>0)return{node:n,offset:r};else if(R(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=bn(n)}else if(n.parentNode&&!vn(n))r=_n(n),n=n.parentNode;else return null}function Rn(e,t){for(let n=e,r=t;;)if(dn(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(R(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!vn(n))r=_n(n)+1,n=n.parentNode;else return null}var zn=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,_n(t),n)}static after(t,n){return new e(t.parentNode,_n(t)+1,n)}},z=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(z||={}),Bn=z.LTR,Vn=z.RTL;function Hn(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var Un=Hn(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Wn=Hn(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),Gn=Object.create(null),Kn=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Gn[t]=n,Gn[n]=-t}function qn(e){return e<=247?Un[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Wn[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Jn=/[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/,Yn=class{get dir(){return this.level%2?Vn:Bn}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function Xn(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Xn(r.inner,i.inner))return!1}return!0}var B=[];function Zn(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=qn(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),B[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=B[e];if(i==128)e<s-1&&t==B[e+1]&&t&24?i=B[e]=t:B[e]=256;else if(i==64){let i=e+1;for(;i<s&&B[i]==64;)i++;let a=e&&t==8||i<n&&B[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)B[t]=a;e=i-1}else i==8&&r==1&&(B[e]=1);t=i,i&7&&(r=i)}}}function Qn(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=Gn[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(Kn[e+1]==-r){let n=Kn[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(B[t]=B[Kn[e]]=r),s=e;break}}else if(Kn.length==189)break;else Kn[s++]=t,Kn[s++]=n,Kn[s++]=c}else if((o=B[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Kn[t+2];if(n&2)break;if(e)Kn[t+2]|=2;else{if(n&4)break;Kn[t+2]|=4}}}}}function $n(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=B[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(B[o]==256)o++;else break;let l=a==1,u=l==((o<t?B[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),B[--t]=u;c=o}else a=o,c++}}}function er(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=B[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(B[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Yn(c,m.from,f)),tr(e,m.direction==Bn==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?B[p]!=s:B[p]==s))break;else p++;d?er(e,c,p,r+1,i,d,o):c<p&&o.push(new Yn(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=B[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(B[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Yn(m.to,c,f)),tr(e,m.direction==Bn==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?B[p-1]!=s:B[p-1]==s))break;else p--;d?er(e,p,c,r+1,i,d,o):p<c&&o.push(new Yn(p,c,f)),c=p}}function tr(e,t,n,r,i,a,o){let s=t%2?2:1;Zn(e,i,a,r,s),Qn(e,i,a,r,s),$n(i,a,r,s),er(e,i,a,t,n,r,o)}function nr(e,t,n){if(!e)return[new Yn(0,0,+(t==Vn))];if(t==Bn&&!n.length&&!Jn.test(e))return rr(e.length);if(n.length)for(;e.length>B.length;)B[B.length]=256;let r=[],i=t==Bn?0:1;return tr(e,i,i,n,0,e.length,r),r}function rr(e){return[new Yn(0,e,0)]}var ir=``;function ar(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=Yn.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=S(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),ir=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?T.cursor(e.to,1):T.cursor(e.from,-1);if(u.level+ +!i<s.level)return T.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return T.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function or(e,t,n){for(let r=t;r<n;r++){let t=qn(e.charCodeAt(r));if(t==1)return Bn;if(t==2||t==4)return Vn}}var sr=E.define(),cr=E.define(),lr=E.define(),ur=E.define(),dr=E.define(),fr=E.define(),pr=E.define(),mr=E.define(),hr=E.define(),gr=E.define({combine:e=>e.some(e=>e)}),_r=E.define({combine:e=>e.some(e=>e)}),vr=E.define(),yr=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(T.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},br=D.define({map:(e,t)=>e.map(t)}),xr=D.define();function Sr(e,t,n){let r=e.facet(ur);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var Cr=E.define({combine:e=>!e.length||e[0]}),wr=0,Tr=E.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),V=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Tr.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Tr.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(wr++,t,r,i,e=>{let t=[];return o&&t.push(kr.of(t=>{let n=t.plugin(e);return n?o(n):L.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Er=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Sr(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Sr(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Sr(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Dr=E.define(),Or=E.define(),kr=E.define(),Ar=E.define(),jr=E.define(),Mr=E.define(),Nr=E.define();function Pr(e,t){let n=e.state.facet(Nr);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return j.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),Fr(t.text,i)}function Fr(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=or(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=z.LTR}Fr(e,n.inner)}return t}var Ir=E.define();function Lr(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(Ir)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var Rr=E.define(),zr=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},Br=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=de.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new zr(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Vr=[],H=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Vr}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&$t(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=_n(this.dom),r=this.length?e>0:t>0;return new zn(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Wr)return e;return null}static get(e){return e.cmTile}},Hr=class extends H{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=Ur(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=Ur(r);this.length=a}};function Ur(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Wr=class extends Hr{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=H.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof Gr)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},Gr=class e extends Hr{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Kr=class e extends Hr{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return n&&r||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&Jr(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):qr(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new zn(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new zn(e.dom,0);e==n.tile&&(a=!0)}}return new zn(this.dom,0)}};function qr(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=hn(t);return n[n.length-1]||null}function Jr(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var Yr=class e extends Hr{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Xr=class e extends H{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?F.chrome||F.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=Mn(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return F.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:xn(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Zr=class e extends H{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return xn(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return xn(n,!r)}}get overrideDOMText(){if(!this.length)return h.empty;let{root:e}=this;if(!e)return h.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Qr=class extends H{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return h.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:xn(r,t>0==n)}},$r=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},ei=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},ti=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new Xr(a.dom,a.text+e);t.parent=i}else i.append(r||Xr.of(e,this.cache.find(Xr)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?di(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Yr&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(di(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&H.get(n.dom)&&(e=di(n.dom));let t=Yr.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=H.get(e.text);i&&this.cache.reused.set(i,2);let a=new Xr(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=ci;let n=Kr.start(e,t||this.cache.find(Kr)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof Yr&&a.mark.eq(i))n=a,t--;else{let e=Yr.of(i,this.cache.find(Yr,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!oi(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(F.ios&&oi(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(pi,0,32)||new Zr(pi.toDOM(),0,pi,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new ei(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof Gr&&n.wrapper.eq(t.wrapper))e=n;else{let n=Gr.of(t.wrapper,this.cache.find(Gr,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Qr,void 0,1);return n&&(n.flags=t),n||new Qr(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},ni=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},ri=[Zr,Kr,Xr,Yr,Qr,Gr,Wr];for(let e=0;e<ri.length;e++)ri[e].bucket=e;var ii=class{constructor(e){this.view=e,this.buckets=ri.map(()=>[]),this.index=ri.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Zr(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},ai=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new ii(e),this.text=new ni(e.state.doc),this.builder=new ti(this.cache,new Wr(e,e.contentDOM),j.iter(n)),this.cache.reused.set(t,2),this.old=new $r(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=ui(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Zr.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Qr)this.cache.add(e);else if(e instanceof Yr)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Yr&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof Yr&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=j.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof on){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?fi.block:fi.inline),c=si(a),l=this.cache.findWidget(i,t-e,c)||Zr.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=li(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=H.get(r);if(r==this.view.contentDOM)break;e instanceof Yr?t.push(e):e?.isLine()?n=e:e instanceof Gr||(r.nodeName==`DIV`&&!n?n=new Kr(r,ci):n||t.push(Yr.of(new rn({tagName:r.nodeName.toLowerCase(),attributes:tn(r)}),r)))}return n?{line:n,marks:t}:null}};function oi(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function si(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var ci={class:`cm-line`};function li(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&Xt(n,e),r&&(e.class+=` `+r)),e}function ui(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Yr&&t.push(r.mark)}return t}function di(e){let t=H.get(e);return t&&t.setDOM(e.cloneNode()),e}var fi=class extends nn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};fi.inline=new fi(`span`),fi.block=new fi(`div`);var pi=new class extends nn{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},mi=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=L.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Wr(e,e.contentDOM),this.updateInner([new zr(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Ti(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?vi(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new zr(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(F.ie||F.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=xi(i,this.decorations,e.changes);o.length&&(t=zr.extendWithRanges(t,o));let s=Ci(a,this.blockWrappers,e.changes);return s.length&&(t=zr.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new ai(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&H.get(t.text)&&r.cache.reused.set(H.get(t.text),2),this.tile=r.run(e,t),hi(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=F.chrome||F.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Ei&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(xr)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(Cr)||n.tabIndex>-1)&&mn(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),F.gecko&&s.empty&&!this.hasComposition&&gi(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new zn(e,0),o=!0}let u=this.view.observer.selectionRange;!o&&u.focusNode&&(gn(c.node,c.offset,u.anchorNode,u.anchorOffset)&&gn(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore(()=>{F.android&&F.chrome&&n.contains(u.focusNode)&&wi(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=fn(this.view.root);if(e){if(s.empty){if(F.gecko){let e=yi(c.node,c.offset);if(e&&e!=3){let t=(e==1?Ln:Rn)(c.node,c.offset);t&&(c=new zn(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new zn(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new zn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&gn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=fn(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=bn(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!H.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Ei?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=S(e.text,t);if(n==t)return null;let r=Mn(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==z.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof Gr)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?hn(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?z.RTL:z.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=hn(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=hn(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(L.replace({widget:new Ei(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return L.set(e)}updateDeco(){let e=1,t=this.view.state.facet(kr).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(jr).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(j.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Ar).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(vr))try{if(t(this.view,e.range,e))return!0}catch(e){Sr(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Lr(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(wn(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==z.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=Dn(e.dom);e.dom.scrollIntoView({block:`nearest`}),On(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){hi(this.tile)}};function hi(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)hi(n,t)}}function gi(e){return R(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function _i(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Ln(n.focusNode,n.focusOffset),i=Rn(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=H.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=H.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function vi(e,t,n){let r=_i(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\\n\\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new zr(c.mapPos(a),c.mapPos(o),a,o),text:i}}function yi(e,t){return R(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var bi=class{constructor(){this.changes=[]}compareRange(e,t){ln(e,t,this.changes)}comparePoint(e,t){ln(e,t,this.changes)}boundChange(e){ln(e,e,this.changes)}};function xi(e,t,n){let r=new bi;return j.compare(e,t,n,r),r.changes}var Si=class{constructor(){this.changes=[]}compareRange(e,t){ln(e,t,this.changes)}comparePoint(){}boundChange(e){ln(e,e,this.changes)}};function Ci(e,t,n){let r=new Si;return j.compare(e,t,n,r),r.changes}function wi(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(R(n)&&n.contentEditable==`false`)return!0;return!1}function Ti(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Ei=class extends nn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Di(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return T.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=S(i.text,a,!1):s=S(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=S(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=S(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return T.undirectionalRange(o+i.from,s+i.from)}function Oi(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Tt(o,a,e.state.tabSize)}function ki(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==I.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function Ai(e,t,n,r){let i=ki(e,t.head,t.assoc||-1),a=!r||i.type!=I.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==z.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return T.cursor(o.pos,o.assoc)}return T.cursor(n?i.to:i.from,n?1:-1)}function ji(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=ar(i,a,o,s,n),l=ir;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`\n`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?T.cursor(i.from,-1):T.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Mi(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==k.Space&&(i=t),i==t}}function Ni(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return T.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=Ri(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return T.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return T.cursor(i.pos,i.assoc,void 0,o)}}function Pi(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function Fi(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=Pi(e,i.from,0);t!=i.from&&(a=T.cursor(t,-1))}else{let t=Pi(e,i.from,-1),n=Pi(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?T.undirectionalRange(i.from,i.to):T.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?T.create(n,t.mainIndex):t}function Ii(e,t,n){let r=Pi(e.state.facet(Mr).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:T.cursor(r,r<n.from?1:-1)}var Li=class{constructor(e,t){this.pos=e,this.assoc=t}};function Ri(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new Li(0,1);if(c>e.viewState.docHeight)return new Li(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==I.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==I.Text){let t=Oi(e,i,l,o,s);return new Li(t,t==l.from?1:-1)}}if(l.type!=I.Text)return c<(l.top+l.bottom)/2?new Li(l.from,1):new Li(l.to,-1);let u=e.docView.lineAt(l.from,2);return u&&u.length==l.length||(u=e.docView.lineAt(l.from,-2)),new zi(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var zi=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Yn.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Yn.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==z.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==z.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=S(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return Mn(e.dom,i,a).getClientRects()});return r.after?new Li(n[r.i+1],-1):new Li(n[r.i],1)}scanTile(e,t){if(!e.length)return new Li(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(R(n.dom)?n.dom:Mn(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Li(n[r.i+1],-1):new Li(a,1)}},Bi=``,Vi=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(A.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bi}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=H.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=H.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:vn(r))||vn(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Ui(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=H.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else dn(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():R(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(dn(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Hi(e,n.node,n.offset)?t:0))}};function Hi(e,t,n){for(;;){if(!t||n<bn(t))return!1;if(t==e)return!0;n=_n(t)+1,t=t.parentNode}}function Ui(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=H.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var Wi=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Gi=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Ki(e.docView.tile,t,n,0))){let t=i||a?[]:Zi(e),n=new Vi(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Qi(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!pn(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!pn(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((F.ios||F.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;a!=0&&a!=1&&t!=0||o!=0&&o!=-1&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(T.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=T.create([T.cursor(n,r)])}else this.newSel=T.single(r,n)}}};function Ki(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return Ki(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function qi(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||F.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,Bi),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:h.of(t.text.slice(a.from-e,u).split(Bi))}:(d=Xi(l,t.text,s-e,c))&&(F.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==``&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:h.of(t.text.slice(d.from,d.toB).split(Bi))})}else r&&(!e.hasFocus&&i.facet(Cr)||$i(r,a))&&(r=null);if(!n&&!r)return!1;if((F.mac||F.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=T.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:h.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:F.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`\n `&&e.lineWrapping&&(r&&=T.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:h.of([` `])}),n)return Ji(e,n,r,o);if(r&&!$i(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=Fi(i.facet(Mr).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Ji(e,t,n,r=-1){if(F.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(F.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&Nn(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&Nn(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Nn(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Yi(e,t,n);return e.state.facet(fr).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Yi(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=Pi(i.facet(Mr).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:T.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&_i(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?T.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function Xi(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function Zi(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new Wi(n,r)),(i!=n||a!=r)&&t.push(new Wi(i,a))),t}function Qi(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?T.create([T.cursor(r+t,-1)]):T.single(n+t,r+t)}function $i(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var ea=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=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.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,F.safari&&e.contentDOM.addEventListener(`input`,()=>null),F.gecko&&Ia(e.contentDOM.ownerDocument)}handleEvent(e){ma(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ra(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,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&&oa.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),F.android&&F.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(F.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(ia.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||aa.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&F.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ta(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Nn(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:F.safari&&!F.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!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 ta(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function na(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Sr(n.state,e)}}}function ra(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(na(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(na(t.value,r))}}for(let e in ha)n(e).handlers.push(ha[e]);for(let e in U)n(e).observers.push(U[e]);return t}var ia=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],aa=`dthko`,oa=[16,17,18,20,91,92,224,225],sa=6;function ca(e){return Math.max(0,e)*.7+8}function la(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var ua=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Tn(e.contentDOM),this.atoms=e.state.facet(Mr).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(A.allowMultipleSelections)&&da(e,t),this.dragging=pa(e,t)&&Ta(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&&la(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Lr(this.view);e.clientX-s.left<=r+sa?t=-ca(r-e.clientX):e.clientX+s.right>=a-sa&&(t=ca(e.clientX-a)),e.clientY-s.top<=i+sa?n=-ca(i-e.clientY):e.clientY+s.bottom>=o-sa&&(n=ca(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??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)}select(e){let{view:t}=this,n=Fi(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function da(e,t){let n=e.state.facet(sr);return n.length?n[0](t):F.mac?t.metaKey:t.ctrlKey}function fa(e,t){let n=e.state.facet(cr);return n.length?n[0](t):F.mac?!t.altKey:!t.ctrlKey}function pa(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=fn(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function ma(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=H.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var ha=Object.create(null),U=Object.create(null),ga=F.ie&&F.ie_version<15||F.ios&&F.webkit_version<604;function _a(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),ya(e,n.value)},50)}function va(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function ya(e,t){t=va(e.state,mr,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(ja!=null&&n.selection.ranges.every(e=>e.empty)&&ja==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:T.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:T.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}U.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,F.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},U.wheel=U.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ha.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),U.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},U.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},U.touchend=(e,t)=>{e.inputState.touchActive=!1},ha.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(lr))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Ea(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ua(e,t,n,r)),r&&e.observer.ignore(()=>{An(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function ba(e,t,n,r){if(r==1)return T.cursor(t,n);if(r==2)return Di(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,T.undirectionalRange(a,o)}}var xa=F.ie&&F.ie_version<=11,Sa=null,Ca=0,wa=0;function Ta(e){if(!xa)return e.detail;let t=Sa,n=wa;return Sa=e,wa=Date.now(),Ca=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Ca+1)%3:1}function Ea(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Ta(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=ba(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=ba(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?T.range(i,a,l.assoc):T.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=Da(i,s.pos))?c:o?i.addRange(l):T.create([l])}}}function Da(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return T.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}ha.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=T.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,va(e.state,hr,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},ha.dragend=e=>(e.inputState.draggedContent=null,!1);function Oa(e,t,n,r){if(n=va(e.state,mr,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&fa(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}ha.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&Oa(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return Oa(e,t,n,!0),!0}return!1},ha.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ga?null:t.clipboardData;return n?(ya(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(_a(e),!1)};function ka(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function Aa(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:va(e,hr,t.join(e.lineBreak)),ranges:n,linewise:r}}var ja=null;ha.copy=ha.cut=(e,t)=>{if(!mn(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Aa(e.state);if(!n&&!i)return!1;ja=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=ga?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(ka(e,n),!1)};var Ma=We.define();function Na(e,t){let n=[];for(let r of e.facet(pr)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Ma.of(!0)}):null}function Pa(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Na(e.state,t);n?e.dispatch(n):e.update([])}},10)}U.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Pa(e)},U.blur=e=>{e.observer.clearSelectionRange(),Pa(e)},U.compositionstart=U.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},U.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,F.chrome&&F.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},U.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ha.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return Ji(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(F.chrome&&F.android&&(n=ia.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return F.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),F.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>U.compositionend(e,t),20),!1};var Fa=new Set;function Ia(e){Fa.has(e)||(Fa.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var La=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Ra=!1;function za(){Ra=!1}var Ba=class{constructor(e){this.lineWrapping=e,this.doc=h.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return La.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=La.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},Va=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Ha=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?I.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof on?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},W=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(W||={}),Ua=.001,Wa=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ua&&(Ra=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,W.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,W.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,W.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=$a.build(n.setDoc(a),e,l,u);i=Ga(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new Ja(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Xa(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function Ga(e,t){return e==t?e:(e.constructor!=t.constructor&&(Ra=!0),t)}Wa.prototype.size=1;var Ka=L.replace({}),qa=class extends Wa{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Ha(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Ha(r,0,n,this.spaceAbove,Ka):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,W.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ja=class e extends qa{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Ha(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Ya&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ya?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Wa.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,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:``})`}},Ya=class e extends Wa{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new Ha(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new Ha(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==W.ByHeight)return this.blockAt(e,n,r,i);if(t==W.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Ha(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new Ha(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new Ha(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return Wa.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=Ua&&(s=-2);let c=new Ja(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Wa.of(r);return(s<0||Math.abs(c.height-this.height)>=Ua||Math.abs(s-this.heightMetrics(t,n).perLine)>=Ua)&&(Ra=!0),Ga(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Xa=class extends Wa{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==W.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==W.ByPosNoHeight?W.ByPosNoHeight:W.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,W.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&Za(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Za(i,e)}return Wa.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Wa.of(this.break?[e,null,t]:[e,t]):(this.left=Ga(this.left,e),this.right=Ga(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,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function Za(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Ya&&(r=e[t+1])instanceof Ya&&e.splice(t-1,3,new Ya(n.length+1+r.length))}var Qa=5,$a=class e{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 e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ja?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ja(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new qa(a,r,n)):(a||i||r>=Qa)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ja(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ya(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ja)return e;let t=new Ja(0,-1,0);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+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ja)&&!this.isCovered?this.nodes.push(new Ja(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof Ja&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return j.spans(n,r,i,a,0),a.finish(r)}};function eo(e,t,n){let r=new to;return j.compare(e,t,n,r,0),r.changes}var to=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&ln(e,t,this.changes,5)}};function no(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(R(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function ro(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function io(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var ao=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return L.replace({widget:new oo(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},oo=class extends nn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},so=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=mo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=z.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Or).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Ba(n),this.stateDeco=ho(t),this.heightMap=Wa.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle.setDoc(t.doc),[new zr(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=L.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new co(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?mo:go.get(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(_o(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ho(this.state);let r=e.changedRanges,i=zr.extendWithRanges(r,eo(n,this.stateDeco,e?e.changes:de.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);za(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Ra)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_r)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?z.RTL:z.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Cn(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=Tn(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=In(this.scrollParent||e.win);let m=(this.printing?io:no)(t,this.paddingTop),g=m.top-this.pixelViewport.top,_=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(s=!0)),!this.inView&&!this.scrollTarget&&!ro(e.dom))return 0;let y=o.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,y/o),t),a&&(e.docView.minWidth=0,c|=16)}g>0&&_>0?l=Math.max(g,_):g<0&&_<0&&(l=Math.min(g,_)),za();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Wa.empty().applyChanges(this.stateDeco,h.empty,this.heightOracle,[new zr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Va(n.from,i))}Ra&&(c|=2)}let ee=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return ee&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||ee)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new co(r.lineAt(a-n*1e3,W.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,W.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,W.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new co(r.lineAt(o-500,W.ByHeight,i,0,0).from,r.lineAt(o+n+500,W.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new co(this.heightMap.lineAt(n,W.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,W.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,W.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,W.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new ao(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=z.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=po(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(T.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new ao(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=I.Text)return;let i=lo(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=fo(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=uo(i,n),l=uo(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=fo(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=uo(i,f),l=uo(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=fo(r,n)-fo(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){ao.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=L.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];j.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||_o(this.heightMap.lineAt(e,W.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)||_o(this.heightMap.lineAt(this.scaler.fromDOM(e),W.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return _o(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}},co=class{constructor(e,t){this.from=e,this.to=t}};function lo(e,t,n){let r=[],i=e,a=0;return j.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function uo({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function fo(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function po(e,t){for(let n of e)if(t(n))return n}var mo={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function ho(e){let t=e.facet(kr).filter(e=>typeof e!=`function`),n=e.facet(jr).filter(e=>typeof e!=`function`);return n.length&&t.push(j.join(n)),t}var go=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,W.ByPos,t,0,0).top,o=n.lineAt(r,W.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return mo;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function _o(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Ha(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>_o(e,t)):e._content)}var vo=E.define({combine:e=>e.join(` `)}),yo=E.define({combine:e=>e.indexOf(!0)>-1}),bo=At.newName(),xo=At.newName(),So=At.newName(),Co={\"&light\":`.`+xo,\"&dark\":`.`+So};function wo(e,t,n){return new At(t,{finish(t){return/&/.test(t)?t.replace(/&\\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var To=wo(`.`+bo,{\"&\":{position:`relative !important`,boxSizing:`border-box`,\"&.cm-focused\":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},\".cm-scroller\":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},\".cm-content\":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,\"&[contenteditable=true]\":{WebkitUserModify:`read-write-plaintext-only`}},\".cm-lineWrapping\":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},\"&light .cm-content\":{caretColor:`black`},\"&dark .cm-content\":{caretColor:`white`},\".cm-line\":{display:`block`,padding:`0 2px 0 6px`},\".cm-layer\":{userSelect:`none`,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:`#ddd`},\".cm-selectionHandle\":{backgroundColor:`currentColor`,width:`1.5px`},\".cm-selectionHandle-start::before, .cm-selectionHandle-end::before\":{content:`\"\"`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},\".cm-selectionHandle-start::before\":{top:`-8px`},\".cm-selectionHandle-end::before\":{bottom:`-8px`},\".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`,zIndex:200},\".cm-gutters-before\":{insetInlineStart:0},\".cm-gutters-after\":{insetInlineEnd:0},\"&light .cm-gutters\":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,\"&.cm-gutters-before\":{borderRightWidth:`1px`},\"&.cm-gutters-after\":{borderLeftWidth:`1px`}},\"&dark .cm-gutters\":{backgroundColor:`#333338`,color:`#ccc`},\".cm-gutter\":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},\".cm-gutterElement\":{boxSizing:`border-box`},\".cm-lineNumbers .cm-gutterElement\":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},\"&light .cm-activeLineGutter\":{backgroundColor:`#e2f2ff`},\"&dark .cm-activeLineGutter\":{backgroundColor:`#222227`},\".cm-panels\":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},\"&light .cm-panels\":{backgroundColor:`#f5f5f5`,color:`black`},\".cm-panels-top\":{top:`0`},\".cm-panels-bottom\":{bottom:`0`},\"&light .cm-panels-top\":{borderBottom:`1px solid #ddd`},\"&light .cm-panels-bottom\":{borderTop:`1px solid #ddd`},\"&dark .cm-panels\":{backgroundColor:`#333338`,color:`white`},\".cm-dialog\":{padding:`2px 19px 4px 6px`,position:`relative`,\"& label\":{fontSize:`80%`}},\".cm-dialog-close\":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},\".cm-tab\":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},\".cm-widgetBuffer\":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},\".cm-placeholder\":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},\".cm-highlightSpace\":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},\".cm-highlightTab\":{backgroundImage:`url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"20\"><path stroke=\"%23888\" stroke-width=\"1\" fill=\"none\" d=\"M1 10H196L190 5M190 15L196 10M197 4L197 16\"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},\".cm-trailingSpace\":{backgroundColor:`#ff332255`},\".cm-button\":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},\"&light .cm-button\":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,\"&:active\":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},\"&dark .cm-button\":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,\"&:active\":{backgroundImage:`linear-gradient(#111, #333)`}},\".cm-textfield\":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},\"&light .cm-textfield\":{backgroundColor:`white`},\"&dark .cm-textfield\":{border:`1px solid #555`,backgroundColor:`inherit`}},Co),Eo={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Do=F.ie&&F.ie_version<=11,Oo=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new En,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 e of t)this.queue.push(e);(F.ie&&F.ie_version<=11||F.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&F.android&&e.constructor.EDIT_CONTEXT!==!1&&!(F.chrome&&F.chrome_version<126)&&(this.editContext=new Mo(e),e.state.facet(Cr)&&(e.contentDOM.editContext=this.editContext.editContext)),Do&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),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,n)=>t!=e[n]))){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:n}=this,r=this.selectionRange;if(n.state.facet(Cr)?n.root.activeElement!=this.dom:!mn(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(F.ie&&F.ie_version<=11||F.android&&F.chrome)&&!n.state.selection.main.empty&&r.focusNode&&gn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=fn(e.root);if(!t)return!1;let n=F.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&jo(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=mn(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Fn(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(R(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,Eo),Do&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Do&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Nn(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&e!=`Enter`||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&mn(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Gi(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=qi(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=ko(t,e.previousSibling||e.target.previousSibling,-1),r=ko(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}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(Cr)!=e.state.facet(Cr)&&(e.view.contentDOM.editContext=e.state.facet(Cr)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.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 ko(e,t,n){for(;t;){let r=H.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function Ao(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return gn(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function jo(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ao(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?Ao(e,n):null}var Mo=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=Xi(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=T.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));$i(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:h.of(n.text.slice(l.from,l.toB).split(`\n`))};if((F.mac||F.android)&&u.from==a-1&&/^\\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:h.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Ji(e,u,T.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\\\p{Alphabetic}\\\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(L.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:xr.of(L.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=fn(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},G=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,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&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Pn(e.parent)||document,this.viewState=new so(this,e.state||A.create(e)),e.scrollTo&&e.scrollTo.is(br)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(e=>new Er(e));for(let e of this.plugins)e.update(this);this.observer=new Oo(this),this.inputState=new ea(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mi(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof O?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Ma))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Na(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(A.phrases)!=this.state.facet(A.phrases))return this.setState(a);i=Br.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new yr(t.empty?t:T.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(br)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Fo.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Rr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(vo)!=i.state.facet(vo)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(dr))try{e(i)}catch(e){Sr(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!qi(this,u)&&l.force&&Nn(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw 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 e of this.plugins)e.destroy(this);this.viewState=new so(this,e),this.plugins=e.facet(Tr).map(e=>new Er(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new mi(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(Tr),n=e.state.facet(Tr);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Er(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Sr(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(In(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return Sr(this.state,e),Po}}),u=Br.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=Po)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){Sr(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(F.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(dr))e(t)}get themeClasses(){return bo+` `+(this.state.facet(yo)?So:xo)+` `+this.state.facet(vo)}updateAttrs(){let e=Io(this,Dr,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(Cr)?`true`:`false`,class:`cm-content`,style:`${F.tabSize}: ${this.state.tabSize}`,role:`textbox`,\"aria-multiline\":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Io(this,Or,t);let n=this.observer.ignore(()=>{let n=en(this.contentDOM,this.contentAttrs,t),r=en(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Rr);let t=this.state.facet(e.cspNonce);At.mount(this.root,this.styleModules.concat(To).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==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,n){return Ii(this,e,ji(this,e,t,n))}moveByGroup(e,t){return Ii(this,e,ji(this,e,t,t=>Mi(this,e.head,t)))}visualLineSide(e,t){return t?T.cursor(e.to,1):T.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return Ai(this,e,t,n)}moveVertically(e,t,n){return Ii(this,e,Ni(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Ri(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Ri(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[Yn.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==z.RTL)}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(gr)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>No)return rr(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Xn(r.isolates,n=Pr(this,e))))return r.order;n||=Pr(this,e);let r=nr(e.text,t,n);return this.bidiCache.push(new Fo(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||F.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{An(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.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return br.of(new yr(typeof e==`number`?T.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return br.of(new yr(T.cursor(n.from),`start`,`start`,n.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 V.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return V.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=At.newName(),r=[vo.of(n),Rr.of(wo(`.${n}`,e))];return t&&t.dark&&r.push(yo.of(!0)),r}static baseTheme(e){return ke.lowest(Rr.of(wo(`.`+bo,e,Co)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&H.get(t)||H.get(e))?.root?.view||null}};G.styleModule=Rr,G.inputHandler=fr,G.clipboardInputFilter=mr,G.clipboardOutputFilter=hr,G.scrollHandler=vr,G.focusChangeEffect=pr,G.perLineTextDirection=gr,G.exceptionSink=ur,G.updateListener=dr,G.editable=Cr,G.mouseSelectionStyle=lr,G.dragMovesSelection=cr,G.clickAddsSelectionRange=sr,G.decorations=kr,G.blockWrappers=Ar,G.outerDecorations=jr,G.atomicRanges=Mr,G.bidiIsolatedRanges=Nr,G.cursorScrollMargin=E.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),G.scrollMargins=Ir,G.darkTheme=yo,G.cspNonce=E.define({combine:e=>e.length?e[0]:``}),G.contentAttributes=Or,G.editorAttributes=Dr,G.lineWrapping=G.contentAttributes.of({class:`cm-lineWrapping`}),G.announce=D.define();var No=4096,Po={},Fo=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:z.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Io(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&Xt(a,n)}return n}var Lo=F.mac?`mac`:F.windows?`win`:F.linux?`linux`:`key`;function Ro(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function zo(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var Bo=ke.default(G.domEventHandlers({keydown(e,t){return Yo(Uo(t.state),e,t,`editor`)}})),Vo=E.define({enables:Bo}),Ho=new WeakMap;function Uo(e){let t=e.facet(Vo),n=Ho.get(t);return n||Ho.set(t,n=qo(t.reduce((e,t)=>e.concat(t),[]))),n}function Wo(e,t,n){return Yo(Uo(e.state),t,e,n)}var Go=null,Ko=4e3;function qo(e,t=Lo){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>Ro(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Go={view:t,prefix:n,scope:e};return setTimeout(()=>{Go==r&&(Go=null)},Ko),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Jo))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var Jo=null;function Yo(e,t,n,r){Jo=t;let i=Rt(t),a=se(C(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Go&&Go.view==n&&Go.scope==r&&(o=Go.prefix+` `,oa.indexOf(t.keyCode)<0&&(c=!0,Go=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+zo(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(F.windows&&t.ctrlKey&&t.altKey)&&!(F.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Nt[t.keyCode])&&p!=i?(d(f[o+zo(p,t,!0)])||t.shiftKey&&(m=Pt[t.keyCode])!=i&&m!=p&&d(f[o+zo(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+zo(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Jo=null,s}var Xo=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(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(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Zo(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return $o(t,n,r)}};function Zo(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==z.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Qo(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function $o(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==z.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Zo(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=ki(e,r,1),m=ki(e,i,-1),h=p.type==I.Text?p:null,g=m.type==I.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=Qo(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=Qo(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):ee(p,!1),r=g?y(null,n.to,g):ee(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==I.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Xo(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==z.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function ee(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function es(e,t){return e.constructor==t.constructor&&e.eq(t)}var ts=class{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(ns)!=e.state.facet(ns)&&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,n=e.facet(ns);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!es(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,F.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},ns=E.define();function rs(e){return[V.define(t=>new ts(t,e)),ns.of(e)]}var is=!F.ios,as=E.define({combine(e){return at(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function os(e={}){return[as.of(e),cs,us,fs,_r.of(!0)]}function ss(e){return e.startState.facet(as)!=e.state.facet(as)}var cs=rs({above:!0,markers(e){let{state:t}=e,n=t.facet(as),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&F.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:T.cursor(i.head,i.assoc);for(let i of Xo.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=ss(e);return n&&ls(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){ls(t.state,e)},class:`cm-cursorLayer`});function ls(e,t){t.style.animationDuration=e.facet(as).cursorBlinkRate+`ms`}var us=rs({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(is||i!=n))for(let n of Xo.forRange(e,`cm-selectionBackground`,i))t.push(n);if(F.ios&&!n.empty&&e.state.facet(as).iosSelectionHandles){for(let r of Xo.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,T.cursor(n.from,1)))t.push(r);for(let r of Xo.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,T.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||ss(e)},class:`cm-selectionLayer`}),ds=F.gecko&&F.gecko_version==153?`#ffffff01`:`transparent`,fs=ke.highest(G.theme({\".cm-line\":{...is?{\"& ::selection, &::selection\":{backgroundColor:`${ds} !important`}}:{},caretColor:`transparent !important`},\".cm-content\":{caretColor:`transparent !important`,\"& :focus\":{caretColor:`initial !important`,...is?{\"&::selection, & ::selection\":{backgroundColor:`Highlight !important`}}:{}}}}));/x/.unicode;function ps(){return hs}var ms=L.line({class:`cm-activeLine`}),hs=V.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(ms.range(i.from)),t=i.from)}return L.set(n)}},{decorations:e=>e.decorations}),gs=class extends nn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?hn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=xn(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function _s(e){let t=V.fromClass(class{constructor(t){this.view=t,this.placeholder=e?L.set([L.widget({widget:new gs(e),side:1}).range(0)]):L.none}get decorations(){return this.view.state.doc.length?L.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,G.contentAttributes.of({\"aria-placeholder\":e})]:t}var vs=`-10000px`,ys=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function bs(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function xs(e){let{left:t,right:n}=bs(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Ss=E.define({combine:e=>({position:F.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||xs})}),Cs=new WeakMap,ws=V.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Ss);this.position=t.position,this.parent=t.parent,this.classes=e.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 ys(e,Os,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.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 e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Ss);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=vs,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(F.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=bs(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=Lr(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Ss).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=vs;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Cs.get(c)??d.bottom-d.top,g=c.offset||Ds,_=this.view.textDirection==z.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let ee=(y?u.top-n.top:n.bottom-u.bottom)-p;if(ee<h&&c.resize!==!1){if(ee<this.view.defaultLineHeight){l.style.top=vs;continue}Cs.set(c,h),l.style.height=(h=ee)/i+`px`}else l.style.height&&(l.style.height=``);let b=y?u.top-h-p-g.y:u.bottom+p+g.y,x=v+m;if(c.overlap!==!0)for(let e of a)e.left<x&&e.right>v&&e.top<b+h&&e.bottom>b&&(b=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(b-e.parent.top)/i+`px`,Ts(l,(v-e.parent.left)/r)):(l.style.top=b/i+`px`,Ts(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:b,right:x,bottom:b+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.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 e of this.manager.tooltipViews)e.dom.style.top=vs}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ts(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var Es=G.baseTheme({\".cm-tooltip\":{zIndex:500,boxSizing:`border-box`},\"&light .cm-tooltip\":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},\"&light .cm-tooltip-section:not(:first-child)\":{borderTop:`1px solid #bbb`},\"&dark .cm-tooltip\":{backgroundColor:`#333338`,color:`white`},\".cm-tooltip-arrow\":{height:`7px`,width:`14px`,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`}}}),Ds={x:0,y:0},Os=E.define({enables:[ws,Es]});function ks(e,t){let n=e.plugin(ws);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var As=E.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function js(e,t){let n=e.plugin(Ms),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var Ms=V.fromClass(class{constructor(e){this.input=e.state.facet(Fs),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(As);this.top=new Ns(e,!0,t.topContainer),this.bottom=new Ns(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(As);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ns(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ns(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Fs);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>G.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),Ns=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,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(),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`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Ps(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ps(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 Ps(e){let t=e.nextSibling;return e.remove(),t}var Fs=E.define({enables:Ms});function Is(e,t){let n,r=new Promise(e=>n=e),i=e=>Vs(e,t,n);e.state.field(Rs,!1)?e.dispatch({effects:zs.of(i)}):e.dispatch({effects:D.appendConfig.of(Rs.init(()=>[i]))});let a=Bs.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Rs).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function Ls(e,t){let n=e.state.field(Rs,!1)||[];for(let r of n){let n=js(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var Rs=Ee.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(zs)?e=[n.value].concat(e):n.is(Bs)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Fs.computeN([e],t=>t.field(e))}),zs=D.define(),Bs=D.define();function Vs(e,t,n){let r=t.content?t.content(e,()=>s(null)):null;if(!r){if(r=N(`form`),t.input){let e=N(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(N(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(N(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),s(null)):e.keyCode==13&&(e.preventDefault(),s(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),s(t)})}let a=N(`div`,r,N(`button`,{onclick:()=>s(null),\"aria-label\":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);let o=typeof t.focus==`string`?r.querySelector(t.focus):t.focus?r.querySelector(`input`)||r.querySelector(`button`):null;function s(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{o&&(`select`in o?o.select():`focus`in o&&o.focus())},destroy:()=>n(null)}}var Hs=class extends ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Hs.prototype.elementClass=``,Hs.prototype.toDOM=void 0,Hs.prototype.mapMode=le.TrackBefore,Hs.prototype.startSide=Hs.prototype.endSide=-1,Hs.prototype.point=!0;var Us=E.define(),Ws=E.define(),Gs=E.define(),Ks=E.define({combine:e=>e.some(e=>e)});function qs(e){let t=[Js];return e&&e.fixed===!1&&t.push(Ks.of(!0)),t}var Js=V.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(Gs).map(t=>new Qs(e,t)),this.fixed=!e.state.facet(Ks);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Ks)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=j.iter(this.view.state.facet(Us),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Zs(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==I.Text&&t){Xs(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==I.Text){Xs(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Gs),n=e.state.facet(Gs),r=e.docChanged||e.heightChanged||e.viewportChanged||!j.eq(e.startState.facet(Us),e.state.facet(Us),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new Qs(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>G.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==z.LTR?{left:r,right:i}:{right:r,left:i}})});function Ys(e){return Array.isArray(e)?e:[e]}function Xs(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var Zs=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=j.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new $s(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Xs(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;(r.length!=0||a.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(Ws)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Qs=class{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 n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=Ys(t.markers(e)),t.initialSpacer&&(this.spacer=new $s(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=Ys(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!j.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},$s=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),ec(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function ec(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var tc=E.define(),nc=E.define(),rc=E.define({combine(e){return at(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),ic=class extends Hs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function ac(e,t){return e.state.facet(rc).formatNumber(t,e.state)}var oc=Gs.compute([rc],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(tc)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new ic(ac(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(nc)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(rc)!=e.state.facet(rc),initialSpacer(e){return new ic(ac(e,cc(e.state.doc.lines)))},updateSpacer(e,t){let n=ac(t.view,cc(t.view.state.doc.lines));return n==e.number?e:new ic(n)},domEventHandlers:e.facet(rc).domEventHandlers,side:`before`}));function sc(e={}){return[rc.of(e),qs(),oc]}function cc(e){let t=9;for(;t<e;)t=t*10+9;return t}var lc=new class extends Hs{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},uc=Us.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(lc.range(i)))}return j.of(t)});function dc(){return uc}var fc=1024,pc=0,mc=class{constructor(e,t){this.from=e,this.to=t}},K=class{constructor(e={}){this.id=pc++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=_c.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};K.closedBy=new K({deserialize:e=>e.split(` `)}),K.openedBy=new K({deserialize:e=>e.split(` `)}),K.group=new K({deserialize:e=>e.split(` `)}),K.isolate=new K({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),K.contextHash=new K({perNode:!0}),K.lookAhead=new K({perNode:!0}),K.mounted=new K({perNode:!0});var hc=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[K.mounted.id]}},gc=Object.create(null),_c=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):gc,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.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(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(K.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(K.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};_c.none=new _c(``,Object.create(null),0,8);var vc=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new _c(e.name,r,e.id,e.flags):e)}return new e(n)}},yc=new WeakMap,bc=new WeakMap,q;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(q||={});var J=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=hc.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new Pc(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new Pc(yc.get(this)||this.topNode);return r.moveTo(e,t),yc.set(this,r._tree),r}get topNode(){return new Ec(this,0,0,null)}resolve(e,t=0){let n=wc(yc.get(this)||this.topNode,e,t,!1);return yc.set(this,n),n}resolveInner(e,t=0){let n=wc(bc.get(this)||this.topNode,e,t,!0);return bc.set(this,n),n}resolveStack(e,t=0){return Nc(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&q.IncludeAnonymous)>0;for(let e=this.cursor(a|q.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:zc(_c.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(_c.none,t,n,r)))}static build(e){return Ic(e)}};J.empty=new J(_c.none,[],[],0);var xc=class e{constructor(e,t){this.buffer=e,this.index=t}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 e(this.buffer,this.index)}},Sc=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return _c.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(Cc(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function Cc(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function wc(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof Ec&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:q.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Ec&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var Tc=class{cursor(e=0){return new Pc(this,e)}getChild(e,t=null,n=null){let r=Dc(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Dc(this,e,t,n)}resolve(e,t=0){return wc(this,e,t,!1)}resolveInner(e,t=0){return wc(this,e,t,!0)}matchContext(e){return Oc(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},Ec=class e extends Tc{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&q.EnterBracketed&&l instanceof J&&(d=hc.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||Cc(i,r,u,u+l.length)){if(l instanceof Sc){if(a&q.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Ac(new kc(o,l,t,u),null,e)}else if(a&q.IncludeAnonymous||!l.type.isAnonymous||Fc(l)){let s;if(!(a&q.IgnoreMounts)&&(s=hc.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&q.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&q.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&q.IgnoreOverlays)&&(i=hc.get(this._tree))&&i.overlay){let a=t-this.from,o=r&q.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}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 Dc(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function Oc(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var kc=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Ac=class e extends Tc{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(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&q.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new J(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function jc(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof Ec&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Mc(i,n)}var Mc=class{constructor(e,t){this.heads=e,this.node=t}get next(){return jc(this.heads)}};function Nc(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Ec?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=hc.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Ec(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(wc(o,t,n,!1))}}return i?jc(i):r}var Pc=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~q.EnterBracketed,e instanceof Ec)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Ec?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&q.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&q.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&q.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&q.IncludeAnonymous||e instanceof Sc||!e.type.isAnonymous||Fc(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new Ac(this.buffer,t,this.stack[e]);return this.bufferNode=new Ac(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return Oc(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return Oc(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function Fc(e){return e.children.some(e=>e instanceof Sc||!e.type.isAnonymous||Fc(e))}function Ic(e){let{buffer:t,nodeSet:n,maxBufferLength:r=fc,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new xc(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,ee){let{id:b,start:x,end:te,size:ne}=o,re=l,S=c;if(ne<0){if(o.next(),ne==-1){let t=i[b];_.push(t),v.push(x-e);return}if(ne==-3){c=b;return}if(ne==-4){l=b;return}throw RangeError(`Unrecognized record size: ${ne}`)}let ie=s[b],ae,C,oe=x-e;if(te-x<=r&&(C=h(o.pos-t,y))){let t=new Uint16Array(C.size-C.skip),r=o.pos-C.size,i=t.length;for(;o.pos>r;)i=g(C.start,t,i);ae=new Sc(t,te-C.start,n),oe=C.start-e}else{let e=o.pos-ne;o.next();let t=[],s=[],c=b>=a?b:-1,h=0,g=te,_=re;for(;o.pos>e;)c>=0&&o.id==c&&o.size>=0?(o.end<=g-r&&(p(t,s,x,h,o.end,g,c,_,S),h=t.length,g=o.end,_=l),o.next()):ee>2500?d(x,e,t,s):(c>=0&&o.size==-1&&i[o.id].type==n.types[c]&&(h<t.length&&p(t,s,x,h,o.end,g,c,_,S),h=t.length+1,g=o.start,_=l),u(x,e,t,s,c,ee+1));if(c>=0&&h>0&&h<t.length&&p(t,s,x,h,x,g,c,_,S),t.reverse(),s.reverse(),c>-1&&h>0){let e=f(ie,S);ae=zc(ie,t,s,0,t.length,0,te-x,e,e)}else ae=m(ie,t,s,te-x,re-te,S)}_.push(ae),v.push(oe)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new Sc(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof J){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(K.lookAhead))&&(a=r[o]+s.length+c-i)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[K.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[K.lookAhead,i];o=o?[e].concat(o):[e]}return new J(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new J(s[e.topID],_.reverse(),v.reverse(),y)}var Lc=new WeakMap;function Rc(e,t){if(!e.isAnonymous||t instanceof Sc||t.type!=e)return 1;let n=Lc.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof J)){n=1;break}n+=Rc(e,r)}Lc.set(t,n)}return n}function zc(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=Rc(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=Rc(e,t[s]);for(s++;s<i;s++){let n=Rc(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(zc(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var Bc=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},Vc=class{startParse(e,t,n){return typeof e==`string`&&(e=new Hc(e)),n=n?n.length?n.map(e=>new mc(e.from,e.to)):[new mc(0,0)]:[new mc(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},Hc=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new K({perNode:!0});var Uc=0,Wc=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Uc++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Kc(e);return e=>e.modified.indexOf(t)>-1?e:Kc.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Gc=0,Kc=class e{constructor(e){this.name=e,this.instances=[],this.id=Gc++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&qc(n,e.modified));if(r)return r;let i=[],a=new Wc(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Jc(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function qc(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Jc(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Yc(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`\"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new Zc(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Xc.add(t)}var Xc=new K({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new Zc(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Zc=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Zc.empty=new Zc([],2,null);function Qc(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function $c(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function el(e,t,n,r=0,i=e.length){let a=new tl(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var tl=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=nl(e)||Zc.empty,u=$c(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(K.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function nl(e){let t=e.type.prop(Xc);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Y=Wc.define,rl=Y(),il=Y(),al=Y(il),ol=Y(il),sl=Y(),cl=Y(sl),ll=Y(sl),ul=Y(),dl=Y(ul),fl=Y(),pl=Y(),ml=Y(),hl=Y(ml),gl=Y(),X={comment:rl,lineComment:Y(rl),blockComment:Y(rl),docComment:Y(rl),name:il,variableName:Y(il),typeName:al,tagName:Y(al),propertyName:ol,attributeName:Y(ol),className:Y(il),labelName:Y(il),namespace:Y(il),macroName:Y(il),literal:sl,string:cl,docString:Y(cl),character:Y(cl),attributeValue:Y(cl),number:ll,integer:Y(ll),float:Y(ll),bool:Y(sl),regexp:Y(sl),escape:Y(sl),color:Y(sl),url:Y(sl),keyword:fl,self:Y(fl),null:Y(fl),atom:Y(fl),unit:Y(fl),modifier:Y(fl),operatorKeyword:Y(fl),controlKeyword:Y(fl),definitionKeyword:Y(fl),moduleKeyword:Y(fl),operator:pl,derefOperator:Y(pl),arithmeticOperator:Y(pl),logicOperator:Y(pl),bitwiseOperator:Y(pl),compareOperator:Y(pl),updateOperator:Y(pl),definitionOperator:Y(pl),typeOperator:Y(pl),controlOperator:Y(pl),punctuation:ml,separator:Y(ml),bracket:hl,angleBracket:Y(hl),squareBracket:Y(hl),paren:Y(hl),brace:Y(hl),content:ul,heading:dl,heading1:Y(dl),heading2:Y(dl),heading3:Y(dl),heading4:Y(dl),heading5:Y(dl),heading6:Y(dl),contentSeparator:Y(ul),list:Y(ul),quote:Y(ul),emphasis:Y(ul),strong:Y(ul),link:Y(ul),monospace:Y(ul),strikethrough:Y(ul),inserted:Y(),deleted:Y(),changed:Y(),invalid:Y(),meta:gl,documentMeta:Y(gl),annotation:Y(gl),processingInstruction:Y(gl),definition:Wc.defineModifier(`definition`),constant:Wc.defineModifier(`constant`),function:Wc.defineModifier(`function`),standard:Wc.defineModifier(`standard`),local:Wc.defineModifier(`local`),special:Wc.defineModifier(`special`)};for(let e in X){let t=X[e];t instanceof Wc&&(t.name=e)}Qc([{tag:X.link,class:`tok-link`},{tag:X.heading,class:`tok-heading`},{tag:X.emphasis,class:`tok-emphasis`},{tag:X.strong,class:`tok-strong`},{tag:X.keyword,class:`tok-keyword`},{tag:X.atom,class:`tok-atom`},{tag:X.bool,class:`tok-bool`},{tag:X.url,class:`tok-url`},{tag:X.labelName,class:`tok-labelName`},{tag:X.inserted,class:`tok-inserted`},{tag:X.deleted,class:`tok-deleted`},{tag:X.literal,class:`tok-literal`},{tag:X.string,class:`tok-string`},{tag:X.number,class:`tok-number`},{tag:[X.regexp,X.escape,X.special(X.string)],class:`tok-string2`},{tag:X.variableName,class:`tok-variableName`},{tag:X.local(X.variableName),class:`tok-variableName tok-local`},{tag:X.definition(X.variableName),class:`tok-variableName tok-definition`},{tag:X.special(X.variableName),class:`tok-variableName2`},{tag:X.definition(X.propertyName),class:`tok-propertyName tok-definition`},{tag:X.typeName,class:`tok-typeName`},{tag:X.namespace,class:`tok-namespace`},{tag:X.className,class:`tok-className`},{tag:X.macroName,class:`tok-macroName`},{tag:X.propertyName,class:`tok-propertyName`},{tag:X.operator,class:`tok-operator`},{tag:X.comment,class:`tok-comment`},{tag:X.meta,class:`tok-meta`},{tag:X.invalid,class:`tok-invalid`},{tag:X.punctuation,class:`tok-punctuation`}]);var _l=new K;function vl(e){return E.define({combine:e?t=>t.concat(e):void 0})}var yl=new K,bl=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,A.prototype.hasOwnProperty(`tree`)||Object.defineProperty(A.prototype,\"tree\",{get(){return Z(this)}}),this.parser=t,this.extension=[jl.of(this),A.languageData.of((e,t,n)=>{let r=xl(e,t,n),i=r.type.prop(_l);if(!i)return[];let a=e.facet(i),o=r.type.prop(yl);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return xl(e,t,n).type.prop(_l)==this.data}findRegions(e){let t=e.facet(jl);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(_l)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(K.mounted);if(i){if(i.tree.prop(_l)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof J&&r(i,e.positions[n]+t)}};return r(Z(e),0),n}get allowsNesting(){return!0}};bl.setState=D.define();function xl(e,t,n){let r=e.facet(jl),i=Z(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,q.ExcludeBuffers|q.EnterBracketed))e.type.isTop&&(i=e);return i}var Sl=class e extends bl{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=vl(t.languageData);return new e(n,t.parser.configure({props:[_l.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function Z(e){let t=e.field(bl.state,!1);return t?t.tree:J.empty}var Cl=class{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 n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},wl=null,Tl=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],J.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Cl(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=J.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(Bc.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=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(Bc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wl;wl=this;try{return e()}finally{wl=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=El(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=Bc.applyChanges(r,e),i=J.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=El(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Vc{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=wl;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new J(_c.none,[],[],a-i)},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 wl}};function El(e,t,n){return Bc.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var Dl=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Tl.create(t.facet(jl).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};bl.state=Ee.define({create:Dl.init,update(e,t){for(let e of t.effects)if(e.is(bl.setState))return e.value;return t.startState.facet(jl)==t.state.facet(jl)?e.apply(t):Dl.init(t.state)}});var Ol=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(Ol=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var kl=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,Al=V.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(bl.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(bl.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Ol(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(bl.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!kl?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>kl&&kl()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:bl.setState.of(new Dl(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Sr(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),jl=E.define({combine(e){return e.length?e[0]:null},enables:e=>[bl.state,Al,G.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{\"data-language\":n.name}:{}})]}),Ml=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Nl=E.define(),Pl=E.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function Fl(e){let t=e.facet(Pl);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Il(e,t){let n=``,r=e.tabSize,i=e.facet(Pl)[0];if(i==`\t`){for(;t>=r;)n+=`\t`,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function Ll(e,t){e instanceof A&&(e=new Rl(e));for(let n of e.state.facet(Nl)){let r=n(e,t);if(r!==void 0)return r}let n=Z(e.state);return n.length>=t?Bl(e,n,t):null}var Rl=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Fl(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\\S|$/))),i}countColumn(e,t=e.length){return wt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},zl=new K;function Bl(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return Vl(r,e,n)}function Vl(e,t,n){for(let r=e;r;r=r.next){let e=Ul(r.node);if(e)return e(Gl.create(t,n,r))}return 0}function Hl(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Ul(e){let t=e.type.prop(zl);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(K.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Jl(e,!0,1,void 0,n&&!Hl(e)?t.from:void 0)}return e.parent==null?Wl:null}function Wl(){return 0}var Gl=class e extends Rl{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}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 n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Kl(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Vl(this.context.next,this.base,this.pos)}};function Kl(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function ql(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Jl(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?ql(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function Yl({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Xl=new K,Zl=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=At.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof bl?e=>e.prop(_l)==a.data:a?e=>e==a:void 0,this.style=Qc(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new At(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},Ql=E.define(),$l=E.define({combine(e){return e.length?[e[0]]:null}});function eu(e){let t=e.facet(Ql);return t.length?t:e.facet($l)}function tu(e,t){let n=[ru],r;return e instanceof Zl&&(e.module&&n.push(G.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push($l.of(e)):r?n.push(Ql.computeN([G.darkTheme],t=>t.facet(G.darkTheme)==(r==`dark`)?[e]:[])):n.push(Ql.of(e)),n}var nu=class{constructor(e){this.markCache=Object.create(null),this.tree=Z(e.state),this.decorations=this.buildDeco(e,eu(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Z(e.state),n=eu(e.state),r=n!=eu(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return L.none;let n=new pt;for(let{from:r,to:i}of e.visibleRanges)el(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=L.mark({class:r})))},r,i);return n.finish()}},ru=ke.high(V.fromClass(nu,{decorations:e=>e.decorations}));X.meta,X.link,X.heading,X.emphasis,X.strong,X.strikethrough,X.keyword,X.atom,X.bool,X.url,X.contentSeparator,X.labelName,X.literal,X.inserted,X.string,X.deleted,X.regexp,X.escape,X.string,X.variableName,X.variableName,X.typeName,X.namespace,X.className,X.variableName,X.macroName,X.propertyName,X.comment,X.invalid;var iu=G.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:`#328c8252`},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:`#bb555544`}}),au=1e4,ou=`()[]{}`,su=E.define({combine(e){return at(e,{afterCursor:!0,brackets:ou,maxScanDistance:au,renderMatch:uu})}}),cu=L.mark({class:`cm-matchingBracket`}),lu=L.mark({class:`cm-nonmatchingBracket`});function uu(e){let t=[],n=e.matched?cu:lu;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function du(e){let t=[],n=e.facet(su);for(let r of e.selection.ranges){if(!r.empty)continue;let i=_u(e,r.head,-1,n)||r.head>0&&_u(e,r.head-1,1,n)||n.afterCursor&&(_u(e,r.head,1,n)||r.head<e.doc.length&&_u(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return L.set(t,!0)}var fu=[V.fromClass(class{constructor(e){this.paused=!1,this.decorations=du(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=du(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),iu];function pu(e={}){return[su.of(e),fu]}var mu=new K;function hu(e,t,n){let r=e.prop(t<0?K.openedBy:K.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function gu(e){let t=e.type.prop(mu);return t?t(e.node):e}function _u(e,t,n,r={}){let i=r.maxScanDistance||au,a=r.brackets||ou,o=Z(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=hu(r.type,n,a);if(i&&r.from<r.to){let o=gu(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return vu(e,t,n,r,o,i,a)}}return yu(e,t,n,o,s.type,i,a)}function vu(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=gu(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(hu(u.type,n,o))l++;else if(hu(u.type,-n,o)){if(l==0){let e=gu(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function yu(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var bu=Object.create(null),xu=[_c.none],Su=[],Cu=Object.create(null),wu=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])wu[e]=Eu(bu,t);function Tu(e,t){Su.indexOf(e)>-1||(Su.push(e),console.warn(t))}function Eu(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||X[n];r?typeof r==`function`?t.length?t=t.map(r):Tu(n,`Modifier ${n} used at start of tag`):t.length?Tu(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Tu(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=Cu[i];if(a)return a.id;let o=Cu[i]=_c.define({id:xu.length,name:r,props:[Yc({[r]:n})]});return xu.push(o),o.id}z.RTL,z.LTR;var Du=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Z(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),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Pu(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Ou(e){let t=Object.keys(e).join(``),n=/\\w/.test(t);return n&&(t=t.replace(/\\w/g,``)),`[${n?`\\\\w`:``}${t.replace(/[^\\w\\s]/g,`\\\\$&`)}]`}function ku(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Ou(t)+Ou(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Au(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\\w+$/.test(e.label))?[/\\w*$/,/\\w+$/]:ku(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ju(e,t){return n=>{for(let t=Z(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var Mu=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Nu(e){return e.selection.main.from}function Pu(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var Fu=We.define();function Iu(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:T.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Lu=new WeakMap;function Ru(e){if(!Array.isArray(e))return e;let t=Lu.get(e);return t||Lu.set(e,t=Au(e)),t}var zu=D.define(),Bu=D.define(),Vu=class{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<e.length;){let n=C(e,t),r=se(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(C(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=C(e,0),i=se(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=C(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=se(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=C(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=oe(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=se(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?se(C(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Hu=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},Q=E.define({combine(e){return at(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Wu,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Uu(e(n),t(n)),optionClass:(e,t)=>n=>Uu(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Uu(e,t){return e?t?e+` `+t:e:t}function Wu(e,t,n,r,i,a){let o=e.textDirection==z.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var Gu=D.define();function Ku(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function qu(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var Ju=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(Q);this.optionContent=Ku(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=qu(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:Gu.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Q).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Bu.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=qu(r.length,i,e.state.facet(Q).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);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;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=qu(t.options.length,t.selected,this.view.state.facet(Q).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>Sr(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&Xu(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(Q).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function Yu(e,t){return n=>new Ju(n,e,t)}function Xu(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function Zu(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function Qu(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(Q);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Mu(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Hu(n):new Vu(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Mu(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):Zu(e.completion)>Zu(c)&&(s[s.length-1]=e),c=e.completion}return s}var $u=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,id(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=Qu(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(Q).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,id(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:pd,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ed=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(ad,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Q),i=(r.override||n.languageDataAt(`autocomplete`,Nu(n)).map(Ru)).map(e=>(this.active.find(t=>t.source==e)||new sd(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(ud));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!td(i,this.active)||o?a=$u.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new sd(e.source,0):e));for(let e of t.effects)e.is(Gu)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?nd:rd}};function td(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var nd={\"aria-autocomplete\":`list`},rd={};function id(e,t){let n={\"aria-autocomplete\":`list`,\"aria-haspopup\":`listbox`,\"aria-controls\":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var ad=[];function od(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Fu);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var sd=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=od(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(zu))i=new e(i.source,1,n.value);else if(n.is(Bu))i=new e(i.source,0);else if(n.is(ud))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Nu(e.state))}},cd=class e extends sd{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Nu(t.state);if(o>a||!r||n&2&&(Nu(t.startState)==this.from||o<this.limit))return new sd(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return ld(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Du(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??Nu(t.state)):new sd(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new sd(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ld(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Pu(e,!0).test(i)}var ud=D.define({map(e,t){return e.map(e=>e.map(t))}}),dd=Ee.define({create(){return ed.start()},update(e,t){return e.update(t)},provide:e=>[Os.from(e,e=>e.tooltip),G.contentAttributes.from(e,e=>e.attrs)]});function fd(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(dd).active.find(e=>e.source==t.source);return r instanceof cd&&(typeof n==`string`?e.dispatch({...Iu(e.state,n,r.from,r.to),annotations:Fu.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var pd=Yu(dd,fd);function md(e,t=`option`){return n=>{let r=n.state.field(dd,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Q).interactionDelay)return!1;let i=1,a;t==`page`&&(a=ks(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:Gu.of(s)}),!0}}var hd=e=>{let t=e.state.field(dd,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Q).interactionDelay?!1:fd(e,t.open.options[t.open.selected])},gd=e=>e.state.field(dd,!1)?(e.dispatch({effects:zu.of(!0)}),!0):!1,_d=e=>{let t=e.state.field(dd,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Bu.of(null)}),!0)},vd=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},yd=50,bd=1e3,xd=V.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(dd).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(dd),n=e.state.facet(Q);if(!e.selectionSet&&!e.docChanged&&e.startState.field(dd)==t)return;let r=e.transactions.some(e=>{let t=od(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>yd&&Date.now()-n.time>bd){for(let e of n.context.abortListeners)try{e()}catch(e){Sr(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(zu)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(dd);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Q).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Du(t,Nu(t),e.explicit,this.view),r=new vd(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Bu.of(null)}),Sr(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Q).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Q),n=this.view.state.field(dd);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=Nu(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new cd(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new sd(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ud.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(dd,!1);if(t&&t.tooltip&&this.view.state.facet(Q).closeOnBlur){let n=t.open&&ks(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:Bu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:zu.of(!1)}),20),this.composing=0}}}),Sd=typeof navigator==`object`&&/Win/.test(navigator.platform),Cd=ke.highest(G.domEventHandlers({keydown(e,t){let n=t.state.field(dd,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!e.key||e.key.length>1||e.ctrlKey&&!(Sd&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&fd(t,r),!1}})),wd=G.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`,cursor:`pointer`},\".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`}}}),Td={brackets:[`(`,`[`,`{`,`'`,`\"`],before:`)]}:;>`,stringPrefixes:[]},Ed=D.define({map(e,t){return t.mapPos(e,-1,le.TrackAfter)??void 0}}),Dd=new class extends ot{};Dd.startSide=1,Dd.endSide=-1;var Od=Ee.define({create(){return j.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Ed)&&(e=e.update({add:[Dd.range(n.value,n.value+1)]}));return e}});function kd(){return[Pd,Od]}var Ad=`()[]{}<>«»»«[]{}`;function jd(e){for(let t=0;t<16;t+=2)if(Ad.charCodeAt(t)==e)return Ad.charAt(t+1);return oe(e<128?e:e+1)}function Md(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Td}var Nd=typeof navigator==`object`&&/Android\\b/.test(navigator.userAgent),Pd=G.inputHandler.of((e,t,n,r)=>{if((Nd?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&se(C(r,0))==1||t!=i.from||n!=i.to)return!1;let a=Id(e.state,r);return a?(e.dispatch(a),!0):!1}),Fd=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Md(e,e.selection.main.head).brackets||Td.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=zd(e.doc,t.head);for(let i of n)if(i==r&&Rd(e.doc,t.head)==jd(C(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:T.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function Id(e,t){let n=Md(e,e.selection.main.head),r=n.brackets||Td.brackets;for(let i of r){let a=jd(C(i,0));if(t==i)return a==i?Hd(e,i,r.indexOf(i+i+i)>-1,n):Bd(e,i,a,n.before||Td.before);if(t==a&&Ld(e,e.selection.main.from))return Vd(e,i,a)}return null}function Ld(e,t){let n=!1;return e.field(Od).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Rd(e,t){let n=e.sliceString(t,t+2);return n.slice(0,se(C(n,0)))}function zd(e,t){let n=e.sliceString(t-2,t);return se(C(n,0))==n.length?n:n.slice(1)}function Bd(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Ed.of(a.to+t.length),range:T.range(a.anchor+t.length,a.head+t.length)};let o=Rd(e.doc,a.head);return!o||/\\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Ed.of(a.head+t.length),range:T.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function Vd(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&Rd(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:T.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function Hd(e,t,n,r){let i=r.stringPrefixes||Td.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Ed.of(r.to+t.length),range:T.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=Rd(e.doc,o),c;if(s==t){if(Ud(e,o))return{changes:{insert:t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};if(Ld(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:T.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=Gd(e,o-2*t.length,i))>-1&&Ud(e,c))return{changes:{insert:t+t+t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=k.Word&&Gd(e,o,i)>-1&&!Wd(e,o,t,i))return{changes:{insert:t+t,from:o},effects:Ed.of(o+t.length),range:T.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function Ud(e,t){let n=Z(e).resolveInner(t+1);return n.parent&&n.from==t}function Wd(e,t,n,r){let i=Z(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function Gd(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=k.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=k.Word)return n}return-1}function Kd(e={}){return[Cd,dd,Q.of(e),xd,Jd,wd]}var qd=[{key:`Ctrl-Space`,run:gd},{mac:\"Alt-`\",run:gd},{mac:`Alt-i`,run:gd},{key:`Escape`,run:_d},{key:`ArrowDown`,run:md(!0)},{key:`ArrowUp`,run:md(!1)},{key:`PageDown`,run:md(!0,`page`)},{key:`PageUp`,run:md(!1,`page`)},{key:`Enter`,run:hd}],Jd=ke.highest(Vo.computeN([Q],e=>e.facet(Q).defaultKeymap?[qd]:[])),Yd=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=ef(e.state,n.from);return r.line?Zd(e):r.block?$d(e):!1};function Xd(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Zd=Xd(of,0),Qd=Xd(af,0),$d=Xd((e,t)=>af(e,t,rf(t)),0);function ef(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var tf=50;function nf(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-tf,r),o=e.sliceDoc(i,i+tf),s=/\\s*$/.exec(a)[0].length,c=/^\\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+tf),d=e.sliceDoc(i-tf,i));let f=/^\\s*/.exec(u)[0].length,p=/\\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\\s/.test(d.charAt(m-1))}}:null}function rf(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:i.to})}return t}function af(e,t,n=t.selection.ranges){let r=n.map(e=>ef(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>nf(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function of(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=ef(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var sf=We.define(),cf=We.define(),lf=E.define(),uf=E.define({combine(e){return at(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),df=Ee.define({create(){return Af.empty},update(e,t){let n=t.state.facet(uf),r=t.annotation(sf);if(r){let i=vf.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?yf(o,o.length,n.minDepth,i):Tf(o,t.startState.selection),new Af(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(cf);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(O.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=vf.fromTransaction(t),o=t.annotation(O.time),s=t.annotation(O.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new Af(e.done.map(vf.fromJSON),e.undone.map(vf.fromJSON))}});function ff(e={}){return[df,uf.of(e),G.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?mf:e.inputType==`historyRedo`?hf:null;return n?(e.preventDefault(),n(t)):!1}})]}function pf(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(df,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var mf=pf(0,!1),hf=pf(1,!1),gf=pf(0,!0),_f=pf(1,!0),vf=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&de.fromJSON(t.changes),[],t.mapped&&ue.fromJSON(t.mapped),t.startSelection&&T.fromJSON(t.startSelection),t.selectionsAfter.map(T.fromJSON))}static fromTransaction(t,n){let r=Cf;for(let e of t.startState.facet(lf)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Cf)}static selection(t){return new e(void 0,Cf,void 0,void 0,t)}};function yf(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function bf(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function xf(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Sf(e,t){return e.length?t.length?e.concat(t):e:t}var Cf=[],wf=200;function Tf(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-wf));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),yf(e,e.length-1,1e9,n.setSelAfter(r)))}return[vf.selection([t])]}function Ef(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Df(e,t){if(!e.length)return e;let n=e.length,r=Cf;for(;n;){let i=Of(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[vf.selection(r)]:Cf}function Of(e,t,n){let r=Sf(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Cf,n);if(!e.changes)return vf.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new vf(i,D.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var kf=/^(input\\.type|delete)($|\\.)/,Af=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||kf.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,bf(s.changes,t.changes))||r==`input.type.compose`)?yf(o,o.length-1,i.minDepth,new vf(t.changes.compose(s.changes),Sf(D.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Cf)):yf(o,o.length,i.minDepth,t),new e(o,Cf,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Cf;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\\.)/.test(r)&&xf(a[a.length-1],t)?this:new e(Tf(this.done,t),this.undone,n,r)}addMapping(t){return new e(Df(this.done,t),Df(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:sf.of({side:e,rest:Ef(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Cf:r.slice(0,r.length-1);return i.mapped&&(n=Df(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:sf.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};Af.empty=new Af(Cf,Cf);var jf=[{key:`Mod-z`,run:mf,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:hf,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:hf,preventDefault:!0},{key:`Mod-u`,run:gf,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:_f,preventDefault:!0}];function Mf(e,t){return T.create(e.ranges.map(t),e.mainIndex)}function Nf(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Pf({state:e,dispatch:t},n){let r=Mf(e.selection,n);return!r.eq(e.selection,!0)&&(t(Nf(e,r)),!0)}function Ff(e,t){return T.cursor(t?e.to:e.from)}function If(e,t){return Pf(e,n=>n.empty?e.moveByChar(n,t):Ff(n,t))}function $(e){return e.textDirectionAt(e.state.selection.main.head)==z.LTR}var Lf=e=>If(e,!$(e)),Rf=e=>If(e,$(e));function zf(e,t){return Pf(e,n=>n.empty?e.moveByGroup(n,t):Ff(n,t))}var Bf=e=>zf(e,!$(e)),Vf=e=>zf(e,$(e));typeof Intl<`u`&&Intl.Segmenter;function Hf(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Uf(e,t,n){let r=Z(e).resolveInner(t.head),i=n?K.closedBy:K.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Hf(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?_u(e,r.from,1):_u(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,T.cursor(s,n?-1:1)}var Wf=e=>Pf(e,t=>Uf(e.state,t,!$(e))),Gf=e=>Pf(e,t=>Uf(e.state,t,$(e)));function Kf(e,t){return Pf(e,n=>{if(!n.empty)return Ff(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var qf=e=>Kf(e,!1),Jf=e=>Kf(e,!0);function Yf(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(G.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Xf(e,t){let n=Yf(e),{state:r}=e,i=Mf(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Ff(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=G.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(Nf(r,i),{effects:a}),!0}var Zf=e=>Xf(e,!1),Qf=e=>Xf(e,!0);function $f(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=T.cursor(r.from+n))}return i}var ep=e=>Pf(e,t=>$f(e,t,!0)),tp=e=>Pf(e,t=>$f(e,t,!1)),np=e=>Pf(e,t=>$f(e,t,!$(e))),rp=e=>Pf(e,t=>$f(e,t,$(e))),ip=e=>Pf(e,t=>e.moveToLineBoundary(t,!1,!1)),ap=e=>Pf(e,t=>e.moveToLineBoundary(t,!0,!1));function op(e,t,n){let r=!1,i=Mf(e.selection,t=>{let i=_u(e,t.head,-1)||_u(e,t.head,1)||t.head>0&&_u(e,t.head-1,1)||t.head<e.doc.length&&_u(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?T.range(t.anchor,a):T.cursor(a)});return r?(t(Nf(e,i)),!0):!1}var sp=({state:e,dispatch:t})=>op(e,t,!1);function cp(e,t,n){let r=Mf(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=T.range(e.head,e.anchor));let r=n(e);return T.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(Nf(e.state,r)),!0)}function lp(e,t){return cp(e,t,n=>e.moveByChar(n,t))}var up=e=>lp(e,!$(e)),dp=e=>lp(e,$(e));function fp(e,t){return cp(e,t,n=>e.moveByGroup(n,t))}var pp=e=>fp(e,!$(e)),mp=e=>fp(e,$(e)),hp=e=>{let t=!$(e);return cp(e,t,n=>Uf(e.state,n,t))},gp=e=>{let t=$(e);return cp(e,t,n=>Uf(e.state,n,t))};function _p(e,t){return cp(e,t,n=>e.moveVertically(n,t))}var vp=e=>_p(e,!1),yp=e=>_p(e,!0);function bp(e,t){return cp(e,t,n=>e.moveVertically(n,t,Yf(e).height))}var xp=e=>bp(e,!1),Sp=e=>bp(e,!0),Cp=e=>cp(e,!0,t=>$f(e,t,!0)),wp=e=>cp(e,!1,t=>$f(e,t,!1)),Tp=e=>{let t=!$(e);return cp(e,t,n=>$f(e,n,t))},Ep=e=>{let t=$(e);return cp(e,t,n=>$f(e,n,t))},Dp=e=>cp(e,!1,t=>T.cursor(e.lineBlockAt(t.head).from)),Op=e=>cp(e,!0,t=>T.cursor(e.lineBlockAt(t.head).to)),kp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:0})),!0),Ap=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.doc.length})),!0),jp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:0})),!0),Mp=({state:e,dispatch:t})=>(t(Nf(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Np=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Pp=({state:e,dispatch:t})=>{let n=$p(e).map(({from:t,to:n})=>T.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:T.create(n),userEvent:`select`})),!0},Fp=({state:e,dispatch:t})=>{let n=Mf(e.selection,t=>{let n=Z(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return T.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(Nf(e,n)),!0)};function Ip(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(Nf(n,T.create(i,i.length-1))),!0)}var Lp=e=>Ip(e,!1),Rp=e=>Ip(e,!0),zp=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=T.create([n.main]):n.main.empty||(r=T.create([T.cursor(n.main.head)])),r?(t(Nf(e,r)),!0):!1};function Bp(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Vp(e,o,!1)):o>i&&(n=`delete.forward`,o=Vp(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Vp(e,i,!1),a=Vp(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:T.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?G.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Vp(e,t,n){if(e instanceof G)for(let r of e.state.facet(G.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Hp=(e,t,n)=>Bp(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \\t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==`\t`)return i-1;let e=wt(s,a.tabSize)%Fl(a)||Fl(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=S(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\\ufe00-\\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=S(o.text,c-o.from,!1,!1)+o.from);return c}),Up=e=>Hp(e,!1,!0),Wp=e=>Hp(e,!0,!1),Gp=(e,t)=>Bp(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=S(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Kp=e=>Gp(e,!1),qp=e=>Gp(e,!0),Jp=e=>Bp(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Yp=e=>Bp(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Xp=e=>Bp(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Zp=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:h.of([``,``])},range:T.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Qp=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:S(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:S(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:T.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function $p(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function em(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of $p(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(T.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(T.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:T.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var tm=({state:e,dispatch:t})=>em(e,t,!1),nm=({state:e,dispatch:t})=>em(e,t,!0);function rm(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of $p(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var im=({state:e,dispatch:t})=>rm(e,t,!1),am=({state:e,dispatch:t})=>rm(e,t,!0),om=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes($p(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Mf(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function sm(e,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Z(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(K.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var cm=um(!1),lm=um(!0);function um(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&sm(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Rl(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Ll(s,r);for(c??=wt(/^\\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,Il(t,c)];return o&&l.push(Il(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:h.of(l)},range:T.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function dm(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:T.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var fm=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Rl(e,{overrideIndentation:e=>n[e]??-1}),i=dm(e,(t,i,a)=>{let o=Ll(r,t.from);if(o==null)return;/\\S/.test(t.text)||(o=0);let s=/^\\s*/.exec(t.text)[0],c=Il(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},pm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(dm(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Pl)})}),{userEvent:`input.indent`})),!0),mm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(dm(e,(t,n)=>{let r=/^\\s*/.exec(t.text)[0];if(!r)return;let i=wt(r,e.tabSize),a=0,o=Il(e,Math.max(0,i-Fl(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),hm=e=>(e.setTabFocusMode(),!0),gm=[{key:`Ctrl-b`,run:Lf,shift:up,preventDefault:!0},{key:`Ctrl-f`,run:Rf,shift:dp},{key:`Ctrl-p`,run:qf,shift:vp},{key:`Ctrl-n`,run:Jf,shift:yp},{key:`Ctrl-a`,run:ip,shift:Dp},{key:`Ctrl-e`,run:ap,shift:Op},{key:`Ctrl-d`,run:Wp},{key:`Ctrl-h`,run:Up},{key:`Ctrl-k`,run:Jp},{key:`Ctrl-Alt-h`,run:Kp},{key:`Ctrl-o`,run:Zp},{key:`Ctrl-t`,run:Qp},{key:`Ctrl-v`,run:Qf}],_m=[{key:`ArrowLeft`,run:Lf,shift:up,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Bf,shift:pp,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:np,shift:Tp,preventDefault:!0},{key:`ArrowRight`,run:Rf,shift:dp,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Vf,shift:mp,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:rp,shift:Ep,preventDefault:!0},{key:`ArrowUp`,run:qf,shift:vp,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:kp,shift:jp},{mac:`Ctrl-ArrowUp`,run:Zf,shift:xp},{key:`ArrowDown`,run:Jf,shift:yp,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Ap,shift:Mp},{mac:`Ctrl-ArrowDown`,run:Qf,shift:Sp},{key:`PageUp`,run:Zf,shift:xp},{key:`PageDown`,run:Qf,shift:Sp},{key:`Home`,run:tp,shift:wp,preventDefault:!0},{key:`Mod-Home`,run:kp,shift:jp},{key:`End`,run:ep,shift:Cp,preventDefault:!0},{key:`Mod-End`,run:Ap,shift:Mp},{key:`Enter`,run:cm,shift:cm},{key:`Mod-a`,run:Np},{key:`Backspace`,run:Up,shift:Up,preventDefault:!0},{key:`Delete`,run:Wp,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Kp,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:qp,preventDefault:!0},{mac:`Mod-Backspace`,run:Yp,preventDefault:!0},{mac:`Mod-Delete`,run:Xp,preventDefault:!0}].concat(gm.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),vm=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Wf,shift:hp},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Gf,shift:gp},{key:`Alt-ArrowUp`,run:tm},{key:`Shift-Alt-ArrowUp`,run:im},{key:`Alt-ArrowDown`,run:nm},{key:`Shift-Alt-ArrowDown`,run:am},{key:`Mod-Alt-ArrowUp`,run:Lp},{key:`Mod-Alt-ArrowDown`,run:Rp},{key:`Escape`,run:zp},{key:`Mod-Enter`,run:lm},{key:`Alt-l`,mac:`Ctrl-l`,run:Pp},{key:`Mod-i`,run:Fp,preventDefault:!0},{key:`Mod-[`,run:mm},{key:`Mod-]`,run:pm},{key:`Mod-Alt-\\\\`,run:fm},{key:`Shift-Mod-k`,run:om},{key:`Shift-Mod-\\\\`,run:sp},{key:`Mod-/`,run:Yd},{key:`Alt-A`,mac:`Ctrl-A`,run:Qd},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:hm}].concat(_m),ym={key:`Tab`,run:pm,shift:mm},bm=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new xm(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Sm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new xm(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},xm=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},Sm=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},Cm=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 e(this.stack,this.pos,this.index)}};function wm(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var Tm=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Em=new Tm,Dm=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=Em,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Em,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},Om=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;jm(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};Om.prototype.contextual=Om.prototype.fallback=Om.prototype.extend=!1;var km=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?wm(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(jm(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};km.prototype.contextual=Om.prototype.fallback=Om.prototype.extend=!1;var Am=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function jm(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||Nm(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function Mm(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function Nm(e,t,n,r){let i=Mm(n,r,t);return i<0||Mm(n,r,e)<i}var Pm=typeof process<`u`&&/\\bparse\\b/.test({}.LOG),Fm=null;function Im(e,t,n){let r=e.cursor(q.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var Lm=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Im(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Im(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;if(e<this.safeFrom)return null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(i instanceof J){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(K.lookAhead))||t+r<this.fragment.to)&&(n&&(this.lastRepeat=i,this.lastRepeatPos=a),a==e))return i}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},Rm=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Tm)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if((!n||c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new Tm,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Tm,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=Um(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(Um(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(Um(o,s+1),t,n,r))}return r}},zm=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Dm(t,r),this.tokens=new Rm(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[bm.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new Lm(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&Wm(r);if(e)return Pm&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw Pm&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return Pm&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}tryReuse(e,t,n,r){if(!n)return null;let i=e.curContext&&e.curContext.tracker.strict,a=i?e.curContext.hash:0;for(;n;){let o=this.parser.nodeSet.types[n.type.id]==n.type?this.parser.getGoto(e.state,n.type.id):-1;if(o>-1&&n.length&&(!i||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof J&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=Pm?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos<r&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,r,this.fragments.nodeAt(r),!1);if(t)return Pm&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(t.type.id)})`),!0}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),Pm&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;o<s.length;){let c=s[o++],l=s[o++],u=s[o++],d=o==s.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(c,l,p?p.start:f.pos,u),Pm&&console.log(a+this.stackID(f)+` (via ${c&65536?`reduce of ${i.getName(c&65535)}`:`shift`} for ${i.getName(l)} @ ${r}${f==e?``:`, split`})`),d)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Bm(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=Pm?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),Pm&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(Pm&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)Pm&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))Pm&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),Pm&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),Bm(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),J.build({buffer:Cm.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Fm||=new WeakMap).get(e);return t||Fm.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function Bm(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var Vm=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},Hm=class e extends Vc{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=K[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new vc(t.map((t,i)=>_c.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=fc;let a=wm(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Gm),this.states=wm(e.states,Uint32Array),this.data=wm(e.stateData),this.goto=wm(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new Om(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new zm(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=Um(n,i+2)];else if(n[i+1]==2)return Um(n,i+2);else break}if(a==t||a==0)return Um(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=Um(this.data,n+2);else break}r=t(Um(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=Um(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=Gm(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new Vm(e,n,r)}static deserialize(t){return new e(t)}};function Um(e,t){return e[t]|e[t+1]<<16}function Wm(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function Gm(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var Km=36,qm=1,Jm=2,Ym=3,Xm=4,Zm=5,Qm=6,$m=7,eh=8,th=9,nh=10,rh=11,ih=12,ah=13,oh=14,sh=15,ch=16,lh=17,uh=18,dh=19,fh=20,ph=21,mh=22,hh=23,gh=24;function _h(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function vh(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function yh(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function bh(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function xh(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function Sh(e,t){for(;e.next==95||_h(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function Ch(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),yh(e,t,!1)}else Sh(e)}function wh(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function Th(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function Eh(e){for(;!(e.next<0||e.next==10);)e.advance()}function Dh(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var Oh=` \t\\r\n`;function kh(e,t,n){let r=Object.create(null);r.true=r.false=Zm,r.null=r.unknown=Qm;for(let t of e.split(` `))t&&(r[t]=fh);for(let e of t.split(` `))e&&(r[e]=ph);for(let e of(n||``).split(` `))e&&(r[e]=gh);return r}var Ah=`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `,jh=`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,Mh={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`\"`,caseInsensitiveIdentifiers:!1,words:kh(jh,Ah)};function Nh(e,t,n,r){let i={};for(let t in Mh)i[t]=(e.hasOwnProperty(t)?e:Mh)[t];return t&&(i.words=kh(t,n||``,r)),i}function Ph(e){return new Am(t=>{let{next:n}=t;if(t.advance(),Dh(n,Oh)){for(;Dh(t.next,Oh);)t.advance();t.acceptToken(Km)}else if(n==36&&e.doubleDollarQuotedStrings){let e=Sh(t,``);t.next==36&&(t.advance(),bh(t,e),t.acceptToken(Ym))}else if(n==39||n==34&&e.doubleQuotedStrings)yh(t,n,e.backslashEscapes),t.acceptToken(Ym);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)Eh(t),t.acceptToken(qm);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))Eh(t),t.acceptToken(qm);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(Jm)}else if((n==101||n==69)&&t.next==39)t.advance(),yh(t,39,!0),t.acceptToken(Ym);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),yh(t,39,e.backslashEscapes),t.acceptToken(Ym);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),yh(t,39,e.backslashEscapes),t.acceptToken(Ym);break}if(!_h(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!Dh(t.peek(1),Oh)){let e=t.peek(1);t.advance(2),xh(t,e),t.acceptToken(Ym)}else if(Dh(n,e.identifierQuotes))yh(t,n==91?93:n,!1),t.acceptToken(dh);else if(n==40)t.acceptToken($m);else if(n==41)t.acceptToken(eh);else if(n==123)t.acceptToken(th);else if(n==125)t.acceptToken(nh);else if(n==91)t.acceptToken(rh);else if(n==93)t.acceptToken(ih);else if(n==59)t.acceptToken(ah);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),wh(t),t.acceptToken(mh);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(yh(t,n,e.backslashEscapes),t.acceptToken(hh)):(wh(t,n),t.acceptToken(mh))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();vh(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(Xm)}else if(n==46&&t.next>=48&&t.next<=57)Th(t,!0),t.acceptToken(Xm);else if(n==46)t.acceptToken(oh);else if(n>=48&&n<=57)Th(t,!1),t.acceptToken(Xm);else if(Dh(n,e.operatorChars)){for(;Dh(t.next,e.operatorChars);)t.advance();t.acceptToken(sh)}else if(Dh(n,e.specialVar))t.next==n&&t.advance(),Ch(t),t.acceptToken(lh);else if(n==58||n==44)t.acceptToken(ch);else if(_h(n)){let r=Sh(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?uh:e.words[r.toLowerCase()]??uh)}})}var Fh=Ph(Mh),Ih=Hm.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,Fh],topRules:{Script:[0,25]},tokenPrec:0});function Lh(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function Rh(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'\"\\[])(.*)([`'\"\\]])$/.exec(n);return r?r[2]:n}function zh(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function Bh(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)zh(r)&&n.push(Rh(e,r));return n}return[Rh(e,t)]}function Vh(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=Lh(t);if(!zh(r))return n;n.unshift(Rh(e,r)),t=Lh(r)}}function Hh(e,t){let n=Z(e).resolveInner(t,-1),r=Wh(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:Vh(e.doc,Lh(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:Vh(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var Uh=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function Wh(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&zh(t.nextSibling))o=Rh(e,t.nextSibling);else if(n&&Uh.has(n))break;else a&&zh(t)&&(o=Rh(e,t));o&&(r||=Object.create(null),r[o]=Bh(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function Gh(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Kh=/^\\w*$/,qh=/^[`'\"\\[]?\\w*[`'\"\\]]?$/;function Jh(e){return e.self&&typeof e.self.label==`string`}var Yh=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(Xh(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.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`?Xh(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Jh(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\\\?\\./g,e=>e==`.`?`\\0`:e).split(`\\0`),a=this;Jh(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\\\\./g,`.`));a.addNamespace(n)}}};function Xh(e,t,n,r){return RegExp(`^[a-z_][a-z_\\\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+Zh(n)}}function Zh(e){return e===`[`?`]`:e}function Qh(e,t,n,r,i,a){let o=new Yh(a?.spec.identifierQuotes?.[0]||`\"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=Hh(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=Zh(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:Gh(t,r,u),validFor:qh}}return{from:n,options:u,validFor:Kh}}}function $h(e){return e==ph?`type`:e==fh?`keyword`:`variable`}function eg(e,t,n){return ju([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],Au(Object.keys(e).map(r=>n(t?r.toUpperCase():r,$h(e[r])))))}var tg=Ih.configure({props:[zl.add({Statement:Yl()}),Xl.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),Yc({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})]}),ng=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=Nh(t,t.keywords,t.types,t.builtin),r=Sl.define({name:`sql`,parser:tg.configure({tokenizers:[{from:Fh,to:Ph(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`\"`,\"`\"]}}});return new e(n,r,t)}};function rg(e,t){return{label:e,type:t,boost:-1}}function ig(e,t=!1,n){return eg(e.dialect.words,t,n||rg)}function ag(e){return e.schema?Qh(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||cg):()=>null}function og(e){return e.schema?(e.dialect||cg).language.data.of({autocomplete:ag(e)}):[]}function sg(e={}){let t=e.dialect||cg;return new Ml(t.language,[og(e),t.language.data.of({autocomplete:ig(t,e.upperCaseKeywords,e.keywordCompletion)})])}var cg=ng.define({}),lg=ng.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:\"+-*/<>=~!@#%^&|`?\",specialVar:``,keywords:jh+`abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes`,types:Ah+`bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml`}),ug=`accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`,dg=Ah+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed`,fg=`charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee`,pg=ng.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:\"`\",keywords:jh+`group_concat `+ug,types:dg,builtin:fg}),mg=ng.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:\"`\",keywords:jh+`always generated groupby_concat hard persistent shutdown soft virtual `+ug,types:dg,builtin:fg}),hg=ng.define({keywords:jh+`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:Ah+`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:`@:?$`}),gg=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,_g=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(gg(e)):gg,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 C(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=oe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=se(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(_g.prototype[Symbol.iterator]=function(){return this});var vg={from:-1,to:-1,match:/.*/.exec(``),precise:!0},yg=`gm`+(/x/.unicode==null?``:`u`),bg=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=vg,/\\\\[sWDnr]|\\n|\\r|\\[\\^/.test(t))return new Cg(e,t,n,r,i);this.re=new RegExp(t,yg+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Tg(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Tg(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},xg=new WeakMap,Sg=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=xg.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return xg.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),xg.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Cg=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=vg,this.matchPos=Tg(e,r),this.re=new RegExp(t,yg+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Sg.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=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 e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Tg(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Sg.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(bg.prototype[Symbol.iterator]=Cg.prototype[Symbol.iterator]=function(){return this});function wg(e){try{return new RegExp(e,yg),!0}catch{return!1}}function Tg(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Eg=e=>{let t=Ls(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=Is(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=T.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,G.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Dg={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Og=E.define({combine(e){return at(e,Dg,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function kg(e){let t=[Fg,Pg];return e&&t.push(Og.of(e)),t}var Ag=L.mark({class:`cm-selectionMatch`}),jg=L.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Mg(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=k.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=k.Word)}function Ng(e,t,n,r){return e(t.sliceDoc(n,n+1))==k.Word&&e(t.sliceDoc(r-1,r))==k.Word}var Pg=V.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Og),{state:n}=e,r=n.selection;if(r.ranges.length>1)return L.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return L.none;let e=n.wordAt(i.head);if(!e)return L.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return L.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Mg(o,n,i.from,i.to)&&Ng(o,n,i.from,i.to)))return L.none}else if(a=n.sliceDoc(i.from,i.to),!a)return L.none}let s=[];for(let r of e.visibleRanges){let e=new _g(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Mg(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(jg.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Ag.range(r,a)),s.length>t.maxMatches))return L.none}}return L.set(s)}},{decorations:e=>e.decorations}),Fg=G.baseTheme({\".cm-selectionMatch\":{backgroundColor:`#99ff7780`},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:`transparent`}}),Ig=({state:e,dispatch:t})=>{let{selection:n}=e,r=T.create(n.ranges.map(t=>e.wordAt(t.head)||T.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function Lg(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new _g(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new _g(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Rg=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Ig({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Lg(e,r);return i?(t(e.update({selection:e.selection.addRange(T.range(i.from,i.to),!1),effects:G.scrollIntoView(i.to)})),!0):!1},zg=E.define({combine(e){return at(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new y_(e),scrollToMatch:e=>G.scrollIntoView(e)})}}),Bg=class{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||wg(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\\\([nrt\\\\])/g,(e,t)=>t==`n`?`\n`:t==`r`?`\\r`:t==`t`?`\t`:`\\\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Zg(this):new Gg(this)}getCursor(e,t=0,n){let r=e.doc?e:A.create({doc:e});return n??=r.doc.length,this.regexp?qg(this,r,t,n):Ug(this,r,t,n)}},Vg=class{constructor(e){this.spec=e}};function Hg(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function Ug(e,t,n,r){let i;return e.wholeWord&&(i=Wg(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Hg(e.test,t,i)),new _g(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Wg(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(Jg(i,n-a))!=k.Word||t(Yg(i,n-a))!=k.Word)&&(t(Yg(i,r-a))!=k.Word||t(Jg(i,r-a))!=k.Word))}var Gg=class extends Vg{constructor(e){super(e)}nextMatch(e,t,n){let r=Ug(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Ug(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Ug(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Ug(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Ug(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Kg(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function qg(e,t,n,r){let i;return e.wholeWord&&(i=Xg(t.charCategorizer(t.selection.main.head))),e.test&&(i=Kg(e.test,t,i)),new bg(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Jg(e,t){return e.slice(S(e,t,!1),t)}function Yg(e,t){return e.slice(t,S(e,t))}function Xg(e){return(t,n,r)=>!r[0].length||(e(Jg(r.input,r.index))!=k.Word||e(Yg(r.input,r.index))!=k.Word)&&(e(Yg(r.input,r.index+r[0].length))!=k.Word||e(Jg(r.input,r.index+r[0].length))!=k.Word)}var Zg=class extends Vg{nextMatch(e,t,n){let r=qg(this.spec,e,n,e.doc.length).next();return r.done&&(r=qg(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=qg(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\\$([$&]|\\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=qg(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=qg(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},Qg=D.define(),$g=D.define(),e_=Ee.define({create(e){return new t_(p_(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Qg)?e=new t_(n.value.create(),e.panel):n.is($g)&&(e=new t_(e.query,n.value?f_:null));return e},provide:e=>Fs.from(e,e=>e.panel)}),t_=class{constructor(e,t){this.query=e,this.panel=t}},n_=L.mark({class:`cm-searchMatch`}),r_=L.mark({class:`cm-searchMatch cm-searchMatch-selected`}),i_=V.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(e_))}update(e){let t=e.state.field(e_);(t!=e.startState.field(e_)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return L.none;let{view:n}=this,r=new pt;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?r_:n_)})}return r.finish()}},{decorations:e=>e.decorations});function a_(e){return t=>{let n=t.state.field(e_,!1);return n&&n.query.spec.valid?e(t,n):g_(t)}}var o_=a_((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=T.single(r.from,r.to),a=e.state.facet(zg);return e.dispatch({selection:i,effects:[C_(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),h_(e),!0}),s_=a_((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=T.single(i.from,i.to),o=e.state.facet(zg);return e.dispatch({selection:a,effects:[C_(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),h_(e),!0}),c_=a_((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:T.create(n.map(e=>T.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),l_=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new _g(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(T.range(t.value.from,t.value.to))}return t(e.update({selection:T.create(a,o),userEvent:`select.search.matches`})),!0},u_=a_((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(G.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=T.single(o.from,o.to).map(d),u.push(C_(e,o)),u.push(n.facet(zg).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),d_=a_((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:G.announce.of(r),userEvent:`input.replace.all`}),!0});function f_(e){return e.state.facet(zg).createPanel(e)}function p_(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(zg);return new Bg({search:t?.literal??i.literal?r:r.replace(/\\n/g,`\\\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function m_(e){let t=js(e,f_);return t&&t.dom.querySelector(`[main-field]`)}function h_(e){let t=m_(e);t&&t==e.root.activeElement&&t.select()}var g_=e=>{let t=e.state.field(e_,!1);if(t&&t.panel){let n=m_(e);if(n&&n!=e.root.activeElement){let r=p_(e.state,t.query.spec);r.valid&&e.dispatch({effects:Qg.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[$g.of(!0),t?Qg.of(p_(e.state,t.query.spec)):D.appendConfig.of(T_)]});return!0},__=e=>{let t=e.state.field(e_,!1);if(!t||!t.panel)return!1;let n=js(e,f_);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:$g.of(!1)}),!0},v_=[{key:`Mod-f`,run:g_,scope:`editor search-panel`},{key:`F3`,run:o_,shift:s_,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:o_,shift:s_,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:__,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:l_},{key:`Mod-Alt-g`,run:Eg},{key:`Mod-d`,run:Rg,preventDefault:!0}],y_=class{constructor(e){this.view=e;let t=this.query=e.state.field(e_).query.spec;this.commit=this.commit.bind(this),this.searchField=N(`input`,{value:t.search,placeholder:b_(e,`Find`),\"aria-label\":b_(e,`Find`),class:`cm-textfield`,name:`search`,form:``,\"main-field\":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=N(`input`,{value:t.replace,placeholder:b_(e,`Replace`),\"aria-label\":b_(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=N(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=N(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=N(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return N(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=N(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>o_(e),[b_(e,`next`)]),n(`prev`,()=>s_(e),[b_(e,`previous`)]),n(`select`,()=>c_(e),[b_(e,`all`)]),N(`label`,null,[this.caseField,b_(e,`match case`)]),N(`label`,null,[this.reField,b_(e,`regexp`)]),N(`label`,null,[this.wordField,b_(e,`by word`)]),...e.state.readOnly?[]:[N(`br`),this.replaceField,n(`replace`,()=>u_(e),[b_(e,`replace`)]),n(`replaceAll`,()=>d_(e),[b_(e,`replace all`)])],N(`button`,{name:`close`,onclick:()=>__(e),\"aria-label\":b_(e,`close`),type:`button`},[`×`])])}commit(){let e=new Bg({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:Qg.of(e)}))}keydown(e){Wo(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?s_:o_)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),u_(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Qg)&&!e.value.eq(this.query)&&this.setQuery(e.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(zg).top}};function b_(e,t){return e.state.phrase(t)}var x_=30,S_=/[\\s\\.,:;?!]/;function C_(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-x_),o=Math.min(i,n+x_),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<x_;e++)if(!S_.test(s[e+1])&&S_.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-x_;e--)if(!S_.test(s[e-1])&&S_.test(s[e])){s=s.slice(0,e);break}}return G.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var w_=G.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`}}),T_=[e_,ke.low(i_),w_],E_=e(t(),1),D_=n(),O_=Zl.define([{tag:X.keyword,color:`var(--accent)`,fontWeight:`600`},{tag:[X.string,X.special(X.string)],color:`#2e9e62`},{tag:[X.number,X.bool,X.null],color:`#d9822b`},{tag:[X.comment,X.lineComment,X.blockComment],color:`var(--text-faint)`,fontStyle:`italic`},{tag:[X.typeName,X.standard(X.name)],color:`#9b51e0`},{tag:X.operator,color:`var(--text-dim)`}]),k_=G.theme({\"&\":{backgroundColor:`var(--bg)`,color:`var(--text)`},\".cm-content\":{caretColor:`var(--text)`,padding:`6px 0`},\".cm-gutters\":{backgroundColor:`var(--bg-chrome)`,color:`var(--text-faint)`,border:`none`},\".cm-activeLine\":{backgroundColor:`var(--bg-hover)`},\".cm-activeLineGutter\":{backgroundColor:`var(--bg-hover)`},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground\":{backgroundColor:`var(--selection) !important`},\".cm-tooltip\":{backgroundColor:`var(--bg)`,border:`1px solid var(--border)`},\".cm-tooltip-autocomplete ul li[aria-selected]\":{backgroundColor:`var(--accent)`,color:`var(--accent-text)`}}),A_={postgres:lg,mysql:pg,mariadb:mg,sqlite:hg};function j_({value:e,onChange:t,onRun:n,schema:r,defaultSchema:i,kind:a,label:o}){let s=A_[a]??lg,c=(0,E_.useRef)(null),l=(0,E_.useRef)(null),u=(0,E_.useRef)(new je),d=(0,E_.useRef)({onChange:t,onRun:n});return(0,E_.useEffect)(()=>{d.current={onChange:t,onRun:n}}),(0,E_.useEffect)(()=>{let t=e=>t=>(d.current.onRun(e,t.state.doc.toString(),t.state.selection.main.head),!0),n=new G({parent:c.current,root:c.current.getRootNode(),state:A.create({doc:e,extensions:[ke.highest(Vo.of([{key:`Mod-Enter`,run:t(`current`)},{key:`Shift-Mod-Enter`,run:t(`all`)}])),sc(),dc(),ps(),ff(),os(),pu(),kd(),Kd(),kg(),tu(O_),u.current.of(sg({dialect:s,schema:r,defaultSchema:i,upperCaseKeywords:!0})),Vo.of([...Fd,...vm,...v_,...jf,...qd,ym]),_s(`SELECT * FROM … ⌘↵ runs the statement at the cursor`),G.lineWrapping,G.contentAttributes.of({\"aria-label\":o}),G.updateListener.of(e=>{e.docChanged&&d.current.onChange(e.state.doc.toString())}),k_]})});return l.current=n,()=>n.destroy()},[]),(0,E_.useEffect)(()=>{let t=l.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,E_.useEffect)(()=>{l.current?.dispatch({effects:u.current.reconfigure(sg({dialect:s,schema:r,defaultSchema:i,upperCaseKeywords:!0}))})},[r,i,s]),(0,D_.jsx)(`div`,{className:`editor`,ref:c})}export{j_ as Editor};"},"ImportDialog-DdB5QaTF.js":{"type":"text/javascript; charset=utf-8","body":"import{a as e,i as t,n,r,t as i}from\"./index-DW5OtN-I.js\";var a=e(t(),1),o=new Set(`utf8mb4.utf8mb3.utf8.binary.ascii.armscii8.dec8.geostd8.greek.hebrew.hp8.keybcs2.koi8r.koi8u.macce.macroman.tis620.latin1.latin2.latin5.latin7.cp1250.cp1251.cp1256.cp1257.cp850.cp852.cp866`.split(`.`)),s=new Set([`big5`,`cp932`,`gb18030`,`gbk`,`sjis`,`eucjpms`,`euckr`,`gb2312`,`ujis`]);function c(e){return o.has(e)?`alike`:s.has(e)?`ascii`:`otherwise`}var l=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`DbAdminError`}},u=4194304,d=1e3,ee=4194300,te=12e4,f=2**53-1-d,p=/[\\ud800-\\udfff]/u;function m(e){ie(e.length);let t=new TextEncoder,n=[],r=0;e.forEach((e,i)=>{if(!e)throw ae(i+1);if(p.test(e))throw _(`${oe(i+1)} isn't whole Unicode: it has half of a surrogate pair.`);let a=t.encode(e);if(r+=4+a.byteLength,r>4194304)throw g();n.push(a)});let i=new Uint8Array(r),a=new DataView(i.buffer),o=0;for(let e of n)a.setUint32(o,e.byteLength),i.set(e,o+4),o+=4+e.byteLength;return i}function ne(e){let{start:t,count:n,skip:r}=re(e);return Array.from({length:n},(e,n)=>r===void 0||t+n<r?t+n:t+n+1)}function h(e){let{start:t,count:n,skip:r}=re(e);return r===void 0?t+n-1:t+n}function re(e){let{start:t,count:n,skip:r}=e;if(!Number.isInteger(t)||t<1||t>f)throw _(`A batch starts at a statement's number, 1 or more, not ${v(t)}.`);if(r===void 0)return ie(n),e;if(!Number.isInteger(n)||n<0||n>1e3)throw _(`A batch that leaves a statement out holds 0 to ${v(d)} statements, not ${v(n)}.`);if(!Number.isInteger(r)||r<t||r>t+n)throw _(`A batch of statements ${v(t)} to ${v(t+n)} can't leave out statement ${v(r)}.`);return e}function ie(e){if(!Number.isInteger(e)||e<1||e>1e3)throw _(`A batch holds 1 to ${v(d)} statements, not ${v(e)}.`)}function ae(e){return _(`${oe(e)} is empty.`)}function g(){return new l(`A batch of statements is ${v(u/1048576)} MB at most.`,413,`too-large`)}function _(e){return new l(e,400,`bad-request`)}function oe(e){return`Statement ${v(e)} of the batch`}function v(e){return e.toLocaleString(`en`)}var y=`�`,b=/[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}\\p{Cs}\\u034f\\u115f\\u1160\\u3164\\uffa0]/gu,se=`\t\n\\r\\u2028\\u2029`;function x(e,t){return(e.length>t?`${e.slice(0,S(e,t))}…`:e).replace(b,e=>se.includes(e)?` `:y)}function S(e,t){let n=e.charCodeAt(t-1),r=e.charCodeAt(t);return n>=55296&&n<=56319&&r>=56320&&r<=57343?t-1:t}var C=`create-table.drop-table.alter-table.truncate.insert.replace.update.delete.create-view.drop-view.create-trigger.create-procedure.create-function.create-event.lock-tables.unlock-tables.start-transaction.commit.set.set-global.use.create-database.drop-database.alter-database.create-index.drop-index.xa.account.other`.split(`.`),w=class{text;#e;#t=0;#n=!1;#r;constructor(e,t){this.text=e,this.#e=t}peek(){return this.#r===void 0&&(this.#r=this.#a()),this.#r}next(){let e=this.peek();return this.#r=void 0,e}keyword(){let e=this.peek();if(!e||e.type!==`word`)return``;let t=this.text.slice(e.start,e.end);return _t(t)?t.toUpperCase():``}takes(e){return this.keyword()===e&&(this.next(),!0)}symbol(e){let t=this.peek();return!t||t.type!==`symbol`||this.text.charCodeAt(t.start)!==e?!1:(this.next(),!0)}pastComma(){let e=0;for(let t=this.next();t;t=this.next()){if(t.type!==`symbol`)continue;let n=this.text.charCodeAt(t.start);if(n===P)e+=1;else if(n===F)--e;else if(n===I&&e<=0)return!0}return!1}isString(e){let t=this.text.charCodeAt(e.start);return t===xe||t===N&&!this.#e.mode.ansiQuotes}name(){let e=this.peek();if(e&&e.type!==`symbol`&&!(e.type===`quoted`&&this.isString(e)))return this.next(),e.type===`word`?this.#i(e):this.unquoted(e)}qualified(){let e=this.name();return this.symbol(we)?{database:e,name:this.name()}:{name:e}}unquoted(e){if(e.end-e.start-2>2*me)return;let t=this.text.charAt(e.start),n=this.text.slice(e.start+1,e.end-1).split(t+t).join(t);return n.length>=1&&n.length<=me?n:void 0}#i(e){if(!(e.end-e.start>me))return this.text.slice(e.start,e.end)}#a(){this.#s();let e=this.text,t=this.#t;if(t>=e.length)return null;let n=e.charCodeAt(t);if(n===xe||n===N||n===je)return this.#t=this.#o(t,n),{type:`quoted`,start:t,end:this.#t};if(!ht(n))return this.#t=t+1,{type:`symbol`,start:t,end:this.#t};let r=t+1;for(;r<e.length&&ht(e.charCodeAt(r));)r+=1;return this.#t=r,{type:`word`,start:t,end:r}}#o(e,t){let n=this.text,{mode:r}=this.#e,i=(t===xe||t===N&&!r.ansiQuotes)&&!r.noBackslashEscapes,a=e+1;for(;a<n.length;){let e=n.charCodeAt(a);if(e===ke&&i)a+=2;else if(e!==t)a+=1;else if(n.charCodeAt(a+1)===t)a+=2;else return a+1}return n.length}#s(){let e=this.text,t=e.length,n=this.#t;for(;n<t;){let t=e.charCodeAt(n);if(mt(t))n+=1;else if(t===ye||t===Ce&&vt(e,n))n=yt(e,n);else if(t===Te&&e.charCodeAt(n+1)===Se)n=this.#c(n);else if(t===Se&&this.#n&&e.charCodeAt(n+1)===Te)this.#n=!1,n+=2;else break}this.#t=n}#c(e){let t=this.text,n=bt(t,e,this.#e.mariadb);if(n===0){let n=t.indexOf(`*/`,e+2);return n===-1?t.length:n+2}let r=e+n,i=xt(t,r),a=Number(t.slice(r,r+i));return this.#l(a,n===he)?(this.#n=!0,r+i):St(t,r+i)}#l(e,t){let{version:n,mariadb:r}=this.#e;return n===void 0?!0:e>n?!1:!r||t||e<ge||e>A}};function T(e,t){let n=new w(e,t),r=n.keyword();n.next();let i;for(;r===`SET`&&t.mariadb&&n.takes(`STATEMENT`);){if(i=Ye(n),i===void 0)return E;r=n.keyword(),n.next()}let a=ce(r,n);return i===void 0?a:{...a,at:i}}function ce(e,t){switch(e){case`INSERT`:return qe(`insert`,t,Ie,`INTO`);case`REPLACE`:return qe(`replace`,t,Le,`INTO`);case`UPDATE`:return ft(qe(`update`,t,Re),t,Ve);case`DELETE`:return ut(t);case`TRUNCATE`:return qe(`truncate`,t,Fe,`TABLE`);case`CREATE`:return Qe(t);case`DROP`:return rt(t);case`ALTER`:return it(t);case`RENAME`:return ot(t);case`LOCK`:return Je(t)?st(t):E;case`UNLOCK`:return Je(t)?{kind:`unlock-tables`}:E;case`START`:return t.takes(`TRANSACTION`)?{kind:`start-transaction`}:E;case`BEGIN`:return t.peek()===null||t.takes(`WORK`)?{kind:`start-transaction`}:E;case`COMMIT`:return{kind:`commit`};case`SET`:return pt(t);case`USE`:return{kind:`use`,database:t.name()};case`XA`:return{kind:`xa`};case`CALL`:return B(`other`,t);case`ANALYZE`:case`OPTIMIZE`:case`REPAIR`:return ct(t);case`LOAD`:return lt(t);case`GRANT`:case`REVOKE`:return{kind:`account`};case`WITH`:return le(t);default:return E}}function le(e){e.takes(`RECURSIVE`);do if(e.name()===void 0||e.symbol(P)&&!ue(e)||!e.takes(`AS`)||!e.symbol(P)||!ue(e))return E;while(e.symbol(I));let t=e.keyword();return e.next(),t===`WITH`?E:ce(t,e)}function ue(e){let t=1;for(let n=e.next();n;n=e.next()){if(n.type!==`symbol`)continue;let r=e.text.charCodeAt(n.start);if(r===P)t+=1;else if(r===F&&--t===0)return!0}return!1}function de(e){let t=e.startsWith(O)?e.slice(O.length):e,n=k.exec(t);if(n)return Number(n[1])*1e4+Number(n[2])*100+Number(n[3])}function fe(e){for(let t=e.indexOf(`_`);t!==-1;t=e.indexOf(`_`,t+1))if(wt(e,t-Pe)!==`no`)return!0;return!1}function pe(e){return e.length===Ne.length?wt(e,0):`no`}var E={kind:`other`},me=64,D=8,O=`5.5.5-`,k=/^(\\d{1,2})\\.(\\d{1,2})\\.(\\d{1,2})(?!\\d)/,he=4,ge=50700,A=99999,j=9,_e=13,M=32,ve=33,N=34,ye=35,be=36,xe=39,P=40,F=41,Se=42,I=44,Ce=45,we=46,Te=47,Ee=61,De=64,Oe=77,ke=92,Ae=95,je=96,Me=127,Ne=`sql_mode`,Pe=Ne.indexOf(`_`),Fe=new Set,Ie=new Set([`LOW_PRIORITY`,`DELAYED`,`HIGH_PRIORITY`,`IGNORE`]),Le=new Set([`LOW_PRIORITY`,`DELAYED`]),Re=new Set([`LOW_PRIORITY`,`IGNORE`]),ze=new Set([`LOW_PRIORITY`,`QUICK`,`IGNORE`]),Be=new Set([`NO_WRITE_TO_BINLOG`,`LOCAL`]),Ve=new Set([`SET`]),He=new Set([`WHERE`,`ORDER`,`RETURNING`]),Ue=new Set([`JOIN`,`STRAIGHT_JOIN`]),We=new Set([`FROM`,`USING`]),Ge=new Set([`GLOBAL`,`PERSIST`,`PERSIST_ONLY`]),Ke=new Set([`CHARACTER`,`CHARSET`,`COLLATE`,`DEFAULT`,`ENCRYPTION`,`READ`,`COMMENT`,`UPGRADE`]);function qe(e,t,n,r){for(;n.has(t.keyword());)t.next();return r&&t.takes(r),L(e,t)}function L(e,t){let{database:n,name:r}=t.qualified();return{kind:e,database:n,table:r}}function R(e,t){if(t===void 0||t===e.database)return;let n=e.others??=[];n.length<D&&!n.includes(t)&&n.push(t)}function Je(e){return e.takes(`TABLES`)||e.takes(`TABLE`)}function Ye(e){let t=0,n=!1;for(;;){let r=e.keyword(),i=e.next();if(!i)return;if(i.type===`symbol`){let n=e.text.charCodeAt(i.start);n===P?t+=1:n===F&&--t}else if(r===`FOR`&&t<=0&&!n)return i.end;n=r===`VALUE`}}function z(e){e.takes(`IF`)&&(e.takes(`NOT`),e.takes(`EXISTS`))}function Xe(e,t){for(;;){let n=e.keyword()===t;if(!e.next())return!1;if(n)return!0}}function Ze(e){for(;;){let t=e.keyword();switch(e.next(),t){case`OR`:case`REPLACE`:case`TEMPORARY`:case`AGGREGATE`:case`ONLINE`:case`OFFLINE`:case`IGNORE`:case`UNIQUE`:case`FULLTEXT`:case`SPATIAL`:break;case`DEFINER`:nt(e);break;case`ALGORITHM`:e.symbol(Ee),e.next();break;case`SQL`:e.next(),e.next();break;default:return t}}}function Qe(e){switch(Ze(e)){case`TABLE`:return z(e),L(`create-table`,e);case`VIEW`:return z(e),L(`create-view`,e);case`DATABASE`:case`SCHEMA`:return z(e),{kind:`create-database`,database:e.name()};case`TRIGGER`:return B(`create-trigger`,e);case`PROCEDURE`:return B(`create-procedure`,e);case`FUNCTION`:return B(`create-function`,e);case`EVENT`:return B(`create-event`,e);case`SEQUENCE`:return B(`other`,e);case`INDEX`:return tt(`create-index`,e);case`USER`:case`ROLE`:return{kind:`account`};default:return E}}function B(e,t){return z(t),{kind:e,database:t.qualified().database}}function $e(e,t){return et(B(e,t),t)}function et(e,t){for(;t.symbol(I);)R(e,t.qualified().database);return e}function tt(e,t){return z(t),Xe(t,`ON`)?L(e,t):{kind:e}}function nt(e){if(e.symbol(Ee),e.next(),e.symbol(P)&&e.symbol(F),!e.symbol(De))return;let t=e.next()?.end;for(;t!==void 0&&e.peek()?.start===t;)t=e.next()?.end}function rt(e){switch(Ze(e)){case`TABLE`:case`TABLES`:return z(e),et(L(`drop-table`,e),e);case`VIEW`:return z(e),et(L(`drop-view`,e),e);case`DATABASE`:case`SCHEMA`:return z(e),{kind:`drop-database`,database:e.name()};case`SEQUENCE`:return $e(`other`,e);case`TRIGGER`:case`PROCEDURE`:case`FUNCTION`:case`EVENT`:return B(`other`,e);case`INDEX`:return tt(`drop-index`,e);case`USER`:case`ROLE`:return{kind:`account`};default:return E}}function it(e){switch(Ze(e)){case`TABLE`:return z(e),at(L(`alter-table`,e),e);case`DATABASE`:case`SCHEMA`:return Ke.has(e.keyword())?{kind:`alter-database`}:{kind:`alter-database`,database:e.name()};case`VIEW`:case`PROCEDURE`:case`FUNCTION`:case`SEQUENCE`:return B(`other`,e);case`EVENT`:return at(B(`other`,e),e,`DO`);case`USER`:return{kind:`account`};default:return E}}function at(e,t,n){for(;;){let r=t.keyword();if(!t.next()||r===n)return e;r===`RENAME`?(!t.takes(`TO`)&&!t.takes(`AS`)&&t.symbol(Ee),R(e,t.qualified().database)):r===`WITH`&&t.takes(`TABLE`)&&R(e,t.qualified().database)}}function ot(e){if(e.takes(`USER`))return{kind:`account`};if(!Je(e))return E;let t=B(`other`,e);for(;Xe(e,`TO`)&&(R(t,e.qualified().database),e.symbol(I));)R(t,e.qualified().database);return t}function st(e){let t=L(`lock-tables`,e);for(;e.pastComma();)R(t,e.qualified().database);return t}function ct(e){for(;Be.has(e.keyword());)e.next();return Je(e)?$e(`other`,e):E}function lt(e){return Xe(e,`INTO`)?(e.takes(`TABLE`),B(`other`,e)):E}function ut(e){for(;ze.has(e.keyword());)e.next();e.takes(`FROM`);let{database:t,name:n}=dt(e);return ft({kind:`delete`,database:t,table:n},e,He)}function dt(e){let{database:t,name:n}=e.qualified();return n===void 0&&e.symbol(Se)?{name:t}:{database:t,name:n}}function ft(e,t,n){let r=0;for(;;){let i=t.keyword(),a=t.next();if(!a||r<=0&&n.has(i))return e;if(a.type===`symbol`){let n=t.text.charCodeAt(a.start);n===P?r+=1:n===F?--r:n===I&&r<=0&&R(e,dt(t).database)}else(Ue.has(i)||r<=0&&We.has(i))&&R(e,dt(t).database)}}function pt(e){let t=e.keyword();if(t===`PASSWORD`)return{kind:`account`};if(Ge.has(t))return{kind:`set-global`};if(e.takes(`DEFAULT`))return{kind:e.keyword()===`ROLE`?`account`:`set`};if(!e.symbol(De)||!e.symbol(De))return{kind:`set`};let n=e.keyword();return e.next(),{kind:Ge.has(n)&&e.symbol(we)?`set-global`:`set`}}function mt(e){return e===M||e>=j&&e<=_e}function ht(e){return e>=128||e===Ae||e===be||gt(e)||(e|32)>=97&&(e|32)<=122}function gt(e){return e>=48&&e<=57}function _t(e){for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>=128)return!1;return!0}function vt(e,t){if(e.charCodeAt(t+1)!==Ce)return!1;if(t+2>=e.length)return!0;let n=e.charCodeAt(t+2);return n<=M||n===Me}function yt(e,t){let n=e.indexOf(`\n`,t);return n===-1?e.length:n+1}function bt(e,t,n){let r=e.charCodeAt(t+2);return r===ve?3:n&&r===Oe&&e.charCodeAt(t+3)===ve?4:0}function xt(e,t){for(let n=0;n<5;n+=1)if(!gt(e.charCodeAt(t+n)))return 0;return gt(e.charCodeAt(t+5))?6:5}function St(e,t){let n=t;for(;;){let t=e.indexOf(`*/`,n);if(t===-1)return e.length;let r=Ct(e,n,t);if(r===-1)return t+2;let i=e.indexOf(`*/`,r+2);if(i===-1)return e.length;n=i+2}}function Ct(e,t,n){for(let r=t;r<n;r+=1)if(e.charCodeAt(r)===Te&&e.charCodeAt(r+1)===Se)return r;return-1}function wt(e,t){let n=`yes`;for(let r=0;r<8;r+=1){let i=e.charCodeAt(t+r),a=Ne.charCodeAt(r);if(i!==a){if(a===Ae)return`no`;if((i|32)!==a){if(!Tt(i))return`no`;n=`maybe`}}}return n}function Tt(e){return e>=192&&e<592||e>=7680&&e<7936}var V=class extends Error{statement;line;constructor(e,t,n){super(e),this.statement=t,this.line=n,this.name=`SplitError`}},Et=class{#e;#t;#n;#r=``;#i=[];#a=0;#o=0;#s=0;#c=!1;#l={at:0,start:-1,state:`code`,line:1,startLine:1,openLine:1,fresh:!0,executable:!1,delimiter:`;`,count:0,measured:0,bytes:0,given:null};constructor(e){if(this.#e=Jt(e.mode),this.#t=e.maxStatement,this.#n=e.mariadb,!e.from)return;let{statements:t,offset:n,line:r,delimiter:i}=e.from;this.#s=n,Object.assign(this.#l,{count:t,line:r,delimiter:i})}push(e){if(this.#c)throw Error(`MySqlSplitter.push() was called after end().`);this.#i.push(e),this.#a>0&&(this.#o+=nn(e,0,e.length))}next(){this.#i.length>0&&this.#o>=this.#a&&this.#u();let e=this.#p();return this.#a=e?0:this.#d(),e}readPushed(){this.#a=0}get given(){return this.#l.given}get behind(){let e=this.#l;return this.#s+(e.start>=0?e.start:e.at)}setMode(e){this.#e=Jt(e);let t=this.#l;t.start<0||(t.at=t.start,t.line=t.startLine,t.start=-1,t.state=`code`,t.executable=!1,t.fresh=!1)}end(){this.#c=!0,this.#i.length>0&&this.#u();let e={...this.#l};this.#p(),this.#l=e}#u(){let e=this.#l,t=e.start>=0?e.start:e.at,n=this.#i.length===1?this.#i[0]:this.#i.join(``);this.#r=this.#r.slice(t)+n,this.#s+=t,e.at-=t,e.start>=0&&(e.start=0,e.measured-=t),this.#i=[],this.#o=0}#d(){let e=this.#l;if(e.start<0)return 0;let t=this.#f(e.at,!1);if(t>this.#t)throw this.#T();if(t<Dt)return 0;let n=nn(this.#r,e.measured,this.#r.length);return Math.min(t,this.#t-t-n+1)}#f(e,t){let n=this.#l,r=!t&&rn(this.#r.charCodeAt(e-1))?e-1:e;return n.bytes+=nn(this.#r,n.measured,r),n.measured=r,n.bytes}#p(){let e=this.#l;for(;e.at<this.#r.length;){let e=this.#m();if(e===`more`)break;if(e!==`on`)return e}return this.#c?this.#h():null}#m(){switch(this.#l.state){case`code`:return this.#_();case`single`:case`double`:case`backtick`:return this.#b();case`line`:return this.#x();case`block`:return this.#S();case`gap`:return this.#C();case`argument`:return this.#w()}}#h(){let e=this.#l;if(e.state===`gap`)throw this.#E();if(e.start>=0&&this.#f(this.#r.length,!0)>this.#t)throw this.#T();let t=qt[this.#g()];if(t)throw new V(`The file ends inside ${t} that starts on line ${e.openLine}.`,e.count+1,e.openLine);if(e.start<0)return null;let n=this.#y(this.#r.length);return e.at=this.#r.length,e.start=-1,n}#g(){let e=this.#l.state;return e===`single`?`string`:e===`double`?this.#e.ansiQuotes?`name`:`string`:e===`backtick`?`name`:e===`block`?`comment`:`other`}#_(){let e=this.#r,t=e.length,n=this.#l,r=this.#c,i=n.delimiter.charCodeAt(0),a=n.at,o=e=>(n.at=a,e);for(;a<t;){let s=e.charCodeAt(a);if(s===H){n.line+=1,n.fresh=!0,a+=1;continue}if(Yt(s)){a+=1;continue}if(n.start<0&&(s|32)===At){let t=Xt(e,a,r);if(t===`more`)return o(`more`);if(t!==`no`){if(!n.fresh)throw this.#D();if(t===`bare`)throw this.#E();return a+=kt.length+1,n.state=`gap`,o(`on`)}}if(s===i){let t=Zt(e,a,n.delimiter,r);if(t===`more`)return o(`more`);if(t===`yes`){let e=n.start>=0?this.#y(a):null;if(a+=n.delimiter.length,n.start=-1,n.executable=!1,n.fresh=!1,e)return o(e);continue}}if(s===It)return a+=1,n.state=`line`,o(`on`);if(s===zt){let t=Qt(e,a,r);if(t===`more`)return o(`more`);if(t===`yes`)return a+=2,n.state=`line`,o(`on`)}else if(s===Bt){let t=$t(e,a,r,this.#n);if(t===`more`)return o(`more`);if(t===`comment`)return n.openLine=n.line,n.fresh=!1,a+=2,n.state=`block`,o(`on`);if(t!==`no`){this.#v(a),n.executable=!0,a+=t;continue}}else if(s===Rt&&n.executable){if(a+1>=t&&!r)return o(`more`);if(e.charCodeAt(a+1)===Bt){n.executable=!1,a+=2;continue}}this.#v(a),a+=1;let c=Kt[s];if(c)return n.openLine=n.line,n.state=c,o(`on`)}return o(`more`)}#v(e){let t=this.#l;t.start>=0||(t.start=e,t.startLine=t.line,t.measured=e,t.bytes=0)}#y(e){let t=this.#l,n=this.#f(e,!0);if(n>this.#t)throw this.#T();let r=e;for(;r>t.start&&Yt(this.#r.charCodeAt(r-1));)--r;return t.given={statements:t.count,offset:this.#s+t.start,line:t.startLine,delimiter:t.delimiter},t.count+=1,{index:t.count,text:this.#r.slice(t.start,r),line:t.startLine,bytes:n-(e-r)}}#b(){let e=this.#r,t=e.length,n=this.#l,r=Gt[n.state],i=this.#g()===`string`&&!this.#e.noBackslashEscapes,a=n.at;for(;a<t;){let o=e.charCodeAt(a);if(o===r){if(a+1>=t&&!this.#c)break;if(e.charCodeAt(a+1)===r){a+=2;continue}return n.at=a+1,n.state=`code`,`on`}if(o===Ht&&i){if(a+1>=t){this.#c&&(a=t);break}e.charCodeAt(a+1)===H&&(n.line+=1),a+=2}else o===H&&(n.line+=1),a+=1}return n.at=a,`more`}#x(){let e=this.#l,t=this.#r.indexOf(`\n`,e.at);return t===-1?(e.at=this.#r.length,`more`):(e.at=t+1,e.line+=1,e.fresh=!0,e.state=`code`,`on`)}#S(){let e=this.#r,t=e.length,n=this.#l,r=n.at;for(;r<t;){let i=e.charCodeAt(r);if(i===Rt){if(r+1>=t)break;if(e.charCodeAt(r+1)===Bt)return n.at=r+2,n.state=`code`,`on`}else i===H&&(n.line+=1);r+=1}return n.at=r,`more`}#C(){let e=this.#r,t=this.#l,n=t.at;for(;n<e.length;){let r=e.charCodeAt(n);if(r===H)throw this.#E();if(!Yt(r))return t.at=n,t.state=`argument`,`on`;n+=1}return t.at=n,`more`}#w(){let e=this.#r,t=e.length,n=this.#l,r=n.at;for(;r<t&&!en(e.charCodeAt(r));){if(r-n.at>=Ot)throw this.#O();r+=1}if(r>=t&&!this.#c)return`more`;if(e.charCodeAt(r)===Mt){if(r+1>=t&&!this.#c)return`more`;if(e.charCodeAt(r+1)!==H)throw this.#O()}let i=e.slice(n.at,r);if(!tn(i))throw this.#O();return n.delimiter=i,n.at=r,n.state=`line`,`on`}#T(){let e=this.#l;return new V(`Statement ${e.count+1}, which starts on line ${e.startLine}, is longer than ${this.#t.toLocaleString(`en`)} bytes.`,e.count+1,e.startLine)}#E(){let e=this.#l;return new V(`Line ${e.line}: DELIMITER has nothing after it to end statements with.`,e.count+1,e.line)}#D(){let e=this.#l;return new V(`Line ${e.line}: DELIMITER is the mysql client’s command only as the first word of its line.`,e.count+1,e.line)}#O(){let e=this.#l;return new V(`Line ${e.line}: a DELIMITER is 1 to 15 plain characters, with no backslash and no quote first.`,e.count+1,e.line)}},Dt=65536,Ot=15,kt=`delimiter`,At=100,jt=9,H=10,Mt=13,Nt=32,Pt=33,Ft=34,It=35,Lt=39,Rt=42,zt=45,Bt=47,Vt=77,Ht=92,Ut=96,Wt=127,Gt={single:Lt,double:Ft,backtick:Ut},Kt={[Lt]:`single`,[Ft]:`double`,[Ut]:`backtick`},qt={string:`a string`,name:`a quoted name`,comment:`a comment`,other:null};function Jt(e){return{noBackslashEscapes:e.noBackslashEscapes,ansiQuotes:e.ansiQuotes}}function Yt(e){return e===Nt||e>=jt&&e<=Mt}function Xt(e,t,n){let r=t+9;for(let i=t;i<r;i+=1){if(i>=e.length)return n?`no`:`more`;if((e.charCodeAt(i)|32)!==kt.charCodeAt(i-t))return`no`}if(r>=e.length)return n?`bare`:`more`;let i=e.charCodeAt(r);return i===Nt||i===jt?`yes`:i===H?`bare`:i===Mt?r+1>=e.length?n?`no`:`more`:e.charCodeAt(r+1)===H?`bare`:`no`:`no`}function Zt(e,t,n,r){for(let i=1;i<n.length;i+=1){if(t+i>=e.length)return r?`no`:`more`;if(e.charCodeAt(t+i)!==n.charCodeAt(i))return`no`}return`yes`}function Qt(e,t,n){if(t+1>=e.length)return n?`no`:`more`;if(e.charCodeAt(t+1)!==zt)return`no`;if(t+2>=e.length)return n?`yes`:`more`;let r=e.charCodeAt(t+2);return r<=Nt||r===Wt?`yes`:`no`}function $t(e,t,n,r){let i=e.length;if(t+1>=i)return n?`no`:`more`;if(e.charCodeAt(t+1)!==Rt)return`no`;if(t+2>=i)return n?`comment`:`more`;let a=e.charCodeAt(t+2);return a===Pt?3:!r||a!==Vt?`comment`:t+3>=i?n?`comment`:`more`:e.charCodeAt(t+3)===Pt?4:`comment`}function en(e){return e===Nt||e===H||e===Mt}function tn(e){if(e.length<1||e.length>Ot||Kt[e.charCodeAt(0)])return!1;for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<=Nt||n>=Wt||n===Ht)return!1}return!0}function nn(e,t,n){let r=n-t;for(let i=t;i<n;i+=1){let t=e.charCodeAt(i);t<128||(t<2048?r+=1:rn(t)&&an(e.charCodeAt(i+1))?(r+=2,i+=1):r+=2)}return r}function rn(e){return e>=55296&&e<=56319}function an(e){return e>=56320&&e<=57343}var on=class extends Error{offset;constructor(e,t){super(e),this.offset=t,this.name=`SourceError`}},sn=65536;async function*cn(e){let t=await fn(e),n=(t?e.stream().pipeThrough(new DecompressionStream(`gzip`)):e.stream()).getReader(),r=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),i=un,a=0,o=!1,s=e=>{let n=hn(i,e),s=n.subarray(0,n.byteLength-gn(n)),c,l;try{l=r.decode(s)}catch{let e=vn(s);c=mn(a+e,t),s=s.subarray(0,e),l=r.decode(s)}return i=n.slice(s.byteLength),a+=s.byteLength,l&&!o&&(o=!0,l.charCodeAt(0)===dn&&(l=l.slice(1))),{text:l,refused:c}};try{for(;;){let{done:e,value:r}=await pn(n,t);if(e)break;for(let e=0;e<r.byteLength;e+=sn){let{text:t,refused:n}=s(r.subarray(e,e+sn));if(t&&(yield t),n)throw n}}if(i.byteLength>0)throw mn(a,t)}finally{await n.cancel().catch(()=>{})}}async function*ln(e,t){let n=t;for await(let t of e)n>=t.length?n-=t.length:(yield n>0?t.slice(n):t,n=0)}var un=new Uint8Array,dn=65279;async function fn(e){let t=new Uint8Array(await e.slice(0,2).arrayBuffer());return t[0]===31&&t[1]===139}async function pn(e,t){try{return await e.read()}catch(e){throw!t||!(e instanceof TypeError)?e:new on(`This .gz can’t be read: it is damaged, cut short, or several gzip files joined.`)}}function mn(e,t){return new on(`The file isn’t UTF-8: what is at byte offset ${`${e.toLocaleString(`en`)}${t?` of the unpacked file`:``}`} can’t be read as text.`,e)}function hn(e,t){if(e.byteLength===0)return t;let n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e),n.set(t,e.byteLength),n}function gn(e){for(let t=1;t<=3&&t<=e.byteLength;t+=1){let n=e[e.byteLength-t];if((n&192)!=128)return _n(n)>t?t:0}return 0}function _n(e){return e<128?1:e<194||e>244?0:e<224?2:e<240?3:4}function vn(e){let t=0;for(;t<e.byteLength;){let n=yn(e,t);if(n===0)break;t+=n}return t}function yn(e,t){let n=e[t],r=_n(n);if(r<2)return r;let i=e[t+1]??0;if(i<(n===224?160:n===240?144:128)||i>(n===237?159:n===244?143:191))return 0;for(let n=2;n<r;n+=1)if(((e[t+n]??0)&192)!=128)return 0;return r}var bn=100,xn=1e5,Sn=1e4,Cn=16,wn=80,Tn=64,En=512,Dn=44,On=46,kn=58,An=61,U=64,jn=`\\0`,Mn=new TextEncoder;function Nn(e,t){return new Pn(t).read(e)}var Pn=class{result={from:1,statements:0,bytes:0,kinds:Bn(),tables:[],tablesUnlisted:0,leaves:{total:0,first:[]},refused:{total:0,first:[]},modeUnread:{total:0,first:[]},unsent:{total:0,first:[]},readings:[],stopped:null};options;splitter;reading;counted=new Map;kept=new Map;client=null;keptSets=new Map;selected;line=1;constructor(e){this.options=e,this.reading={mode:e.mode,mariadb:e.mariadb,version:de(e.version)};let{rest:t}=e;if(this.splitter=new Et({mode:e.mode,maxStatement:e.limits.statementBytes,mariadb:e.mariadb,...t?{from:t.from}:{}}),this.selected=t?t.database:e.database,!t)return;this.result.from=t.from.statements+1,this.line=t.from.line;let n=t.characterSet;c(n)!==`alike`&&(this.client={set:n})}async read(e){let{signal:t}=this.options;try{t?.throwIfAborted();for await(let n of e)this.take(n),t?.throwIfAborted();t?.throwIfAborted(),this.splitter.end(),this.drain()}catch(e){this.result.stopped=this.stoppedBy(e)}return this.result}stoppedBy(e){if(e instanceof V)return Jn(e);if(!(e instanceof on))throw e;try{this.splitter.readPushed(),this.drain()}catch(e){if(e instanceof V)return Jn(e);throw e}return Yn(e,this.result.statements+1,this.line)}take(e){this.result.bytes+=Mn.encode(e).byteLength,this.line+=Gn(e),this.splitter.push(e),this.drain(),this.options.onProgress?.(this.result.bytes)}drain(){for(let e=this.splitter.next();e;e=this.splitter.next())this.note(e)}note(e){let{result:t}=this;this.record(e);let n=T(e.text,this.reading);t.statements=e.index,t.kinds[n.kind]+=1,this.count(n);let r=Un(n,this.options.database);if((r!==void 0||Ln.has(n.kind))&&Vn(t.leaves,()=>Wn(e,n.kind,r??n.database)),n.kind===`xa`&&Vn(t.refused,()=>qn(e)),!this.sent(e))return;n.kind===`use`&&this.select(n.database),n.kind===`drop-database`&&this.dropped(n.database);let i=n.at===void 0?e.text:e.text.slice(n.at);Rn.has(n.kind)?this.set(e,i):Kn(i,n.kind,this.reading)&&Vn(t.modeUnread,()=>Hn(e))}record(e){let{readings:t}=this.result,n={from:e.index,...this.reading.mode,reads:this.client?c(this.client.set):`alike`,database:this.selected},r=t.at(-1);if(!(r&&Zn(r,n))){if(t.length>=xn)throw new V(`The file changes how its statements are read (sql_mode, the character set, the database) more than ${xn.toLocaleString(`en`)} times, and the check follows it no further.`,e.index,e.line);t.push(n)}}sent(e){let{client:t}=this;return!t||s.has(t.set)&&_t(e.text)?!0:(Vn(this.result.unsent,()=>({...Hn(e),...t})),!1)}count(e){let t=Fn[e.kind];if(!t||e.table===void 0)return;let n=this.inDatabase(e.database),r=x(e.table,Tn),i=n===null?r:n+jn+r,a=this.counted.get(i);if(!a){if(this.result.tables.length>=Sn){this.result.tablesUnlisted+=1;return}a={database:n,name:r,creates:0,drops:0,fills:0,changes:0},this.counted.set(i,a),this.result.tables.push(a)}a[t]+=1}inDatabase(e){let t=e??this.selected;return t===null||t===this.options.database?null:x(t,Tn)}select(e){e!==void 0&&(this.selected=e)}dropped(e){e!==void 0&&e===this.selected&&(this.selected=null)}set(e,t){this.client=br(t,e.index,this.reading,this.client,this.keptSets);let n=ir(t,this.reading,this.kept);n===`unknown`?Vn(this.result.modeUnread,()=>Hn(e)):n&&!Xn(n,this.reading.mode)&&(this.reading={...this.reading,mode:n},this.splitter.setMode(n))}},Fn={\"create-table\":`creates`,\"create-view\":`creates`,\"drop-table\":`drops`,\"drop-view\":`drops`,insert:`fills`,replace:`fills`,\"alter-table\":`changes`,\"create-index\":`changes`,\"drop-index\":`changes`,truncate:`changes`,update:`changes`,delete:`changes`},In=new Set([`swe7`]),Ln=new Set([`use`,`create-database`,`drop-database`,`alter-database`]),Rn=new Set([`set`,`set-global`]),zn=new Set([...Rn,`other`]);function Bn(){return Object.fromEntries(C.map(e=>[e,0]))}function Vn(e,t){e.total+=1,e.first.length<bn&&e.first.push(t())}function Hn(e){return{n:e.index,line:e.line,head:x(e.text,wn)}}function Un(e,t){return e.database!==void 0&&e.database!==t?e.database:e.others?.find(e=>e!==t)}function Wn(e,t,n){let r={...Hn(e),kind:t};return n!==void 0&&(r.database=x(n,Tn)),r}function Gn(e){let t=0;for(let n=e.indexOf(`\n`);n!==-1;n=e.indexOf(`\n`,n+1))t+=1;return t}function Kn(e,t,n){return!zn.has(t)||!fe(e)?!1:new w(e,n).peek()!==null}function qn(e){return{n:e.index,line:e.line,message:`Statement ${e.index}, which starts on line ${e.line}, is an XA statement: an import doesn’t run XA transactions.`}}function Jn(e){return{n:e.statement,line:e.line,message:e.message}}function Yn(e,t,n){return e.offset===void 0?{n:t,message:e.message}:{n:t,line:n,offset:e.offset,message:`${e.message} It is on line ${n}, in or just before statement ${t}.`}}function Xn(e,t){return e.noBackslashEscapes===t.noBackslashEscapes&&e.ansiQuotes===t.ansiQuotes}function Zn(e,t){return Xn(e,t)&&e.reads===t.reads&&e.database===t.database}var Qn={what:`other`},$n=new Set([`SESSION`,`LOCAL`]),er=new Set([`ALLOW_INVALID_DATES`,`ANSI`,`ANSI_QUOTES`,`ERROR_FOR_DIVISION_BY_ZERO`,`HIGH_NOT_PRECEDENCE`,`IGNORE_SPACE`,`NO_AUTO_VALUE_ON_ZERO`,`NO_BACKSLASH_ESCAPES`,`NO_DIR_IN_CREATE`,`NO_ENGINE_SUBSTITUTION`,`NO_UNSIGNED_SUBTRACTION`,`NO_ZERO_DATE`,`NO_ZERO_IN_DATE`,`ONLY_FULL_GROUP_BY`,`PAD_CHAR_TO_FULL_LENGTH`,`PIPES_AS_CONCAT`,`REAL_AS_FLOAT`,`STRICT_ALL_TABLES`,`STRICT_TRANS_TABLES`,`TRADITIONAL`]),tr=new Set([`TIME_TRUNCATE_FRACTIONAL`]),nr=new Set([`DB2`,`EMPTY_STRING_IS_NULL`,`IGNORE_BAD_TABLE_OPTIONS`,`MAXDB`,`MSSQL`,`MYSQL323`,`MYSQL40`,`NO_AUTO_CREATE_USER`,`NO_FIELD_OPTIONS`,`NO_KEY_OPTIONS`,`NO_TABLE_OPTIONS`,`ORACLE`,`POSTGRESQL`,`SIMULTANEOUS_ASSIGNMENT`,`TIME_ROUND_FRACTIONAL`]),rr=new Set([`ANSI_QUOTES`,`ANSI`,`DB2`,`MAXDB`,`MSSQL`,`ORACLE`,`POSTGRESQL`]);function ir(e,t,n){let r=new w(e,t);if(r.next(),r.takes(`STATEMENT`))return ar(r,t);let i={session:!0},a=[],o=null;do{let e=or(r,i);dr(r);let s=fr(r);if(e.what===`variable`){let n=s===`session`?t.mode:void 0;e.name!==void 0&&a.push([e.name,n])}else e.what===`maybe`?o=`unknown`:e.what===`mode`&&(o=gr(s,t,n))}while(r.pastComma());for(let[e,t]of a)yr(n,e,t);return o}function ar(e,t){for(let t=e.keyword();t!==`FOR`;t=e.keyword())if(!e.next())return null;e.next();let n=e.peek();if(!n)return null;let r=e.text.slice(n.start);return Kn(r,T(r,t).kind,t)?`unknown`:null}function or(e,t){if(e.symbol(U)){if(!e.symbol(U))return{what:`variable`,name:lr(e)};let{database:t,name:n}=e.qualified();return cr(n,t===void 0||sr(t))}let n=e.keyword();($n.has(n)||Ge.has(n))&&(t.session=$n.has(n),e.next());let{database:r,name:i}=e.qualified();return r===void 0?cr(i,t.session):Qn}function sr(e){return $n.has(e.toUpperCase())}function cr(e,t){let n=e===void 0?`no`:pe(e);return n===`no`||!t?Qn:{what:n===`yes`?`mode`:`maybe`}}function lr(e){let t=e.next();if(!t||t.type===`symbol`)return;if(t.type===`quoted`)return e.unquoted(t)?.toLowerCase();let n=t.end;for(let t=e.peek();t&&ur(e,t,n);t=e.peek())n=t.end,e.next();return n-t.start>Tn?void 0:e.text.slice(t.start,n).toLowerCase()}function ur(e,t,n){return t.start!==n||t.type===`quoted`?!1:t.type===`word`||e.text.charCodeAt(t.start)===On}function dr(e){e.symbol(kn),e.symbol(An)}function fr(e){let t=e.peek(),n=`other`;t?.type===`quoted`||t?.type===`word`?(e.next(),n=pr(e,t)):e.symbol(U)&&(n=e.symbol(U)?mr(e):{variable:lr(e)});let r=e.peek();return r===null||hr(e,r,Dn)?n:`other`}function pr(e,t){let n=+(t.type===`quoted`);return t.end-t.start-2*n>En?`other`:{literal:e.text.slice(t.start+n,t.end-n)}}function mr(e){let{database:t,name:n}=e.qualified();return(t===void 0||sr(t))&&n!==void 0&&pe(n)===`yes`?`session`:`other`}function hr(e,t,n){return t.type===`symbol`&&e.text.charCodeAt(t.start)===n}function gr(e,t,n){return e===`session`?t.mode:e===`other`?`unknown`:`literal`in e?_r(e.literal,t.mariadb):e.variable!==void 0&&n.get(e.variable)||`unknown`}function _r(e,t){let n={noBackslashEscapes:!1,ansiQuotes:!1};if(e===``)return n;for(let r of e.split(`,`)){let e=vr(r,t);if(e===void 0)return`unknown`;e===`NO_BACKSLASH_ESCAPES`?n.noBackslashEscapes=!0:rr.has(e)&&(n.ansiQuotes=!0)}return n}function vr(e,t){if(!_t(e))return;let n=e.toUpperCase();return er.has(n)||(t?nr:tr).has(n)?n:void 0}function yr(e,t,n){n===void 0?e.delete(t):(e.has(t)||e.size<Cn)&&e.set(t,n)}function br(e,t,n,r,i){let a=new w(e,n);if(a.next(),a.takes(`STATEMENT`))return r;let o={session:!0},s=[],c;do{let e=xr(a,o);if(typeof e==`object`&&e)dr(a),e.variable!==void 0&&s.push([e.variable,Cr(a,r)]);else if(e!==null){e===`client`&&dr(a);let t=Sr(a,e,i);t!==void 0&&(c=t)}}while(a.pastComma());for(let[e,t]of s)wr(i,e,t);return c===void 0?r:c===null?null:{set:c,setBy:t}}function xr(e,t){if(e.symbol(U))return e.symbol(U)?Tr(e)?`client`:null:{variable:lr(e)};let n=e.keyword();if(($n.has(n)||Ge.has(n))&&(t.session=$n.has(n),e.next()),e.takes(`NAMES`)||e.takes(`CHARSET`))return`names`;if(e.takes(`CHARACTER`))return e.takes(`SET`)?`names`:null;let{database:r,name:i}=e.qualified();return r===void 0&&t.session&&Er(i)?`client`:null}function Sr(e,t,n){let r;if(e.takes(`DEFAULT`))r=null;else if(t===`client`&&e.symbol(U)){let t=e.symbol(U)?void 0:lr(e);r=t===void 0?void 0:n.get(t)}else r=Or(Dr(e));return t===`names`&&e.takes(`COLLATE`)&&e.next(),kr(e)?r:void 0}function Cr(e,t){let n=e.peek(),r;return n?.type===`quoted`&&e.isString(n)?(e.next(),r=Or(e.unquoted(n))):e.symbol(U)&&e.symbol(U)&&Tr(e)&&(r=t?.set??null),kr(e)?r:void 0}function wr(e,t,n){n===void 0?e.delete(t):(e.has(t)||e.size<Cn)&&e.set(t,n)}function Tr(e){let{database:t,name:n}=e.qualified();return(t===void 0||sr(t))&&Er(n)}function Er(e){return e!==void 0&&_t(e)&&e.toLowerCase()===`character_set_client`}function Dr(e){let t=e.peek();if(t&&t.type!==`symbol`)return e.next(),t.type===`quoted`?e.unquoted(t):t.end-t.start>Tn?void 0:e.text.slice(t.start,t.end)}function Or(e){if(e===void 0||!_t(e))return;let t=e.toLowerCase();return o.has(t)?null:s.has(t)||In.has(t)?t:void 0}function kr(e){let t=e.peek();return t===null||hr(e,t,Dn)}var Ar={silenceMs:3e4,pollMs:3e3,giveUpMs:12e4,touchMs:45e3,drainMs:2e3,endMs:27e4},jr=3,Mr=256,Nr=1024,Pr=12e4,Fr=3e5,Ir=1048576,W=Symbol(`late`),Lr=class{#e;#t;#n;#r;#i=!1;#a;#o=!1;#s;#c;#l;#u=new Rr;#d=[];#f=null;#p=null;#m=0;#h=null;#g;#_=0;#v={bytes:0,affected:0,warnings:0};#y={done:0,running:null};#b=0;#x=new Set;#S=new Set;#C=new Set;#w=new Set;#T=null;#E=!1;#D=null;#O={start:0,count:0};#k=!1;#A=!1;#j=null;#M=null;#N=!1;#P=new AbortController;#F=null;#I=null;#L=!1;constructor(e){this.#e=e,this.#t={...Ar,...e.timing},this.#n=e.keepChars??33554432,this.#r=e.text[Symbol.asyncIterator](),this.#s=Yr(e.started),this.#c=Xr(e.started),this.#l=e.readings,this.#a=this.#G(),this.#g=qr(e.started.limits.batchBytes,u)}get kept(){return this.#u.chars}start(){if(this.#R(),this.#k)throw Error(`The import has already started.`);return this.#k=!0,this.#V(!1)}retry(){return this.#R(),this.#j?.type===`unknown`?this.#V(!0):(this.#B(),this.#V(!1))}skip(){return this.#R(),this.#x.add(this.#B().n),this.#V(!1)}goOn(e){if(this.#R(),this.#j?.type!==`reread`)throw Error(`The import isn’t waiting on the rest.`);let{from:t}=this.#j.reread;if(e[0]?.from!==t)throw Error(`The rest is checked from statement ${t}.`);return this.#l=[...this.#l.filter(e=>e.from<t),...e],this.#V(!1)}stop(){return this.#j&&Kr(this.#j)?Promise.resolve(this.#j):(this.#N=!0,this.#P.abort(),this.#z(`stopped`).then(e=>this.#H(e)))}get touchMs(){let e=Jr(this.#e.started.limits.idleMs,Fr);return Math.max(1,Math.min(this.#t.touchMs,Math.floor(e/3)))}async touch(){if(this.#F||this.#j&&Kr(this.#j))return null;let e=this.#j,t=await this.#Se().catch(()=>null);return!t||this.#A||this.#F||this.#j!==e||t.state!==`ended`&&t.state!==`lost`?null:this.#H(this.#we(t))}#R(){if(this.#A)throw Error(`The import is already running.`);if(this.#j&&Kr(this.#j))throw Error(`The import is over.`);if(this.#F)throw Error(`The import was asked to end: it can only be stopped.`)}#z(e){return(!this.#F||this.#L)&&(this.#L=!1,this.#I??=e,this.#F=this.#Te(this.#I)),this.#F}#B(){if(this.#j?.type!==`failed`)throw Error(`The import hasn’t failed.`);let{failure:e}=this.#j;if(!e.canGoOn)throw Error(`The import can’t go on from this failure.`);return this.#E=!0,e}async#V(e){this.#A=!0,this.#O.count=0;try{let t=await this.#W(e);return this.#H(this.#N?await this.#F:t)}finally{this.#A=!1}}#H(e){if(this.#j&&this.#M===e)return this.#j;this.#U(e);let t=Wr(this.#w),n={...e,leftOut:this.#S.size,...t.length>0?{sentAgain:t}:{}};return this.#j=n,this.#M=e,this.#E=!1,Kr(e)&&Promise.resolve(this.#r.return?.()).catch(()=>{}),n}#U(e){let t=Gr(e);if(t===void 0)return;let n={done:this.#y.done,leftOut:this.#S.size};t!==this.#_&&(this.#v=this.#ve(t,null)),this.#_=t,this.#y={done:t,running:null},this.#fe(t,t),(t!==n.done||this.#S.size!==n.leftOut)&&this.#ke()}async#W(e){for(;;){if(this.#N)return this.#F;if(e||!this.#c){let t=await this.#xe({halt:this.#P.signal});if(this.#N)return this.#F;if(`untold`in t)return this.#Q(t);let n=e?this.#Ce(t):this.#Z(t);if(n)return n}let t;try{t=await this.#K()}catch(e){return this.#De(e)}if(this.#N)return this.#F;if(t===`reread`){let e=await this.#X();if(e)return e;continue}if(!t)return this.#z(`finished`);let n=await this.#ne(t);if(typeof n!=`string`)return n;e=n===`ask`}}#G(e){let{started:t,mariadb:n}=this.#e;return new Et({mode:this.#s,maxStatement:qr(t.limits.statementBytes,ee),mariadb:n,...e?{from:e}:{}})}async#K(){if(this.#h)throw this.#h;let{limits:e}=this.#e.started,t=this.#g,n=qr(e.batchStatements,d),r=[],i=0,a;for(;r.length<n;){let e=this.#f??await this.#q();if(!e)break;if(this.#f=null,this.#x.has(e.taken.n)&&a===void 0){a=e.taken.n,this.#d.push(e.taken);continue}let n=4+e.taken.bytes,o=r.length===0||i+n<=t;if(this.#x.has(e.taken.n)||!o||!this.#Y(e.taken.n)){this.#f=e;break}if(this.#d.push(e.taken),r.push(e.text),i+=n,fe(e.text))break}if(r.length===0&&a===void 0)return this.#f?`reread`:null;let o={connection:this.#e.connection,import:this.#e.started.import,start:this.#_+1,count:r.length,nbe:+!!this.#s.noBackslashEscapes,aq:+!!this.#s.ansiQuotes,...a===void 0?{}:{skip:a}};return{query:o,body:r.length>0?m(r):null,numbers:ne(o)}}async#q(){try{return await this.#J(this.#d.length>0)}catch(e){if(!(e instanceof V)||this.#d.length===0)throw e;return this.#h=e,null}}async#J(e){for(;;){let t=this.#a.next();if(t){this.#m=t.index;let{index:e,line:n,bytes:r,text:i}=t;return{taken:{n:e,line:n,head:x(i,Mr),bytes:r,point:this.#a.given,...this.#$(i)},text:i}}if(this.#o)return null;if(this.#i){this.#a.end(),this.#o=!0;continue}if(e&&this.#u.chars>this.#n)return null;let n=await this.#r.next();n.done?this.#i=!0:(this.#u.add(n.value),this.#a.push(n.value),this.#ee())}}#Y(e){let t=Qr(this.#l,e),n=this.#c;return t!==void 0&&n!==null&&Zn(t,Zr(n))}async#X(){let e=await this.#xe({halt:this.#P.signal});if(this.#N)return this.#F;if(`untold`in e)return this.#Q(e);let t=this.#Z(e);if(t)return t;if(!this.#f||this.#Y(this.#f.taken.n))return null;let n=this.#f.taken,r=Qr(this.#l,n.n);if(!r)return this.#Oe(wi(n.n));if(e.done!==n.n-1)return this.#Oe(Ti(n.n,e.done));let{pauseMs:i}=this.#e.started.limits,a=e.state===`failed`?e.pauseLeftMs:void 0,o=this.#S.has(n.n-1)?{skipped:n.n-1}:{};return{type:`reread`,reread:{from:n.n,point:n.point,session:Xr(e),assumed:r,...o,pauseMs:a??Jr(i,Pr)}}}#Z(e){if(e.state===`ended`||e.state===`lost`)return this.#we(e);this.#c=Xr(e);let t=Yr(e);if($r(t,this.#s))return null;let n=e.inTransaction||e.state===`failed`?e.since:void 0;return this.#me(e.done,n,t)?null:this.#Oe(Ci(e.done))}#Q(e){let{giveUpMs:t}=this.#t;return this.#Oe(e.untold===`refused`?e.message:Ei(t))}#$(e){let t={mode:this.#s,mariadb:this.#e.mariadb},{kind:n}=T(e,t),r=Vr[n]||n===`other`&&Hr.has(Ur(e,t));return{changesRows:Br[n],mayCommit:!r}}#ee(){this.#u.dropBefore(this.#te()),this.#u.chars<=this.#n||!this.#p?.point||(this.#p={...this.#p,point:null},this.#u.dropBefore(this.#te()))}#te(){return Math.min(this.#p?.point?.offset??1/0,this.#d[0]?.point.offset??1/0,this.#f?.taken.point.offset??1/0,this.#a.behind)}async#ne(e){let{start:t}=e.query;if(this.#O={start:t,count:this.#O.start===t?this.#O.count+1:1},this.#O.count>jr)return this.#Oe(Si(t,this.#D));let n=new AbortController,i=()=>n.abort();this.#P.signal.addEventListener(`abort`,i);let a=setInterval(()=>void this.#Se().catch(()=>{}),this.touchMs),o={ended:!1};try{let t=this.#e.api.importRun(e.query,e.body,n.signal);return await this.#ie(e,t[Symbol.asyncIterator](),o)}catch(t){let n=t instanceof r&&t.status===413&&!t.ours?e.body:null;return this.#D={refused:n!==null||ri(t),reason:t instanceof Error?t.message:String(t)},n?this.#re(e,n.byteLength):`ask`}finally{clearInterval(a),this.#P.signal.removeEventListener(`abort`,i),o.ended||n.abort()}}#re(e,t){return e.query.count===1?this.#Oe(Di(e.numbers[0],t)):(this.#g=Math.floor(t/2),--this.#O.count,`ask`)}async#ie(e,t,n){let{limits:r}=this.#e.started,i=qr(r.bodyMs,te)+this.#t.silenceMs,a=-1,o=null;for(;;){let r=await ti(t.next(),i);if(r===W)throw Error(`The server sent nothing for ${ji(i)}.`);if(r.done)throw n.ended=!0,Error(`The answer ended before its last line.`);let s=gi(r.value);if(!s||!mi(e,a,o!==null,s))throw xi();switch(i=this.#t.silenceMs,oi.has(s.type)&&(n.ended=await this.#ae(t)),s.type){case`accepted`:a=0,this.#E=!1;break;case`statement`:a+=1,this.#oe(s.n,s);break;case`beat`:this.#y.running={n:s.n,ms:s.ms},this.#ke();break;case`mode`:o=s;break;case`done`:{let e=s.inTransaction?s.since:void 0;return o&&(this.#c=Xr(o)),this.#me(s.done,e,o?Yr(o):this.#s)?`on`:this.#Oe(Ci(s.done))}case`failed`:return this.#se(s);case`lost`:return{type:`closed`,state:`lost`,done:s.done,...s.doubt===void 0?{}:{doubt:s.doubt}};case`stopped`:throw Error(`The import was ended while the batch ran.`)}}}async#ae(e){let t=await ti(e.next(),this.#t.drainMs).catch(()=>W);return t!==W&&t.done===!0}#oe(e,t){let n=this.#d.find(t=>t.n===e),r=n?.changesRows===!1?0:t.affected;n&&(n.counted={affected:r,warnings:t.warnings},this.#v.bytes+=n.bytes),this.#v.affected+=r,this.#v.warnings+=t.warnings,this.#y={done:e,running:null},this.#fe(e,e),this.#ke()}#se(e){this.#c=null;let t=this.#ce(e);if(e.ended){let n=e.since===void 0?{}:{since:e.since};return this.#he(e.done,e.since),{type:`closed`,state:`ended`,done:e.done,...n,failure:t}}let n=this.#me(e.done,e.since,this.#s),r=Jr(this.#e.started.limits.pauseMs,Pr);return this.#ue(t,e.done,e.since,n,r)}#ce(e){let{n:t,error:n,state:r}=e,i=this.#d.find(e=>e.n===t),a=this.#le(t),o=i??a,s=!n.unsent&&(i?.mayCommit??(!a||a.mayCommit));return{n:t,...o?.line===void 0?{}:{line:o.line},...o?.head===void 0?{}:{head:o.head},error:{errno:n.errno,code:x(n.code,Nr),message:x(n.message,Nr),...n.unsent?{unsent:!0}:{}},state:r,...s?{mayCommit:!0}:{}}}#le(e){return this.#T?.n===e?this.#T:void 0}#ue(e,t,n,r,i){this.#de(e.n,t);let a=Wr(this.#C).filter(t=>t!==e.n),o={...e,done:t,...n===void 0?{}:{since:n},pauseMs:i,canGoOn:r,...r?{}:{whyNot:this.#pe(e.state,t,n)},...r&&a.length>0?{resends:a}:{}};return this.#T=o,{type:`failed`,failure:o}}#de(e,t){this.#fe(e-1,t),this.#x.delete(e)}#fe(e,t){for(let t of this.#x)t>e||(this.#x.delete(t),this.#C.delete(t),this.#S.add(t));for(let e of[...this.#S,...this.#w])e<=t||(this.#S.delete(e),this.#w.delete(e),this.#C.add(e));for(let e of this.#C)e>t||(this.#C.delete(e),this.#w.add(e))}#pe(e,t,n){return e!==`rolled-back`||n===void 0?Ci(t):`The server rolled the file’s transaction back from statement ${Y(n)}. To run it again the file’s text from there on is needed, and no more than its last ${Y(this.#n)} characters are kept. The import can only be stopped here.`}#me(e,t,n){let r=t===void 0?null:this.#_e(t),i=this.#ve(e,r),a=this.#ye(e,n,r);return this.#p=r,this.#d=a?[]:zr(this.#d,e),this.#ee(),this.#ge(e,i),a}#he(e,t){let n=t===void 0?null:this.#_e(t),r=this.#ve(e,n);this.#d=zr(this.#d,e),this.#ge(e,r)}#ge(e,t){this.#v=t,this.#_=e,this.#y={done:e,running:null},this.#fe(e,e),this.#ke()}#_e(e){if(this.#p?.n===e)return this.#p;let t=this.#d.find(t=>t.n===e);return t?{n:e,point:t.point,totals:this.#ve(e-1,null)}:null}#ve(e,t){if(t?.n===e+1)return{...t.totals};let n={...this.#v};for(let{n:t,bytes:r,counted:i}of this.#d)t>e&&i&&(n.bytes-=r,n.affected-=i.affected,n.warnings-=i.warnings),t<=e&&!i&&(n.bytes+=r);return n}#ye(e,t,n){let r=$r(t,this.#s),i=this.#m-e;if((i===0||r&&i===1&&this.#f?.taken.n===e+1)&&(r||!this.#h))return r||this.#a.setMode(t),this.#s=t,!0;let a=i===0?e:e+1,o=this.#be(a,n),s=o?this.#u.from(o.offset):null;if(!o||s===null)return!1;let c=this.#G(o);return c.push(s),a===e&&c.next()?.index!==e?!1:(c.setMode(t),this.#s=t,this.#a=c,this.#h=null,this.#o=!1,this.#f=null,this.#m=e,!0)}#be(e,t){return t?.n===e&&t.point?t.point:this.#f?.taken.n===e?this.#f.taken.point:this.#d.find(t=>t.n===e)?.point}async#xe(e={}){let{pollMs:t,giveUpMs:n}=this.#t,{halt:r,until:i=1/0}=e,a=Date.now();this.#b+=1,this.#ke();try{for(;;){try{let e=await this.#Se(r);if(e.state!==`running`)return e;a=Date.now(),this.#y={done:e.done,running:e.running??null},this.#ke()}catch(e){if(ri(e))return{untold:`refused`,message:e.message};if(Date.now()-a>=n)return{untold:`silent`}}if(Date.now()>=i)return{untold:`late`};if(await ii(t,r),r?.aborted)return{untold:`halted`}}}finally{--this.#b,this.#ke()}}async#Se(e){let{api:t,connection:n,started:r}=this.#e,i=await ni(e=>t.importStatus(n,r.import,e),this.#t.silenceMs,e),a=i===W?null:yi(i);if(!a)throw Error(`The server didn’t say where the import is.`);return a}#Ce(e){let t=Yr(e);if(e.state===`ended`||e.state===`lost`)return this.#we(e);if(this.#c=Xr(e),e.state===`failed`&&e.failure){let n=this.#ce(e.failure),r=this.#E&&this.#D?.refused===!0&&this.#le(n.n),i=this.#me(e.done,e.since,t);if(r&&i)return null;let a=e.pauseLeftMs??Jr(this.#e.started.limits.pauseMs,Pr);return this.#ue(n,e.done,e.since,i,a)}let n=e.inTransaction?e.since:void 0;return this.#me(e.done,n,t)?null:this.#Oe(Ci(e.done))}#we(e){let{done:t,failure:n,rolledBack:r,since:i,doubt:a}=e,o=n?this.#ce(n):void 0;return this.#he(t,i),{type:`closed`,state:e.state===`lost`?`lost`:`ended`,done:t,...o?{failure:o}:{},...r===void 0?{}:{rolledBack:r},...i===void 0?{}:{since:i},...a===void 0?{}:{doubt:a}}}async#Te(e){let{api:t,connection:n,started:r}=this.#e,{endMs:i}=this.#t,a=Date.now()+i;try{let a=await ni(e=>t.importEnd(n,r.import,e),i),o=a===W?null:bi(a);if(o)return{type:e,ended:o}}catch(t){if(ri(t))return this.#Ee(e,t.message)}let o=Jr(r.limits.idleMs,Fr),s=await this.#xe({until:a});return`untold`in s?this.#Ee(e,s.untold===`refused`?s.message:ki(o)):s.state===`ended`?{type:e,ended:ei(s)}:s.state===`lost`?this.#we(s):this.#Ee(e,Oi(o))}#Ee(e,t){return this.#L=!0,{...this.#Oe(t),ending:e}}async#De(e){let t=e instanceof Error?e.message:String(e),n=e instanceof V?{statement:e.statement,line:e.line}:{},r=await this.#z(`stopped`),i=r.type===`stopped`?{ended:r.ended}:{};return{type:`unreadable`,message:x(t,Nr),...n,...i}}#Oe(e){return{type:`unknown`,message:x(e,Nr)}}#ke(){let e=this.#b>0,t=this.#S.size;this.#e.onProgress?.({...this.#y,asking:e,...this.#v,leftOut:t})}},Rr=class{#e=[];#t=0;chars=0;add(e){this.#e.push(e),this.chars+=e.length}dropBefore(e){for(;this.#e.length>0&&this.#t+this.#e[0].length<=e;){let{length:e}=this.#e.shift();this.#t+=e,this.chars-=e}}from(e){if(e<this.#t)return null;let t=this.#t,n=[];for(let r of this.#e)t>=e?n.push(r):t+r.length>e&&n.push(r.slice(e-t)),t+=r.length;return n.join(``)}};function zr(e,t){return e.filter(({n:e})=>e>t).map(({n:e,line:t,head:n,bytes:r,point:i,changesRows:a,mayCommit:o})=>({n:e,line:t,head:n,bytes:r,point:i,changesRows:a,mayCommit:o}))}var Br={insert:!0,replace:!0,update:!0,delete:!0,other:!0,\"create-table\":!0,\"drop-table\":!1,\"alter-table\":!1,\"create-index\":!1,\"drop-index\":!1,truncate:!1,\"create-view\":!1,\"drop-view\":!1,\"create-trigger\":!1,\"create-procedure\":!1,\"create-function\":!1,\"create-event\":!1,\"lock-tables\":!1,\"unlock-tables\":!1,\"start-transaction\":!1,commit:!1,set:!1,\"set-global\":!1,use:!1,\"create-database\":!1,\"drop-database\":!1,\"alter-database\":!1,xa:!1,account:!1},Vr={insert:!0,replace:!0,update:!0,delete:!0,use:!0,set:!0,\"set-global\":!0,other:!1,\"create-table\":!1,\"drop-table\":!1,\"alter-table\":!1,\"create-index\":!1,\"drop-index\":!1,truncate:!1,\"create-view\":!1,\"drop-view\":!1,\"create-trigger\":!1,\"create-procedure\":!1,\"create-function\":!1,\"create-event\":!1,\"lock-tables\":!1,\"unlock-tables\":!1,\"start-transaction\":!1,commit:!1,\"create-database\":!1,\"drop-database\":!1,\"alter-database\":!1,xa:!1,account:!1},Hr=new Set([`SELECT`,`DO`,`SAVEPOINT`,`RELEASE`]);function Ur(e,t){return new w(e,t).keyword()}function Wr(e){return[...e].sort((e,t)=>e-t)}function Gr(e){return e.type===`closed`?e.done:e.type===`finished`||e.type===`stopped`?e.ended.done:e.type===`unreadable`?e.ended?.done:void 0}function Kr(e){return e.type===`unreadable`?e.ended!==void 0:e.type===`finished`||e.type===`stopped`||e.type===`closed`}function qr(e,t){return K(e)&&e>=1?Math.min(e,t):t}function Jr(e,t){return ci(e)&&e>=1?e:t}function Yr(e){return{noBackslashEscapes:e.noBackslashEscapes,ansiQuotes:e.ansiQuotes}}function Xr(e){let{noBackslashEscapes:t,ansiQuotes:n,characterSet:r,database:i}=e;return!J(t)||!J(n)||typeof r!=`string`||!ui(i)?null:{noBackslashEscapes:t,ansiQuotes:n,characterSet:r,database:i}}function Zr({characterSet:e,database:t,...n}){return{...Yr(n),reads:c(e),database:t}}function Qr(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i].from<=t?n=i+1:r=i}return e[n-1]}function $r(e,t){return e.noBackslashEscapes===t.noBackslashEscapes&&e.ansiQuotes===t.ansiQuotes}function ei(e){let{done:t,rolledBack:n,since:r,doubt:i}=e;return{done:t,rolledBack:n===!0,...n&&r!==void 0?{since:r}:{},...i===void 0?{}:{doubt:i}}}function ti(e,t,n){return new Promise((r,i)=>{let a=()=>r(W),o=setTimeout(a,t);n?.addEventListener(`abort`,a),e.then(r,i).finally(()=>{clearTimeout(o),n?.removeEventListener(`abort`,a)})})}async function ni(e,t,n){let r=new AbortController;try{return await ti(e(r.signal),t,n)}finally{r.abort()}}function ri(e){return e instanceof r&&e.ours&&e.status<500}function ii(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(i),t?.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t?.addEventListener(`abort`,r)})}var ai=[`uncommitted`,`rolled-back`,`committed`,`unknown`],oi=new Set([`done`,`failed`,`lost`,`stopped`]),si=[`idle`,`running`,`failed`,`ended`,`lost`];function G(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){return Number.isSafeInteger(e)&&e>=0}function q(e){return e===void 0||K(e)}function ci(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function J(e){return typeof e==`boolean`}function li(e){return J(e.noBackslashEscapes)&&J(e.ansiQuotes)}function ui(e){return e===null||typeof e==`string`}function di(e){return li(e)&&typeof e.characterSet==`string`&&ui(e.database)}function fi(e){return G(e)&&typeof e.errno==`number`&&typeof e.code==`string`&&typeof e.message==`string`&&(e.unsent===void 0||e.unsent===!0)}function pi(e){switch(e.type){case`accepted`:return K(e.start)&&K(e.count);case`statement`:return[e.n,e.affected,e.warnings,e.rows].every(K)&&ci(e.ms);case`beat`:return K(e.n)&&ci(e.ms);case`mode`:return K(e.after)&&di(e);case`done`:return K(e.done)&&J(e.inTransaction)&&q(e.since);case`failed`:return K(e.n)&&K(e.done)&&fi(e.error)&&ai.includes(e.state)&&q(e.since)&&(e.ended===void 0||e.ended===!0);case`lost`:return K(e.done)&&q(e.doubt);case`stopped`:return K(e.done);default:return!1}}function mi(e,t,n,r){let{query:i,numbers:a}=e;if(r.type===`accepted`!=(t===-1)||n&&r.type!==`done`)return!1;let o=a[t],s=o===void 0?h(i):o-1;switch(r.type){case`accepted`:return r.start===i.start&&r.count===i.count;case`statement`:case`beat`:return r.n===o;case`mode`:return t>0&&(r.after===a[t-1]||r.after===s);case`done`:return r.done===s&&(n||o===void 0)&&(!r.inTransaction||r.since===void 0||r.since<=s);case`failed`:return r.n===o&&hi({...r,unsent:r.error.unsent});case`lost`:return r.done<=s&&(r.doubt===void 0||r.doubt===o);case`stopped`:return!0}}function hi({n:e,state:t,done:n,since:r,ended:i,unsent:a}){return r!==void 0&&r>e||a&&(t===`unknown`||t===`rolled-back`)||t===`unknown`&&!i?!1:t===`rolled-back`||t===`unknown`?r!==void 0&&n===r-1:n===e-1}function gi(e){return G(e)&&pi(e)?e:null}function _i(e){return G(e)&&K(e.n)&&fi(e.error)&&ai.includes(e.state)}function vi(e,t,n,r){if(t===void 0)return e!==`failed`;if(!_i(t))return!1;if(e===`idle`||e===`running`)return!0;let i=e===`failed`?{}:{ended:!0},{n:a,error:o}=t;return hi({n:a,state:t.state,done:n,since:r,unsent:o.unsent,...i})}function yi(e){return G(e)&&si.includes(e.state)&&K(e.done)&&J(e.inTransaction)&&di(e)&&q(e.since)&&q(e.doubt)&&vi(e.state,e.failure,e.done,e.since)&&(e.running===void 0||G(e.running)&&K(e.running.n))&&(e.pauseLeftMs===void 0||ci(e.pauseLeftMs))?e:null}function bi(e){return G(e)&&K(e.done)&&J(e.rolledBack)&&q(e.since)&&q(e.doubt)?e:null}function xi(){return Error(`The answer isn’t one to the batch that was sent.`)}function Si(e,t){return`The server didn’t take the statements from ${Y(e)} on, in ${jr} tries. The last time: ${t?.reason??`it didn’t say why.`}`}function Ci(e){return`The server is at statement ${Y(e)}, and the file’s text from there on is no longer held. The import can only be stopped here.`}function wi(e){return`The file’s check said nothing of statement ${Y(e)}, so it isn’t sent. The import can only be stopped here.`}function Ti(e,t){return`The server is at statement ${Y(t)}, and this import was to send statement ${Y(e)} next. The import can only be stopped here.`}function Ei(e){return`The server hasn’t said where the import is for ${Mi(e)}. It may still be running: ask again, or stop it.`}function Di(e,t){return`A proxy in front of the server answered 413 to statement ${Y(e)}: with its length it is ${Y(t)} bytes, and the proxy takes no request that large. It has to take ${Y(u)} bytes for an import; nginx takes ${Y(Ir)} unless its client_max_body_size says more.`}function Oi(e){return`The request to stop didn’t reach the server. ${Ai(e)}`}function ki(e){return`The server hasn’t said that the import ended. ${Ai(e)}`}function Ai(e){return`Stop again, or Stop and close. The server closes an import that nothing has asked about for ${Mi(e)}.`}function ji(e){return`${Y(Math.round(e/1e3))} seconds`}function Mi(e){let t=Math.round(e/6e4);return t===1?`1 minute`:`${Y(t)} minutes`}function Y(e){return e.toLocaleString(`en`)}var Ni=100,Pi=10,Fi=64,Ii=1153,Li=1235;function Ri(e,t){let n=new Set(t.map(e=>x(e,Fi))),r={total:0,first:[]};for(let t of e){let e=zi(t);t.database===null&&e&&n.has(t.name)&&(r.total+=1,r.first.length<Ni&&r.first.push({name:t.name,what:e}))}return r}function zi(e){return e.drops>0?e.creates>0?`replaced`:`dropped`:e.creates>0?`exists`:null}var Bi=new Map([[`create-table`,[`CREATE`]],[`drop-table`,[`DROP`]],[`truncate`,[`DROP`]],[`alter-table`,[`ALTER`]],[`create-index`,[`INDEX`]],[`drop-index`,[`INDEX`]],[`insert`,[`INSERT`]],[`replace`,[`INSERT`,`DELETE`]],[`update`,[`UPDATE`]],[`delete`,[`DELETE`]],[`create-view`,[`CREATE VIEW`]],[`drop-view`,[`DROP`]],[`lock-tables`,[`LOCK TABLES`]],[`create-trigger`,[`TRIGGER`]],[`create-procedure`,[`CREATE ROUTINE`]],[`create-function`,[`CREATE ROUTINE`]],[`create-event`,[`EVENT`]]]);function Vi(e,t){if(t===null)return null;if(t.includes(`ALL PRIVILEGES`))return[];let n=new Map;for(let[t,r]of Bi)if(e[t]!==0)for(let i of r)n.set(i,(n.get(i)??0)+e[t]);return[...n].filter(([e])=>!t.includes(e)).map(([e,t])=>({privilege:e,statements:t}))}function Hi(e,t,n){return e.stopped!==null||e.refused.total>0?!1:e.leaves.total===0&&!n||t}function Ui({from:e,session:t,assumed:n,skipped:r}){return`${r===void 0?`The server’s session reads the file from statement ${X(e)} on otherwise than the check took it to`:`Statement ${X(r)} was skipped, and the check had read the statements after it as if it had run: the server’s session reads them otherwise`}. ${Wi(t,n)} So nothing more was sent, and the rest of the file, from statement ${X(e)}, was checked again as that session reads it. Read what it holds now: the import goes on only when you choose to go on.`}function Wi(e,t){let n=[];Yi(e,t)||n.push(`its sql_mode has ${Ki(e)}, where the check took ${Ki(t)}`);let r=c(e.characterSet);if(r!==t.reads&&n.push(`it reads statements as ${e.characterSet}, ${Gi[r]}, where the check took a character set ${Gi[t.reads]}`),e.database!==t.database){let r=e.database===null?`no database`:x(e.database,Fi),i=t.database===null?`none`:x(t.database,Fi);n.push(`it has ${r} selected, where the check took ${i}`)}return n.length>0?`Now ${n.join(`; `)}.`:``}var Gi={alike:`which reads the file’s text as it was checked`,ascii:`in which the import sends only statements that are all ASCII`,otherwise:`in which the import sends no statement`};function Ki(e){let t=[e.noBackslashEscapes&&`NO_BACKSLASH_ESCAPES`,e.ansiQuotes&&`ANSI_QUOTES`].filter(e=>e!==!1);return t.length>0?t.join(` and `):`neither NO_BACKSLASH_ESCAPES nor ANSI_QUOTES`}function qi(e){let{check:t,agreed:n,typed:r,database:i}=e;return t.stopped!==null||t.refused.total>0||t.statements===0?!1:(t.leaves.total===0||n)&&r===i}function Ji(e){let t=new Set(e.toUpperCase().split(`,`));return{noBackslashEscapes:t.has(`NO_BACKSLASH_ESCAPES`),ansiQuotes:t.has(`ANSI_QUOTES`)}}function Yi(e,t){return e.noBackslashEscapes===t.noBackslashEscapes&&e.ansiQuotes===t.ansiQuotes}function Xi({errno:e,code:t,message:n}){let r=`ERROR ${e} (${t})`;return n===r?r:`${r}: ${n}`}function Zi({n:e,line:t,error:n}){let r=t===void 0?``:`, on line ${X(t)} of the file,`;return`Statement ${X(e)}${r} ${n.unsent?`was not sent`:`failed`}.`}function Qi({errno:e}){let t=`nothing of it reached the server, and nothing changed. Trying it again is refused the same way.`;switch(e){case Ii:return`It is longer than the server takes in one statement, so ${t} To import it, raise the server’s max_allowed_packet and import the file again, or split the statement in the file.`;case Li:return`The file set a character set in which the server would read this statement otherwise than this import checked it, so ${t} To import it, have the file set utf8mb4 (SET NAMES utf8mb4) in place of that set, and import the file again.`;default:return`Nothing of it reached the server, and nothing changed.`}}function $i({total:e,first:t}){let{n,line:r,set:i,setBy:a}=t[0],o=e>1?` and ${X(e-1)} more`:``,c=s.has(i)?`in which the server would read text beyond ASCII otherwise than this check did, and statement ${X(n)} holds such text`:`in which the server would read even ASCII otherwise than this check did, so the import sends no statement after it`,l=a===void 0?`the session reads statements in the character set ${i} already`:`statement ${X(a)} sets the character set ${i}`;return`Statement ${X(n)}, on line ${X(r)},${o} will be refused and not sent: ${l}, ${c}. Have the file set utf8mb4 (SET NAMES utf8mb4) instead.`}function ea({n:e,state:t,since:n,canGoOn:r,mayCommit:i,error:a}){if(t===`unknown`)return ha(e,n);if(t===`committed`||n===void 0)return t===`rolled-back`?`The server rolled the file’s transaction back: what ran in it is undone.`:`What ran before statement ${X(e)} is kept.`;let o=`statement ${X(n)}`;if(t===`uncommitted`)return`What ran from ${o} on isn’t undone: it is in the file’s open transaction, not yet committed${i&&!a.unsent?`, unless statement ${X(e)} committed it before it failed`:``}. What ran before ${o} is kept.`;let s=`The server rolled the file’s transaction back: what ran from ${o} on is undone, and what ran before it is kept.`,c=`rows those statements put into tables without transactions (MyISAM, Aria), which the server kept`;return r?`${s} Trying again runs the file again from ${o}. Two things that can’t be put back that way: ${c}, and user variables they set other than with SET.`:`${s} Not undone with it: ${c}.`}function ta({canGoOn:e},t){let n=`its connection may hold locks on a live database.`;return e?`Try it again, skip it and go on, or stop. The server waits ${ba(t)} for the choice, then closes the import: ${n}`:`The server waits ${ba(t)}, then closes the import itself: ${n}`}function na(e){let t=e.length===1;return`${ia(e)} ${t?`was`:`were`} skipped before. The server rolled back the transaction ${t?`it was`:`they were`} in, and no longer takes ${t?`it as one`:`them as ones`} to skip: trying again, or skipping this one, sends ${t?`it`:`them`} again.`}function ra(e){let t=e.length===1;return`${ia(e)} ${t?`was`:`were`} skipped at first, and ran after all: ${t?`it was`:`they were`} sent again with the transaction the server rolled back.`}function ia(e){if(e.length===1)return`Statement ${X(e[0])}`;let t=e.slice(0,Pi).map(X),n=e.length-t.length,r=n>0?`${X(n)} more`:t.pop();return`Statements ${t.join(`, `)} and ${r}`}function aa(e){let{sentAgain:t}=e.outcome,n=t===void 0?[]:[ra(t)];return[...oa(e),...n]}function oa(e){let{outcome:t}=e;switch(t.type){case`finished`:return[...ca(e,t.ended),...ga(t.ended)];case`stopped`:return[...la(e,t.ended),...ga(t.ended)];case`closed`:return _a(t);case`unreadable`:return da(t);default:return[]}}function sa(e){return e.type===`stopped`?`warning`:e.type===`finished`?e.ended.rolledBack||e.ended.doubt!==void 0?`warning`:`success`:`error`}function ca({outcome:e,affected:t,warnings:n,tookMs:r},i){let a=e.leftOut,o=`${Z(i.done-a,`statement`)} in ${xa(r)}`,s=a>0?`, ${Z(a,`statement`)} skipped`:``;if(!i.rolledBack)return[`Imported ${o}: ${Z(t,`row`)} changed, ${Z(n,`warning`)}${s}.`];let c=t>0?[`The statements reported ${Z(t,`row`)} changed, those undone among them.`]:[];return[`Ran ${o}: ${Z(n,`warning`)}${s}. Not all of what they did is kept.`,...fa(i,!0),...c]}function la({total:e,expired:t,waited:n},r){let i=t?`${ua(n)} `:``,a=r.done===0?`${i}Stopped before statement 1 of ${X(e)} was done.`:`${i}Stopped after statement ${X(r.done)} of ${X(e)}.`;return r.rolledBack?[a,...fa(r,!1)]:n?.state===`rolled-back`?[a,ma(n.n,n.since)]:[r.done===0?a:`${a} What ran stays.`]}function ua(e){return e?.canGoOn===!1?`The import was closed when the time for it ran out.`:`No choice was made in time, so the import was closed.`}function da(e){let{statement:t,line:n,message:r,ended:i}=e,a=[`The file can’t be read on${t===void 0?``:` at statement ${X(t)}`}${n===void 0?``:`, line ${X(n)}`}: ${r}`];if(!i)return a;let o=i.done===0?`The import was closed before statement 1 was done.`:`The import was closed after statement ${X(i.done)}.`;return i.rolledBack?a.push(o,...fa(i,!1)):a.push(i.done===0?o:`${o} What ran stays.`),[...a,...ga(i)]}function fa(e,t){let{done:n,since:r}=e,i=t?`The file left a transaction open`:`The file had a transaction open`,a=t?`it was rolled back, as the mysql client does at the end of a file`:`it was rolled back`;if(r===void 0)return[`${i}: ${a}, and what ran in it is undone.`];let o=`${i} from statement ${X(r)}: ${a}`,s=r>n?`${o}.`:`${o}, and what ${pa(r,n)} did in it is undone.`;return r>1?[`What ran before statement ${X(r)} stays.`,s]:[s]}function pa(e,t){return e===t?`statement ${X(e)}`:`statements ${X(e)} to ${X(t)}`}function ma(e,t){let n=`When statement ${X(e)} failed, the server rolled the file’s open transaction back: what ran in it is undone.`;if(t===void 0)return n;let r=t>1?`, and what ran before that stays`:``;return`${n} It was open from statement ${X(t)} at the earliest${r}.`}function ha(e,t){let n=t===void 0?``:` at statement ${X(t)}`,r=t===void 0||t>=e?`what ran in it was`:`${pa(t,e-1)} ${t===e-1?`was`:`were`}`;return`Statement ${X(e)} failed inside a transaction the file had opened${n}, and the server can’t tell what became of that transaction. Whether ${r} kept is not known: look at the tables before importing again.`}function ga({doubt:e}){return e===void 0?[]:[`Statement ${X(e)} was running and would not stop: whether it finished isn’t known.`]}function _a(e){let{state:t,done:n,failure:r,rolledBack:i,since:a,doubt:o}=e,s=t===`lost`,c=r?.state===`unknown`,l=c?`when statement ${X(r.n)} failed`:r?.state===`rolled-back`?`after statement ${X(r.n)} failed`:n===0?`before any statement was done`:`after statement ${X(n)}`,u=[s?`The server lost the import’s connection to the database ${l}. What a transaction held open is undone.`:`The server closed the import ${l}.`];return r&&u.push(va(r)),r?.state===`rolled-back`?u.push(ma(r.n,a)):c?u.push(ha(r.n,a)):i&&u.push(...fa({done:n,since:a},!1)),o!==void 0&&u.push(`Statement ${X(o)} was running then: whether it finished isn’t known.`),u}function va({n:e,error:t}){return`Statement ${X(e)} ${t.unsent?`was not sent`:`failed`}: ${Xi(t)}`}function ya(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toLocaleString(`en`,{maximumFractionDigits:1})} MB`}function ba(e){let t=Math.max(0,Math.ceil(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function xa(e){if(e<6e4)return`${(Math.floor(e/100)/10).toLocaleString(`en`)} s`;let t=Math.floor(e/1e3),n=Math.floor(t/60);return n<60?`${n} min ${t%60} s`:`${Math.floor(n/60)} h ${n%60} min`}function X(e){return e.toLocaleString(`en`)}function Z(e,t){return`${X(e)} ${t}${e===1?``:`s`}`}var Q=n(),Sa={noBackslashEscapes:!1,ansiQuotes:!1},Ca={checkBytes:0,progress:{done:0,bytes:0,affected:0,warnings:0,leftOut:0,running:null,asking:!1},startedAt:0},wa=250,Ta=5e3,Ea=6e4,Da=6e4,Oa=50,ka=new Map;function Aa({api:e,connection:t,database:n,onImported:o,onClose:s}){let c=t.access===`read`,[l]=(0,a.useState)(n),[u,d]=(0,a.useState)(null),[ee,te]=(0,a.useState)(null),[f,p]=(0,a.useState)(``),[m,ne]=(0,a.useState)(null),[h,re]=(0,a.useState)(null),[ie,ae]=(0,a.useState)(``),[g,_]=(0,a.useState)(!1),[oe,v]=(0,a.useState)(!1),[y,b]=(0,a.useState)({step:`choose`}),[se,x]=(0,a.useState)(null),[S,C]=(0,a.useState)({now:0,...Ca}),[w,T]=(0,a.useState)(null),[ce,le]=(0,a.useState)(!1),[ue,de]=(0,a.useState)(!1),[fe,pe]=(0,a.useState)(!1),[E,me]=(0,a.useState)(null),D=(0,a.useRef)(null),O=(0,a.useRef)(!0),k=(0,a.useRef)({...Ca}),he=(0,a.useRef)(null),ge=(0,a.useRef)(null),A=(0,a.useRef)(null),j=(0,a.useRef)(null),_e=(0,a.useRef)(null),M=y.step===`checking`||y.step===`starting`||y.step===`running`||y.step===`failed`||y.step===`reread`||y.step===`open`,ve=y.step===`checking`||y.step===`running`||y.step===`failed`||y.step===`reread`,N=M&&y.step!==`checking`;(0,a.useEffect)(()=>{let e=(D.current?.getRootNode()??document).activeElement;return D.current?.focus(),()=>e?.focus()},[]);let ye=oe||w===`asking`;(0,a.useEffect)(()=>{let e=D.current?.getRootNode()??document;!ye&&!D.current?.contains(e.activeElement)&&D.current?.focus()},[y.step,ye,u]),(0,a.useEffect)(()=>(O.current=!0,()=>{O.current=!1,he.current?.abort(),ge.current?.abort(),_e.current?.abort(),j.current?.stop().catch(()=>{})}),[]);let be=async(n=!1)=>{try{let n=await e.importOptions(t.name);if(!O.current)return;d(n),le(!1)}catch(e){O.current&&!n&&x($(e))}},xe=async()=>{T(`ending`),x(null);try{await e.importEndOpen(t.name)}catch(e){let t=e instanceof r&&e.code===`unknown-import`;O.current&&!t&&x($(e))}await be(),O.current&&T(null)};(0,a.useEffect)(()=>{if(c)return;let n=!0;return e.importOptions(t.name).then(e=>{n&&(d(e),p(qa(e,l)))},e=>n&&te($(e))),()=>{n=!1}},[e,t.name,l,c]),(0,a.useEffect)(()=>{if(!ve)return;let e=setInterval(()=>C({now:Date.now(),...k.current}),wa);return()=>clearInterval(e)},[ve]),(0,a.useEffect)(()=>{if(!M)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[M]),(0,a.useEffect)(()=>{let e=window.navigation;if(!N||!e)return;let t=e=>{e.navigationType===`traverse`&&e.cancelable&&(e.preventDefault(),pe(!0))};return e.addEventListener(`navigate`,t),()=>e.removeEventListener(`navigate`,t)},[N]);let P=()=>{M||s()},F=e=>{let t=D.current;if(e.key!==`Tab`||!t)return;let n=to(t),r=t.getRootNode().activeElement,i=e.shiftKey,a=i?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING;r&&n.some(e=>r.compareDocumentPosition(e)&a)||(e.preventDefault(),(n.at(i?-1:0)??t).focus())},Se=e=>{e.database!==void 0&&p(e.database),e.file!==void 0&&ne(e.file),ae(``),x(null),b({step:`choose`})},I=async n=>{if(!u||!m)return;let r=new AbortController;he.current=r,k.current.checkBytes=0,_(!1),n!==null&&ae(``),x(null),C({now:Date.now(),...k.current}),b({step:`checking`});try{let i=n??await Ya(e,t.name,r.signal);r.signal.throwIfAborted();let a=await no(Promise.all([Nn(cn(m),{mode:i,mariadb:Za(u),version:u.version,database:f,limits:u.limits,onProgress:e=>{k.current.checkBytes=e},signal:r.signal}),Xa(e,t.name,f)]),r.signal,()=>{});if(!O.current)return;if(!a)return b({step:`choose`});let[o,s]=a;re({check:o,existing:s,mode:i,again:n!==null}),b({step:`checked`})}catch(e){if(!O.current)return;r.signal.aborted||x(`The file couldn’t be read: ${$(e)}`),b({step:`choose`})}},Ce=async(n,i,a)=>{let o=new AbortController;if(ge.current=o,A.current&&await no(A.current,o.signal,()=>{}),o.signal.aborted)return null;let s=ka.get(t.name);for(;;){let c=new AbortController,l=setTimeout(()=>c.abort(),Ea),u=e.importStart({connection:t.name,database:f,confirm:ie,file:{name:i.name,size:i.size,statements:n.check.statements},...s===void 0?{}:{previousThread:s}},c.signal).finally(()=>clearTimeout(l));try{let e=await no(u,o.signal,()=>{});return e===null&&Ee(u),e}catch(e){if(o.signal.aborted)return null;if(c.signal.aborted)return x(ro(a)),null;if(!(e instanceof r)||e.code!==`import-thread`)return x($(e)),e instanceof r&&e.code===`import-open`&&be(),null;if(b({step:`starting`,waiting:e.message}),await ao(Ta,o.signal),o.signal.aborted)return null}}},we=n=>e.importEnd(t.name,n,AbortSignal.timeout(Da)),Te=e=>{let t=e.then(()=>{},()=>{}).finally(()=>{A.current===t&&(A.current=null)});A.current=t},Ee=e=>Te(e.then(e=>we(e.import))),De=async()=>{if(!u||!m||!h)return;v(!1),x(null),pe(!1),b({step:`starting`,waiting:null});let n=await Ce(h,m,u.limits);if(!O.current)return;if(!n)return b({step:`checked`});if(ka.set(t.name,n.thread),le(!0),!Yi(h.mode,n)){let e=we(n.import).then(()=>ka.delete(t.name));Te(e.finally(()=>void be(!0))),await I(Qa(n));return}k.current={...Ca,startedAt:Date.now()};let r=new Lr({api:e,connection:t.name,started:n,mariadb:Za(u),text:cn(m),readings:h.check.readings,onProgress:e=>{k.current.progress=e}});j.current=r,de(!1),me(null),Oe(()=>r.start(),!1)},Oe=async(e,t,n=null)=>{C({now:Date.now(),...k.current}),b({step:`running`,stopping:t});let r;try{r=await e()}catch(e){let{leftOut:t}=k.current.progress;r={type:`unknown`,message:$(e),leftOut:t}}O.current&&ke(r,n)},ke=(e,n)=>{let r=Date.now();if(C({now:r,...k.current}),e.type===`failed`){let{failure:t,sentAgain:n}=e,i=n===void 0?{}:{sentAgain:n};return b({step:`failed`,failure:t,until:r+t.pauseMs,...i})}if(e.type===`reread`){let{reread:t}=e;_(!1),x(null),b({step:`reread`,reread:t,until:r+t.pauseMs,rest:null}),Ae(t)}else{if(!Kr(e)){let t=e.type===`unknown`&&e.ending===void 0;return b({step:`open`,message:Ka(e),canAsk:t})}ka.delete(t.name),b({step:`over`,outcome:e,tookMs:r-k.current.startedAt,waited:n}),o(f),be(!0)}},Ae=async n=>{if(!u||!m)return;let r=new AbortController;_e.current=r,k.current.checkBytes=0;let{session:i,point:a}=n,o=Promise.all([Nn(ln(cn(m),a.offset),{mode:i,mariadb:Za(u),version:u.version,database:f,limits:u.limits,rest:{from:a,characterSet:i.characterSet,database:i.database},onProgress:e=>{k.current.checkBytes=e},signal:r.signal}),Xa(e,t.name,f)]);try{let e=await no(o,r.signal,()=>{});if(!e||!O.current)return;let[t,a]=e,s={check:t,existing:a,mode:Qa(i),again:!1};b(e=>e.step===`reread`&&e.reread===n?{...e,rest:s}:e)}catch(e){O.current&&!r.signal.aborted&&x(`The rest of the file couldn’t be read: ${$(e)}`)}},je=(e=!1)=>{let t=j.current;t&&(_e.current?.abort(),e&&de(!0),y.step===`running`?(b({step:`running`,stopping:!0}),t.stop().catch(()=>{})):Oe(()=>t.stop(),!0,y.step===`failed`?y.failure:null))},Me=e=>{let t=j.current;t&&Oe(()=>e?t.skip():t.retry(),!1)},Ne=e=>{let t=j.current;t&&(me(e.check.statements),Oe(()=>t.goOn(e.check.readings),!1))},Pe=(0,a.useEffectEvent)(()=>je(!0));(0,a.useEffect)(()=>{if(y.step!==`failed`&&y.step!==`reread`)return;let e=setTimeout(Pe,Math.max(0,y.until-Date.now()));return()=>clearTimeout(e)},[y]);let Fe=y.step===`failed`?y.failure:y.step===`reread`?y.reread:null,Ie=(0,a.useEffectEvent)((e,t)=>{_e.current?.abort(),O.current&&ke(e,`canGoOn`in t?t:null)});(0,a.useEffect)(()=>{let e=j.current;if(!Fe||!e)return;let t=setInterval(()=>void e.touch().then(e=>e&&Ie(e,Fe)),e.touchMs);return()=>clearInterval(t)},[Fe]);let Le=h!==null&&qi({check:h.check,agreed:g,typed:ie,database:f}),Re=y.step===`reread`&&y.rest!==null&&Hi(y.rest.check,g,y.reread.session.database!==f),ze=y.step===`choose`||y.step===`checked`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`overlay`,onMouseDown:e=>{e.target===e.currentTarget&&(e.preventDefault(),P())},onKeyDown:e=>{e.key===`Escape`&&P(),F(e)},children:(0,Q.jsxs)(`div`,{ref:D,className:`dialog import`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Import SQL`,tabIndex:-1,children:[(0,Q.jsxs)(`div`,{className:`dialog-body`,children:[(0,Q.jsx)(`h2`,{children:`Import SQL`}),c&&(0,Q.jsx)(`div`,{className:`notice warning`,children:`Importing needs write access, and this connection is read-only.`}),ee&&(0,Q.jsx)(`div`,{className:`notice`,role:`alert`,children:ee}),!c&&!u&&!ee&&(0,Q.jsx)(`p`,{className:`muted`,children:`Loading…`}),u&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ja,{options:u,database:f,file:m,disabled:!ze,mine:N||ce,ending:w===`ending`,onChoose:Se,onEndOpen:()=>T(`asking`)}),se&&(0,Q.jsx)(`div`,{className:`notice`,role:`alert`,children:se}),y.step===`checking`&&(0,Q.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,Q.jsx)(`progress`,{max:m&&!$a(m.name)?m.size:void 0,value:m&&!$a(m.name)?S.checkBytes:void 0}),`Checking the file: `,ya(S.checkBytes),` read…`]}),h&&(y.step===`checked`||y.step===`starting`)&&(0,Q.jsx)(Na,{options:u,database:f,checked:h,agreed:g,onAgree:_,typed:ie,onType:ae,disabled:y.step!==`checked`}),y.step===`starting`&&(0,Q.jsx)(`p`,{role:`status`,children:y.waiting??`Opening the import…`}),N&&fe&&(0,Q.jsx)(`div`,{className:`notice warning`,role:`status`,\"aria-label\":`Page kept`,children:`The browser’s Back was held: leaving this page ends the import. Stop it first, if that is what you want.`}),h&&(y.step===`running`||y.step===`failed`||y.step===`reread`)&&(0,Q.jsx)(Fa,{total:{...h.check,statements:E??h.check.statements},progress:S.progress,elapsedMs:S.now-S.startedAt,stopping:y.step===`running`&&y.stopping}),y.step===`failed`&&(0,Q.jsx)(Ia,{failure:y.failure,sentAgain:y.sentAgain,leftMs:y.until-S.now}),y.step===`reread`&&(0,Q.jsx)(Ma,{options:u,database:f,reread:y.reread,rest:y.rest,checking:se===null,checkBytes:S.checkBytes,agreed:g,onAgree:_,leftMs:y.until-S.now}),y.step===`open`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`notice`,role:`alert`,children:y.message}),(0,Q.jsxs)(`p`,{className:`muted`,children:[`Stop asks the server to end the import, and shows how it ended. Stop and close asks the same and closes this dialog without waiting for the answer. An import that nothing asks about is closed by the server after`,` `,io(u.limits.idleMs),`.`]})]}),y.step===`over`&&h&&(0,Q.jsx)(La,{outcome:y.outcome,total:E??h.check.statements,affected:S.progress.affected,warnings:S.progress.warnings,tookMs:y.tookMs,expired:ue,waited:y.waited})]})]}),(0,Q.jsxs)(`div`,{className:`dialog-actions`,children:[!M&&(0,Q.jsx)(`button`,{type:`button`,className:`button`,onClick:P,children:y.step===`over`||c||!u?`Close`:`Cancel`}),y.step===`choose`&&u&&(0,Q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!f||!m||eo(m.name),onClick:()=>void I(null),children:`Check file`}),y.step===`checking`&&(0,Q.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>he.current?.abort(),children:`Cancel check`}),y.step===`checked`&&(0,Q.jsx)(`button`,{type:`button`,className:`button danger`,disabled:!Le||w===`ending`,onClick:()=>t.tag===`production`?v(!0):void De(),children:`Import`}),y.step===`starting`&&(0,Q.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>ge.current?.abort(),children:`Cancel`}),y.step===`open`&&(0,Q.jsx)(`button`,{type:`button`,className:`button`,onClick:s,children:`Stop and close`}),(y.step===`running`||y.step===`failed`||y.step===`reread`||y.step===`open`)&&(0,Q.jsx)(`button`,{type:`button`,className:`button danger`,disabled:y.step===`running`&&y.stopping,onClick:()=>je(),children:y.step===`running`&&y.stopping?`Stopping…`:`Stop`}),y.step===`open`&&y.canAsk&&(0,Q.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>Me(!1),children:`Ask again`}),y.step===`reread`&&(0,Q.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!Re,onClick:()=>y.rest&&Ne(y.rest),children:`Go on with the rest`}),y.step===`failed`&&y.failure.canGoOn&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>Me(!0),children:`Skip it and go on`}),(0,Q.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>Me(!1),children:`Try again`})]})]})]})}),oe&&(0,Q.jsx)(i,{title:`Import into production?`,confirmLabel:`Import`,danger:!0,onCancel:()=>v(!1),onConfirm:()=>void De(),children:(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:t.label}),` is tagged production. The file’s`,` `,Z(h?.check.statements??0,`statement`),` run on `,(0,Q.jsx)(`strong`,{children:f}),`, and what ran can’t be undone.`]})}),w===`asking`&&(0,Q.jsx)(i,{title:`End that import?`,confirmLabel:`End import`,danger:!0,onCancel:()=>T(null),onConfirm:()=>void xe(),children:(0,Q.jsxs)(`p`,{children:[`Your import on `,(0,Q.jsx)(`strong`,{children:t.label}),` that another window or an earlier visit has open is ended: the statement it runs is stopped, and a transaction it has open is rolled back. What it committed stays.`]})})]})}function ja({options:e,database:t,file:n,disabled:r,mine:i,ending:a,onChoose:o,onEndOpen:s}){let{current:c}=e,l=!i&&c!==null&&za.has(c.state),u=a||c?.ending===!0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`muted`,children:[e.product,` `,e.version]}),l&&(0,Q.jsxs)(`div`,{className:`notice warning`,role:`group`,\"aria-label\":`Import open elsewhere`,children:[`You have an import open on this connection, from another window or an earlier visit. A new one can start when that has ended.`,` `,u?`It is being ended.`:`End it here, or the server closes it once nothing has asked about it for ${io(e.limits.idleMs)}.`,!u&&(0,Q.jsx)(`div`,{className:`notice-actions`,children:(0,Q.jsx)(`button`,{type:`button`,className:`button danger`,onClick:s,children:`End that import`})})]}),e.databases.length===0?(0,Q.jsx)(`div`,{className:`notice`,role:`alert`,children:`The connection’s login sees no database to import into.`}):(0,Q.jsxs)(`label`,{className:`file-choice`,children:[(0,Q.jsx)(`span`,{children:`Database to import into`}),(0,Q.jsx)(`select`,{className:`select`,value:t,disabled:r,onChange:e=>o({database:e.target.value}),children:e.databases.map(({name:e})=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`file-choice`,children:[(0,Q.jsx)(`span`,{children:`SQL file (.sql or .sql.gz)`}),(0,Q.jsx)(`input`,{type:`file`,accept:`.sql,.gz,application/sql,application/gzip`,disabled:r,onChange:e=>o({file:e.target.files?.[0]??null})})]}),n&&eo(n.name)&&(0,Q.jsx)(`div`,{className:`notice`,role:`alert`,children:`A .zip can’t be imported: unpack it and choose the .sql in it, or a .sql.gz.`})]})}function Ma({options:e,database:t,reread:n,rest:r,checking:i,checkBytes:a,agreed:o,onAgree:s,leftMs:c}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`notice warning`,role:`alert`,\"aria-label\":`Checked again`,children:Ui(n)}),r?(0,Q.jsx)(Na,{options:e,database:t,checked:r,agreed:o,onAgree:s,disabled:!1,rest:n}):i&&(0,Q.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,Q.jsx)(`progress`,{}),`Checking the rest of the file: `,ya(a),` read…`]}),(0,Q.jsxs)(`p`,{role:`timer`,\"aria-label\":`Time left to go on`,children:[`Go on with the rest, or stop. The import waits `,ba(c),`, then it is stopped: its connection may hold locks on a live database.`]})]})}function Na({options:e,database:t,checked:n,agreed:r,onAgree:i,typed:a=``,onType:o,disabled:s,rest:c}){let{check:l,existing:u,mode:d,again:ee}=n,te=e.databases.find(e=>e.name===t)?.privileges??null,f=Vi(l.kinds,te),p=u?Ri(l.tables,u):null,m=l.kinds.account+l.kinds[`set-global`],ne=l.stopped!==null||l.refused.total>0,h=c&&c.session.database!==t?c.session.database:void 0,re=(0,Q.jsxs)(`label`,{className:`agree`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:r,disabled:s||ne,onChange:e=>i(e.target.checked)}),(0,Q.jsxs)(`span`,{children:[`Run them too, outside `,t]})]});return(0,Q.jsxs)(`section`,{className:`import-summary`,\"aria-label\":`What the file holds`,children:[ee&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[`The import’s session reads strings another way than the first check took it to (its sql_mode has `,Ki(d),`), so the file was checked again as that session reads it, and nothing was run. Read what it holds now, then start the import.`]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`strong`,{children:Z(l.statements-l.from+1,`statement`)}),c?` left, from statement ${X(l.from)}`:``,`, `,ya(l.bytes),` of SQL`,l.stopped?`, as far as it could be read`:``,`.`,` `,c?`Nothing more has run.`:`Nothing has run yet.`]}),h!==void 0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[`The import’s session has `,h===null?`no database`:x(h,64),` selected, not`,` `,t,`: the statements from `,X(l.from),` on that name no database run there.`,l.leaves.total===0&&re]}),l.statements>0&&(0,Q.jsx)(`p`,{className:`muted`,children:Ha(l.kinds)}),l.tables.length>0&&(0,Q.jsx)(Pa,{check:l}),l.stopped&&(0,Q.jsxs)(`div`,{className:`notice`,role:`alert`,children:[`The file can’t be imported as it is. `,Ga(l.stopped)]}),l.refused.total>0&&(0,Q.jsxs)(`div`,{className:`notice`,role:`alert`,children:[`An import doesn’t run `,Z(l.refused.total,`statement`),` of this file:`,(0,Q.jsx)(`ul`,{children:l.refused.first.map(e=>(0,Q.jsx)(`li`,{children:Ga(e)},e.n))})]}),p&&p.total>0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[t,` already holds `,Z(p.total,`table`),` the file makes or drops:`,(0,Q.jsx)(`ul`,{children:p.first.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`strong`,{children:e.name}),` `,Ba[e.what]]},e.name))})]}),!u&&(0,Q.jsxs)(`p`,{className:`muted`,children:[`What `,t,` holds couldn’t be listed, so the tables the file would clash with aren’t shown.`]}),f===null&&(0,Q.jsx)(`p`,{className:`muted`,children:`The login’s grants couldn’t be read: the server says at each statement what it may run.`}),f&&f.length>0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[`By its grants, the connection’s login may not run all of this in `,t,`:`,(0,Q.jsx)(`ul`,{children:f.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`strong`,{children:e.privilege}),`, which `,Z(e.statements,`statement`),` `,e.statements===1?`needs`:`need`]},e.privilege))})]}),m>0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[Z(m,`statement`),` `,m===1?`acts`:`act`,` on the whole server, not on`,` `,t,`: `,Ua(l.kinds),`.`]}),l.unsent.total>0&&(0,Q.jsx)(`div`,{className:`notice warning`,role:`group`,\"aria-label\":`Statements that won’t be sent`,children:$i(l.unsent)}),l.modeUnread.total>0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[Z(l.modeUnread.total,`statement`),` may change how strings are read (sql_mode) in a way the check can’t tell from the text, the first being statement`,` `,X(l.modeUnread.first[0].n),` on line `,X(l.modeUnread.first[0].line),`. The counts after it may be off. The import itself asks the server.`]}),l.leaves.total>0&&(0,Q.jsxs)(`div`,{className:`notice warning`,children:[Z(l.leaves.total,`statement`),` `,l.leaves.total===1?`leaves`:`leave`,` `,t,`:`,(0,Q.jsxs)(`ul`,{children:[l.leaves.first.map(e=>(0,Q.jsxs)(`li`,{children:[`Statement `,X(e.n),`, line `,X(e.line),`: `,(0,Q.jsx)(`code`,{children:e.head})]},e.n)),l.leaves.total>l.leaves.first.length&&(0,Q.jsxs)(`li`,{children:[`and `,X(l.leaves.total-l.leaves.first.length),` more`]})]}),re]}),!ne&&l.statements>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`notice warning`,children:[e.product,` can’t undo an import. What ran stays if it stops partway.`]}),!c&&(0,Q.jsxs)(`label`,{className:`confirm`,children:[(0,Q.jsxs)(`span`,{children:[`Type `,(0,Q.jsx)(`strong`,{children:t}),` to import into it`]}),(0,Q.jsx)(`input`,{className:`input`,\"aria-label\":`Database name, to confirm`,value:a,disabled:s,autoComplete:`off`,spellCheck:!1,onChange:e=>o?.(e.target.value)})]})]})]})}function Pa({check:e}){let t=e.tables.length-Oa+e.tablesUnlisted;return(0,Q.jsxs)(`ul`,{className:`import-tables`,\"aria-label\":`Tables in the file`,children:[e.tables.slice(0,Oa).map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`strong`,{children:e.database===null?e.name:`${e.database}.${e.name}`}),` `,(0,Q.jsx)(`span`,{className:`muted`,children:Wa(e)})]},`${e.database??``}\\0${e.name}`)),t>0&&(0,Q.jsxs)(`li`,{className:`muted`,children:[`and `,X(t),` more`]})]})}function Fa({total:e,progress:t,elapsedMs:n,stopping:r}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`progress`,role:`status`,\"aria-label\":`Import progress`,children:[(0,Q.jsx)(`progress`,{max:e.statements||1,value:Math.min(t.done,e.statements)}),`Statement `,X(t.done),` of `,X(e.statements),` · `,ya(t.bytes),` of`,` `,ya(e.bytes),` · `,Z(t.affected,`row`),` · `,xa(Math.max(0,n))]}),t.running&&(0,Q.jsxs)(`p`,{className:`muted`,role:`status`,\"aria-label\":`Statement running`,children:[`Statement `,X(t.running.n),` has been running for `,xa(t.running.ms),`.`]}),t.asking&&!r&&(0,Q.jsx)(`p`,{className:`muted`,role:`status`,children:`The answer from the server was cut. Asking it where the import is: nothing is sent again until it says.`})]})}function Ia({failure:e,sentAgain:t,leftMs:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`notice`,role:`alert`,children:[Zi(e),(0,Q.jsx)(`div`,{className:`detail`,children:Xi(e.error)}),e.head!==void 0&&(0,Q.jsx)(`pre`,{children:e.head})]}),e.error.unsent&&(0,Q.jsx)(`p`,{children:Qi(e.error)}),(0,Q.jsx)(`p`,{children:ea(e)}),t&&(0,Q.jsx)(`p`,{children:ra(t)}),e.resends&&(0,Q.jsx)(`div`,{className:`notice warning`,children:na(e.resends)}),e.canGoOn?(0,Q.jsx)(`p`,{role:`timer`,\"aria-label\":`Time left to choose`,children:ta(e,n)}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`notice warning`,children:e.whyNot}),(0,Q.jsx)(`p`,{role:`timer`,\"aria-label\":`Time left to stop`,children:ta(e,n)})]})]})}function La(e){let[t,...n]=aa(e),r=sa(e.outcome);return(0,Q.jsxs)(`div`,{className:r===`error`?`notice`:`notice ${r}`,role:r===`error`?`alert`:`status`,children:[t,(0,Q.jsx)(Ra,{said:n})]})}function Ra({said:e}){return(0,Q.jsx)(Q.Fragment,{children:e.map(e=>(0,Q.jsx)(`div`,{className:`detail`,children:e},e))})}var za=new Set([`idle`,`running`,`failed`]),Ba={exists:`is there, and the file makes it: that CREATE fails unless it says IF NOT EXISTS.`,dropped:`is dropped, with the rows it holds.`,replaced:`is dropped and made again: the rows it holds now are gone.`},Va={\"create-table\":`CREATE TABLE`,\"drop-table\":`DROP TABLE`,\"alter-table\":`ALTER TABLE`,truncate:`TRUNCATE`,insert:`INSERT`,replace:`REPLACE`,update:`UPDATE`,delete:`DELETE`,\"create-view\":`CREATE VIEW`,\"drop-view\":`DROP VIEW`,\"create-trigger\":`CREATE TRIGGER`,\"create-procedure\":`CREATE PROCEDURE`,\"create-function\":`CREATE FUNCTION`,\"create-event\":`CREATE EVENT`,\"lock-tables\":`LOCK TABLES`,\"unlock-tables\":`UNLOCK TABLES`,\"start-transaction\":`START TRANSACTION`,commit:`COMMIT`,set:`SET`,\"set-global\":`SET GLOBAL`,use:`USE`,\"create-database\":`CREATE DATABASE`,\"drop-database\":`DROP DATABASE`,\"alter-database\":`ALTER DATABASE`,\"create-index\":`CREATE INDEX`,\"drop-index\":`DROP INDEX`,xa:`XA`,account:`users and grants`,other:`other`};function Ha(e){return C.filter(t=>e[t]>0).map(t=>`${Va[t]} ${X(e[t])}`).join(` · `)}function Ua(e){return[e.account>0&&`${X(e.account)} about users and grants`,e[`set-global`]>0&&`${X(e[`set-global`])} setting a variable for every session`].filter(e=>e!==!1).join(`, `)}function Wa(e){return[e.drops>0&&`dropped`,e.creates>0&&`created`,e.fills>0&&`filled by ${Z(e.fills,`statement`)}`,e.changes>0&&`changed by ${Z(e.changes,`statement`)}`].filter(e=>e!==!1).join(`, `)}function Ga(e){let t=e.line===void 0?``:`, line ${X(e.line)}`;return`Statement ${X(e.n)}${t}: ${e.message}`}function Ka(e){return e.type===`unknown`?e.message:e.type===`unreadable`?`The file can’t be read on: ${e.message} The import couldn’t be closed: stop it again.`:`The server didn’t say where the import is.`}function qa(e,t){let n=e.databases.map(e=>e.name);return t!==null&&n.includes(t)?t:e.database??n[0]??``}var Ja=0;async function Ya(e,t,n){try{return Ji((await e.query(t,`SELECT @@GLOBAL.sql_mode`,`import-mode-${Date.now().toString(36)}-${(Ja++).toString(36)}`,n)).rows[0]?.[0]??``)}catch{return Sa}}function Xa(e,t,n){return e.tables(t).then(e=>e.filter(e=>e.schema===n).map(e=>e.name),()=>null)}function Za(e){return e.product===`MariaDB`}function Qa({noBackslashEscapes:e,ansiQuotes:t}){return{noBackslashEscapes:e,ansiQuotes:t}}function $a(e){return/\\.gz$/i.test(e)}function eo(e){return/\\.zip$/i.test(e)}function to(e){return[...e.querySelectorAll(`button, input, select, textarea, a[href], [tabindex]`)].filter(e=>e.tabIndex>=0&&!e.matches(`:disabled`)&&e.getClientRects().length>0)}function $(e){return x(e instanceof Error?e.message:String(e),1024)}function no(e,t,n){return new Promise((r,i)=>{let a=()=>r(null);t.aborted?a():t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,a),t.aborted?n(e):r(e)},e=>{t.removeEventListener(`abort`,a),i(e)})})}function ro(e){return`The server didn’t say within ${Z(Ea/1e3,`second`)} whether the import opened, and it wasn’t waited for longer. If one did open, the server closes it once nothing has asked about it for ${io(e.idleMs)}.`}function io(e){return Z(Math.max(1,Math.round(e/6e4)),`minute`)}function ao(e,t){return new Promise(n=>{let r=()=>{clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t.addEventListener(`abort`,r)})}export{Aa as ImportDialog};"},"index-DW5OtN-I.js":{"type":"text/javascript; charset=utf-8","body":"var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var C={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function w(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function T(e,t){return w(e.type,t,e.props)}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={\"=\":`=0`,\":\":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\\/+/g;function oe(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function E(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function D(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,D(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+oe(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),D(o,r,i,``,function(e){return e})):o!=null&&(re(o)&&(o=T(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+oe(a,u),c+=D(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+oe(a,u++),c+=D(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return D(E(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function O(e,t,n){if(e==null)return e;var r=[],i=0;return D(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function se(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ce=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function le(e){var t=C.T,n={};n.types=t===null?null:t.types,C.T=n;try{var r=e(),i=C.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),C.T=t}}function k(e){var t=C.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else le(k.bind(null,e))}var A={map:O,forEach:function(e,t,n){O(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return O(e,function(){t++}),t},toArray:function(e){return O(e,function(e){return e})||[]},only:function(e){if(!re(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=A,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},e.addTransitionType=k,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ne.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return w(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ne.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return w(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=re,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:se}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=le,e.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},e.use=function(e){return C.H.use(e)},e.useActionState=function(e,t,n){return C.H.useActionState(e,t,n)},e.useCallback=function(e,t){return C.H.useCallback(e,t)},e.useContext=function(e){return C.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return C.H.useEffect(e,t)},e.useEffectEvent=function(e){return C.H.useEffectEvent(e)},e.useId=function(){return C.H.useId()},e.useImperativeHandle=function(e,t,n){return C.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return C.H.useMemo(e,t)},e.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return C.H.useReducer(e,t,n)},e.useRef=function(e){return C.H.useRef(e)},e.useState=function(e){return C.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return C.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return C.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,T());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,ee=-1,te=5,C=-1;function ne(){return g?!0:!(e.unstable_now()-C<te)}function w(){if(g=!1,S){var t=e.unstable_now();C=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(ee),ee=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?T():S=!1}}}var T;if(typeof y==`function`)T=function(){y(w)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=w,T=function(){ie.postMessage(null)}}else T=function(){_(w,0)};function ae(t,n){ee=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(ee),ee=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,T()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function ee(e,t,n){return e===n||e===t&&(x=e,!0)}function te(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),re=Symbol.for(`react.transitional.element`),ie=Symbol.for(`react.portal`),ae=Symbol.for(`react.fragment`),oe=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.consumer`),O=Symbol.for(`react.context`),se=Symbol.for(`react.forward_ref`),ce=Symbol.for(`react.suspense`),le=Symbol.for(`react.suspense_list`),k=Symbol.for(`react.memo`),A=Symbol.for(`react.lazy`),ue=Symbol.for(`react.activity`),de=Symbol.for(`react.legacy_hidden`),fe=Symbol.for(`react.memo_cache_sentinel`),pe=Symbol.for(`react.view_transition`),me=Symbol.for(`react.recoverable`),he=Symbol.iterator;function ge(e){return typeof e!=`object`||!e?null:(e=he&&e[he]||e[`@@iterator`],typeof e==`function`?e:null)}var _e=Symbol.for(`react.client.reference`);function ve(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===_e?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ae:return`Fragment`;case E:return`Profiler`;case oe:return`StrictMode`;case ce:return`Suspense`;case le:return`SuspenseList`;case ue:return`Activity`;case pe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ie:return`Portal`;case O:return e.displayName||`Context`;case D:return(e._context.displayName||`Context`)+`.Consumer`;case se:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case k:return t=e.displayName||null,t===null?ve(e.type)||`Memo`:t;case A:t=e._payload,e=e._init;try{return ve(e(t))}catch{}}return null}var ye=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N={pending:!1,data:null,method:null,action:null},be=[],xe=-1;function Se(e){return{current:e}}function P(e){0>xe||(e.current=be[xe],be[xe]=null,xe--)}function F(e,t){xe++,be[xe]=e.current,e.current=t}var Ce=Se(null),we=Se(null),Te=Se(null),Ee=Se(null);function De(e,t){switch(F(Te,t),F(we,e),F(Ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}P(Ce),F(Ce,e)}function Oe(){P(Ce),P(we),P(Te)}function ke(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,F(Ee,e)),t=Ce.current;var n=dp(t,e.type);t!==n&&(F(we,e),F(Ce,n))}function Ae(e){we.current===e&&(P(Ce),P(we)),Ee.current===e&&(P(Ee),sh._currentValue=N)}var je,Me;function Ne(e){if(je===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\\n( *(at )?)/);je=t&&t[1]||``,Me=-1<e.stack.indexOf(`\n at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`\n`+je+e+Me}var Pe=!1;function Fe(e,t){if(!e||Pe)return``;Pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,\"props\",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,\"props\",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,\"props\",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,\"name\",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`\n`),l=s.split(`\n`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`\n`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ne(n):``}function Ie(e,t){switch(e.tag){case 26:case 27:case 5:return Ne(e.type);case 16:return Ne(`Lazy`);case 13:return e.child!==t&&t!==null?Ne(`Suspense Fallback`):Ne(`Suspense`);case 19:return Ne(`SuspenseList`);case 0:case 15:return Fe(e.type,!1);case 11:return Fe(e.type.render,!1);case 1:return Fe(e.type,!0);case 31:return Ne(`Activity`);case 30:return Ne(`ViewTransition`);default:return``}}function Le(e){try{var t=``,n=null;do t+=Ie(e,n),n=e,e=e.return;while(e);return t}catch(e){return`\nError generating stack: `+e.message+`\n`+e.stack}}var Re=Object.prototype.hasOwnProperty,ze=t.unstable_scheduleCallback,Be=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,He=t.unstable_requestPaint,Ue=t.unstable_now,We=t.unstable_getCurrentPriorityLevel,Ge=t.unstable_ImmediatePriority,Ke=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,Je=t.unstable_LowPriority,Ye=t.unstable_IdlePriority,Xe=t.log,Ze=t.unstable_setDisableYieldValue,Qe=null,$e=null;function et(e){if(typeof Xe==`function`&&Ze(e),$e&&typeof $e.setStrictMode==`function`)try{$e.setStrictMode(Qe,e)}catch{}}var tt=Math.clz32?Math.clz32:it,nt=Math.log,rt=Math.LN2;function it(e){return e>>>=0,e===0?32:31-(nt(e)/rt|0)|0}var at=256,ot=262144,st=4194304;function ct(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function lt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ct(n))):i=ct(o):i=ct(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ct(n))):i=ct(o)):i=ct(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ut(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-tt(n),i=1<<r;t|=e[r],n&=~i}return t}function ft(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pt(){var e=st;return st<<=1,!(st&62914560)&&(st=4194304),e}function mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ht(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-tt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&_t(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function _t(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function vt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-tt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function yt(e,t){var n=t&-t;return n=n&42?1:bt(n),(n&(e.suspendedLanes|t))===0?n:0}function bt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function xt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function St(){var e=M.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function Ct(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var wt=Math.random().toString(36).slice(2),Tt=`__reactFiber$`+wt,Et=`__reactProps$`+wt,Dt=`__reactContainer$`+wt,Ot=`__reactEvents$`+wt,kt=`__reactListeners$`+wt,At=`__reactHandles$`+wt,jt=`__reactResources$`+wt,Mt=`__reactMarker$`+wt,Nt=`__reactLoad$`+wt;function Pt(e){delete e[Tt],delete e[Et],delete e[kt],delete e[At]}function Ft(e){var t;if(t=e[Tt])return t;for(var n=e.parentNode;n;){if(t=n[Dt]||n[Tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Tt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function It(e){if(e=e[Tt]||e[Dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Lt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Rt(e){var t=e[jt];return t||=e[jt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function zt(e){e[Mt]=!0}function Bt(e){e[Nt]=void 0}var Vt=new Set,Ht={};function Ut(e,t){Wt(e,t),Wt(e+`Capture`,t)}function Wt(e,t){for(Ht[e]=t,e=0;e<t.length;e++)Vt.add(t[e])}var Gt=RegExp(`^[:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD][:A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\\\\-.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]*$`),Kt={},qt={};function Jt(e){return Re.call(qt,e)?!0:Re.call(Kt,e)?!1:Gt.test(e)?qt[e]=!0:(Kt[e]=!0,!1)}var I=!1;function Yt(){var e=I;return I=!1,e}function Xt(e,t,n){if(Jt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Zt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Qt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function $t(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function en(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function tn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nn(e){if(!e._valueTracker){var t=en(e)?`checked`:`value`;e._valueTracker=tn(e,t,``+e[t])}}function rn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=en(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var an=/[\\n\"\\\\]/g;function on(e){return e.replace(an,function(e){return`\\\\`+e.charCodeAt(0).toString(16)+` `})}function sn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+$t(t)):e.value!==``+$t(t)&&(e.value=``+$t(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):ln(e,$t(n)):o===`number`&&e.value==t?ln(e,$t(e.value)):ln(e,$t(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+$t(s):e.removeAttribute(`name`)}function cn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){nn(e);return}n=n==null?``:``+$t(n),t=t==null?n:``+$t(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),nn(e)}function ln(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function un(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+$t(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function dn(e,t,n){t!=null&&(t=``+$t(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+$t(n)}function fn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ye(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=$t(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),nn(e)}function pn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function hn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||mn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function gn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,I=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(hn(e,a,r),I=!0)}else for(var o in t)t.hasOwnProperty(o)&&hn(e,o,t[o])}function _n(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var vn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),yn=/^[\\u0000-\\u001F ]*j[\\r\\n\\t]*a[\\r\\n\\t]*v[\\r\\n\\t]*a[\\r\\n\\t]*s[\\r\\n\\t]*c[\\r\\n\\t]*r[\\r\\n\\t]*i[\\r\\n\\t]*p[\\r\\n\\t]*t[\\r\\n\\t]*:/i;function bn(e){return yn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function xn(){}var Sn=null;function Cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wn=null,Tn=null;function En(e){var t=It(e);if(t&&(e=t.stateNode)){var n=e[Et]||null;a:switch(e=t.stateNode,t.type){case`input`:if(sn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=\"`+on(``+t)+`\"][type=\"radio\"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Et]||null;if(!a)throw Error(i(90));sn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&rn(r)}break a;case`textarea`:dn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&un(e,!!n.multiple,t,!1)}}}var Dn=!1;function On(e,t,n){if(Dn)return e(t,n);Dn=!0;try{return e(t)}finally{if(Dn=!1,(wn!==null||Tn!==null)&&(zd(),wn&&(t=wn,e=Tn,Tn=wn=null,En(t),e)))for(t=0;t<e.length;t++)En(e[t])}}function kn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Et]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var An=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,jn=!1;if(An)try{var Mn={};Object.defineProperty(Mn,\"passive\",{get:function(){jn=!0}}),window.addEventListener(`test`,Mn,Mn),window.removeEventListener(`test`,Mn,Mn)}catch{jn=!1}var Nn=null,Pn=null,Fn=null;function In(){if(Fn)return Fn;var e,t=Pn,n=t.length,r,i=`value`in Nn?Nn.value:Nn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Fn=i.slice(e,1<r?1-r:void 0)}function Ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Rn(){return!0}function zn(){return!1}function Bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Rn:zn,this.isPropagationStopped=zn,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Rn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Rn)},persist:function(){},isPersistent:Rn}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hn=Bn(Vn),Un=w({},Vn,{view:0,detail:0}),Wn=Bn(Un),Gn,Kn,qn,Jn=w({},Un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ar,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==qn&&(qn&&e.type===`mousemove`?(Gn=e.screenX-qn.screenX,Kn=e.screenY-qn.screenY):Kn=Gn=0,qn=e),Gn)},movementY:function(e){return`movementY`in e?e.movementY:Kn}}),Yn=Bn(Jn),Xn=Bn(w({},Jn,{dataTransfer:0})),Zn=Bn(w({},Un,{relatedTarget:0})),Qn=Bn(w({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0})),$n=Bn(w({},Vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),er=Bn(w({},Vn,{data:0})),tr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},nr={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},rr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function ir(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rr[e])?!!t[e]:!1}function ar(){return ir}var or=Bn(w({},Un,{key:function(e){if(e.key){var t=tr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?nr[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ar,charCode:function(e){return e.type===`keypress`?Ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),sr=Bn(w({},Jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),cr=Bn(w({},Vn,{submitter:0})),lr=Bn(w({},Un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ar})),ur=Bn(w({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),dr=Bn(w({},Jn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),fr=Bn(w({},Vn,{newState:0,oldState:0,source:0})),pr=[9,13,27,32],mr=An&&`CompositionEvent`in window,hr=null;An&&`documentMode`in document&&(hr=document.documentMode);var gr=An&&`TextEvent`in window&&!hr,_r=An&&(!mr||hr&&8<hr&&11>=hr),vr=` `,yr=!1;function br(e,t){switch(e){case`keyup`:return pr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function xr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Sr=!1;function Cr(e,t){switch(e){case`compositionend`:return xr(t);case`keypress`:return t.which===32?(yr=!0,vr):null;case`textInput`:return e=t.data,e===vr&&yr?null:e;default:return null}}function wr(e,t){if(Sr)return e===`compositionend`||!mr&&br(e,t)?(e=In(),Fn=Pn=Nn=null,Sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return _r&&t.locale!==`ko`?null:t.data;default:return null}}var Tr={color:!0,date:!0,datetime:!0,\"datetime-local\":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Tr[e.type]:t===`textarea`}function Dr(e,t,n,r){wn?Tn?Tn.push(r):Tn=[r]:wn=r,t=Jf(t,`onChange`),0<t.length&&(n=new Hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Or=null,kr=null;function Ar(e){Vf(e,0)}function jr(e){if(rn(Lt(e)))return e}function Mr(e,t){if(e===`change`)return t}var Nr=!1;if(An){var Pr;if(An){var Fr=`oninput`in document;if(!Fr){var Ir=document.createElement(`div`);Ir.setAttribute(`oninput`,`return;`),Fr=typeof Ir.oninput==`function`}Pr=Fr}else Pr=!1;Nr=Pr&&(!document.documentMode||9<document.documentMode)}function Lr(){Or&&(Or.detachEvent(`onpropertychange`,Rr),kr=Or=null)}function Rr(e){if(e.propertyName===`value`&&jr(kr)){var t=[];Dr(t,kr,e,Cn(e)),On(Ar,t)}}function zr(e,t,n){e===`focusin`?(Lr(),Or=t,kr=n,Or.attachEvent(`onpropertychange`,Rr)):e===`focusout`&&Lr()}function Br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return jr(kr)}function Vr(e,t){if(e===`click`)return jr(t)}function Hr(e,t){if(e===`input`||e===`change`)return jr(t)}function Ur(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Wr=typeof Object.is==`function`?Object.is:Ur;function Gr(e,t){if(Wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Re.call(t,i)||!Wr(e[i],t[i]))return!1}return!0}function Kr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function qr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jr(e,t){var n=qr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=qr(n)}}function Yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Kr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Kr(e.document)}return t}function Zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Qr=An&&`documentMode`in document&&11>=document.documentMode,$r=null,ei=null,ti=null,ni=!1;function ri(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ni||$r==null||$r!==Kr(r)||(r=$r,`selectionStart`in r&&Zr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ti&&Gr(ti,r)||(ti=r,r=Jf(ei,`onSelect`),0<r.length&&(t=new Hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=$r)))}function ii(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ai={animationend:ii(`Animation`,`AnimationEnd`),animationiteration:ii(`Animation`,`AnimationIteration`),animationstart:ii(`Animation`,`AnimationStart`),transitionrun:ii(`Transition`,`TransitionRun`),transitionstart:ii(`Transition`,`TransitionStart`),transitioncancel:ii(`Transition`,`TransitionCancel`),transitionend:ii(`Transition`,`TransitionEnd`)},oi={},si={};An&&(si=document.createElement(`div`).style,`AnimationEvent`in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),`TransitionEvent`in window||delete ai.transitionend.transition);function ci(e){if(oi[e])return oi[e];if(!ai[e])return e;var t=ai[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in si)return oi[e]=t[n];return e}var li=ci(`animationend`),ui=ci(`animationiteration`),di=ci(`animationstart`),fi=ci(`transitionrun`),pi=ci(`transitionstart`),mi=ci(`transitioncancel`),hi=ci(`transitionend`),gi=new Map,_i=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);_i.push(`scrollEnd`);function vi(e,t){gi.set(e,t),Ut(t,[e])}var yi=0;function bi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=bd.identifierPrefix;var n=yi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function xi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Od;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function Si(e,t){return e=xi(e),t=xi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Ci=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},wi=[],Ti=0,Ei=0;function Di(){for(var e=Ti,t=Ei=Ti=0;t<e;){var n=wi[t];wi[t++]=null;var r=wi[t];wi[t++]=null;var i=wi[t];wi[t++]=null;var a=wi[t];if(wi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ji(n,i,a)}}function Oi(e,t,n,r){wi[Ti++]=e,wi[Ti++]=t,wi[Ti++]=n,wi[Ti++]=r,Ei|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ki(e,t,n,r){return Oi(e,t,n,r),Mi(e)}function Ai(e,t){return Oi(e,null,null,t),Mi(e)}function ji(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-tt(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Mi(e){if(50<kd)throw kd=0,Ad=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ni={};function Pi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(e,t,n,r){return new Pi(e,t,n,r)}function Ii(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Li(e,t){var n=e.alternate;return n===null?(n=Fi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Ri(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function zi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ii(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ue:return e=Fi(31,n,t,a),e.elementType=ue,e.lanes=o,e;case ae:return Bi(n.children,a,o,t);case oe:s=8,a|=24;break;case E:return e=Fi(12,n,t,a|2),e.elementType=E,e.lanes=o,e;case ce:return e=Fi(13,n,t,a),e.elementType=ce,e.lanes=o,e;case le:return e=Fi(19,n,t,a),e.elementType=le,e.lanes=o,e;case de:case pe:return e=a|32,e=Fi(30,n,t,e),e.elementType=pe,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case O:s=10;break a;case D:s=9;break a;case se:s=11;break a;case k:s=14;break a;case A:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Fi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Bi(e,t,n,r){return e=Fi(7,e,r,t),e.lanes=n,e}function Vi(e,t,n){return e=Fi(6,e,null,t),e.lanes=n,e}function Hi(e){var t=Fi(18,null,null,0);return t.stateNode=e,t}function Ui(e,t,n){return t=Fi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Wi=new WeakMap;function Gi(e,t){if(typeof e==`object`&&e){var n=Wi.get(e);return n===void 0?(t={value:e,source:t,stack:Le(t)},Wi.set(e,t),t):n}return{value:e,source:t,stack:Le(t)}}var Ki=[],qi=0,Ji=null,Yi=0,Xi=[],Zi=0,Qi=null,$i=1,ea=``;function ta(e,t){Ki[qi++]=Yi,Ki[qi++]=Ji,Ji=e,Yi=t}function na(e,t,n){Xi[Zi++]=$i,Xi[Zi++]=ea,Xi[Zi++]=Qi,Qi=e;var r=$i;e=ea;var i=32-tt(r)-1;r&=~(1<<i),n+=1;var a=32-tt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,$i=1<<32-tt(t)+i|n<<i|r,ea=a+e}else $i=1<<a|n<<i|r,ea=e}function ra(e){e.return!==null&&(ta(e,1),na(e,1,0))}function ia(e){for(;e===Ji;)Ji=Ki[--qi],Ki[qi]=null,Yi=Ki[--qi],Ki[qi]=null;for(;e===Qi;)Qi=Xi[--Zi],Xi[Zi]=null,ea=Xi[--Zi],Xi[Zi]=null,$i=Xi[--Zi],Xi[Zi]=null}function aa(e,t){Xi[Zi++]=$i,Xi[Zi++]=ea,Xi[Zi++]=Qi,$i=t.id,ea=t.overflow,Qi=e}var oa=null,L=null,R=!1,sa=null,ca=!1,la=Error(i(519));function ua(e){throw ga(Gi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),la}function da(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Tt]=e,t[Et]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<zf.length;n++)Q(zf[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),cn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),fn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ep(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=xn),t=!0):t=!1,t||ua(e,!0)}function fa(e){for(oa=e.return;oa;)switch(oa.tag){case 5:case 31:case 13:ca=!1;return;case 27:case 3:ca=!0;return;default:oa=oa.return}}function pa(e){if(e!==oa)return!1;if(!R)return fa(e),R=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&L&&ua(e),fa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));L=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));L=dm(e)}else t===27?(t=L,Sp(e.type)?(e=um,um=null,L=e):L=t):L=oa?lm(e.stateNode.nextSibling):null;return!0}function ma(){L=oa=null,R=!1}function ha(){var e=sa;return e!==null&&(pd===null?pd=e:pd.push.apply(pd,e),sa=null),e}function ga(e){sa===null?sa=[e]:sa.push(e)}var _a=Se(null),va=null,ya=null;function ba(e,t,n){F(_a,t._currentValue),t._currentValue=n}function xa(e){e._currentValue=_a.current,P(_a)}function Sa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ca(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Sa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Sa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Sa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function wa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Wr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Ee.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&Ca(t,e,n,r),t.flags|=262144,e!==null}function Ta(e){for(e=e.firstContext;e!==null;){if(!Wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ea(e){va=e,ya=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Da(e){return ka(va,e)}function Oa(e,t){return va===null&&Ea(e),ka(e,t)}function ka(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ya===null){if(e===null)throw Error(i(308));ya=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ya=ya.next=t;return n}var Aa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ja=t.unstable_scheduleCallback,Ma=t.unstable_NormalPriority,Na={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pa(){return{controller:new Aa,data:new Map,refCount:0}}function Fa(e){e.refCount--,e.refCount===0&&ja(Ma,function(){e.controller.abort()})}function Ia(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var La=null;function Ra(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var za=null,Ba=0,Va=0,Ha=null;function Ua(e,t){if(za===null){var n=za=[];Ba=0,Va=Pf(),Ha={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ba++,t.then(Wa,Wa),t}function Wa(){if(--Ba===0&&(La=null,za!==null)){Ha!==null&&(Ha.status=`fulfilled`);var e=za;za=null,Va=0,Ha=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ga(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ka=j.S;j.S=function(e,t){if(gd=Ue(),typeof t==`object`&&t&&typeof t.then==`function`&&Ua(e,t),La!==null)for(var n=bf;n!==null;)Ia(n,La),n=n.next;if(n=e.types,n!==null){for(var r=bf;r!==null;)Ia(r,n),r=r.next;if(Va!==0){r=La,r===null&&(r=La=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ka!==null&&Ka(e,t)};var qa=Se(null);function Ja(){var e=qa.current;return e===null?G.pooledCache:e}function Ya(e,t){t===null?F(qa,qa.current):F(qa,t.pool)}function Xa(){var e=Ja();return e===null?null:{parent:Na._currentValue,pool:e}}var Za=Error(i(460)),Qa=Error(i(474)),$a=Error(i(542)),eo={then:function(){}};function to(e){return e=e.status,e===`fulfilled`||e===`rejected`}function no(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(xn,xn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,oo(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(xn,xn);else{if(e=G,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,oo(e),e}throw io=t,Za}}function ro(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(io=e,Za):e}}var io=null;function ao(){if(io===null)throw Error(i(459));var e=io;return io=null,e}function oo(e){if(e===Za||e===$a)throw Error(i(483))}var so=null,co=0;function lo(e){var t=co;return co+=1,so===null&&(so=[]),no(so,e,t)}function uo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function fo(e,t){throw t.$$typeof===T?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function po(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Li(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Vi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ae?(e=d(e,t,n.props.children,r,n.key),uo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===A&&ro(i)===t.type)?(t=a(t,n.props),uo(t,n),t.return=e,t):(t=zi(n.type,n.key,n.props,null,e.mode,r),uo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Bi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Vi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case re:return n=zi(t.type,t.key,t.props,null,e.mode,n),uo(n,t),n.return=e,n;case ie:return t=Ui(t,e.mode,n),t.return=e,t;case A:return t=ro(t),f(e,t,n)}if(ye(t)||ge(t))return t=Bi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,lo(t),n);if(t.$$typeof===O)return f(e,Oa(e,t),n);fo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case re:return n.key===i?l(e,t,n,r):null;case ie:return n.key===i?u(e,t,n,r):null;case A:return n=ro(n),p(e,t,n,r)}if(ye(n)||ge(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,lo(n),r);if(n.$$typeof===O)return p(e,t,Oa(e,n),r);fo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case re:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case ie:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case A:return r=ro(r),m(e,t,n,r,i)}if(ye(r)||ge(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,lo(r),i);if(r.$$typeof===O)return m(e,t,n,Oa(t,r),i);fo(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),R&&ta(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return R&&ta(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),R&&ta(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),R&&ta(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return R&&ta(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),R&&ta(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ae&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case re:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ae){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),uo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===A&&ro(l)===r.type){n(e,r.sibling),c=a(r,o.props),uo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ae?(c=Bi(o.props.children,e.mode,c,o.key),uo(c,o),c.return=e,e=c):(c=zi(o.type,o.key,o.props,null,e.mode,c),uo(c,o),c.return=e,e=c)}return s(e);case ie:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ui(o,e.mode,c),c.return=e,e=c}return s(e);case A:return o=ro(o),_(e,r,o,c)}if(ye(o))return h(e,r,o,c);if(ge(o)){if(l=ge(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,lo(o),c);if(o.$$typeof===O)return _(e,r,Oa(e,o),c);fo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Vi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{co=0;var i=_(e,t,n,r);return so=null,i}catch(t){if(t===Za||t===$a)throw t;var a=Fi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var mo=po(!0),ho=po(!1),go=!1;function _o(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function yo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Mi(e),ji(e,null,n),t}return Oi(e,r,t,n),Mi(e)}function xo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vt(e,n)}}function So(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Co=!1;function wo(){if(Co){var e=Ha;if(e!==null)throw e}}function To(e,t,n,r){Co=!1;var i=e.updateQueue;go=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===Va&&(Co=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=w({},d,f);break a;case 2:go=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function Eo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Do(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Eo(n[e],t)}var Oo=Se(null),ko=Se(0);function Ao(e,t){e=od,F(ko,e),F(Oo,t),od=e|t.baseLanes}function jo(){F(ko,od),F(Oo,Oo.current)}function Mo(){od=ko.current,P(Oo),P(ko)}var No=Se(null),Po=null;function Fo(e){var t=e.alternate;F(Bo,Bo.current&1),F(No,e),Po===null&&(t===null||Oo.current!==null||t.memoizedState!==null)&&(Po=e)}function Io(e){F(Bo,Bo.current),F(No,e),Po===null&&(Po=e)}function Lo(e){e.tag===22?(F(Bo,Bo.current),F(No,e),Po===null&&(Po=e)):Ro()}function Ro(){F(Bo,Bo.current),F(No,No.current)}function zo(e){P(No),Po===e&&(Po=null),P(Bo)}var Bo=Se(0);function Vo(e,t){F(No,No.current),F(Bo,t)}function Ho(e){P(Bo),P(No),Po===e&&(Po=null)}function Uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wo=0,z=null,B=null,Go=null,Ko=!1,qo=!1,Jo=!1,Yo=0,Xo=0,Zo=null,Qo=0;function $o(){throw Error(i(321))}function es(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Wr(e[n],t[n]))return!1;return!0}function ts(e,t,n,r,i,a){return Wo=a,z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?vc:yc,Jo=!1,a=n(r,i),Jo=!1,qo&&(a=rs(t,n,r,i)),ns(e),a}function ns(e){j.H=_c;var t=B!==null&&B.next!==null;if(Wo=0,Go=B=z=null,Ko=!1,Xo=0,Zo=null,t)throw Error(i(300));e===null||Ic||(e=e.dependencies,e!==null&&Ta(e)&&(Ic=!0))}function rs(e,t,n,r){z=e;var a=0;do{if(qo&&(Zo=null),Xo=0,qo=!1,25<=a)throw Error(i(301));if(a+=1,Go=B=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=bc,o=t(n,r)}while(qo);return o}function is(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(B===null?null:B.memoizedState)!==e&&(z.flags|=1024),t}function as(){var e=Yo!==0;return Yo=0,e}function os(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ss(e){if(Ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ko=!1}Wo=0,Go=B=z=null,qo=!1,Xo=Yo=0,Zo=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Go===null?z.memoizedState=Go=e:Go=Go.next=e,Go}function ls(){if(B===null){var e=z.alternate;e=e===null?null:e.memoizedState}else e=B.next;var t=Go===null?z.memoizedState:Go.next;if(t!==null)Go=t,B=e;else{if(e===null)throw z.alternate===null?Error(i(467)):Error(i(310));B=e,e={memoizedState:B.memoizedState,baseState:B.baseState,baseQueue:B.baseQueue,queue:B.queue,next:null},Go===null?z.memoizedState=Go=e:Go=Go.next=e}return Go}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Xo;return Xo+=1,Zo===null&&(Zo=[]),e=no(Zo,e,t),t=z,(Go===null?t.memoizedState:Go.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?vc:yc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===me)return;if(e.$$typeof===O)return Da(e)}throw Error(i(438,String(e)))}function ps(e){var t=null,n=z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=z.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=us(),z.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=fe;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(ls(),B,e)}function gs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Wo&f)===f:(q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Va&&(d=!0);else if((Wo&p)===p){u=u.next,p===Va&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,z.lanes|=p,sd|=p;f=u.action,Jo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,z.lanes|=f,sd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Wr(o,e.memoizedState)&&(Ic=!0,d&&(n=Ha,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function _s(e){var t=ls(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Wr(o,t.memoizedState)||(Ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vs(e,t,n){var r=z,a=ls(),o=R;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Wr((B||a).memoizedState,n);if(s&&(a.memoizedState=n,Ic=!0),a=a.queue,Us(xs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Go!==null&&!!(Go.memoizedState.tag&1),Rs(e?9:8,{destroy:void 0},bs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,G===null)throw Error(i(349));o||Wo&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=z.updateQueue,t===null?(t=us(),z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,Ss(t)&&Cs(e)}function xs(e,t,n){return n(function(){Ss(t)&&Cs(e)})}function Ss(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Wr(e,n)}catch{return!0}}function Cs(e){var t=Ai(e,2);t!==null&&Pd(t,e,2)}function ws(e){var t=cs();if(typeof e==`function`){var n=e;if(e=n(),Jo){et(!0);try{n()}finally{et(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,gs(e,B,typeof r==`function`?r:ms)}function Es(e,t,n,r,a){if(mc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};o.types=a===null?null:a.types,j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(R){var n=G.formState;if(n!==null){a:{var r=z;if(R){if(L){b:{for(var i=L,a=ca;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){L=lm(i.nextSibling),r=i.data===`F!`;break a}}ua(r)}r=!1}r&&(t=n[0])}}return n=cs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=dc.bind(null,z,r),r.dispatch=n,r=ws(!1),a=pc.bind(null,z,!1,r.queue),r=cs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(ls(),B,e)}function Fs(e,t,n){if(t=gs(e,t,Ms)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===Za?$a:e}else r=t;t=ls();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(z.flags|=2048,Rs(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function Ls(e){var t=ls(),n=B;if(n!==null)return Fs(t,n,e);ls(),t=t.memoizedState,n=ls();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=z.updateQueue,t===null&&(t=us(),z.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return ls().memoizedState}function Bs(e,t,n,r){var i=cs();z.flags|=e,i.memoizedState=Rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Vs(e,t,n,r){var i=ls();r=r===void 0?null:r;var a=i.memoizedState.inst;B!==null&&r!==null&&es(r,B.memoizedState.deps)?i.memoizedState=Rs(t,a,n,r):(z.flags|=e,i.memoizedState=Rs(1|t,a,n,r))}function Hs(e,t){Bs(8390656,8,e,t)}function Us(e,t){Vs(2048,8,e,t)}function Ws(e){z.flags|=4;var t=z.updateQueue;if(t===null)t=us(),z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Gs(e){var t=ls().memoizedState;return Ws({ref:t,nextImpl:e}),function(){if(W&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ks(e,t){return Vs(4,2,e,t)}function qs(e,t){return Vs(4,4,e,t)}function Js(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ys(e,t,n){n=n==null?null:n.concat([e]),Vs(4,4,Js.bind(null,t,e),n)}function Xs(){}function Zs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&es(t,r[1]))return r[0];if(r=e(),Jo){et(!0);try{e()}finally{et(!1)}}return n.memoizedState=[r,t],r}function $s(e,t,n){return n===void 0||Wo&1073741824&&!(q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Md(),z.lanes|=e,sd|=e,n)}function ec(e,t,n,r){return Wr(n,t)?n:Oo.current===null?!(Wo&106)||Wo&1073741824&&!(q&261930)?(Ic=!0,e.memoizedState=n):(e=Md(),z.lanes|=e,sd|=e,t):(e=$s(e,n,r),Wr(e,t)||(Ic=!0),e)}function tc(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};s.types=o===null?null:o.types,j.T=s,pc(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?fc(e,t,Ga(c,r),jd(e)):fc(e,t,r,jd(e))}catch(n){fc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ic(e).queue;tc(e,a,t,N,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:N},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),fc(e,t.next.queue,{},jd())}function oc(){return Da(sh)}function sc(){return ls().memoizedState}function cc(){return ls().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=yo(n);var r=bo(t,e,n);r!==null&&(Pd(r,t,n),xo(r,t,n)),t={cache:Pa()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mc(e)?hc(t,n):(n=ki(e,t,n,r),n!==null&&(Pd(n,e,r),gc(n,t,r)))}function dc(e,t,n){fc(e,t,n,jd())}function fc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mc(e))hc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Wr(s,o))return Oi(e,t,i,0),G===null&&Di(),!1}catch{}if(n=ki(e,t,i,r),n!==null)return Pd(n,e,r),gc(n,t,r),!0}return!1}function pc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mc(e)){if(t)throw Error(i(479))}else t=ki(e,n,r,2),t!==null&&Pd(t,e,2)}function mc(e){var t=e.alternate;return e===z||t!==null&&t===z}function hc(e,t){qo=Ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vt(e,n)}}var _c={readContext:Da,use:fs,useCallback:$o,useContext:$o,useEffect:$o,useImperativeHandle:$o,useLayoutEffect:$o,useInsertionEffect:$o,useMemo:$o,useReducer:$o,useRef:$o,useState:$o,useDebugValue:$o,useDeferredValue:$o,useTransition:$o,useSyncExternalStore:$o,useId:$o,useHostTransitionStatus:$o,useFormState:$o,useActionState:$o,useOptimistic:$o,useMemoCache:$o,useCacheRefresh:$o,useEffectEvent:$o},vc={readContext:Da,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:Da,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(Jo){et(!0);try{e()}finally{et(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(Jo){et(!0);try{n(t)}finally{et(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=dc.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(cs(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,z,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,a=cs();if(R){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),G===null)throw Error(i(349));q&127||ys(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=cs(),t=G.identifierPrefix;if(R){var n=ea,r=$i;n=(r&~(1<<32-tt(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Qo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=cs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=pc.bind(null,z,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return cs().memoizedState=lc.bind(null,z)},useEffectEvent:function(e){var t=cs(),n={impl:e};return t.memoizedState=n,function(){if(W&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},yc={readContext:Da,use:fs,useCallback:Zs,useContext:Da,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:hs,useRef:zs,useState:function(){return hs(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){return ec(ls(),B.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(ls(),B,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs},bc={readContext:Da,use:fs,useCallback:Zs,useContext:Da,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:_s,useRef:zs,useState:function(){return _s(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){var n=ls();return B===null?$s(n,e,t):ec(n,B.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){var n=ls();return B===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,B,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs};function xc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=jd(),i=yo(r);i.payload=t,n!=null&&(i.callback=n),t=bo(e,i,r),t!==null&&(Pd(t,e,r),xo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=jd(),i=yo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=bo(e,i,r),t!==null&&(Pd(t,e,r),xo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=jd(),r=yo(n);r.tag=2,t!=null&&(r.callback=t),t=bo(e,r,n),t!==null&&(Pd(t,e,n),xo(t,e,n))}};function Cc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Gr(n,r)||!Gr(i,a):!0}function wc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Sc.enqueueReplaceState(t,t.state,null)}function Tc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ec(e){Ci(e)}function Dc(e){console.error(e)}function Oc(e){Ci(e)}function kc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function jc(e,t,n){return n=yo(n),n.tag=3,n.payload={element:null},n.callback=function(){kc(e,t)},n}function Mc(e){return e=yo(e),e.tag=3,e}function Nc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ac(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ac(t,n,r),typeof i!=`function`&&(yd===null?yd=new Set([this]):yd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Pc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&wa(t,n,a,!0),n=No.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Po===null?Kd():n.alternate===null&&Y===0&&(Y=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===eo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),mf(e,r,a)),!1;case 22:return n.flags|=65536,r===eo?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),mf(e,r,a)),!1}throw Error(i(435,n.tag))}return mf(e,r,a),Kd(),!1}if(R)return t=No.current,t===null?(r!==la&&(t=Error(i(423),{cause:r}),ga(Gi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Gi(r,n),a=jc(e.stateNode,r,a),So(e,a),Y!==4&&(Y=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==la&&(e=Error(i(422),{cause:r}),ga(Gi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Gi(o,n),fd===null?fd=[o]:fd.push(o),Y!==4&&(Y=2),t===null)return!0;r=Gi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=jc(n.stateNode,r,e),So(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(yd===null||!yd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Mc(a),Nc(a,e,n,r),So(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Fc=Error(i(461)),Ic=!1;function Lc(e,t,n,r){t.child=e===null?ho(t,null,n,r):mo(t,e.child,n,r)}function Rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ea(t),r=ts(e,t,n,o,a,i),s=as(),e!==null&&!Ic?(os(e,t,i),fl(e,t,i)):(R&&s&&ra(t),t.flags|=1,Lc(e,t,r,i),t.child)}function zc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ii(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Bc(e,t,a,r,i)):(e=zi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!pl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Gr:n,n(o,r)&&e.ref===t.ref)return fl(e,t,i)}return t.flags|=1,e=Li(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Gr(a,r)&&e.ref===t.ref){if(Ic=!1,t.pendingProps=r=a,pl(e,i))e.flags&131072&&(Ic=!0);else return t.lanes=e.lanes,fl(e,t,i)}}return Jc(e,t,n,r,i)}function Vc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Uc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ya(t,a===null?null:a.cachePool),a===null?jo():Ao(t,a),Lo(t);else return r=t.lanes=536870912,Uc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ya(t,null),jo(),Ro()):(Ya(t,a.cachePool),Ao(t,a),Ro(),t.memoizedState=null);return Lc(e,t,i,n),t.child}function Hc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Uc(e,t,n,r,i){var a=Ja();return a=a===null?null:{parent:Na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ya(t,null),jo(),Lo(t),e!==null&&wa(e,t,r,!0),t.childLanes=i,null}function Wc(e,t){return t=rl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Gc(e,t,n){return mo(t,e.child,null,n),e=Wc(t,t.pendingProps),e.flags|=2,zo(t),t.memoizedState=null,e}function Kc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(R){if(r.mode===`hidden`)return e=Wc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Hc(null,e);if(Io(t),(e=L)?(e=am(e,ca),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qi===null?null:{id:$i,overflow:ea},retryLane:536870912,hydrationErrors:null},n=Hi(e),n.return=t,t.child=n,oa=t,L=null)):e=null,e===null)throw ua(t);return t.lanes=536870912,null}return Wc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Io(t),a){if(t.flags&256)t.flags&=-257,t=Gc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Ic||wa(e,t,n,!1),a=(n&e.childLanes)!==0,Ic||a){if(Oo.current===null){if(r=G,r!==null&&(s=yt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ai(e,s),Pd(r,e,s),Fc;Kd()}t=Gc(e,t,n)}else e=o.treeContext,L=lm(s.nextSibling),oa=t,R=!0,sa=null,ca=!1,e!==null&&aa(t,e),t=Wc(t,r),t.flags|=134221824;return t}return e=Li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Jc(e,t,n,r,i){return Ea(t),n=ts(e,t,n,r,void 0,i),r=as(),e!==null&&!Ic?(os(e,t,i),fl(e,t,i)):(R&&r&&ra(t),t.flags|=1,Lc(e,t,n,i),t.child)}function Yc(e,t,n,r,i,a){return Ea(t),t.updateQueue=null,n=rs(t,r,n,i),ns(e),r=as(),e!==null&&!Ic?(os(e,t,a),fl(e,t,a)):(R&&r&&ra(t),t.flags|=1,Lc(e,t,n,a),t.child)}function Xc(e,t,n,r,i){if(Ea(t),t.stateNode===null){var a=Ni,o=n.contextType;typeof o==`object`&&o&&(a=Da(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Sc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},_o(t),o=n.contextType,a.context=typeof o==`object`&&o?Da(o):Ni,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(xc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Sc.enqueueReplaceState(a,a.state,null),To(t,r,a,i),wo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Tc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ni,typeof u==`object`&&u&&(o=Da(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&wc(t,a,r,o),go=!1;var f=t.memoizedState;a.state=f,To(t,r,a,i),wo(),l=t.memoizedState,s||f!==l||go?(typeof d==`function`&&(xc(t,n,d,r),l=t.memoizedState),(c=go||Cc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,vo(e,t),o=t.memoizedProps,u=Tc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ni,typeof l==`object`&&l&&(c=Da(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&wc(t,a,r,c),go=!1,f=t.memoizedState,a.state=f,To(t,r,a,i),wo();var p=t.memoizedState;o!==d||f!==p||go||e!==null&&e.dependencies!==null&&Ta(e.dependencies)?(typeof s==`function`&&(xc(t,n,s,r),p=t.memoizedState),(u=go||Cc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ta(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,qc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=mo(t,e.child,null,i),t.child=mo(t,null,n,i)):Lc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=fl(e,t,i),e}function Zc(e,t,n,r){return ma(),t.flags|=256,Lc(e,t,n,r),t.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $c(e){return{baseLanes:e,cachePool:Xa()}}function el(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ud),e}function tl(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Bo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(R){if(i?Fo(t):Ro(),(e=L)?(e=am(e,ca),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qi===null?null:{id:$i,overflow:ea},retryLane:536870912,hydrationErrors:null},n=Hi(e),n.return=t,t.child=n,oa=t,L=null)):e=null,e===null)throw ua(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Ro(),i=t.mode,a=rl({mode:`hidden`,children:a},i),r=Bi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=$c(n),r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(null,r)):(Fo(t),nl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return al(e,t,a,o,r,c,s,n)}return i?(Ro(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Li(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Bi(i,a,n,null),i.flags|=2):i=Li(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Hc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=$c(n):(a=i.cachePool,a===null?a=Xa():(s=Na._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=el(e,o,n),t.memoizedState=Qc,Hc(e.child,r)):(Fo(t),n=e.child,e=n.sibling,n=Li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function nl(e,t){return t=rl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function rl(e,t){return e=Fi(22,e,null,t),e.lanes=0,e}function il(e,t,n){return mo(t,e.child,null,n),e=nl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function al(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Fo(t),t.flags&=-257,il(e,t,c)):t.memoizedState===null?(Ro(),o=a.fallback,s=t.mode,a=rl({mode:`visible`,children:a.children},s),o=Bi(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,mo(t,e.child,null,c),a=t.child,a.memoizedState=$c(c),a.childLanes=el(e,r,c),t.memoizedState=Qc,Hc(null,a)):(Ro(),t.child=e.child,t.flags|=128,null);if(Fo(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ga({value:a,source:null,stack:null})),il(e,t,c)}if(Ic||wa(e,t,c,!1),r=(c&e.childLanes)!==0,Ic||r){if(Oo.current!==null)return il(e,t,c);if(r=G,r!==null&&(a=yt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Ai(e,a),Pd(r,e,a),Fc;return om(o)||Kd(),il(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,L=lm(o.nextSibling),oa=t,R=!0,sa=null,ca=!1,e!==null&&aa(t,e),t=nl(t,a.children),t.flags|=134221824,t)}function ol(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Sa(e.return,t,n)}function sl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Uo(n)===null&&(t=e),e=e.sibling}return t}function cl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function ll(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ul(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Bo.current;if(t.flags&128)return Vo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Vo(t,o),i===`backwards`&&e!==null?(ll(e),Lc(e,t,r,n),ll(e)):Lc(e,t,r,n),r=R?Yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ol(e,n,t);else if(e.tag===19)ol(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,ll(t)),cl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}cl(t,!0,n,null,a,r);break;case`together`:cl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=sl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),cl(t,!1,i,n,a,r)}return t.child}function dl(e,t,n){var r=t.pendingProps;return ba(t,t.type,r.value),Lc(e,t,r.children,n),t.child}function fl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(wa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ta(e)))}function ml(e,t,n){switch(t.tag){case 3:De(t,t.stateNode.containerInfo),ba(t,Na,e.memoizedState.cache),ma();break;case 27:case 5:ke(t);break;case 4:De(t,t.stateNode.containerInfo);break;case 10:ba(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Io(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Fo(t),t.flags|=128,null;r=wa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?tl(e,t,n):(Fo(t),e=fl(e,t,n),e===null?null:e.sibling)}Fo(t);break;case 19:if(t.flags&128)return ul(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(wa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ul(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Vo(t,Bo.current),r)break;return null;case 22:return t.lanes=0,Vc(e,t,n,t.pendingProps);case 24:ba(t,Na,e.memoizedState.cache)}return fl(e,t,n)}function hl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ic=!0;else{if(!pl(e,n)&&!(t.flags&128))return Ic=!1,ml(e,t,n);Ic=!!(e.flags&131072)}}else Ic=!1,R&&t.flags&1048576&&na(t,Yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ro(t.elementType),t.type=e,typeof e==`function`)Ii(e)?(r=Tc(e,r),t.tag=1,t=Xc(null,t,e,r,n)):(t.tag=0,t=Jc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===se){t.tag=11,t=Rc(null,t,e,r,n);break a}if(a===k){t.tag=14,t=zc(null,t,e,r,n);break a}if(a===O){t.tag=10,t.type=e,t=dl(null,t,n);break a}}throw t=ve(e)||e,Error(i(306,t,``))}}return t;case 0:return Jc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Tc(r,t.pendingProps),Xc(e,t,r,a,n);case 3:a:{if(De(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,vo(e,t),To(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ba(t,Na,r),r!==o.cache&&Ca(t,[Na],n,!0),wo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Zc(e,t,r,n);break a}if(r!==a){a=Gi(Error(i(424)),t),ga(a),t=Zc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(L=lm(e.firstChild),oa=t,R=!0,sa=null,ca=!0,n=ho(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ma(),r===a){t=fl(e,t,n);break a}Lc(e,t,r,n)}t=t.child}return t;case 26:return qc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:R||(t.stateNode=fp(t.type,t.pendingProps,Te.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ke(t),e===null&&R&&(r=t.stateNode=hm(t.type,t.pendingProps,Te.current),oa=t,ca=!0,a=L,Sp(t.type)?(um=a,L=lm(r.firstChild)):L=a),Lc(e,t,t.pendingProps.children,n),qc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&R&&((a=r=L)&&(r=rm(r,t.type,t.pendingProps,ca),r===null?a=!1:(t.stateNode=r,oa=t,L=lm(r.firstChild),ca=!1,a=!0)),a||ua(t)),ke(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ts(e,t,is,null,null,n),sh._currentValue=a),qc(e,t),Lc(e,t,r,n),t.child;case 6:return e===null&&R&&((e=n=L)&&(n=im(n,t.pendingProps,ca),n===null?e=!1:(t.stateNode=n,oa=t,L=null,e=!0)),e||ua(t)),null;case 13:return tl(e,t,n);case 4:return De(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mo(t,null,r,n):Lc(e,t,r,n),t.child;case 11:return Rc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,qc(e,t),Lc(e,t,r,n),t.child;case 8:return Lc(e,t,t.pendingProps.children,n),t.child;case 12:return Lc(e,t,t.pendingProps.children,n),t.child;case 10:return dl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Ea(t),a=Da(a),r=r(a),t.flags|=1,Lc(e,t,r,n),t.child;case 14:return zc(e,t,t.type,t.pendingProps,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 19:return ul(e,t,n);case 31:return Kc(e,t,n);case 22:return Vc(e,t,n,t.pendingProps);case 24:return Ea(t),r=Da(Na),e===null?(a=Ja(),a===null&&(a=G,o=Pa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},_o(t),ba(t,Na,a)):((e.lanes&n)!==0&&(vo(e,t),To(t,null,null,n),wo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ba(t,Na,r),r!==a.cache&&Ca(t,[Na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ba(t,Na,r))),Lc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:R&&ra(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:qc(e,t),Lc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function gl(e){e.flags|=4}function _l(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ud())e.flags|=8192;else throw io=eo,Qa}}else e.flags&=-16777217}function vl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Ud())e.flags|=8192;else throw io=eo,Qa}}function yl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:pt(),e.lanes|=t,dd|=t)}function bl(e,t){if(!R)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function V(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function xl(e,t,n){var r=t.pendingProps;switch(ia(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return V(t),null;case 1:return V(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),xa(Na),Oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(pa(t)?gl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ha())),V(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(gl(t),o===null?(V(t),_l(t,a,null,r,n)):(V(t),vl(t,o))):o?o===e.memoizedState?(V(t),t.flags&=-16777217):(gl(t),V(t),vl(t,o)):(e=e.memoizedProps,e!==r&&gl(t),V(t),_l(t,a,e,r,n)),null;case 27:if(Ae(t),n=Te.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return V(t),t.subtreeFlags&=-33554433,null}e=Ce.current,pa(t)?da(t,e):(e=hm(a,r,n),t.stateNode=e,gl(t))}return V(t),t.subtreeFlags&=-33554433,null;case 5:if(Ae(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return V(t),t.subtreeFlags&=-33554433,null}if(o=Ce.current,pa(t))da(t,o);else{var s=lp(Te.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Tt]=t,o[Et]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&gl(t)}}return V(t),t.subtreeFlags&=-33554433,_l(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&gl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Te.current,pa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=oa,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Tt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||ua(t,!0)}else e=lp(e).createTextNode(r),e[Tt]=t,t.stateNode=e}return V(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=pa(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Tt]=t}else ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),e=!1}else n=ha(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(zo(t),t):(zo(t),null);if(t.flags&128)throw Error(i(558))}return V(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=pa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Tt]=t}else ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),a=!1}else a=ha(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(zo(t),t):(zo(t),null)}return zo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yl(t,t.updateQueue),V(t),null);case 4:return Oe(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,V(t),null;case 10:return xa(t.type),V(t),null;case 19:if(Ho(t),r=t.memoizedState,r===null)return V(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)bl(r,!1);else{if(Y!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Uo(e),o!==null){for(t.flags|=128,bl(r,!1),e=o.updateQueue,t.updateQueue=e,yl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ri(n,e),n=n.sibling;return Vo(t,Bo.current&1|2),R&&ta(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ue()>_d&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,yl(t,e),bl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!R)return V(t),null}else 2*Ue()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,a=!0,bl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ue(),e.sibling=null,o=Bo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||R?Vo(t,o):(n=o,F(No,t),F(Bo,n),Po===null&&(Po=t)),R&&ta(t,r.treeForkCount),e}return V(t),null;case 22:case 23:return zo(t),Mo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(V(t),t.subtreeFlags&6&&(t.flags|=8192)):V(t),n=t.updateQueue,n!==null&&yl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&P(qa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),xa(Na),V(t),null;case 25:return null;case 30:return t.flags|=33554432,V(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(ia(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return xa(Na),Oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ae(t),null;case 31:if(t.memoizedState!==null){if(zo(t),t.alternate===null)throw Error(i(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(zo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ho(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Oe(),null;case 10:return xa(t.type),null;case 22:case 23:return zo(t),Mo(),e!==null&&P(qa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return xa(Na),null;case 25:return null;default:return null}}function Cl(e,t){switch(ia(t),t.tag){case 3:xa(Na),Oe();break;case 26:case 27:case 5:Ae(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&zo(t);break;case 13:zo(t);break;case 19:Ho(t);break;case 10:xa(t.type);break;case 22:case 23:zo(t),Mo(),e!==null&&P(qa);break;case 24:xa(Na)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Do(t,n)}catch(t){Z(e,e.return,t)}}}function Dl(e,t,n){n.props=Tc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=bi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);h(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&em(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&tm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[Et]=t}catch(t){Z(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xn)),Al(e,r),I=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),I=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[Tt]=e,t[Et]=n}catch(t){Z(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Hl=!0,Tp(o,ql===0?t:t+`_`+ql,n),ql++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Xl(e.child,t),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=Si(t.default,t.share),t!==`none`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=bi(r,n),a=Si(r.default,n.paired?r.share:r.enter);a===`none`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Nd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=Si(n.default,n.share);if(a!==`none`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Nd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=bi(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=Si(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Nd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Nd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=bi(t,e.stateNode);t=Si(t.default,t.update),e.flags&=-5,t!==`none`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=bi(n,r),a=Si(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Nd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,H=!1,cu=!1,lu=!1,uu=typeof WeakSet==`function`?WeakSet:Set,du=null,fu=!1,pu=!1,mu=!1,hu=!1;function gu(e,t,n){if(e=e.containerInfo,sp=gh,e=Xr(e),Zr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,du=t,t=n?9270:1024;du!==null;){if(e=du,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),_u(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),_u(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),_u(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,du=r):(n&&tu(e),_u(n))}}Ul=null}function _u(e){for(;du!==null;){var t=du,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Tc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){Z(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=bi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=Si(a.default,a.update),a!==`none`&&Jl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,du=r;break}du=t.return}}function vu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Lu(e,n),r&4&&wl(5,n);break;case 1:if(Lu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Z(n,n.return,e)}else{var i=Tc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Z(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(Lu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Do(e,t)}catch(e){Z(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:Lu(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:Lu(e,n);break;case 31:Lu(e,n),r&4&&Eu(e,n);break;case 13:Lu(e,n),r&4&&Du(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=_f.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||H;t=su,i=H,su=r,(H=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),zu(e,n,r)):Lu(e,n),su=t,H=i}break;case 30:Lu(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:Lu(e,n)}}function yu(e,t){for(e=e.child;e!==null;)bu(e,t),e=e.sibling}function bu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){Z(e,e.return,t)}xu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,I=!0}catch(t){Z(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){Z(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&yu(e,t);break;default:yu(e,t)}}function xu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:bu(n,r);break a;case 22:n.memoizedState===null&&xu(n,r);break a;default:xu(n,r)}}e=e.sibling}}function Su(e){var t=e.alternate;t!==null&&(e.alternate=null,Su(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var U=null,Cu=!1;function wu(e,t,n){for(n=n.child;n!==null;)Tu(e,t,n),n=n.sibling}function Tu(e,t,n){if($e&&typeof $e.onCommitFiberUnmount==`function`)try{$e.onCommitFiberUnmount(Qe,n)}catch{}switch(n.tag){case 26:H||kl(n,t),wu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!H&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:H||kl(n,t),Ml(n);var r=U,i=Cu;Sp(n.type)&&(U=n.stateNode,Cu=!1),wu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),U=r,Cu=i;break;case 5:H||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=U,i=Cu,U=null,wu(e,t,n),U=r,Cu=i,U!==null){if(Cu)try{(U.nodeType===9?U.body:U.nodeName===`HTML`?U.ownerDocument.body:U).removeChild(n.stateNode),I=!0}catch(e){Z(n,t,e)}else try{U.removeChild(n.stateNode),I=!0}catch(e){Z(n,t,e)}}break;case 18:U!==null&&(Cu?(e=U,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(U,n.stateNode));break;case 4:r=U,i=Cu,U=n.stateNode.containerInfo,Cu=!0,wu(e,t,n),U=r,Cu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),H||Tl(4,n,t),wu(e,t,n);break;case 1:H||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),wu(e,t,n);break;case 21:wu(e,t,n);break;case 22:H=(r=H)||n.memoizedState!==null,wu(e,t,n),H=r;break;case 30:kl(n,t),wu(e,t,n);break;case 7:H||kl(n,t),wu(e,t,n);break;default:wu(e,t,n)}}function Eu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){Z(t,t.return,e)}}}function Du(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){Z(t,t.return,e)}}function Ou(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new uu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new uu),t;default:throw Error(i(435,e.tag))}}function ku(e,t){var n=Ou(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=vf.bind(null,e,t);t.then(r,r)}})}function Au(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){U=l.stateNode,Cu=!1;break a}break;case 5:U=l.stateNode,Cu=!1;break a;case 3:case 4:U=l.stateNode.containerInfo,Cu=!0;break a}l=l.return}if(U===null)throw Error(i(160));Tu(s,c,o),U=null,Cu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mu(t,e,n),t=t.sibling}var ju=null;function Mu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Au(t,e,n),Nu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),a&64&&su&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=ju,Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(su)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Mt]||r[Tt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[Tt]=e,zt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Tt]=e,zt(r),t=r}e.stateNode=t}}else su||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||H||t.parentNode.removeChild(t)):a.count--,n===null?su||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:Au(t,e,n),Nu(e),a&512&&(H||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=cu,cu=!1,Au(t,e,n),cu=o,Nu(e),a&512&&(H||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{pn(t,``),I=!0}catch(t){Z(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(lu=!0);break;case 6:if(Au(t,e,n),Nu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,I=!0}catch(t){Z(e,e.return,t)}}break;case 3:if(I=!1,Wm=null,o=ju,ju=bm(t.containerInfo),Au(t,e,n),ju=o,Nu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){Z(e,e.return,t)}lu&&(lu=!1,Pu(e)),I=!1;break;case 4:a=cu,cu=su,r=Yt(),o=ju,ju=bm(e.stateNode.containerInfo),Au(t,e,n),Nu(e),ju=o,I&&pu&&(mu=!0),I=r,cu=a;break;case 12:Au(t,e,n),Nu(e);break;case 31:Au(t,e,n),Nu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 13:Au(t,e,n),Nu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(hd=Ue()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=H,u=cu;su=c||o,cu=u||o,H=l||s,Au(t,e,n),H=l,cu=u,su=c,Nu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||H||(t=s||H,n=su,r=H,su=o||su,H=t,Ru(e,2),su=n,H=r),!o&&cu||yu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ku(e,n))));break;case 19:Au(t,e,n),Nu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ku(e,t)));break;case 30:a&512&&(H||r===null||kl(r,r.return)),a=Yt(),o=pu,s=(n&335544064)===n,c=e.memoizedProps,pu=s&&Si(c.default,c.update)!==`none`,Au(t,e,n),Nu(e),s&&r!==null&&I&&(e.flags|=4),pu=o,I=a;break;case 21:break;case 7:a&512&&(H||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Au(t,e,n),Nu(e)}}function Nu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(pn(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){Z(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Pu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Fu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Iu(t,e),t=t.sibling;else ou(t,!1)}function Iu(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(hu=fu=!1,Kl(),Fu(t,e),!fu&&!mu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),hu=!0}Gl=null;break;case 5:Fu(t,e);break;case 4:r=fu,fu=!1,Fu(t,e),fu&&(mu=!0),fu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Fu(t,e):Ql(e,!1));break;case 30:r=fu,i=Kl(),fu=!1,Fu(t,e),fu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=bi(a,o),o=bi(n.memoizedProps,o);var s=Si(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Nd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),fu=e.flags&32?!0:r;break;default:Fu(t,e)}}function Lu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)vu(e,t.alternate,t),t=t.sibling}function Ru(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),Ru(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),Ru(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Ru(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||H||i.parentNode.removeChild(i),Ru(n,r);break;case 22:n.memoizedState===null&&Ru(n,r);break;case 30:kl(n,n.return),Ru(n,r);break;case 7:kl(n,n.return);default:Ru(n,r)}e=e.sibling}}function zu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:zu(i,a,n),wl(4,a);break;case 1:if(zu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Z(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Eo(l[i],c)}catch(e){Z(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),zu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||Km(bm(c.ownerDocument),a.type,c),zu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:zu(i,a,n);break;case 31:zu(i,a,n),s&&o&4&&Eu(i,a);break;case 13:zu(i,a,n),s&&o&4&&Du(i,a);break;case 22:a.memoizedState===null&&zu(i,a,n),Ol(a,a.return);break;case 30:zu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:zu(i,a,n)}t=t.sibling}}function Bu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Fa(n))}function Vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fa(e))}function Hu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Uu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Uu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Hu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Hu(e,t,n,r);break;case 3:Hu(e,t,n,r),i&&hu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Fa(a)));break;case 12:if(a&2048){Hu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){Z(t,t.return,e)}}else Hu(e,t,n,r);break;case 31:Hu(e,t,n,r);break;case 13:Hu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ru(t),o._visibility&2?Hu(e,t,n,r):(o._visibility|=2,Wu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Hu(e,t,n,r):Gu(e,t)),a&2048&&Bu(s,t);break;case 24:Hu(e,t,n,r),a&2048&&Vu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Hu(e,t,n,r);break;default:Hu(e,t,n,r)}}function Wu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Wu(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Wu(a,o,s,c,i)):u._visibility&2?Wu(a,o,s,c,i):Gu(a,o),i&&l&2048&&Bu(o.alternate,o);break;case 24:Wu(a,o,s,c,i),i&&l&2048&&Vu(o.alternate,o);break;default:Wu(a,o,s,c,i)}t=t.sibling}}function Gu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Gu(n,r),i&2048&&Bu(r.alternate,r);break;case 24:Gu(n,r),i&2048&&Vu(r.alternate,r);break;default:Gu(n,r)}t=t.sibling}}var Ku=8192;function qu(e,t,n){if(e.subtreeFlags&Ku)for(e=e.child;e!==null;)Ju(e,t,n),e=e.sibling}function Ju(e,t,n){switch(e.tag){case 26:qu(e,t,n),e.flags&Ku&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,ju,e.memoizedState,e.memoizedProps));break;case 5:qu(e,t,n),e.flags&Ku&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=ju;ju=bm(e.stateNode.containerInfo),qu(e,t,n),ju=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ku,Ku=16777216,qu(e,t,n),Ku=r):qu(e,t,n));break;case 30:if((e.flags&Ku)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}qu(e,t,n);break;default:qu(e,t,n)}}function Yu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Xu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,$u(r,e)}Yu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zu(e),e=e.sibling}function Zu(e){switch(e.tag){case 0:case 11:case 15:Xu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Xu(e);break;case 12:Xu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Qu(e)):Xu(e);break;default:Xu(e)}}function Qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,$u(r,e)}Yu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),Qu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Qu(t));break;default:Qu(t)}e=e.sibling}}function $u(e,t){for(;du!==null;){var n=du;switch(n.tag){case 0:case 11:case 15:Tl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,du=r;else a:for(n=e;du!==null;){r=du;var i=r.sibling,a=r.return;if(Su(r),r===n){du=null;break a}if(i!==null){i.return=a,du=i;break a}du=a}}}var ed={getCacheForType:function(e){var t=Da(Na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Da(Na).controller.signal}},td=typeof WeakMap==`function`?WeakMap:Map,W=0,G=null,K=null,q=0,J=0,nd=null,rd=!1,id=!1,ad=!1,od=0,Y=0,sd=0,cd=0,ld=0,ud=0,dd=0,fd=null,pd=null,md=!1,hd=0,gd=0,_d=1/0,vd=null,yd=null,X=0,bd=null,xd=null,Sd=0,Cd=0,wd=null,Td=null,Ed=null,Dd=null,Od=null,kd=0,Ad=null;function jd(){return W&2&&q!==0?q&-q:j.T===null?St():Pf()}function Md(){if(ud===0){if(!(q&536870912)||R){var e=ot;ot<<=1,!(ot&3932160)&&(ot=262144),ud=e}else ud=536870912}return e=No.current,e!==null&&(e.flags|=32),ud}function Nd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(bi(e.memoizedProps,n))),Dd===null&&(Dd=[]),Dd.push(t.bind(null,r))}}function Pd(e,t,n){(e===G&&(J===2||J===9)||e.cancelPendingCommit!==null)&&(Vd(e,0),Rd(e,q,ud,!1)),ht(e,n),W&2&&e===G||(e===G&&(!(W&2)&&(cd|=n),Y===4&&Rd(e,q,ud,!1)),Ef(e))}function Fd(e,t,n){if(W&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ut(e,t),a=r?Yd(e,t):qd(e,t,!0),o=r;do{if(a===0){id&&!r&&Rd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Ld(n))a=qd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=fd;var l=c.current.memoizedState.isDehydrated;if(l&&(Vd(c,s).flags|=256),s=qd(c,s,!1),s!==2&&s!==6){if(ad&&!l){c.errorRecoveryDisabledLanes|=o,cd|=o,a=4;break a}o=pd,pd=a,o!==null&&(pd===null?pd=o:pd.push.apply(pd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Vd(e,0),Rd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Rd(r,t,ud,!rd);break a;case 2:pd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=hd+300-Ue(),10<a)){if(Rd(r,t,ud,!rd),lt(r,0,!0)!==0)break a;Sd=t,r.timeoutHandle=gp(Id.bind(null,r,n,pd,vd,md,t,ud,cd,dd,rd,o,`Throttled`,-0,0),a);break a}Id(r,n,pd,vd,md,t,ud,cd,dd,rd,o,null,-0,0)}break}}while(1);Ef(e)}function Id(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xn},Ul=null,Ju(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?hd-Ue():(a&4194048)===a?gd-Ue():0,m=eh(d,m),m!==null)?(Sd=a,e.cancelPendingCommit=m(nf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Rd(e,a,o,!l)):nf(e,t,a,n,r,i,o,s,c,l,u,d)}function Ld(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Wr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rd(e,t,n,r){t=dt(e,t),t&=~ld,t&=~cd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-tt(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&_t(e,n,t)}function zd(){return W&6?!0:(Df(0,!1),!1)}function Bd(){if(K!==null){if(J===0)var e=K.return;else e=K,ya=va=null,ss(e),so=null,co=0,e=K;for(;e!==null;)Cl(e.alternate,e),e=e.return;K=null}}function Vd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Sd=0,Bd(),G=e,K=n=Li(e.current,null),q=t,J=0,nd=null,rd=!1,id=ut(e,t),ad=!1,dd=ud=ld=cd=sd=Y=0,pd=fd=null,md=!1,od=dt(e,t),Di(),n}function Hd(e,t){z=null,j.H=_c,t===Za||t===$a?(t=ao(),J=3):t===Qa?(t=ao(),J=4):J=t===Fc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,nd=t,K===null&&(Y=1,kc(e,Gi(t,e.current)))}function Ud(){var e=No.current;return e===null?!0:(q&4194048)===q?Po===null:(q&62914560)===q||q&536870912?e===Po:!1}function Wd(){var e=j.H;return j.H=_c,e===null?_c:e}function Gd(){var e=j.A;return j.A=ed,e}function Kd(){Y=4,rd||(q&4194048)!==q&&No.current!==null||(id=!0),!(sd&134217727)&&!(cd&134217727)||G===null||Rd(G,q,ud,!1)}function qd(e,t,n){var r=W;W|=2;var i=Wd(),a=Gd();(G!==e||q!==t)&&(vd=null,Vd(e,t)),t=!1;var o=Y;a:do try{if(J!==0&&K!==null){var s=K,c=nd;switch(J){case 8:Bd(),o=6;break a;case 3:case 2:case 9:case 6:No.current===null&&(t=!0);var l=J;if(J=0,nd=null,$d(e,s,c,l),n&&id){o=0;break a}break;default:l=J,J=0,nd=null,$d(e,s,c,l)}}Jd(),o=Y;break}catch(t){Hd(e,t)}while(1);return t&&e.shellSuspendCounter++,ya=va=null,W=r,j.H=i,j.A=a,K===null&&(G=null,q=0,Di()),o}function Jd(){for(;K!==null;)Zd(K)}function Yd(e,t){var n=W;W|=2;var r=Wd(),a=Gd();G!==e||q!==t?(vd=null,_d=Ue()+500,Vd(e,t)):id=ut(e,t);a:do try{if(J!==0&&K!==null){t=K;var o=nd;b:switch(J){case 1:J=0,nd=null,$d(e,t,o,1);break;case 2:case 9:if(to(o)){J=0,nd=null,Qd(t);break}t=function(){J!==2&&J!==9||G!==e||(J=7),Ef(e)},o.then(t,t);break a;case 3:J=7;break a;case 4:J=5;break a;case 7:to(o)?(J=0,nd=null,Qd(t)):(J=0,nd=null,$d(e,t,o,7));break;case 5:var s=null;switch(K.tag){case 26:s=K.memoizedState;case 5:case 27:var c=K;if(s?Ym(s):c.stateNode.complete){J=0,nd=null;var l=c.sibling;if(l!==null)K=l;else{var u=c.return;u===null?K=null:(K=u,ef(u))}break b}}J=0,nd=null,$d(e,t,o,5);break;case 6:J=0,nd=null,$d(e,t,o,6);break;case 8:Bd(),Y=6;break a;default:throw Error(i(462))}}Xd();break}catch(t){Hd(e,t)}while(1);return ya=va=null,j.H=r,j.A=a,W=n,K===null?(G=null,q=0,Di(),Y):0}function Xd(){for(;K!==null&&!Ve();)Zd(K)}function Zd(e){var t=hl(e.alternate,e,od);e.memoizedProps=e.pendingProps,t===null?ef(e):K=t}function Qd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Yc(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=Yc(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:ss(t);var r=t;r===oa&&(R?(fa(r),r.tag===5&&r.stateNode!=null&&(L=r.stateNode)):(fa(r),R=!0));default:Cl(n,t),t=K=Ri(t,od),t=hl(n,t,od)}e.memoizedProps=e.pendingProps,t===null?ef(e):K=t}function $d(e,t,n,r){ya=va=null,ss(t),so=null,co=0;var i=t.return;try{if(Pc(e,i,t,n,q)){Y=1,kc(e,Gi(n,e.current)),K=null;return}}catch(t){if(i!==null)throw K=i,t;Y=1,kc(e,Gi(n,e.current)),K=null;return}t.flags&32768?(R||r===1?e=!0:id||q&536870912?e=!1:(rd=e=!0,(r===2||r===9||r===3||r===6)&&(r=No.current,r!==null&&r.tag===13&&(r.flags|=16384))),tf(t,e)):ef(t)}function ef(e){var t=e;do{if(t.flags&32768){tf(t,rd);return}e=t.return;var n=xl(t.alternate,t,od);if(n!==null){K=n;return}if(t=t.sibling,t!==null){K=t;return}K=t=e}while(t!==null);Y===0&&(Y=5)}function tf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,K=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){K=e;return}K=e=n}while(e!==null);Y=6,K=null}function nf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do df();while(X!==0);if(W&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===G&&(K=G=null,q=0),xd=t,bd=e,Sd=n,wd=a,Td=r,rf(e,t,n,s,c,l,f)}}function rf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Cd=s,s|=Ei,gt(e,n,s,r,i,a),Dd=null,(n&335544064)===n?(Od=Ra(e),r=10262):(Od=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,yf(qe,function(){return ff(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=j.T,j.T=null,i=M.p,M.p=2,a=W,W|=4;try{gu(e,t,n)}finally{W=a,M.p=i,j.T=r}}X=1,Hl?Ed=Mp(o,e.containerInfo,Od,sf,cf,of,lf,ff,af,null,null):(sf(),cf(),lf())}function af(e){if(X!==0){var t=bd.onRecoverableError;t(e,{componentStack:null})}}function of(){X===3&&(X=0,Iu(xd,bd),X=4)}function sf(){if(X===1){X=0;var e=bd,t=xd,n=Sd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=j.T,j.T=null;var i=M.p;M.p=2;var a=W;W|=4;try{pu=mu=!1,Mu(t,e,n),n=cp;var o=Xr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Yr(s.ownerDocument.documentElement,s)){if(c!==null&&Zr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Jr(s,h),v=Jr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{W=a,M.p=i,j.T=r}}e.current=t,X=2}}function cf(){if(X===2){X=0;var e=bd,t=xd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=W;W|=4;try{vu(e,t.alternate,t)}finally{W=i,M.p=r,j.T=n}}X=3}}function lf(){if(X===4||X===3){X=0;var e=Ed;Ed=null,He();var t=bd,n=xd,r=Sd,i=Td,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?X=5:(X=0,xd=bd=null,uf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(yd=null),xt(r),n=n.stateNode,$e&&typeof $e.onCommitFiberRoot==`function`)try{$e.onCommitFiberRoot(Qe,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=j.T,a=M.p,M.p=2,j.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{j.T=n,M.p=a}}if(i=Dd,o=Od,Od=null,i!==null&&(Dd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Sd&3&&df(),Ef(t),a=t.pendingLanes,r&261930&&a&42?t===Ad?kd++:(kd=0,Ad=t):(kd=0,Ad=null),Df(0,!1)}}function uf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fa(t)))}function df(){return Ed!==null&&(Ed.skipTransition(),Ed=null),sf(),cf(),lf(),ff()}function ff(){if(X!==5)return!1;var e=bd,t=Cd;Cd=0;var n=xt(Sd),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=wd,wd=null;var o=bd,s=Sd;if(X=0,xd=bd=null,Sd=0,W&6)throw Error(i(331));var c=W;if(W|=4,Zu(o.current),Uu(o,o.current,s,n),W=c,Df(0,!1),$e&&typeof $e.onPostCommitFiberRoot==`function`)try{$e.onPostCommitFiberRoot(Qe,o)}catch{}return!0}finally{M.p=a,j.T=r,uf(e,t)}}function pf(e,t,n){t=Gi(n,t),t=jc(e.stateNode,t,2),e=bo(e,t,2),e!==null&&(ht(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=Gi(n,e),n=Mc(2),r=bo(t,n,2),r!==null&&(Nc(n,r,t,e),ht(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new td;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Y===4||Y===3&&(q&62914560)===q&&300>Ue()-hd?W&2?ld|=n:Vd(e,0):ld|=n,dd===q&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=pt()),e=Ai(e,t),e!==null&&(ht(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return ze(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-tt(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=q,a=lt(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ut(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=Ue(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-tt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ft(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=G,n=q,n=lt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(J===2||J===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ut(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Be(r),xt(n)){case 2:case 8:n=Ke;break;case 32:n=qe;break;case 268435456:n=Ye;break;default:n=qe}return r=jf.bind(null,e),n=ze(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Be(r),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,t){if(X!==0&&X!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(df()&&e.callbackNode!==n)return null;var r=q;return r=lt(e,e===G?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Fd(e,r,t),Af(e,Ue()),e.callbackNode!=null&&e.callbackNode===n?jf.bind(null,e):null)}function Mf(e,t){if(df())return null;Fd(e,t,!0)}function Nf(){bp(function(){W&6?ze(Ge,Of):kf()})}function Pf(){if(Tf===0){var e=Va;e===0&&(e=at,at<<=1,!(at&261888)&&(at=256)),Tf=e}return Tf}function Ff(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:bn(e)}function If(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ff((i[Et]||null).action),o=r.submitter;o&&(t=(t=o[Et]||null)?Ff(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Tf!==0){var e=new FormData(i,o);rc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),rc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Lf=0;Lf<_i.length;Lf++){var Rf=_i[Lf];vi(Rf.toLowerCase(),`on`+(Rf[0].toUpperCase()+Rf.slice(1)))}vi(li,`onAnimationEnd`),vi(ui,`onAnimationIteration`),vi(di,`onAnimationStart`),vi(`dblclick`,`onDoubleClick`),vi(`focusin`,`onFocus`),vi(`focusout`,`onBlur`),vi(fi,`onTransitionRun`),vi(pi,`onTransitionStart`),vi(mi,`onTransitionCancel`),vi(hi,`onTransitionEnd`),Wt(`onMouseEnter`,[`mouseout`,`mouseover`]),Wt(`onMouseLeave`,[`mouseout`,`mouseover`]),Wt(`onPointerEnter`,[`pointerout`,`pointerover`]),Wt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ut(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ut(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ut(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ut(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ut(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ut(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var zf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Bf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(zf));function Vf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ci(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ci(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[Ot];n===void 0&&(n=t[Ot]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Vt.forEach(function(t){t!==`selectionchange`&&(Bf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!jn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Ft(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}On(function(){var r=a,i=Cn(n),s=[];a:{var c=gi.get(e);if(c!==void 0){var l=Hn,u=e;switch(e){case`keypress`:if(Ln(n)===0)break a;case`keydown`:case`keyup`:l=or;break;case`focusin`:u=`focus`,l=Zn;break;case`focusout`:u=`blur`,l=Zn;break;case`beforeblur`:case`afterblur`:l=Zn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Yn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=lr;break;case li:case ui:case di:l=Qn;break;case hi:l=ur;break;case`scroll`:case`scrollend`:l=Wn;break;case`wheel`:l=dr;break;case`copy`:case`cut`:case`paste`:l=$n;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=sr;break;case`submit`:l=cr;break;case`toggle`:case`beforetoggle`:l=fr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=kn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==Sn&&(u=n.relatedTarget||n.fromElement)&&(Ft(u)||u[Dt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ft(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Yn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=sr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Lt(c),h=l==null?u:Lt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Ft(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?ne(c,l,Yf):null,c!==null&&Xf(s,u,c,d,!1),l!==null&&f!==null&&Xf(s,f,l,d,!0)))}a:{if(c=r?Lt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Mr;else if(Er(c)){if(Nr)_=Hr;else{_=Br;var v=zr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&_n(r.elementType)&&(_=Mr):_=Vr;if(_&&=_(e,r)){Dr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Lt(r):window,e){case`focusin`:(Er(v)||v.contentEditable===`true`)&&($r=v,ei=r,ti=null);break;case`focusout`:ti=ei=$r=null;break;case`mousedown`:ni=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ni=!1,ri(s,n,i);break;case`selectionchange`:if(Qr)break;case`keydown`:case`keyup`:ri(s,n,i)}var y;if(mr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else Sr?br(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(_r&&n.locale!==`ko`&&(Sr||b!==`onCompositionStart`?b===`onCompositionEnd`&&Sr&&(y=In()):(Nn=i,Pn=`value`in Nn?Nn.value:Nn.textContent,Sr=!0)),v=Jf(r,b),0<v.length&&(b=new er(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=xr(n),y!==null&&(b.data=y)))),(y=gr?Cr(e,n):wr(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new er(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),If(s,e,r,n,i)}Vf(s,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=kn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=kn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=kn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=kn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\\r\\n?/g,Qf=/\\u0000|\\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`\n`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&pn(e,``+r);else return;break;case`className`:Zt(e,`class`,r);break;case`tabIndex`:Zt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Zt(e,n,r);break;case`style`:gn(e,r,o);return;case`data`:if(t!==`object`){Zt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=xn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=bn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Xt(e,`popover`,r);break;case`xlinkActuate`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Xt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=vn.get(n)||n,Xt(e,n,r);else return}I=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:gn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)pn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=xn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Et]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}I=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Xt(e,n,r)}return}I=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,o,s,n,null)}}a&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:$(e,t,r,d,n,null)}}cn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&un(e,!!r,n,!0):un(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:$(e,t,s,c,n,null)}fn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<zf.length;r++)Q(zf[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,u,r,n,null)}return;default:if(_n(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(I=!0),o=m;break;case`name`:m!==f&&(I=!0),a=m;break;case`checked`:m!==f&&(I=!0),u=m;break;case`defaultChecked`:m!==f&&(I=!0),d=m;break;case`value`:m!==f&&(I=!0),s=m;break;case`defaultValue`:m!==f&&(I=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}sn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||$(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(I=!0),p=o;break;case`defaultValue`:o!==l&&(I=!0),c=o;break;case`multiple`:o!==l&&(I=!0),s=o;default:o!==l&&$(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?un(e,!!n,n?[]:``,!1):un(e,!!n,t,!0)):un(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(I=!0),p=a;break;case`defaultValue`:a!==o&&(I=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&$(e,t,s,a,r,o)}dn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(I=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(_n(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[Tt]=r,n[Et]=t,np(n,e,t),zt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Mt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Ft(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ne(n,a,C),t===null?t=!1:(h(t,!0,ee,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ne(r,a,C),t===null?t=!1:(h(t,!0,te,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Mt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&$(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===xn&&(e.onclick=null),Pt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Pt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=M.d;M.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=zd();return e||t}function Cm(e){var t=It(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=on(t);i=`link[rel=\"`+e+`\"][href=\"`+i+`\"]`,typeof n==`string`&&(i+=`[crossorigin=\"`+n+`\"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),zt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel=\"preload\"][as=\"`+on(t)+`\"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset=\"`+on(n.imageSrcSet)+`\"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes=\"`+on(n.imageSizes)+`\"]`)):i+=`[href=\"`+on(e)+`\"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Nt]=!0,o.onload=o.onerror=function(){Bt(o)}),zt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel=\"modulepreload\"][as=\"`+on(r)+`\"][href=\"`+on(e)+`\"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=w({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),zt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Rt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,\"data-precedence\":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);zt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Rt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),zt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Rt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),zt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=Te.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Rt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Rt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Rt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href=\"`+on(e)+`\"`}function Fm(e){return`link[rel=\"stylesheet\"][`+e+`]`}function Im(e){return w({},e,{\"data-precedence\":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel=\"preload\"][as=\"style\"][`+t+`]`)){if(!0!==t[Nt]){r.loading=1;return}}else t=e.createElement(`link`),t[Nt]=!0,t.onload=t.onerror=Bt.bind(null,t),np(t,`link`,n),zt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src=\"`+on(e)+`\"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~=\"`+on(n.href)+`\"]`);if(r)return t.instance=r,zt(r),r;var a=w({},n,{\"data-href\":n.href,\"data-precedence\":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),zt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,zt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),zt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,zt(a),a):(r=n,(a=vm.get(o))&&(r=w({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),zt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel=\"stylesheet\"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Mt]||a[Tt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,zt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),zt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:O,Provider:null,Consumer:null,_currentValue:N,_currentValue2:N,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=mt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mt(0),this.hiddenUpdates=mt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Fi(3,null,null,t),e.current=a,a.stateNode=e,t=Pa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},_o(a),e}function uh(e){return e?(e=Ni,e):Ni}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=yo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=bo(e,r,t),n!==null&&(Pd(n,e,t),xo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Ai(e,67108864);t!==null&&Pd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=jd();t=bt(t);var n=Ai(e,t);n!==null&&Pd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,yh(e,t,n,r)}finally{M.p=a,j.T=i}}function vh(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,yh(e,t,n,r)}finally{M.p=a,j.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=It(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ct(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-tt(o);s.entanglements[1]|=c,o&=~c}Ef(a),!(W&6)&&(_d=Ue()+500,Df(0,!1))}}break;case 31:case 13:s=Ai(a,2),s!==null&&Pd(s,a,2),zd(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=Cn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(We()){case Ge:return 2;case Ke:return 8;case qe:case Je:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=It(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ct(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ct(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Sn=r,n.target.dispatchEvent(r),Sn=null}else return t=It(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=It(n);a!==null&&(e.splice(t,3),t-=3,rc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Et]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Et]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,jd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),zd(),t[Dt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=St();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(i(527,Kh,`19.3.1`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Qe=Jh.inject(qh),$e=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ec,s=Dc,c=Oc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[Dt]=t.current,Wf(e),new Wh(t)}})),g=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g(),y=class extends Error{status;code;sqlState;position;detail;hint;ours;constructor(e,t,n,r,i,a,o,s=!0){super(n),this.status=e,this.code=t,this.sqlState=r,this.position=i,this.detail=a,this.hint=o,this.ours=s,this.name=`ApiError`}};function b(e=document){let t=e.querySelector(`meta[name=\"otw-db\"]`)?.getAttribute(`content`);return!t||t.startsWith(`%`)?{api:`/api`}:JSON.parse(t)}function x(e,t,n){let r=e=>new URLSearchParams(e).toString();function i(e,t){return n?t===void 0?[`${e}${e.includes(`?`)?`&`:`?`}${r({database:n})}`,t]:[e,{...t,database:n}]:[e,t]}function a(t,n,r){return fetch(`${e.api}${t}`,{method:n===void 0?`GET`:`POST`,headers:{\"x-db-admin\":`1`,...n===void 0?{}:{\"content-type\":`application/json`}},body:n===void 0?void 0:JSON.stringify(n),credentials:`same-origin`,signal:r})}async function o(e,t,n){let r=await a(e,t,n);if(!r.ok)throw await s(r);return await r.json()}async function s(e){let n=S(await e.json().catch(()=>null));return e.status===401&&t(),new y(e.status,n?.code??`failed`,n?.message??`The server answered ${e.status}.`,n?.sqlState,n?.position,n?.detail,n?.hint,n!==void 0)}function c(e,t,n){let[r,a]=i(e,t);return o(r,a,n)}let l={forDatabase:n=>x(e,t,n??void 0),connections:()=>o(`/connections`).then(e=>e.connections),databases:e=>o(`/databases?${r({connection:e})}`),info:e=>c(`/info?${r({connection:e})}`).then(e=>e.info),tables:e=>c(`/tables?${r({connection:e})}`).then(e=>e.tables),table:(e,t,n)=>c(`/table?${r({connection:e,schema:t,name:n})}`).then(e=>e.table),rows:(e,t)=>c(`/rows`,e,t),count:(e,t)=>c(`/count`,e,t).then(e=>e.count),query:(e,t,n,r)=>c(`/query`,{connection:e,sql:t,queryId:n},r),apply:e=>c(`/apply`,e),exportTable:async e=>{let t=await a(...i(`/export`,e));if(!t.ok)throw await s(t);let n=t.headers.get(`content-disposition`)??``,r=/filename=\"([^\"]+)\"/.exec(n)?.[1]??`${e.table}.${e.format}`;return{blob:await t.blob(),filename:r}},cancel:e=>o(`/cancel`,{queryId:e}).then(e=>e.canceled),backupOptions:e=>c(`/backup-options?${r({connection:e})}`),backup:async e=>{let t=await a(...i(`/backup`,e));if(!t.ok)throw await s(t);let n=t.headers.get(`content-disposition`)??``,r=/filename=\"([^\"]+)\"/.exec(n)?.[1]??`backup`;return{blob:await t.blob(),filename:r}},restorePlan:(e,t)=>c(`/restore-plan`,{connection:e,header:t}),restore:async(e,t,n,r,i,a)=>l.restoreRun(e,await l.restoreUpload(e,t,n,i),r,a),restoreUpload:async(t,n,a,o)=>{let{upload:l,chunkBytes:u}=await c(`/restore-start`,{connection:t,size:n.size,kind:a,name:n.name??`backup`});try{for(let a=0,c=0;c<n.size;a+=1){let d=n.slice(c,c+u),[f]=i(`/restore-chunk?${r({connection:t,upload:l,seq:String(a)})}`);await ee(async()=>{let t=await fetch(`${e.api}${f}`,{method:`POST`,headers:{\"x-db-admin\":`1`,\"content-type\":`application/octet-stream`},body:d,credentials:`same-origin`});if(!t.ok)throw await s(t)}),c+=d.size,o(c)}}catch(e){throw await c(`/restore-discard`,{connection:t,upload:l}).catch(()=>{}),e}return l},restoreRun:async(e,t,n,r)=>{let o=await a(...i(`/restore-run`,{connection:e,upload:t,confirm:n}));if(!o.ok)throw await s(o);let c=null;for await(let e of ne(o))c=e,r(c);if(!c)throw new y(500,`failed`,`The restore stopped without saying how it went.`);return c},restoreDiscard:(e,t)=>c(`/restore-discard`,{connection:e,upload:t}),importOptions:e=>o(`/import-options?${r({connection:e})}`),importStart:(e,t)=>o(`/import-start`,e,t),importRun:async function*(t,n,i){let a=await fetch(`${e.api}/import-run?${r(C(t))}`,{method:`POST`,headers:{\"x-db-admin\":`1`,...n?{\"content-type\":`application/octet-stream`}:{}},body:n,credentials:`same-origin`,signal:i});if(!a.ok)throw await s(a);for await(let e of ne(a,te))yield e},importStatus:(e,t,n)=>o(`/import-status?${r({connection:e,import:t})}`,void 0,n),importEnd:(e,t,n)=>o(`/import-end`,{connection:e,import:t},n),importEndOpen:(e,t)=>o(`/import-end`,{connection:e,current:!0},t)};return l}function S(e){let t=e?.error;if(typeof t!=`object`||!t)return;let{code:n,message:r}=t;return typeof n==`string`&&typeof r==`string`?t:void 0}async function ee(e){for(let t=1;;t+=1)try{return await e()}catch(e){if(!(!(e instanceof y)||e.status>=500)||t===3)throw e;await new Promise(e=>setTimeout(e,500*t))}}var te=65536;function C(e){let{connection:t,start:n,count:r,nbe:i,aq:a,skip:o}=e;return{connection:t,import:e.import,start:String(n),count:String(r),nbe:String(i),aq:String(a),...o===void 0?{}:{skip:String(o)}}}async function*ne(e,t=1/0){let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r=``,i=(e,n,i)=>{if(r.length+i-n>t)throw Error(`A line of the answer is longer than ${t.toLocaleString(`en`)} characters.`);return r+e.slice(n,i)};for(;;){let{done:e,value:t=``}=await n.read(),a=0;for(let e=t.indexOf(`\n`);e!==-1;e=t.indexOf(`\n`,a)){let n=i(t,a,e).trim();r=``,a=e+1,n&&(yield JSON.parse(n))}if(r=i(t,a,t.length),e)break}r.trim()&&(yield JSON.parse(r))}var w=e=>{try{return decodeURIComponent(e)}catch{return null}};function T(e){let t=e.replace(/^#/,``),n=t.indexOf(`/`);return{connection:w(n===-1?t:t.slice(0,n))??``,database:n===-1?null:w(t.slice(n+1))||null}}function re({connection:e,database:t}){if(!e)return``;let n=encodeURIComponent(e);return t?`${n}/${encodeURIComponent(t)}`:n}function ie(e,t){return t?`${e}/${t}`:e}var ae=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),oe=o(((e,t)=>{t.exports=ae()})),E=oe(),D={table:`M2.5 3.5h11v9h-11z M2.5 6.5h11 M6.5 6.5v6`,view:`M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z M8 6.2a1.8 1.8 0 1 1 0 3.6 1.8 1.8 0 0 1 0-3.6z`,stack:`M8 2.5l5.5 2.75L8 8 2.5 5.25z M2.5 8L8 10.75 13.5 8 M2.5 10.75L8 13.5l5.5-2.75`,play:`M5 3.5l7 4.5-7 4.5z`,stop:`M4.5 4.5h7v7h-7z`,plus:`M8 3.5v9 M3.5 8h9`,minus:`M3.5 8h9`,refresh:`M12.5 5.5A5 5 0 1 0 13 9 M12.5 2.5v3h-3`,sidebar:`M2.5 3.5h11v9h-11z M6 3.5v9`,panel:`M2.5 3.5h11v9h-11z M10 3.5v9`,console:`M2.5 3.5h11v9h-11z M5 7l2 1.5L5 10 M8.5 10h2.5`,search:`M7 3a4 4 0 1 1 0 8 4 4 0 0 1 0-8z M10 10l3.5 3.5`,close:`M4.5 4.5l7 7 M11.5 4.5l-7 7`,left:`M10 3.5L5.5 8l4.5 4.5`,right:`M6 3.5l4.5 4.5L6 12.5`,down:`M4 6.5l4 4 4-4`,backup:`M8 2.5v7 M5.5 7l2.5 2.5L10.5 7 M2.5 10v3.5h11V10`,import:`M8 9.5v-7 M5.5 5L8 2.5 10.5 5 M2.5 10v3.5h11V10`,filter:`M2.5 3.5h11L9.5 8.5v4l-3-1.5v-2.5z`,sql:`M5.5 5L3 8l2.5 3 M10.5 5L13 8l-2.5 3 M9 4l-2 8`,key:`M10 2.5a3.5 3.5 0 1 1-2.6 5.9L3.5 12.3v1.2H2.3v-1.2l3.9-3.9A3.5 3.5 0 0 1 10 2.5z`,lock:`M4.5 7.5h7v5.5h-7z M6 7.5V5.5a2 2 0 0 1 4 0v2`,database:`M3 4c0-1.1 2.2-1.5 5-1.5s5 .4 5 1.5v8c0 1.1-2.2 1.5-5 1.5s-5-.4-5-1.5z M3 4c0 1.1 2.2 1.5 5 1.5s5-.4 5-1.5 M3 8c0 1.1 2.2 1.5 5 1.5s5-.4 5-1.5`,switch:`M3 5.5h9.5L10 3 M13 10.5H3.5L6 13`,history:`M2.5 8a5.5 5.5 0 1 0 1.6-3.9 M2.5 2.5v2.5H5 M8 5v3l2 1.5`,save:`M3 2.5h8l2 2v9H3z M5.5 2.5v3h4v-3 M5 13.5v-4h6v4`};function O({name:e,size:t=16,label:n}){return(0,E.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,role:n?`img`:void 0,\"aria-label\":n,\"aria-hidden\":!n||void 0,children:(0,E.jsx)(`path`,{d:D[e]})})}function se(e){return e===`view`?`view`:e===`materialized-view`?`stack`:`table`}var ce={postgres:`Pg`,mysql:`My`,sqlite:`Lt`},le={postgres:`PostgreSQL`,mysql:`MySQL`,sqlite:`SQLite`};function k({connections:e,onOpen:t}){let[n,r]=(0,_.useState)(``),i=n.trim().toLowerCase(),a=e.filter(e=>!i||e.label.toLowerCase().includes(i)||e.name.includes(i)||e.tag?.includes(i));return(0,E.jsx)(`div`,{className:`connections`,children:(0,E.jsxs)(`div`,{className:`connections-card`,children:[(0,E.jsxs)(`div`,{className:`connections-head`,children:[(0,E.jsx)(O,{name:`database`,size:28}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{children:`OTW DB`}),(0,E.jsx)(`p`,{children:e.length===1?`1 connection`:`${e.length} connections`})]})]}),e.length>6&&(0,E.jsx)(`div`,{className:`connections-search`,children:(0,E.jsx)(`input`,{className:`input`,type:`search`,\"aria-label\":`Search connections`,placeholder:`Search for connection…`,value:n,onChange:e=>r(e.target.value),autoFocus:!0})}),(0,E.jsxs)(`ul`,{className:`connections-list`,\"aria-label\":`Connections`,children:[!e.length&&(0,E.jsxs)(`li`,{className:`tree-empty`,children:[`No connections yet. Set `,(0,E.jsx)(`code`,{children:`DB_ADMIN_<NAME>_URL`}),` on the server.`]}),a.map((n,r)=>{let i=n.capabilities!==null,a=n.tag?`tag-${n.tag}`:``;return(0,E.jsx)(`li`,{className:a,children:(0,E.jsxs)(`button`,{type:`button`,className:`connection`,\"aria-label\":n.label,\"aria-describedby\":`connection-${n.name}`,\"aria-disabled\":!i,autoFocus:r===0&&e.length<=6,onClick:()=>i&&t(n),children:[(0,E.jsx)(`span`,{className:`kind-badge`,children:ce[n.kind]??`?`}),(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`div`,{className:`connection-name`,children:n.label}),(0,E.jsxs)(`div`,{className:`connection-meta`,id:`connection-${n.name}`,children:[le[n.kind],n.label!==n.name&&` · ${n.name}`,!i&&` · not supported yet`]})]}),(0,E.jsxs)(`span`,{className:`connection-tags`,children:[n.access===`read`&&(0,E.jsx)(O,{name:`lock`,size:13,label:`Read-only`}),n.tag&&(0,E.jsx)(`span`,{className:`pill`,children:n.tag})]})]})},n.name)})]})]})})}var A={tabs:[],active:null,queries:0},ue=(e,t)=>`table:${e}.${t}`;function de(e,t){switch(t.type){case`open-table`:{let n=ue(t.schema,t.table);if(e.tabs.some(e=>e.id===n))return{...e,active:n};let r={id:n,kind:`table`,schema:t.schema,table:t.table};return{...e,tabs:[...e.tabs,r],active:n}}case`new-query`:{let n=e.queries+1,r=`query:${n}`,i={id:r,kind:`query`,title:`Query ${n}`,sql:t.sql??``};return{tabs:[...e.tabs,i],active:r,queries:n}}case`close`:{let n=e.tabs.findIndex(e=>e.id===t.id);if(n===-1)return e;let r=e.tabs.filter(e=>e.id!==t.id),i=e.active===t.id?r[n]?.id??r[n-1]?.id??null:e.active;return{...e,tabs:r,active:i}}case`activate`:return e.tabs.some(e=>e.id===t.id)?{...e,active:t.id}:e;case`cycle`:{if(!e.tabs.length)return e;let n=(e.tabs.findIndex(t=>t.id===e.active)+t.by+e.tabs.length)%e.tabs.length;return{...e,active:e.tabs[n].id}}case`edit-sql`:return{...e,tabs:e.tabs.map(e=>e.id===t.id&&e.kind===`query`?{...e,sql:t.sql}:e)}}}function fe(e,t=me()){try{let n=t?.getItem(`otw-db:tabs:${e}`);if(!n)return A;let r=JSON.parse(n);return!Array.isArray(r.tabs)||typeof r.queries!=`number`?A:r}catch{return A}}function pe(e,t,n=me()){try{n?.setItem(`otw-db:tabs:${e}`,JSON.stringify(t))}catch{}}function me(){try{return globalThis.localStorage}catch{return}}var he=200,ge=e=>`otw-db:history:${e}`;function _e(e,t=me()){try{let n=JSON.parse(t?.getItem(ge(e))??`[]`);return Array.isArray(n)?n:[]}catch{return[]}}function ve(e,t,n=me()){let r=[{sql:t,at:new Date().toISOString()},..._e(e,n).filter(e=>e.sql!==t)].slice(0,he);try{n?.setItem(ge(e),JSON.stringify(r))}catch{}return r}var ye=(0,_.createContext)(null);function j(){let e=(0,_.useContext)(ye);if(!e)throw Error(`useWorkspace() is for components inside a workspace.`);return e}var M=`-- otw-db backup `,N=1048576;async function be(e){let t=new Uint8Array(await e.slice(0,5).arrayBuffer());if(new TextDecoder().decode(t)===`PGDMP`)return{kind:`pg_dump`};let n=t[0]===31&&t[1]===139,r;try{r=await xe(n?e.stream().pipeThrough(new DecompressionStream(`gzip`)):e.stream())}catch{return{kind:`unknown`,reason:`The file can’t be read: it may be damaged.`}}if(r===null||!r.startsWith(M))return{kind:`unknown`,reason:`This isn’t a backup made here: choose a .sql.gz from Back up, or a .dump from pg_dump.`};try{return{kind:`sql`,header:JSON.parse(r.slice(17))}}catch{return{kind:`unknown`,reason:`The backup’s first line is damaged.`}}}async function xe(e){let t=new TextDecoderStream,n=e.pipeThrough(t).getReader(),r=``;try{for(;;){let{done:e,value:t}=await n.read();t&&(r+=t);let i=r.indexOf(`\n`);if(i!==-1)return r.slice(0,i);if(e||r.length>N)return null}}finally{await n.cancel().catch(()=>{})}}var Se={csv:`CSV`,json:`JSON`,sql:`SQL INSERTs`};function P({formats:e,onExport:t}){let[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!n)return;let e=e=>{i.current&&!e.composedPath().includes(i.current)&&r(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[n]),(0,E.jsxs)(`div`,{style:{position:`relative`},ref:i,onKeyDown:e=>e.key===`Escape`&&r(!1),children:[(0,E.jsx)(`button`,{type:`button`,className:`button`,\"aria-haspopup\":`menu`,\"aria-expanded\":n,onClick:()=>r(e=>!e),children:`Export`}),n&&(0,E.jsx)(`div`,{className:`menu`,role:`menu`,\"aria-label\":`Export as`,children:e.map(e=>(0,E.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(!1),t(e)},children:Se[e]},e))})]})}function F(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function Ce({api:e,connection:t,onRestored:n,onClose:r}){let[i,a]=(0,_.useState)(`backup`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1),f=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let n=!0;return e.backupOptions(t.name).then(e=>n&&s(e),e=>n&&l(e)),()=>{n=!1}},[e,t.name]);let p=()=>{!u&&!f.current&&r()};return(0,E.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&p(),children:(0,E.jsxs)(`div`,{className:`dialog backup`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Back up and restore`,onKeyDown:e=>e.key===`Escape`&&p(),children:[(0,E.jsx)(`div`,{className:`tabs`,role:`tablist`,\"aria-label\":`Back up or restore`,children:[`backup`,`restore`].map(e=>(0,E.jsx)(`button`,{type:`button`,role:`tab`,id:`backup-tab-${e}`,\"aria-selected\":i===e,\"aria-controls\":`backup-panel-${e}`,disabled:u,onClick:()=>a(e),children:e===`backup`?`Back up`:`Restore`},e))}),c&&(0,E.jsx)(`div`,{className:`dialog-body`,children:(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:c.message})}),!o&&!c&&(0,E.jsx)(`div`,{className:`dialog-body muted`,children:`Loading…`}),o&&i===`backup`&&(0,E.jsx)(we,{api:e,connection:t,options:o,busy:u,setBusy:d,onClose:p}),o&&i===`restore`&&(0,E.jsx)(Te,{api:e,connection:t,options:o,setBusy:e=>{f.current=e,d(e)},busy:u,onRestored:n,onClose:p}),!o&&(0,E.jsx)(`div`,{className:`dialog-actions`,children:(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:p,children:`Close`})})]})})}function we({api:e,connection:t,options:n,busy:r,setBusy:i,onClose:a}){let[o,s]=(0,_.useState)(()=>new Set(n.schemas.filter(e=>e.selected).map(e=>e.name))),[c,l]=(0,_.useState)(`sql`),[u,d]=(0,_.useState)(null),f=n.notIncluded.filter(e=>e.schema===null||o.has(e.schema)),p=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m=async()=>{i(!0),d(null);try{let r=n.schemas.filter(e=>o.has(e.name)).map(e=>e.name),{blob:i,filename:s}=await e.backup({connection:t.name,schemas:r,format:c});F(i,s),a()}catch(e){d(e.message)}finally{i(!1)}};return(0,E.jsxs)(`div`,{role:`tabpanel`,id:`backup-panel-backup`,\"aria-labelledby\":`backup-tab-backup`,children:[(0,E.jsxs)(`div`,{className:`dialog-body`,children:[(0,E.jsxs)(`p`,{className:`muted`,children:[n.database,` on `,n.server]}),(0,E.jsxs)(`fieldset`,{className:`choices`,children:[(0,E.jsx)(`legend`,{children:`Schemas`}),n.schemas.map(e=>(0,E.jsxs)(`label`,{children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:o.has(e.name),disabled:r,onChange:()=>p(e.name)}),(0,E.jsx)(`span`,{children:e.name}),(0,E.jsxs)(`span`,{className:`muted`,children:[e.tables===1?`1 table`:`${e.tables.toLocaleString()} tables`,e.mine?``:` · owner ${e.owner}`]})]},e.name))]}),(0,E.jsxs)(`fieldset`,{className:`choices`,children:[(0,E.jsx)(`legend`,{children:`Format`}),(0,E.jsxs)(`label`,{children:[(0,E.jsx)(`input`,{type:`radio`,name:`backup-format`,checked:c===`sql`,disabled:r,onChange:()=>l(`sql`)}),(0,E.jsx)(`span`,{children:`SQL backup (.sql.gz)`}),(0,E.jsx)(`span`,{className:`muted`,children:`restores here, or with psql`})]}),(0,E.jsxs)(`label`,{title:n.pgDump.available?void 0:n.pgDump.reason,children:[(0,E.jsx)(`input`,{type:`radio`,name:`backup-format`,checked:c===`pg_dump`,disabled:r||!n.pgDump.available,onChange:()=>l(`pg_dump`)}),(0,E.jsx)(`span`,{children:`pg_dump (.dump)`}),(0,E.jsx)(`span`,{className:`muted`,children:n.pgDump.available?`restores with pg_restore`:n.pgDump.reason})]})]}),n.exclusive&&(0,E.jsx)(`div`,{className:`notice warning`,children:`This is the site’s embedded database: the site waits while the backup is taken.`}),c===`sql`&&f.length>0&&(0,E.jsxs)(`div`,{className:`notice warning`,children:[`Not in the backup: `,f.map(e=>e.what).join(`; `),`. Use pg_dump for those.`]}),u&&(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:u})]}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{type:`button`,className:`button`,disabled:r,onClick:a,children:`Cancel`}),(0,E.jsx)(`button`,{type:`button`,className:`button primary`,disabled:r||o.size===0,onClick:()=>void m(),children:r?`Backing up…`:`Download backup`})]})]})}function Te({api:e,connection:t,options:n,busy:r,setBusy:i,onRestored:a,onClose:o}){let[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)({step:`idle`}),[b,x]=(0,_.useState)(null),S=()=>{b&&e.restoreDiscard(t.name,b).catch(()=>{}),x(null)},ee=async n=>{if(S(),c(n),u(null),f(null),m(null),y({step:`idle`}),!n)return;let r=await be(n);if(u(r),r.kind===`sql`)try{f(await e.restorePlan(t.name,r.header))}catch(e){m(e.message)}},te=l?.kind===`pg_dump`?`pg_dump`:`sql`,C=(d?.blocked.length??0)>0,ne=n.restore.allowed&&s!==null&&l!==null&&l.kind!==`unknown`&&(l.kind===`pg_dump`?n.pgRestore.available:d!==null&&!C)&&h===n.database&&(v.step===`idle`||b!==null),w=async()=>{if(s){i(!0);try{let n=b;n||=(y({step:`uploading`,sent:0}),await e.restoreUpload(t.name,s,te,e=>y({step:`uploading`,sent:e}))),y({step:`restoring`,statements:0});let r=await e.restoreRun(t.name,n,h,e=>{e.type===`progress`&&y({step:`restoring`,statements:e.statements})});r.type===`done`?(x(null),y({step:`done`,result:r}),a()):r.type===`error`&&(x(r.error.code===`busy`?n:null),y({step:`failed`,message:r.error.message}))}catch(e){x(null),y({step:`failed`,message:e.message})}finally{i(!1)}}};return(0,E.jsxs)(`div`,{role:`tabpanel`,id:`backup-panel-restore`,\"aria-labelledby\":`backup-tab-restore`,children:[(0,E.jsx)(`div`,{className:`dialog-body`,children:n.restore.allowed?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`label`,{className:`file-choice`,children:[(0,E.jsx)(`span`,{children:`Backup file`}),(0,E.jsx)(`input`,{type:`file`,accept:`.gz,.sql,.dump,application/gzip,application/sql`,disabled:r,onChange:e=>void ee(e.target.files?.[0]??null)})]}),l?.kind===`unknown`&&(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:l.reason}),l?.kind===`sql`&&(0,E.jsxs)(`p`,{className:`muted`,children:[`Backup of `,l.header.database,` (`,l.header.server,`), made`,` `,new Date(l.header.createdAt).toLocaleString(),`: `,l.header.schemas.join(`, `),`.`]}),l?.kind===`pg_dump`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`p`,{className:`muted`,children:[`pg_dump archive, `,ke(s?.size??0),`.`]}),!n.pgRestore.available&&(0,E.jsxs)(`div`,{className:`notice`,role:`alert`,children:[n.pgRestore.reason,` Restore it with pg_restore from a machine that has it.`]})]}),p&&(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:p}),d&&(0,E.jsx)(Ee,{plan:d,database:n.database}),l?.kind===`sql`&&l.header.notIncluded.length>0&&(0,E.jsxs)(`div`,{className:`notice warning`,children:[`The backup didn’t hold: `,l.header.notIncluded.join(`; `),`.`]}),n.exclusive&&l&&l.kind!==`unknown`&&(0,E.jsx)(`div`,{className:`notice warning`,children:`This is the site’s embedded database: the site waits while it’s restored.`}),l&&l.kind!==`unknown`&&(!C||l.kind===`pg_dump`)&&(0,E.jsxs)(`label`,{className:`confirm`,children:[(0,E.jsxs)(`span`,{children:[`Type `,(0,E.jsx)(`strong`,{children:n.database}),` to replace what it holds`]}),(0,E.jsx)(`input`,{className:`input`,\"aria-label\":`Database name, to confirm`,value:h,disabled:r||v.step===`done`,autoComplete:`off`,spellCheck:!1,onChange:e=>g(e.target.value)})]}),(0,E.jsx)(De,{phase:v,total:s?.size??0})]}):(0,E.jsx)(`div`,{className:`notice warning`,children:`Restoring needs write access, and this connection is read-only.`})}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{type:`button`,className:`button`,disabled:r,onClick:()=>{S(),o()},children:v.step===`done`?`Close`:`Cancel`}),n.restore.allowed&&(0,E.jsx)(`button`,{type:`button`,className:`button danger`,disabled:!ne||r,onClick:()=>void w(),children:r?`Restoring…`:b?`Try again`:`Restore`})]})]})}function Ee({plan:e,database:t}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`replaces`,children:[(0,E.jsxs)(`p`,{children:[`Replaces in `,t,`:`]}),(0,E.jsx)(`ul`,{children:e.schemas.map(e=>(0,E.jsxs)(`li`,{children:[(0,E.jsx)(`strong`,{children:e.schema}),` `,e.exists?(0,E.jsxs)(`span`,{className:`muted`,children:[Oe(e.tables,`table`),`, `,Oe(e.views,`view`),`,`,` `,Oe(e.functions,`function`),e.rows>0&&`, about ${Oe(e.rows,`row`)}`]}):(0,E.jsx)(`span`,{className:`muted`,children:`new here`})]},e.schema))})]}),e.blocked.length>0&&(0,E.jsxs)(`div`,{className:`notice`,role:`alert`,children:[`Restoring would also drop what the backup can’t bring back:`,(0,E.jsx)(`ul`,{children:e.blocked.map(e=>(0,E.jsx)(`li`,{children:e},e))}),`Back up those schemas too, or remove what’s listed here.`]}),e.missingRoles.length>0&&(0,E.jsxs)(`div`,{className:`notice warning`,children:[`These roles aren’t on this server: `,e.missingRoles.join(`, `),`. Their grants will be skipped, and a policy made for the other roles it names (or skipped, when it names no other).`]}),e.warnings.map(e=>(0,E.jsx)(`div`,{className:`notice warning`,children:e},e))]})}function De({phase:e,total:t}){switch(e.step){case`idle`:return null;case`uploading`:return(0,E.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,E.jsx)(`progress`,{max:t||1,value:e.sent}),`Uploading `,ke(e.sent),` of `,ke(t),`…`]});case`restoring`:return(0,E.jsxs)(`div`,{className:`progress`,role:`status`,children:[(0,E.jsx)(`progress`,{}),`Restoring: `,Oe(e.statements,`statement`),` run…`]});case`done`:return(0,E.jsxs)(`div`,{className:`notice success`,role:`status`,children:[`Restored`,e.result.tables?` ${Oe(e.result.tables,`table`)} and ${Oe(e.result.rows,`row`)}`:``,` `,`in`,` `,(e.result.durationMs/1e3).toLocaleString(void 0,{maximumFractionDigits:1}),` `,`s. If an app uses this database, restart it: it may keep what it read before.`]});case`failed`:return(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:e.message})}}function Oe(e,t){return`${e.toLocaleString()} ${t}${e===1?``:`s`}`}function ke(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})} MB`}function Ae(e,t){let n=0;for(let r of t.toLowerCase()){if(n=e.toLowerCase().indexOf(r,n),n===-1)return!1;n++}return!0}function je(e,t,n){let r=n.trim().toLowerCase();return e.filter(e=>Ae(t(e),r)).sort((e,n)=>Number(!t(e).toLowerCase().startsWith(r))-Number(!t(n).toLowerCase().startsWith(r))).slice(0,50)}function Me({tables:e,onOpen:t,onClose:n}){let[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(null);(0,_.useEffect)(()=>{s.current?.focus()},[]);let c=je(e,e=>e.name,r),l=c[Math.min(a,c.length-1)];return(0,E.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,E.jsxs)(`div`,{className:`dialog palette`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Open anything`,children:[(0,E.jsx)(`input`,{ref:s,className:`input`,\"aria-label\":`Table name`,placeholder:`Open table…`,value:r,onChange:e=>{i(e.target.value),o(0)},onKeyDown:e=>{e.key===`Escape`?n():e.key===`ArrowDown`?(e.preventDefault(),o(e=>Math.min(e+1,c.length-1))):e.key===`ArrowUp`?(e.preventDefault(),o(e=>Math.max(e-1,0))):e.key===`Enter`&&l&&t(l)}}),(0,E.jsxs)(`ul`,{role:`listbox`,\"aria-label\":`Tables`,children:[c.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,role:`option`,\"aria-selected\":e===l,onMouseEnter:()=>o(c.indexOf(e)),onClick:()=>t(e),children:[(0,E.jsx)(O,{name:se(e.kind),size:14}),e.name,(0,E.jsx)(`span`,{className:`schema`,children:e.schema})]})},`${e.schema}.${e.name}`)),!c.length&&(0,E.jsx)(`li`,{className:`tree-empty`,children:`No table matches.`})]})]})})}function Ne({api:e,connection:t,open:n,onOpen:r,onClose:i}){let[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{p.current?.focus()},[]),(0,_.useEffect)(()=>{let n=!0;return e.databases(t).then(e=>{n&&o(e)},e=>{n&&c(e)}),()=>{n=!1}},[e,t]);let m=je(a?.databases??[],e=>e,l),h=m[Math.min(d,m.length-1)],g=e=>r(e===a?.current?null:e);return(0,E.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,E.jsxs)(`div`,{className:`dialog palette`,role:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Open database`,children:[(0,E.jsx)(`input`,{ref:p,className:`input`,\"aria-label\":`Database name`,placeholder:`Open database…`,value:l,onChange:e=>{u(e.target.value),f(0)},onKeyDown:e=>{e.key===`Escape`?i():e.key===`ArrowDown`?(e.preventDefault(),f(e=>Math.min(e+1,m.length-1))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>Math.max(e-1,0))):e.key===`Enter`&&h!==void 0&&g(h)}}),(0,E.jsxs)(`ul`,{role:`listbox`,\"aria-label\":`Databases`,children:[m.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,role:`option`,\"aria-selected\":e===h,\"aria-current\":e===n||void 0,onMouseEnter:()=>f(m.indexOf(e)),onClick:()=>g(e),children:[(0,E.jsx)(O,{name:`database`,size:14}),e,e===n&&(0,E.jsx)(`span`,{className:`schema`,children:`open`})]})},e)),s&&(0,E.jsx)(`li`,{className:`tree-empty`,role:`alert`,children:s.message}),!a&&!s&&(0,E.jsx)(`li`,{className:`tree-empty`,children:`Loading…`}),a&&!m.length&&(0,E.jsx)(`li`,{className:`tree-empty`,children:`No database matches.`})]})]})})}function Pe(e){let t,n;return{get loaded(){return n},load(){return t??=e().then(e=>n=e,e=>{throw t=void 0,e}),t}}}var Fe=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Ie=function(e,t){return new URL(e,t).href},Le={},Re=function(e){return e.pathname.endsWith(`.css`)},ze=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Be=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ie(t,n);let r=s(t),i=Re(r);return ze(Le,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Fe,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ve=Pe(()=>Be(()=>import(`./ImportDialog-DdB5QaTF.js`).then(e=>e.ImportDialog),[],import.meta.url));function He(e){let[t,n]=(0,_.useState)(()=>Ve.loaded),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(t||r)return;let e=!0;return Ve.load().then(t=>e&&n(()=>t),()=>e&&i(!0)),()=>{e=!1}},[t,r]),t?(0,E.jsx)(t,{...e}):(0,E.jsx)(Ue,{failed:r,onAgain:()=>i(!1),onClose:e.onClose})}function Ue({failed:e,onAgain:t,onClose:n}){let r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=(r.current?.getRootNode()??document).activeElement;return r.current?.focus(),()=>e?.focus()},[]),(0,_.useEffect)(()=>{let e=r.current?.getRootNode()??document;r.current?.contains(e.activeElement)||r.current?.focus()},[e]),(0,E.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,E.jsxs)(`div`,{ref:r,className:`dialog import`,role:e?`alertdialog`:`dialog`,\"aria-modal\":`true`,\"aria-label\":`Import SQL`,\"aria-busy\":!e,tabIndex:-1,onKeyDown:e=>e.key===`Escape`&&n(),children:[(0,E.jsxs)(`div`,{className:`dialog-body`,children:[(0,E.jsx)(`h2`,{children:`Import SQL`}),e?(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:`The import dialog didn’t load.`}):(0,E.jsx)(`p`,{className:`muted`,children:`Loading…`})]}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:n,children:`Close`}),e&&(0,E.jsx)(`button`,{type:`button`,className:`button primary`,onClick:t,children:`Try again`})]})]})})}function We({tabs:e,active:t,onActivate:n,onClose:r,kinds:i}){return e.length?(0,E.jsx)(`div`,{className:`tabbar`,role:`tablist`,\"aria-label\":`Open tabs`,children:e.map(e=>{let a=e.kind===`table`?e.table:e.title;return(0,E.jsxs)(`div`,{className:`tab`,role:`tab`,tabIndex:0,\"aria-selected\":e.id===t,title:e.kind===`table`?`${e.schema}.${e.table}`:e.title,onClick:()=>n(e.id),onAuxClick:t=>t.button===1&&r(e.id),onKeyDown:t=>t.key===`Enter`&&n(e.id),children:[(0,E.jsx)(O,{name:e.kind===`query`?`sql`:se(i.get(`${e.schema}.${e.table}`)??`table`),size:13}),(0,E.jsx)(`span`,{className:`title`,children:a}),(0,E.jsx)(`button`,{type:`button`,className:`icon-button close`,\"aria-label\":`Close ${a}`,onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,E.jsx)(O,{name:`close`,size:12})})]},e.id)})}):null}function Ge({row:e}){return(0,E.jsxs)(`aside`,{className:`panel`,\"aria-label\":`Row`,children:[(0,E.jsx)(`div`,{className:`panel-head`,children:`Row`}),e?(0,E.jsx)(`dl`,{className:`fields`,children:e.columns.map((t,n)=>(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`dt`,{children:[t.name,` `,(0,E.jsx)(`span`,{className:`type`,children:t.type})]}),(0,E.jsx)(`dd`,{children:e.values[n]??(0,E.jsx)(`span`,{className:`null`,children:`NULL`})})]},`${t.name}-${n}`))}):(0,E.jsx)(`div`,{className:`tree-empty`,children:`Select a row to see its fields.`})]})}function Ke({entries:e}){let t=(0,_.useRef)(null);return(0,_.useEffect)(()=>{t.current?.scrollIntoView({block:`nearest`})},[e]),(0,E.jsxs)(`div`,{className:`console`,role:`log`,\"aria-label\":`Console`,children:[e.map((e,t)=>(0,E.jsxs)(`div`,{className:`console-entry${e.error?` failed`:``}`,children:[(0,E.jsx)(`span`,{className:`time`,children:e.at.toLocaleTimeString()}),(0,E.jsxs)(`span`,{className:`sql`,children:[e.statement,e.error&&` — ${e.error}`]}),(0,E.jsx)(`span`,{className:`took`,children:e.durationMs===void 0?``:`${e.durationMs} ms`})]},t)),(0,E.jsx)(`div`,{ref:t})]})}function qe({icon:e,label:t,shortcut:n,pressed:r,onClick:i}){return(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":t,\"aria-pressed\":r,title:n?`${t} (${n})`:t,onClick:i,children:(0,E.jsx)(O,{name:e})})}function Je(e){let t=[],n=0,r=0,i=r=>{let i=e.slice(n,r),a=i.length-i.trimStart().length,o=i.trim();o&&!Ze(o)&&t.push({text:o,from:n+a,to:n+a+o.length})};for(;r<e.length;){let t=e[r],a=e[r+1];if(t===`-`&&a===`-`){let t=e.indexOf(`\n`,r);r=t===-1?e.length:t+1}else if(t===`/`&&a===`*`)r=Xe(e,r);else if(t===`'`){let t=/[eE]/.test(e[r-1]??``)&&!/[\\w$]/.test(e[r-2]??``);r=Ye(e,r,`'`,t)}else if(t===`\"`)r=Ye(e,r,`\"`,!1);else if(t===`$`){let t=/^\\$([A-Za-z_][A-Za-z0-9_]*)?\\$/.exec(e.slice(r));if(t&&!/[\\w$]/.test(e[r-1]??``)){let n=e.indexOf(t[0],r+t[0].length);r=n===-1?e.length:n+t[0].length}else r++}else t===`;`&&(i(r),n=r+1),r++}return i(e.length),t}function Ye(e,t,n,r){let i=t+1;for(;i<e.length;)if(r&&e[i]===`\\\\`)i+=2;else if(e[i]===n){if(e[i+1]===n)i+=2;else return i+1}else i++;return e.length}function Xe(e,t){let n=0,r=t;for(;r<e.length;)if(e[r]===`/`&&e[r+1]===`*`)n++,r+=2;else if(e[r]===`*`&&e[r+1]===`/`){if(n--,r+=2,n===0)return r}else r++;return e.length}function Ze(e){let t=0;for(;t<e.length;)if(/\\s/.test(e[t]))t++;else if(e.startsWith(`--`,t)){let n=e.indexOf(`\n`,t);t=n===-1?e.length:n+1}else if(e.startsWith(`/*`,t))t=Xe(e,t);else return!1;return!0}function Qe(e,t){let n=null;for(let r of e){if(t>=r.from&&t<=r.to)return r;r.to<t&&(n=r)}return n??e[0]??null}var $e=/^\\s*(?:with\\b[\\s\\S]*?\\b)?(insert|update|delete|merge|truncate|drop|alter|create|grant|revoke|comment|vacuum|reindex|cluster|refresh|copy|call|do|lock|import|security)\\b/i;function et(e){return $e.test(tt(e))}function tt(e){let t=e.trimStart();for(;;)if(t.startsWith(`--`)){let e=t.indexOf(`\n`);t=e===-1?``:t.slice(e+1).trimStart()}else if(t.startsWith(`/*`))t=t.slice(Xe(t,0)).trimStart();else return t}function nt(e){return`${e.map(it).join(`,`)}\\r\\n`}function rt(e){return`${e.map(at).join(`,`)}\\r\\n`}function it(e){return e===null?``:e===``?`\"\"`:at(e)}function at(e){return/[\",\\r\\n]|^\\s|\\s$/.test(e)?`\"${e.replaceAll(`\"`,`\"\"`)}\"`:e}function ot(e,t){let n={};return e.forEach((e,r)=>Object.defineProperty(n,e,{value:t[r]??null,enumerable:!0,writable:!0,configurable:!0})),n}function st(e,t){return rt(e)+t.map(nt).join(``)}function ct(e,t){return`${JSON.stringify(t.map(t=>ot(e,t)),null,2)}\\n`}function lt({title:e,children:t,confirmLabel:n,danger:r,busy:i,onConfirm:a,onCancel:o}){let s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=(s.current?.getRootNode()??document).activeElement;return s.current?.focus(),()=>e?.focus()},[]),(0,E.jsx)(`div`,{className:`overlay`,onMouseDown:e=>e.target===e.currentTarget&&o(),children:(0,E.jsxs)(`div`,{className:`dialog`,role:`alertdialog`,\"aria-modal\":`true`,\"aria-label\":e,onKeyDown:e=>{e.key===`Escape`&&o()},children:[(0,E.jsxs)(`div`,{className:`dialog-body`,children:[(0,E.jsx)(`h2`,{children:e}),t]}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:o,children:`Cancel`}),(0,E.jsx)(`button`,{ref:s,type:`button`,className:`button ${r?`danger`:`primary`}`,disabled:i,onClick:a,children:n})]})]})})}var ut=m();function dt(e){return typeof e==`object`?e.key:e}function ft(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function pt(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function mt(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var ht=(e,t)=>Math.abs(e-t)<1.01,gt=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function _t({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var vt=e=>e===`smooth`||e===`smoothFinishing`;function yt({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!vt(n.phase)&&!ht(t,n.lastTargetOffset)&&!ht(t,r())&&e!==`clampedEcho`}var bt=40;function xt(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<bt;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<bt;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function St(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<bt;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var Ct,wt=()=>{if(Ct!==void 0)return Ct;if(typeof navigator>`u`)return Ct=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ct=!0;let e=navigator.maxTouchPoints;return Ct=navigator.platform===`MacIntel`&&e!==void 0&&e>0},Tt,Et=()=>Tt===void 0?Tt=wt()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):Tt,Dt=()=>!wt()||Et(),Ot={capture:!0,passive:!0},kt=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,Ot),e.addEventListener(`touchend`,n,Ot),e.addEventListener(`touchcancel`,n,Ot),()=>{e.removeEventListener(`touchstart`,t,Ot),e.removeEventListener(`touchend`,n,Ot),e.removeEventListener(`touchcancel`,n,Ot),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},At=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},jt=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},Mt=e=>e,Nt=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},Pt=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(At(n)),!r.ResizeObserver)return()=>{};let a=jt(r),o=new r.ResizeObserver(()=>{let t=()=>{i(At(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},Ft={passive:!0},It=typeof window>`u`||`onscrollend`in window,Lt=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&It,o=0,s=a?null:gt(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,Ft),a&&r.addEventListener(`scrollend`,u,Ft),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},Rt=(e,t)=>Lt(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),zt=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Bt=(e,{adjustments:t=0,behavior:n},r)=>{var i;let{scrollElement:a,options:o}=r,s=e+t,c=o.horizontal&&o.isRtl&&a!==null&&`ownerDocument`in a;(i=a?.scrollTo)==null||i.call(a,{[o.horizontal?`left`:`top`]:c?-s:s,behavior:n})},Vt=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,Ht=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function Ut(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var Wt=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new kt({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&St(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=!1,r=!1,i=new Set,a=()=>{if(e)return e;let r=this.targetWindow;if(!r||!r.ResizeObserver)return null;let i=t=jt(r);return e=new r.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(o)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)i.schedule(t);else{n=!0;try{t()}finally{n=!1}}})},o=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var n;(n=a())==null||n.disconnect(),t?.cancel(),i.clear(),r=!1,e=null,t=null},observe:o=>{let s=a();s&&(n?(i.add(o),r||(r=!0,t?.schedule(()=>{r=!1,i.forEach(t=>{t.isConnected&&e?.observe(t,{box:`border-box`})}),i.clear()}))):s.observe(o,{box:`border-box`}))},unobserve:e=>{var t;i.delete(e),(t=a())==null||t.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Mt,rangeExtractor:Nt,onChange:()=>{},measureElement:zt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>dt(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||Ut(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=pt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:yt({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||xt(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?Ht(this.scrollState)&&!ht(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>_t({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=Vt(t,e.index!=null&&ht(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(wt()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=pt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=pt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=ft(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=pt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes,this._getLayoutTotalSize()+this.options.scrollMargin],(e,t,n,r,i)=>{if(e.length===0||t===0)return this.range=null,null;let a=Math.max(i-t,0);return this.range=qt(e,t,Math.min(n,a),r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=pt(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!Ht(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!Ht(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!Ht(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=pt(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return mt(t[Gt(0,t.length-1,r?e=>n[e*2]:e=>mt(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a),c=()=>this.options.horizontal?r.clientHeight:r.clientWidth,l=c();if(i.setProperty(a,`hidden`,`important`),c()!==l){i.setProperty(a,o,s);return}let u={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=u,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===u&&(this._momentumStop=null,u.restore()&&u.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.getMeasurements()[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(wt()&&this._iosGesture.dragging())&&e!==null&&!ht(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&ht(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=Ht(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&Dt()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:Vt(n,e.index!=null&&ht(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},Gt=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Kt(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function qt(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=Kt(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=Gt(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Jt=typeof document<`u`?_.useLayoutEffect:_.useEffect;function I({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=_.useReducer(e=>e+1,0)[1],a=_.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=_.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,ut.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=_.useState(()=>{let e=new Wt(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),Jt(()=>d._didMount(),[]),Jt(()=>(s(d),d._willUpdate())),Jt(()=>{l(d)}),d}function Yt(e){return I({observeElementRect:Pt,observeElementOffset:Rt,scrollToFn:Bt,...e})}var Xt=24,Zt=26,Qt=52,$t=64,en=360,tn=300;function nn({columns:e,rows:t,firstRow:n=1,sort:r,onSort:i,selected:a,onSelect:o,label:s,onEdit:c,onDeleteRow:l,lockedColumns:u,rowState:d,cellState:f}){let p=(0,_.useRef)(null),[m,h]=(0,_.useState)(null),g=(0,_.useRef)(null),v=e=>{g.current=e,h(e)},[y,b]=(0,_.useState)(()=>on(e,t)),x=`${e.map(e=>e.name).join(`\\0`)}\\u0000${t.length>0}`,[S,ee]=(0,_.useState)(x);S!==x&&(ee(x),b(on(e,t)));let te=Yt({count:t.length,getScrollElement:()=>p.current,estimateSize:()=>Xt,overscan:12}),C=Yt({horizontal:!0,count:e.length,getScrollElement:()=>p.current,estimateSize:e=>y[e]??120,overscan:4});(0,_.useEffect)(()=>{C.measure()},[y,C]);let ne=Qt+C.getTotalSize(),w=C.getVirtualItems();function T(n){let r={row:Math.max(0,Math.min(t.length-1,n.row)),col:Math.max(0,Math.min(e.length-1,n.col))};o(r),te.scrollToIndex(r.row),C.scrollToIndex(r.col)}let re=e=>!!c&&!u?.has(e.col)&&d?.(e.row)!==`deleted`;function ie(e,n){re(e)&&v({cell:e,draft:n??t[e.row]?.[e.col]??``})}function ae(e,n){let r=g.current;if(!r)return;let{cell:i}=r;v(null),e!==void 0&&e!==(t[i.row]?.[i.col]??null)&&c?.(i,e),n&&T(n),p.current?.focus()}function oe(e){if(!m)return;e.stopPropagation();let{row:t,col:n}=m.cell,r=e.currentTarget.value;e.key===`Enter`?(e.preventDefault(),ae(r,{row:t+1,col:n})):e.key===`Tab`?(e.preventDefault(),ae(r,{row:t,col:n+(e.shiftKey?-1:1)})):e.key===`Escape`?(e.preventDefault(),ae(void 0)):e.key===`Backspace`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ae(null))}function D(n){if(!t.length||!e.length)return;let r=a??{row:0,col:0},i=n.metaKey||n.ctrlKey;if(c&&a){if(n.key===`Enter`||n.key===`F2`){n.preventDefault(),ie(a);return}if(n.key===`Backspace`&&i){n.preventDefault(),re(a)&&c(a,null);return}if((n.key===`Delete`||n.key===`Backspace`)&&l){n.preventDefault(),l(a.row);return}if(n.key.length===1&&!i&&!n.altKey){n.preventDefault(),ie(a,n.key);return}}let o=Math.max(1,Math.floor((p.current?.clientHeight??240)/Xt)-1),s={ArrowUp:{row:r.row-1,col:r.col},ArrowDown:{row:r.row+1,col:r.col},ArrowLeft:{row:r.row,col:r.col-1},ArrowRight:{row:r.row,col:r.col+1},PageUp:{row:r.row-o,col:r.col},PageDown:{row:r.row+o,col:r.col},Home:{row:n.metaKey||n.ctrlKey?0:r.row,col:0},End:{row:n.metaKey||n.ctrlKey?t.length-1:r.row,col:e.length-1}}[n.key];if(s)n.preventDefault(),T(s);else if(n.key===`c`&&(n.metaKey||n.ctrlKey)&&a){let e=t[a.row]?.[a.col];n.preventDefault(),navigator.clipboard?.writeText(e??`NULL`)}}function O(e,t){t.preventDefault(),t.stopPropagation();let n=t.clientX,r=y[e]??120,i=t=>{let i=Math.max($t,r+t.clientX-n);b(t=>t.map((t,n)=>n===e?i:t))},a=()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)}return(0,E.jsx)(`div`,{ref:p,className:`grid`,role:`grid`,\"aria-label\":s,\"aria-rowcount\":t.length+1,\"aria-colcount\":e.length,tabIndex:0,onKeyDown:D,children:(0,E.jsxs)(`div`,{className:`grid-inner`,style:{width:ne,height:Zt+te.getTotalSize()},children:[(0,E.jsxs)(`div`,{className:`grid-head`,role:`row`,\"aria-rowindex\":1,style:{width:ne},children:[(0,E.jsx)(`div`,{className:`head-cell number-cell`,style:{width:Qt}}),w.map(t=>{let n=e[t.index],a=r?.column===n.name?r:null;return(0,E.jsxs)(`div`,{className:`head-cell`,role:`columnheader`,\"aria-colindex\":t.index+1,\"aria-sort\":a?a.descending?`descending`:`ascending`:`none`,title:`${n.name} (${n.type})`,style:{left:Qt+t.start,width:t.size},onClick:i?()=>i(n.name):void 0,children:[(0,E.jsx)(`span`,{children:n.name}),a&&(0,E.jsx)(`span`,{\"aria-hidden\":!0,children:a.descending?`↓`:`↑`}),(0,E.jsx)(`span`,{className:`type`,children:n.type}),(0,E.jsx)(`span`,{className:`resize`,onMouseDown:e=>O(t.index,e)})]},t.key)})]}),te.getVirtualItems().map(r=>{let i=t[r.index],s=a?.row===r.index,c=d?.(r.index);return(0,E.jsxs)(`div`,{className:`grid-row${s?` selected`:``}${c?` ${c}`:``}`,role:`row`,\"aria-rowindex\":r.index+2,\"aria-selected\":s,style:{top:Zt+r.start,width:ne},children:[(0,E.jsx)(`div`,{className:`cell number-cell`,style:{width:Qt},children:n+r.index}),w.map(t=>m?.cell.row===r.index&&m.cell.col===t.index?(0,E.jsx)(`input`,{className:`cell-editor`,\"aria-label\":`Edit ${e[t.index].name}`,style:{left:Qt+t.start,width:t.size},defaultValue:m.draft,autoFocus:!0,onFocus:e=>e.currentTarget.setSelectionRange(e.currentTarget.value.length,e.currentTarget.value.length),onKeyDown:oe,onBlur:e=>ae(e.currentTarget.value)},t.key):(0,E.jsx)(rn,{value:i[t.index]??null,state:f?.(r.index,t.index)??null,left:Qt+t.start,width:t.size,column:t.index,selected:s&&a?.col===t.index,onClick:()=>{o({row:r.index,col:t.index}),p.current?.focus()},onDoubleClick:()=>ie({row:r.index,col:t.index})},t.key))]},r.key)})]})})}function rn({value:e,state:t,left:n,width:r,column:i,selected:a,onClick:o,onDoubleClick:s}){return(0,E.jsx)(`div`,{className:`cell${a?` selected`:``}${t?` ${t}`:``}`,role:`gridcell`,\"aria-colindex\":i+1,\"aria-selected\":a,style:{left:n,width:r},onClick:o,onDoubleClick:s,children:t===\"default\"?(0,E.jsx)(`span`,{className:`null`,children:`DEFAULT`}):e===null?(0,E.jsx)(`span`,{className:`null`,children:`NULL`}):an(e)})}function an(e){let t=e.indexOf(`\n`),n=t===-1?e:e.slice(0,t);return n.length>tn?`${n.slice(0,tn)}…`:t===-1?n:`${n} …`}function on(e,t){let n=t.slice(0,50);return e.map((e,t)=>{let r=e.name.length+e.type.length*.8+3,i=n.reduce((e,n)=>Math.max(e,Math.min(n[t]?.length??4,60)),0);return Math.round(Math.max($t,Math.min(en,Math.max(r,i)*7+18)))})}var sn=Pe(()=>Be(()=>import(`./Editor-C-kA2tCc.js`).then(e=>e.Editor),[],import.meta.url));function cn(e){let[t,n]=(0,_.useState)(()=>sn.loaded),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(t||r)return;let e=!0;return sn.load().then(t=>e&&n(()=>t),()=>e&&i(!0)),()=>{e=!1}},[t,r]),t?(0,E.jsx)(t,{...e}):r?(0,E.jsxs)(`div`,{className:`editor message`,role:`alert`,children:[`The editor didn’t load.`,` `,(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:()=>i(!1),children:`Try again`})]}):(0,E.jsx)(`div`,{className:`editor`,\"aria-busy\":`true`})}var ln=0,un=()=>`q${Date.now().toString(36)}${(ln++).toString(36)}`;function dn({id:e,sql:t,onChange:n,schema:r,defaultSchema:i,kind:a,active:o,onHistory:s}){let{api:c,connection:l,scope:u,log:d,showRow:f}=j(),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(0),[v,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(null),[ee,te]=(0,_.useState)(null),[C,ne]=(0,_.useState)(45),w=(0,_.useRef)(null),T=(0,_.useRef)(!1);(0,_.useEffect)(()=>()=>{T.current=!0},[]);function re(e,t,n){if(v)return;let r=Je(t),i=e===`all`?r:[Qe(r,n)].filter(e=>e!==null);i.length&&(l.tag===`production`&&l.access===`write`&&i.some(e=>et(e.text))?S(i):ie(i))}async function ie(e){let t=[];m([]),g(0),te(null);for(let n of e){let e=un();b(e);let r=performance.now();try{let r=await c.query(l.name,n.text,e);t.push({statement:n,result:r}),d({statement:n.text,durationMs:r.durationMs})}catch(e){let i=e instanceof y?e:new y(0,`failed`,e.message);t.push({statement:n,error:i}),d({statement:n.text,durationMs:Math.round(performance.now()-r),error:i.message});break}finally{ve(u,n.text)}if(T.current)return;m([...t])}T.current||(m(t),g(t.length-1),b(null),s())}async function ae(){v&&await c.cancel(v)}let oe=p[h],D=oe?.result;(0,_.useEffect)(()=>{if(!o)return;let e=D&&ee?D.rows[ee.row]:void 0;f(e&&D?{columns:D.columns,values:e}:null)},[o,D,ee,f]);function se(e){e.preventDefault();let t=w.current.getBoundingClientRect(),n=e=>ne(Math.max(15,Math.min(85,(e.clientY-t.top)/t.height*100))),r=()=>{window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)}return(0,E.jsxs)(`div`,{className:`tab-body`,hidden:!o,children:[l.warning&&(0,E.jsx)(`div`,{className:`notice warning`,role:`note`,children:l.warning}),(0,E.jsxs)(`div`,{className:`query`,ref:w,style:{\"--editor\":`${C}%`},children:[(0,E.jsx)(cn,{value:t,onChange:n,onRun:re,schema:r,defaultSchema:i,kind:a,label:`SQL editor ${e}`}),(0,E.jsx)(`div`,{className:`splitter`,role:`separator`,\"aria-orientation\":`horizontal`,onMouseDown:se}),(0,E.jsxs)(`div`,{className:`results`,children:[p.length>1&&(0,E.jsx)(`div`,{className:`results-tabs`,role:`tablist`,\"aria-label\":`Results`,children:p.map((e,t)=>(0,E.jsxs)(`button`,{type:`button`,role:`tab`,className:`button`,\"aria-selected\":t===h,onClick:()=>{g(t),te(null)},children:[e.error?`⚠ `:``,`Result `,t+1]},t))}),oe?.error&&(0,E.jsx)(fn,{outcome:oe,sql:t}),D&&D.columns.length>0&&(0,E.jsx)(nn,{label:`Result`,columns:D.columns,rows:D.rows,selected:ee,onSelect:te}),D&&!D.columns.length&&(0,E.jsxs)(`div`,{className:`message`,role:`status`,children:[D.command,D.affectedRows!==null&&` · ${D.affectedRows.toLocaleString()} rows affected`,` `,`· `,D.durationMs,` ms`]}),!p.length&&!v&&(0,E.jsx)(`div`,{className:`message`,children:`Results show here. ⌘↵ runs the statement at the cursor, ⇧⌘↵ all of them.`})]})]}),(0,E.jsxs)(`div`,{className:`bottombar`,children:[v?(0,E.jsxs)(`button`,{type:`button`,className:`button danger`,onClick:ae,children:[(0,E.jsx)(O,{name:`stop`,size:12}),` Cancel`]}):(0,E.jsx)(`span`,{children:l.access===`read`?`Read-only connection`:``}),(0,E.jsx)(`span`,{className:`spacer`}),D&&D.columns.length>0&&(0,E.jsx)(P,{formats:[`csv`,`json`],onExport:e=>{let t=D.columns.map(e=>e.name),n=e===`csv`?st(t,D.rows):ct(t,D.rows);F(new Blob([n],{type:`${e===`csv`?`text/csv`:`application/json`};charset=utf-8`}),`result.${e}`)}}),(0,E.jsx)(`span`,{\"aria-live\":`polite`,children:v?`Running…`:D?`${D.rows.length.toLocaleString()} rows${D.truncated?` (cut at the row limit)`:``} · ${D.durationMs} ms`:``})]}),x&&(0,E.jsxs)(lt,{title:`Run on production?`,confirmLabel:`Run`,danger:!0,onCancel:()=>S(null),onConfirm:()=>{let e=x;S(null),ie(e)},children:[(0,E.jsxs)(`p`,{children:[(0,E.jsx)(`strong`,{children:l.label}),` is tagged production. This may change it:`]}),(0,E.jsx)(`pre`,{children:x.map(e=>e.text).join(`;\n\n`)})]})]})}function fn({outcome:e,sql:t}){let{error:n,statement:r}=e,i=``;if(n?.position){let e=r.from+n.position-1,a=t.slice(0,e);i=` (line ${a.split(`\n`).length}, column ${e-a.lastIndexOf(`\n`)})`}return(0,E.jsxs)(`div`,{className:`notice`,role:`alert`,children:[n.message,i,n.sqlState&&(0,E.jsxs)(`div`,{className:`detail`,children:[`SQLSTATE `,n.sqlState]}),n.detail&&(0,E.jsx)(`div`,{className:`detail`,children:n.detail}),n.hint&&(0,E.jsxs)(`div`,{className:`detail`,children:[`Hint: `,n.hint]})]})}var pn=[{kinds:[`table`,`partitioned-table`],title:`Tables`},{kinds:[`view`],title:`Views`},{kinds:[`materialized-view`],title:`Materialized views`},{kinds:[`foreign-table`],title:`Foreign tables`}];function mn({tables:e,schema:t,onSchema:n,current:r,onOpen:i,history:a,onHistory:o}){let[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`items`),d=(0,_.useMemo)(()=>[...new Set((e??[]).map(e=>e.schema))],[e]),f=s.trim().toLowerCase(),p=(e??[]).filter(e=>e.schema===t&&(!f||e.name.toLowerCase().includes(f)));return(0,E.jsxs)(`aside`,{className:`sidebar`,\"aria-label\":`Sidebar`,children:[(0,E.jsxs)(`div`,{className:`sidebar-head`,children:[d.length>1&&(0,E.jsx)(`select`,{className:`select`,\"aria-label\":`Schema`,value:t,onChange:e=>n(e.target.value),children:d.map(e=>(0,E.jsx)(`option`,{children:e},e))}),(0,E.jsx)(`input`,{className:`input`,type:`search`,\"aria-label\":`Search for item`,placeholder:`Search for item…`,value:s,onChange:e=>c(e.target.value)})]}),l===`items`?(0,E.jsxs)(`ul`,{className:`tree`,\"aria-label\":`Items`,children:[e===null&&(0,E.jsx)(`li`,{className:`tree-empty`,children:`Loading…`}),e!==null&&!p.length&&(0,E.jsx)(`li`,{className:`tree-empty`,children:f?`Nothing matches.`:`No tables here.`}),pn.map(e=>{let t=p.filter(t=>e.kinds.includes(t.kind));return t.length?(0,E.jsxs)(`li`,{children:[(0,E.jsx)(`div`,{className:`tree-group`,children:e.title}),(0,E.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0},\"aria-label\":e.title,children:t.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,className:`tree-item`,\"aria-current\":r?.schema===e.schema&&r.table===e.name,onClick:()=>i(e),title:`${e.schema}.${e.name}`,children:[(0,E.jsx)(O,{name:se(e.kind),size:14}),(0,E.jsx)(`span`,{className:`name`,children:e.name}),e.estimatedRows!==null&&(0,E.jsx)(`span`,{className:`count`,children:hn(e.estimatedRows)})]})},e.name))})]},e.title):null})]}):(0,E.jsxs)(`ul`,{className:`tree`,\"aria-label\":`History`,children:[!a.length&&(0,E.jsx)(`li`,{className:`tree-empty`,children:`Statements you run show here.`}),a.filter(e=>!f||e.sql.toLowerCase().includes(f)).map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,className:`tree-item`,title:e.sql,onClick:()=>o(e.sql),children:[(0,E.jsx)(O,{name:`sql`,size:14}),(0,E.jsx)(`span`,{className:`name`,children:e.sql.replace(/\\s+/g,` `)})]})},e.at+e.sql))]}),(0,E.jsx)(`div`,{className:`sidebar-foot`,children:(0,E.jsxs)(`div`,{className:`segmented`,role:`group`,\"aria-label\":`Sidebar view`,children:[(0,E.jsx)(`button`,{type:`button`,\"aria-pressed\":l===`items`,onClick:()=>u(`items`),children:`Items`}),(0,E.jsx)(`button`,{type:`button`,\"aria-pressed\":l===`history`,onClick:()=>u(`history`),children:`History`})]})})]})}function hn(e){return new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e)}var gn={updates:{},deletes:{},inserts:[],next:1};function _n(e,t,n){if(!e.length)return null;let r={};for(let i of e){let e=n[t.indexOf(i)];if(e==null)return null;vn(r,i,e)}return{id:JSON.stringify(e.map(e=>r[e])),key:r}}function vn(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0})}function yn(e,t){switch(t.type){case`edit`:{let n=e.updates[t.id],r={...n?.values},i={...n?.original},a=Object.hasOwn(i,t.column)?i[t.column]:t.original;t.value===a?(delete r[t.column],delete i[t.column]):(vn(r,t.column,t.value),vn(i,t.column,a));let o={...e.updates};return Object.keys(r).length?o[t.id]={key:t.key,values:r,original:i}:delete o[t.id],{...e,updates:o}}case`edit-new`:return{...e,inserts:e.inserts.map(e=>e.id===t.id?{...e,values:{...e.values,[t.column]:t.value}}:e)};case`add`:return{...e,inserts:[...e.inserts,{id:e.next,values:{}}],next:e.next+1};case`delete`:return{...e,deletes:{...e.deletes,[t.id]:t.key}};case`undelete`:{let n={...e.deletes};return delete n[t.id],{...e,deletes:n}}case`remove-new`:return{...e,inserts:e.inserts.filter(e=>e.id!==t.id)}}}function bn(e){return Object.keys(e.updates).filter(t=>!(t in e.deletes)).length+Object.keys(e.deletes).length+e.inserts.length}function xn(e){let t=Object.values(e.deletes).map(e=>({type:`delete`,key:e})),n=Object.entries(e.updates).filter(([t])=>!(t in e.deletes)).map(([,{key:e,values:t,original:n}])=>({type:`update`,key:e,values:t,original:n})),r=e.inserts.map(({values:e})=>({type:`insert`,values:e}));return[...t,...n,...r]}var Sn=[{value:`=`,label:`=`},{value:`<>`,label:`≠`},{value:`<`,label:`<`},{value:`>`,label:`>`},{value:`<=`,label:`≤`},{value:`>=`,label:`≥`},{value:`contains`,label:`Contains`},{value:`not contains`,label:`Not contains`},{value:`starts with`,label:`Starts with`},{value:`ends with`,label:`Ends with`},{value:`in`,label:`In`},{value:`not in`,label:`Not in`},{value:`between`,label:`Between`},{value:`not between`,label:`Not between`},{value:`like`,label:`Like`},{value:`not like`,label:`Not like`},{value:`is null`,label:`Is null`},{value:`is not null`,label:`Is not null`}],Cn=e=>e===`is null`||e===`is not null`,wn=e=>e===`between`||e===`not between`,Tn=e=>e===`in`||e===`not in`;function En(e){return{column:e,operator:`=`,value:``,to:``}}function Dn(e){return e.map(({column:e,operator:t,value:n,to:r})=>Cn(t)?{column:e,operator:t}:wn(t)?{column:e,operator:t,value:[n,r]}:Tn(t)?{column:e,operator:t,value:n.split(`,`).map(e=>e.trim()).filter(Boolean)}:{column:e,operator:t,value:n})}function On({columns:e,drafts:t,onChange:n,onApply:r,onClose:i,focusKey:a}){let o=(0,_.useRef)(null);(0,_.useEffect)(()=>{o.current?.focus()},[a]);let s=(e,r)=>n(t.map((t,n)=>n===e?{...t,...r}:t));return(0,E.jsx)(`form`,{className:`filters`,\"aria-label\":`Filters`,onSubmit:e=>{e.preventDefault(),r()},onKeyDown:e=>{e.key===`Escape`&&i()},children:t.map((r,a)=>(0,E.jsxs)(`div`,{className:`filter-row`,children:[(0,E.jsx)(`select`,{className:`select`,\"aria-label\":`Column`,value:r.column,onChange:e=>s(a,{column:e.target.value}),children:e.map(e=>(0,E.jsx)(`option`,{children:e},e))}),(0,E.jsx)(`select`,{className:`select`,\"aria-label\":`Operator`,value:r.operator,onChange:e=>s(a,{operator:e.target.value}),children:Sn.map(e=>(0,E.jsx)(`option`,{value:e.value,children:e.label},e.value))}),!Cn(r.operator)&&(0,E.jsx)(`input`,{ref:a===0?o:void 0,className:`input value`,\"aria-label\":`Value`,placeholder:Tn(r.operator)?`a, b, c`:`Value`,value:r.value,onChange:e=>s(a,{value:e.target.value})}),wn(r.operator)&&(0,E.jsx)(`input`,{className:`input value`,\"aria-label\":`And`,placeholder:`and`,value:r.to,onChange:e=>s(a,{to:e.target.value})}),(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Remove condition`,onClick:()=>n(t.filter((e,t)=>t!==a)),children:(0,E.jsx)(O,{name:`minus`})}),(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Add condition`,onClick:()=>n([...t.slice(0,a+1),En(r.column),...t.slice(a+1)]),children:(0,E.jsx)(O,{name:`plus`})}),a===0&&(0,E.jsxs)(`div`,{className:`filter-actions`,children:[(0,E.jsx)(`button`,{type:`submit`,className:`button primary`,children:`Apply`}),(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:i,children:`Clear`})]})]},a))})}function kn({table:e}){let t=new Set(e.primaryKey);return(0,E.jsxs)(`div`,{className:`structure`,\"aria-label\":`Structure`,children:[e.comment&&(0,E.jsx)(`p`,{children:e.comment}),(0,E.jsxs)(`table`,{\"aria-label\":`Columns`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{children:`#`}),(0,E.jsx)(`th`,{children:`Column`}),(0,E.jsx)(`th`,{children:`Type`}),(0,E.jsx)(`th`,{children:`Nullable`}),(0,E.jsx)(`th`,{children:`Default`}),(0,E.jsx)(`th`,{children:`Generated`}),(0,E.jsx)(`th`,{children:`Comment`})]})}),(0,E.jsx)(`tbody`,{children:e.columns.map((e,n)=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`td`,{children:n+1}),(0,E.jsxs)(`td`,{children:[t.has(e.name)&&(0,E.jsx)(O,{name:`key`,size:12,label:`Primary key`}),` `,e.name]}),(0,E.jsx)(`td`,{children:(0,E.jsx)(`code`,{children:e.type})}),(0,E.jsx)(`td`,{children:e.nullable?`YES`:`NO`}),(0,E.jsx)(`td`,{children:e.default!==null&&(0,E.jsx)(`code`,{children:e.default})}),(0,E.jsx)(`td`,{children:e.generated}),(0,E.jsx)(`td`,{children:e.comment})]},e.name))})]}),(0,E.jsx)(An,{title:`Indexes`,items:e.indexes}),(0,E.jsx)(An,{title:`Foreign keys`,items:e.foreignKeys}),(0,E.jsx)(An,{title:`Checks`,items:e.checks})]})}function An({title:e,items:t}){return t.length?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`h2`,{children:e}),(0,E.jsx)(`table`,{\"aria-label\":e,children:(0,E.jsx)(`tbody`,{children:t.map(e=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`td`,{style:{width:`30%`},children:e.name}),(0,E.jsx)(`td`,{children:(0,E.jsx)(`code`,{children:e.definition})})]},e.name))})})]}):null}var jn=[100,300,1e3];function Mn({schema:e,table:t,summary:n,active:r}){let{api:i,connection:a,log:o,showRow:s,refreshKey:c,filterKey:l}=j(),[u,d]=(0,_.useState)(`data`),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(0),[ee,te]=(0,_.useState)(300),[C,ne]=(0,_.useState)(null),[w,T]=(0,_.useState)(null),[re,ie]=(0,_.useState)([]),[ae,oe]=(0,_.useState)(null),[D,se]=(0,_.useState)(null),[ce,le]=(0,_.useState)(0),[k,A]=(0,_.useState)(gn),[ue,de]=(0,_.useState)([]),[fe,pe]=(0,_.useState)(null),[me,he]=(0,_.useState)(0),ge=`${e}.${t}`;(0,_.useEffect)(()=>{let n=!0;return i.table(a.name,e,t).then(e=>n&&p(e),e=>n&&v(e)),()=>{n=!1}},[i,a.name,e,t,c]);let _e=C?[{column:C.column,descending:C.descending}]:f?.primaryKey.map(e=>({column:e}))??[],ve=JSON.stringify({limit:ee,offset:x,order:_e,filters:re,refreshKey:c,saved:me}),ye=f!==null&&y!==ve;(0,_.useEffect)(()=>{if(!f)return;let n=new AbortController,r=JSON.parse(ve),s=Nn(ge,r.filters,r.limit,r.offset),c=performance.now();return i.rows({connection:a.name,schema:e,table:t,...r},n.signal).then(e=>{h(e),v(null),se(null),o({statement:s,durationMs:e.durationMs})},e=>{n.signal.aborted||(v(e),o({statement:s,durationMs:Math.round(performance.now()-c),error:e.message}))}).finally(()=>!n.signal.aborted&&b(ve)),()=>n.abort()},[i,a.name,e,t,ge,f,ve,o]);let M=(0,_.useRef)(l);(0,_.useEffect)(()=>{r&&l!==M.current&&(M.current=l,d(`data`),T(e=>e??[En(f?.columns[0]?.name??``)]),le(e=>e+1))},[r,l,f]);let N=m?.rows??[],be=m?.columns??f?.columns??[],xe=be.map(e=>e.name),Se=f?.primaryKey??[],Ce=a.access===`write`&&Se.length>0&&(f?.kind===`table`||f?.kind===`partitioned-table`),we=N.map(e=>_n(Se,xe,e)),Te=[...N.map((e,t)=>{let n=we[t]&&k.updates[we[t].id];return n?xe.map((t,r)=>Object.hasOwn(n.values,t)?n.values[t]:e[r]):e}),...k.inserts.map(e=>xe.map(t=>Object.hasOwn(e.values,t)?e.values[t]??null:null))],Ee=new Set(xe.flatMap((e,t)=>{let n=f?.columns.find(t=>t.name===e);return n?.generated&&n.generated!==`by default`?[t]:[]})),De=bn(k);(0,_.useEffect)(()=>{if(!r)return;let e=D?Te[D.row]:void 0;s(e?{columns:be,values:e}:null)},[r,m,k,f,D,s]);function Oe(e){de(e=>[...e.slice(-99),k]),A(t=>yn(t,e))}function ke(e,t){let n=xe[e.col];if(e.row>=N.length){let r=k.inserts[e.row-N.length];r&&Oe({type:`edit-new`,id:r.id,column:n,value:t});return}let r=we[e.row];r&&Oe({type:`edit`,...r,column:n,value:t,original:N[e.row][e.col]??null})}function Ae(e){if(e>=N.length){let t=k.inserts[e-N.length];t&&Oe({type:`remove-new`,id:t.id});return}let t=we[e];t&&Oe(t.id in k.deletes?{type:`undelete`,id:t.id}:{type:`delete`,...t})}function je(){Oe({type:`add`}),d(`data`);let e=xe.findIndex((e,t)=>!Ee.has(t));se({row:N.length+k.inserts.length,col:Math.max(0,e)})}function Me(){De&&(de(e=>[...e.slice(-99),k]),A(gn))}let Ne={connection:a.name,schema:e,table:t};async function Pe(){if(De&&!fe)try{let{statements:e}=await i.apply({...Ne,changes:xn(k),dryRun:!0});pe({statements:e})}catch(e){v(e)}}async function Fe(){if(!fe)return;pe({...fe,saving:!0});let e=performance.now();try{let{statements:t}=await i.apply({...Ne,changes:xn(k)});o({statement:t.join(`;\n`),durationMs:Math.round(performance.now()-e)}),A(gn),de([]),pe(null),he(e=>e+1)}catch(e){o({statement:`${De} changes to ${ge}`,error:e.message}),pe({...fe,saving:!1,error:e})}}async function Ie(e){try{let{blob:t,filename:n}=await i.exportTable({...Ne,filters:re,order:_e,format:e});F(t,n)}catch(e){v(e)}}(0,_.useEffect)(()=>{if(!r||!Ce)return;function e(e){if(!(e.metaKey||e.ctrlKey)||e.defaultPrevented)return;let t=(e.composedPath()[0]??e.target).closest?.(`input, textarea, select, [contenteditable=\"true\"]`);e.key===`s`?(e.preventDefault(),Pe()):e.key===`z`&&!e.shiftKey&&!t&&ue.length&&(e.preventDefault(),A(ue.at(-1)),de(ue.slice(0,-1)))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});function Le(e){ne(t=>t?.column===e?t.descending?null:{column:e,descending:!0}:{column:e,descending:!1}),S(0)}function Re(e){ie(e?Dn(e):[]),S(0),oe(null)}async function ze(){let n=performance.now();try{oe(await i.count({connection:a.name,schema:e,table:t,filters:re})),o({statement:`SELECT count(*) FROM ${ge}${re.length?` WHERE …`:``}`,durationMs:Math.round(performance.now()-n)})}catch(e){v(e)}}let Be=f?.columns.map(e=>e.name)??[],Ve=ae??(re.length?null:n?.estimatedRows??null),He=N;return(0,E.jsxs)(`div`,{className:`tab-body`,hidden:!r,children:[w&&u===`data`&&(0,E.jsx)(On,{columns:Be,drafts:w,onChange:e=>e.length?T(e):(T(null),Re(null)),onApply:()=>Re(w),onClose:()=>{T(null),Re(null)},focusKey:ce}),g&&(0,E.jsxs)(`div`,{className:`notice`,role:`alert`,children:[g.message,g.detail&&(0,E.jsx)(`div`,{className:`detail`,children:g.detail})]}),u===`structure`?f&&(0,E.jsx)(kn,{table:f}):(0,E.jsx)(nn,{label:ge,columns:be,rows:Te,firstRow:x+1,sort:C,onSort:Le,selected:D,onSelect:se,...Ce?{onEdit:ke,onDeleteRow:Ae,lockedColumns:Ee,rowState:e=>e>=N.length?`inserted`:we[e]&&we[e].id in k.deletes?`deleted`:null,cellState:(e,t)=>{let n=xe[t];if(e>=N.length)return Object.hasOwn(k.inserts[e-N.length]?.values??{},n)?`changed`:`default`;let r=we[e]&&k.updates[we[e].id];return r&&Object.hasOwn(r.values,n)?`changed`:null}}:{}}),(0,E.jsxs)(`div`,{className:`bottombar`,children:[(0,E.jsxs)(`div`,{className:`segmented`,role:`group`,\"aria-label\":`View`,children:[(0,E.jsx)(`button`,{type:`button`,\"aria-pressed\":u===`data`,onClick:()=>d(`data`),children:`Data`}),(0,E.jsx)(`button`,{type:`button`,\"aria-pressed\":u===`structure`,onClick:()=>d(`structure`),children:`Structure`})]}),(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Filter`,\"aria-pressed\":w!==null,onClick:()=>{d(`data`),w?(T(null),Re(null)):T([En(Be[0]??``)])},children:(0,E.jsx)(O,{name:`filter`})}),Ce&&(0,E.jsxs)(`button`,{type:`button`,className:`button`,onClick:je,children:[(0,E.jsx)(O,{name:`plus`,size:12}),` Row`]}),De>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{className:`changes`,\"aria-live\":`polite`,children:De===1?`1 change`:`${De} changes`}),(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:Me,children:`Discard`}),(0,E.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>void Pe(),children:`Commit`})]}),a.access===`write`&&f&&!Ce&&(0,E.jsx)(`span`,{title:`Rows are named by their primary key to change them`,children:`Read-only: no primary key`}),(0,E.jsx)(`span`,{className:`spacer`}),(0,E.jsx)(P,{formats:[`csv`,`json`,`sql`],onExport:Ie}),u===`data`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{\"aria-live\":`polite`,children:[ye?`Loading…`:He.length?`Rows ${(x+1).toLocaleString()}–${(x+He.length).toLocaleString()}`:`No rows`,Ve!==null&&` of ${ae===null?`~`:``}${Ve.toLocaleString()}`]}),(0,E.jsx)(`button`,{type:`button`,className:`button`,onClick:ze,children:`Count`}),(0,E.jsxs)(`div`,{className:`pager`,children:[(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Previous page`,disabled:x===0,onClick:()=>S(e=>Math.max(0,e-ee)),children:(0,E.jsx)(O,{name:`left`})}),(0,E.jsx)(`button`,{type:`button`,className:`icon-button`,\"aria-label\":`Next page`,disabled:!m?.truncated,onClick:()=>S(e=>e+ee),children:(0,E.jsx)(O,{name:`right`})}),(0,E.jsx)(`select`,{className:`select`,\"aria-label\":`Rows per page`,value:ee,onChange:e=>{te(Number(e.target.value)),S(0)},children:jn.map(e=>(0,E.jsxs)(`option`,{value:e,children:[e,` rows`]},e))})]}),m&&(0,E.jsxs)(`span`,{children:[m.durationMs,` ms`]})]})]}),fe&&(0,E.jsxs)(lt,{title:a.tag===`production`?`Commit to production?`:`Commit changes?`,confirmLabel:`Commit`,danger:a.tag===`production`,busy:fe.saving,onCancel:()=>pe(null),onConfirm:()=>void Fe(),children:[(0,E.jsxs)(`p`,{children:[fe.statements.length===1?`This statement runs`:`These ${fe.statements.length} statements run`,` `,`in one transaction: all of them, or none.`]}),(0,E.jsx)(`pre`,{children:fe.statements.join(`;\n`)+`;`}),fe.error&&(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:fe.error.message})]})]})}function Nn(e,t,n,r){return`SELECT * FROM ${e}${t.length?` WHERE ${t.map(e=>`${e.column} ${e.operator}${e.value===void 0?``:` …`}`).join(` AND `)}`:``} LIMIT ${n} OFFSET ${r}`}function Pn(e,t){let n=new Set(e.map(e=>e.schema));return t&&n.has(t)?t:n.has(`public`)?`public`:e[0]?.schema??`public`}function Fn(e,t,n){return e!==null&&t.some(t=>t.schema===e)?e:Pn(t,n)}var In=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),Ln=In?`⌘`:`Ctrl+`;function Rn({api:e,connection:t,database:n,onDatabase:r,onSwitch:i}){let a=(0,_.useMemo)(()=>e.forDatabase(n),[e,n]),o=ie(t.name,n),s=t.capabilities?.databases===!0,c=t.capabilities?.backup===!0,l=t.capabilities?.import===!0,[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useReducer)(de,o,fe),[x,S]=(0,_.useState)([]),[ee,te]=(0,_.useState)(null),[C,ne]=(0,_.useState)(!0),[w,T]=(0,_.useState)(!1),[re,ae]=(0,_.useState)(!1),[oe,D]=(0,_.useState)(!1),[se,ce]=(0,_.useState)(!1),[le,k]=(0,_.useState)(!1),[A,ue]=(0,_.useState)(!1),[me,he]=(0,_.useState)(0),[ge,ve]=(0,_.useState)(0),[j,M]=(0,_.useState)(()=>_e(o)),N=(0,_.useRef)(null),be=(0,_.useRef)(null);(0,_.useEffect)(()=>{pe(o,y)},[o,y]),(0,_.useEffect)(()=>{let e=!0;return Promise.all([a.info(t.name),a.tables(t.name)]).then(([t,n])=>{e&&(d(t),p(n),h(null),v(e=>Fn(e,n,t.database)))},t=>e&&h(t)),()=>{e=!1}},[a,t.name,me]);let xe=()=>{let e=N.current?.getRootNode()??document;be.current=e.activeElement,ue(!0)};(0,_.useEffect)(()=>{A||(be.current?.focus(),be.current=null)},[A]);let Se=(0,_.useCallback)(e=>S(t=>[...t.slice(-499),{at:new Date,...e}]),[]),P=y.tabs.find(e=>e.id===y.active)??null;(0,_.useEffect)(()=>{function e(e){if(e.defaultPrevented||A)return;let t=In?e.metaKey:e.ctrlKey,n=e.key.toLowerCase();(()=>{if(t&&n===`e`)b({type:`new-query`});else if(t&&n===`p`)D(!0);else if(t&&n===`k`&&s)ce(!0);else if(t&&!e.shiftKey&&n===`r`)he(e=>e+1);else if(t&&n===`f`&&P?.kind===`table`)ve(e=>e+1);else if(e.altKey&&e.code===`KeyW`&&P)b({type:`close`,id:P.id});else if(t&&e.key===`[`)b({type:`cycle`,by:-1});else if(t&&e.key===`]`)b({type:`cycle`,by:1});else return!1;return!0})()&&e.preventDefault()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P,s,A]);let F=(0,_.useMemo)(()=>({api:a,connection:t,scope:o,log:Se,showRow:te,refreshKey:me,filterKey:ge}),[a,t,o,Se,me,ge]),we=(0,_.useMemo)(()=>new Map((f??[]).map(e=>[`${e.schema}.${e.name}`,e])),[f]),Te=(0,_.useMemo)(()=>new Map([...we].map(([e,t])=>[e,t.kind])),[we]),Ee=(0,_.useMemo)(()=>{let e={};for(let t of f??[])(e[t.schema]??={})[t.name]=[];return e},[f]),De=t.tag?`tag-${t.tag}`:``,Oe=P?.kind===`table`?{schema:P.schema,table:P.table}:null,ke=u?.database??n;return(0,E.jsxs)(ye.Provider,{value:F,children:[(0,E.jsxs)(`div`,{ref:N,className:`workspace`,inert:A,children:[(0,E.jsxs)(`header`,{className:`toolbar`,children:[(0,E.jsxs)(`div`,{className:`toolbar-group`,children:[(0,E.jsx)(qe,{icon:`sidebar`,label:`Sidebar`,pressed:C,onClick:()=>ne(e=>!e)}),(0,E.jsx)(qe,{icon:`switch`,label:`Connections`,onClick:i}),(0,E.jsx)(qe,{icon:`refresh`,label:`Refresh`,shortcut:`${Ln}R`,onClick:()=>he(e=>e+1)})]}),(0,E.jsxs)(`div`,{className:`status-pill ${De}`,\"aria-label\":`Connection`,title:t.warning??void 0,children:[t.tag&&(0,E.jsx)(`span`,{className:`tag-dot ${De}`,title:t.tag}),(0,E.jsx)(`strong`,{children:u?`${u.product} ${u.version}`:`…`}),(0,E.jsx)(`span`,{className:`sep`,children:`:`}),(0,E.jsx)(`span`,{children:t.label}),(0,E.jsx)(`span`,{className:`sep`,children:`:`}),s?(0,E.jsxs)(`button`,{type:`button`,className:`database-button`,\"aria-haspopup\":`dialog`,title:`Open another database (${Ln}K)`,onClick:()=>ce(!0),children:[ke??`…`,(0,E.jsx)(O,{name:`down`,size:11})]}):(0,E.jsx)(`span`,{children:ke??`…`}),t.access===`read`&&(0,E.jsxs)(`span`,{className:`read-only`,title:`Read-only: writes are refused`,children:[(0,E.jsx)(O,{name:`lock`,size:12}),` read-only`]})]}),(0,E.jsxs)(`div`,{className:`toolbar-group end`,children:[c&&(0,E.jsx)(qe,{icon:`backup`,label:`Back up and restore`,onClick:()=>k(!0)}),l&&(0,E.jsx)(qe,{icon:`import`,label:`Import SQL`,onClick:xe}),(0,E.jsx)(qe,{icon:`sql`,label:`New SQL editor`,shortcut:`${Ln}E`,onClick:()=>b({type:`new-query`})}),(0,E.jsx)(qe,{icon:`console`,label:`Console`,pressed:re,onClick:()=>ae(e=>!e)}),(0,E.jsx)(qe,{icon:`panel`,label:`Row panel`,pressed:w,onClick:()=>T(e=>!e)})]})]}),(0,E.jsxs)(`div`,{className:`body${C?``:` no-sidebar`}${w?` with-panel`:``}`,children:[C?(0,E.jsx)(mn,{tables:f,schema:g??`public`,onSchema:v,current:Oe,onOpen:e=>b({type:`open-table`,schema:e.schema,table:e.name}),history:j,onHistory:e=>b({type:`new-query`,sql:e})}):(0,E.jsx)(`div`,{}),(0,E.jsxs)(`main`,{className:`content`,children:[(0,E.jsx)(We,{tabs:y.tabs,active:y.active,kinds:Te,onActivate:e=>b({type:`activate`,id:e}),onClose:e=>b({type:`close`,id:e})}),m&&(0,E.jsx)(`div`,{className:`notice`,role:`alert`,children:m.message}),!y.tabs.length&&(0,E.jsxs)(`div`,{className:`empty`,children:[(0,E.jsx)(`div`,{children:`Open a table from the sidebar, or`}),(0,E.jsxs)(`div`,{children:[`Open anything `,(0,E.jsxs)(`kbd`,{children:[Ln,`P`]}),` · New SQL editor `,(0,E.jsxs)(`kbd`,{children:[Ln,`E`]}),s&&(0,E.jsxs)(E.Fragment,{children:[` `,`· Open database `,(0,E.jsxs)(`kbd`,{children:[Ln,`K`]})]})]})]}),y.tabs.map(e=>e.kind===`table`?(0,E.jsx)(Mn,{schema:e.schema,table:e.table,summary:we.get(`${e.schema}.${e.table}`),active:e.id===y.active},e.id):(0,E.jsx)(dn,{id:e.id,sql:e.sql,onChange:t=>b({type:`edit-sql`,id:e.id,sql:t}),schema:Ee,defaultSchema:g??`public`,kind:t.kind,active:e.id===y.active,onHistory:()=>M(_e(o))},e.id)),re&&(0,E.jsx)(Ke,{entries:x})]}),w?(0,E.jsx)(Ge,{row:ee}):(0,E.jsx)(`div`,{})]})]}),se&&(0,E.jsx)(Ne,{api:a,connection:t.name,open:u?.database??n,onClose:()=>ce(!1),onOpen:e=>{ce(!1),e!==n&&r(e)}}),le&&(0,E.jsx)(Ce,{api:a,connection:t,onClose:()=>k(!1),onRestored:()=>he(e=>e+1)}),A&&(0,E.jsx)(He,{api:a,connection:t,database:ke,onClose:()=>ue(!1),onImported:e=>{v(e),he(e=>e+1)}}),oe&&f&&(0,E.jsx)(Me,{tables:f,onClose:()=>D(!1),onOpen:e=>{D(!1),b({type:`open-table`,schema:e.schema,table:e.name})}})]})}function zn({config:e}){let[t,n]=(0,_.useState)(!1),r=(0,_.useMemo)(()=>x(e,()=>n(!0)),[e]),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(()=>T(location.hash));(0,_.useEffect)(()=>{r.connections().then(a,e=>s(e))},[r]),(0,_.useEffect)(()=>{let e=()=>l(T(location.hash));return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let u=e=>{location.hash=re(e),l(e)};if(t)return(0,E.jsxs)(`div`,{className:`signed-out`,children:[(0,E.jsx)(`h1`,{children:`Sign in to continue`}),e.signInUrl?(0,E.jsx)(`a`,{href:e.signInUrl,children:`Sign in`}):(0,E.jsx)(`p`,{children:`Open the link this server gave you, or sign in to the app it's part of.`})]});if(o)return(0,E.jsxs)(`div`,{className:`signed-out`,children:[(0,E.jsx)(`h1`,{children:`Can't reach the server`}),(0,E.jsx)(`p`,{children:o.message})]});if(!i)return(0,E.jsx)(`div`,{className:`signed-out`,children:`Loading…`});let d=i.find(e=>e.name===c.connection&&e.capabilities);if(d){let e=d.capabilities?.databases?c.database:null;return(0,E.jsx)(Rn,{api:r,connection:d,database:e,onDatabase:e=>u({connection:d.name,database:e}),onSwitch:()=>u({connection:``,database:null})},ie(d.name,e))}return(0,E.jsx)(k,{connections:i,onOpen:e=>u({connection:e.name,database:null})})}function Bn(e,t=b()){let n=(0,v.createRoot)(e);return n.render((0,E.jsx)(_.StrictMode,{children:(0,E.jsx)(zn,{config:t})})),()=>n.unmount()}var Vn=class extends HTMLElement{#e=null;connectedCallback(){let e=JSON.parse(this.getAttribute(`config`)??`{}`),t=this.shadowRoot??this.attachShadow({mode:`open`}),n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e.style;let r=document.createElement(`div`);r.className=`otw-db`,t.replaceChildren(n,r),this.#e=Bn(r,e)}disconnectedCallback(){this.#e?.(),this.#e=null}};customElements.get(`otw-db-app`)||customElements.define(`otw-db-app`,Vn);var Hn=document.getElementById(`root`);Hn&&Bn(Hn);export{c as a,u as i,oe as n,y as r,lt as t};"},"style-DNm72SIS.css":{"type":"text/css; charset=utf-8","body":":root,:host{--font:-apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, Roboto, sans-serif;--mono:ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, Consolas, monospace;--text:#1d1d1f;--text-dim:#6e6e73;--text-faint:#a1a1a6;--bg:#fff;--bg-chrome:#f3f3f5;--bg-sidebar:#eeeef1;--bg-hover:#0000000d;--bg-row-alt:#fafafb;--bg-input:#fff;--border:#dcdce0;--border-strong:#c7c7cc;--accent:#2f6feb;--accent-text:#fff;--selection:#dbe7ff;--selection-strong:#2f6feb;--danger:#d93025;--danger-bg:#fdecea;--warning-bg:#fff6e0;--success:#1a7f37;--success-bg:#e6f6ea;--null:#a1a1a6;--changed:#fff1b8;--inserted:#dcf5e3;--deleted:#fde0e0;--shadow:0 8px 30px #0000002e;--tag-local:#2ea44f;--tag-development:#2f80ed;--tag-testing:#9b51e0;--tag-staging:#f2994a;--tag-production:#e5484d;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:dark){:root,:host{--text:#ececef;--text-dim:#9d9da6;--text-faint:#6b6b74;--bg:#1e1e21;--bg-chrome:#2a2a2e;--bg-sidebar:#252528;--bg-hover:#ffffff0f;--bg-row-alt:#222225;--bg-input:#18181a;--border:#38383d;--border-strong:#4a4a50;--accent:#4c8dff;--selection:#23395f;--selection-strong:#4c8dff;--danger:#ff6b61;--danger-bg:#3b1f1d;--warning-bg:#3a3020;--success:#6ad18a;--success-bg:#1d3424;--null:#6b6b74;--changed:#4b4115;--inserted:#183a24;--deleted:#4a2020;--shadow:0 8px 30px #00000080;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{overflow:hidden}.otw-db{height:100%;font:12px/1.4 var(--font);color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased}button,input,select,textarea{font:inherit;color:inherit}.button{border:1px solid var(--border-strong);background:var(--bg-input);cursor:pointer;white-space:nowrap;border-radius:5px;align-items:center;gap:5px;height:24px;padding:0 9px;display:inline-flex}.button:hover{background:var(--bg-hover)}.button:disabled{opacity:.45;cursor:default}.button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}.button.danger{background:var(--danger);border-color:var(--danger);color:#fff}.icon-button{width:26px;height:24px;color:var(--text-dim);cursor:pointer;background:0 0;border:0;border-radius:5px;justify-content:center;align-items:center;display:inline-flex}.icon-button:hover{background:var(--bg-hover);color:var(--text)}.icon-button[aria-pressed=true]{color:var(--accent)}.icon-button:disabled{opacity:.4;cursor:default}.input,.select{border:1px solid var(--border-strong);background:var(--bg-input);border-radius:5px;outline:none;height:24px;padding:0 7px}.input:focus,.select:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent)}.segmented{border:1px solid var(--border-strong);background:var(--bg-chrome);border-radius:6px;padding:1px;display:inline-flex}.segmented button{cursor:pointer;height:20px;color:var(--text-dim);background:0 0;border:0;border-radius:4px;padding:0 10px}.segmented button[aria-pressed=true]{background:var(--bg-input);color:var(--text);box-shadow:0 1px 2px #0000001f}kbd{font:11px var(--font);color:var(--text-faint)}.tag-dot{background:var(--text-faint);border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}.tag-local{--tag:var(--tag-local)}.tag-development{--tag:var(--tag-development)}.tag-testing{--tag:var(--tag-testing)}.tag-staging{--tag:var(--tag-staging)}.tag-production{--tag:var(--tag-production)}.tag-dot[class*=tag-]{background:var(--tag)}.connections{background:var(--bg-chrome);place-items:center;height:100%;display:grid}.connections-card{border:1px solid var(--border);background:var(--bg);width:min(560px,100vw - 32px);max-height:calc(100vh - 64px);box-shadow:var(--shadow);border-radius:10px;flex-direction:column;display:flex;overflow:hidden}.connections-head{border-bottom:1px solid var(--border);align-items:center;gap:10px;padding:16px 18px;display:flex}.connections-head h1{margin:0;font-size:15px;font-weight:600}.connections-head p{color:var(--text-dim);margin:0}.connections-search{border-bottom:1px solid var(--border);padding:10px 18px}.connections-search .input{width:100%}.connections-list{margin:0;padding:6px;list-style:none;overflow:auto}.connection{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:7px;grid-template-columns:34px 1fr auto;align-items:center;gap:10px;width:100%;padding:8px 10px;display:grid}.connection:hover,.connection:focus-visible{background:var(--bg-hover);outline:none}.connection[aria-disabled=true]{opacity:.5;cursor:default}.kind-badge{background:var(--tag,var(--text-faint));color:#fff;border-radius:8px;place-items:center;width:34px;height:34px;font-size:12px;font-weight:700;display:grid}.connection-name{font-size:13px;font-weight:600}.connection-meta{color:var(--text-dim)}.connection-tags{color:var(--text-dim);align-items:center;gap:6px;display:flex}.pill{background:color-mix(in srgb, var(--tag,var(--text-faint)) 16%, transparent);height:18px;color:var(--tag,var(--text-dim));text-transform:capitalize;border-radius:9px;align-items:center;gap:5px;padding:0 7px;font-size:11px;font-weight:600;display:inline-flex}.workspace{grid-template-rows:38px 1fr;height:100%;display:grid}.toolbar{border-bottom:1px solid var(--border);background:var(--bg-chrome);grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;padding:0 8px;display:grid}.toolbar-group{align-items:center;gap:2px;display:flex}.toolbar-group.end{justify-content:flex-end}.status-pill{border:1px solid var(--border);background:color-mix(in srgb, var(--tag,transparent) 14%, var(--bg));white-space:nowrap;border-radius:7px;justify-content:center;align-items:center;gap:8px;min-width:280px;max-width:520px;height:26px;padding:0 12px;display:flex;overflow:hidden}.status-pill strong{font-weight:600}.status-pill .sep{color:var(--text-faint)}.database-button{min-width:0;height:20px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;border-radius:5px;align-items:center;gap:3px;padding:0 4px 0 6px;display:inline-flex}.database-button:hover,.database-button:focus-visible{background:color-mix(in srgb, var(--text) 10%, transparent)}.database-button svg{color:var(--text-dim)}.status-pill .read-only{color:var(--text-dim);font-size:11px}.body{grid-template-columns:var(--sidebar,240px) 1fr var(--panel,0px);min-height:0;display:grid}.body.no-sidebar{--sidebar:0px}.body.with-panel{--panel:300px}.sidebar{border-right:1px solid var(--border);background:var(--bg-sidebar);flex-direction:column;min-height:0;display:flex;overflow:hidden}.sidebar-head{flex-direction:column;gap:6px;padding:8px;display:flex}.sidebar-head .select,.sidebar-head .input{width:100%}.tree{flex:1;margin:0;padding:0 4px 8px;list-style:none;overflow:auto}.tree-group{color:var(--text-dim);text-transform:uppercase;letter-spacing:.02em;padding:8px 6px 3px;font-size:11px;font-weight:600}.tree-item{text-align:left;cursor:pointer;white-space:nowrap;text-overflow:ellipsis;background:0 0;border:0;border-radius:5px;align-items:center;gap:6px;width:100%;height:22px;padding:0 6px;display:flex;overflow:hidden}.tree-item:hover{background:var(--bg-hover)}.tree-item[aria-current=true]{background:var(--selection)}.tree-item svg{color:var(--text-dim);flex:none}.tree-item .name{text-overflow:ellipsis;overflow:hidden}.tree-item .count{color:var(--text-faint);margin-left:auto;font-size:11px}.tree-empty{color:var(--text-dim);padding:12px 8px}.sidebar-foot{border-top:1px solid var(--border);justify-content:center;padding:6px;display:flex}.content{flex-direction:column;min-width:0;min-height:0;display:flex}.tabbar{border-bottom:1px solid var(--border);background:var(--bg-chrome);scrollbar-width:none;flex:none;height:30px;display:flex;overflow-x:auto}.tab{border:0;border-right:1px solid var(--border);min-width:120px;max-width:220px;color:var(--text-dim);cursor:pointer;white-space:nowrap;background:0 0;align-items:center;gap:6px;padding:0 6px 0 10px;display:flex}.tab .title{text-overflow:ellipsis;text-align:left;flex:1;overflow:hidden}.tab[aria-selected=true]{background:var(--bg);color:var(--text);box-shadow:inset 0 2px 0 var(--accent)}.tab .close{visibility:hidden}.tab:hover .close,.tab[aria-selected=true] .close{visibility:visible}.tab-body{flex-direction:column;flex:1;min-height:0;display:flex}[hidden]{display:none!important}.empty{color:var(--text-dim);text-align:center;flex:1;place-content:center;gap:6px;display:grid}.empty kbd{margin-left:4px}.filters{border-bottom:1px solid var(--border);background:var(--bg-chrome);flex-direction:column;gap:5px;padding:6px 8px;display:flex}.filter-row{align-items:center;gap:5px;display:flex}.filter-row .value{flex:1}.filter-actions{gap:5px;margin-left:auto;display:flex}.bottombar{border-top:1px solid var(--border);background:var(--bg-chrome);height:32px;color:var(--text-dim);flex:none;align-items:center;gap:10px;padding:0 8px;display:flex}.bottombar .spacer{flex:1}.pager{align-items:center;gap:4px;display:flex}.notice{background:var(--danger-bg);color:var(--danger);white-space:pre-wrap;border-radius:6px;margin:8px;padding:8px 10px}.notice.warning{background:var(--warning-bg);color:var(--text)}.notice.success{background:var(--success-bg);color:var(--success)}.notice ul{margin:4px 0;padding-left:18px}.notice .detail{color:var(--text-dim);margin-top:4px}.grid{font-variant-numeric:tabular-nums;outline:none;flex:1;min-height:0;position:relative;overflow:auto}.grid-inner{position:relative}.grid-head{z-index:2;background:var(--bg-chrome);border-bottom:1px solid var(--border);height:26px;position:sticky;top:0}.grid-row{height:24px;position:absolute;left:0}.grid-row:nth-child(2n){background:var(--bg-row-alt)}.cell,.head-cell{border-right:1px solid var(--border);white-space:nowrap;text-overflow:ellipsis;height:100%;padding:0 8px;line-height:24px;position:absolute;top:0;overflow:hidden}.head-cell{cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:4px;font-weight:600;line-height:26px;display:flex}.head-cell .type{color:var(--text-faint);text-overflow:ellipsis;font-size:11px;font-weight:400;overflow:hidden}.head-cell .resize{cursor:col-resize;width:6px;height:100%;position:absolute;top:0;right:-3px}.number-cell{z-index:1;color:var(--text-faint);text-align:right;background:var(--bg-chrome);position:sticky;left:0}.cell.selected{box-shadow:inset 0 0 0 2px var(--selection-strong)}.grid-row.selected .cell{background:var(--selection)}.cell.changed{background:var(--changed)}.grid-row.inserted .cell:not(.number-cell){background:var(--inserted)}.grid-row.deleted .cell:not(.number-cell){background:var(--deleted);color:var(--text-dim);text-decoration:line-through}.cell-editor{z-index:3;border:2px solid var(--selection-strong);background:var(--bg-input);height:100%;font:inherit;outline:none;padding:0 7px;position:absolute;top:0}.menu{z-index:5;border:1px solid var(--border);background:var(--bg);min-width:140px;box-shadow:var(--shadow);border-radius:7px;flex-direction:column;padding:4px;display:flex;position:absolute;bottom:34px}.menu button{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:5px;padding:5px 10px}.menu button:hover,.menu button:focus-visible{background:var(--accent);color:var(--accent-text);outline:none}.changes{color:var(--text);font-weight:600}.cell .null{color:var(--null);font-style:italic}.structure{flex:1;padding:10px 12px;overflow:auto}.structure h2{color:var(--text-dim);text-transform:uppercase;margin:14px 0 6px;font-size:12px;font-weight:600}.structure table{border-collapse:collapse;width:100%}.structure th,.structure td{border-bottom:1px solid var(--border);text-align:left;vertical-align:top;padding:4px 8px}.structure th{color:var(--text-dim);font-weight:500}.structure code{font-family:var(--mono);font-size:11.5px}.query{grid-template-rows:minmax(80px, var(--editor,45%)) 5px 1fr;flex:1;min-height:0;display:grid}.editor{min-height:0;overflow:hidden}.editor .cm-editor{height:100%;font-size:13px}.editor .cm-scroller{font-family:var(--mono)}.editor .cm-editor.cm-focused{outline:none}.splitter{border-top:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--bg-chrome);cursor:row-resize}.results{flex-direction:column;min-height:0;display:flex}.results-tabs{border-bottom:1px solid var(--border);gap:2px;padding:4px 6px;display:flex}.message{color:var(--text-dim);padding:10px 12px}.panel{border-left:1px solid var(--border);background:var(--bg-sidebar);flex-direction:column;min-height:0;display:flex;overflow:hidden}.panel-head{border-bottom:1px solid var(--border);padding:8px 10px;font-weight:600}.fields{flex:1;margin:0;padding:6px 10px;overflow:auto}.fields dt{color:var(--text-dim);margin-top:8px;font-size:11px}.fields dt .type{color:var(--text-faint)}.fields dd{border:1px solid var(--border);background:var(--bg-input);font-family:var(--mono);white-space:pre-wrap;word-break:break-word;border-radius:5px;margin:2px 0 0;padding:4px 6px;font-size:11.5px}.console{border-top:1px solid var(--border);height:150px;font-family:var(--mono);flex:none;font-size:11.5px;overflow:auto}.console-entry{border-bottom:1px solid var(--border);grid-template-columns:70px 1fr auto;gap:8px;padding:2px 8px;display:grid}.console-entry .time,.console-entry .took{color:var(--text-faint)}.console-entry.failed .sql{color:var(--danger)}.overlay{z-index:10;background:#0000002e;justify-content:center;align-items:flex-start;padding-top:12vh;display:flex;position:fixed;inset:0}.dialog{border:1px solid var(--border);background:var(--bg);width:min(520px,100vw - 32px);box-shadow:var(--shadow);border-radius:10px;overflow:hidden}.dialog-body{padding:16px 18px}.dialog-body h2{margin:0 0 6px;font-size:14px}.dialog-body pre{background:var(--bg-chrome);max-height:200px;font-family:var(--mono);white-space:pre-wrap;border-radius:6px;padding:8px;font-size:11.5px;overflow:auto}.dialog-actions{border-top:1px solid var(--border);background:var(--bg-chrome);justify-content:flex-end;gap:8px;padding:10px 18px;display:flex}.palette .input{border:0;border-bottom:1px solid var(--border);width:100%;height:40px;box-shadow:none;border-radius:0;padding:0 14px;font-size:15px}.palette ul{max-height:320px;margin:0;padding:4px;list-style:none;overflow:auto}.palette li button{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;align-items:center;gap:8px;width:100%;padding:6px 10px;display:flex}.palette li button[aria-selected=true]{background:var(--accent);color:var(--accent-text)}.palette li button[aria-selected=true] svg,.palette li button[aria-selected=true] .schema{color:inherit}.palette .schema{color:var(--text-faint);margin-left:auto}.signed-out{text-align:center;height:100%;color:var(--text-dim);place-content:center;gap:8px;display:grid}.signed-out h1{color:var(--text);margin:0;font-size:16px}.dialog.backup{width:min(560px,100vw - 32px)}.backup .tabs{border-bottom:1px solid var(--border);background:var(--bg-chrome);gap:2px;padding:8px 12px 0;display:flex}.backup .tabs button{color:var(--text-dim);cursor:pointer;background:0 0;border:1px solid #0000;border-bottom:0;border-radius:6px 6px 0 0;padding:6px 12px}.backup .tabs button[aria-selected=true]{border-color:var(--border);background:var(--bg);color:var(--text);margin-bottom:-1px}.backup .dialog-body,.import .dialog-body{gap:10px;max-height:min(60vh,520px);display:grid;overflow:auto}.backup .notice,.import .notice,.backup p,.import p{margin:0}.muted{color:var(--text-dim)}.choices{border:0;gap:4px;margin:0;padding:0;display:grid}.choices legend{margin-bottom:4px;font-weight:600}.choices label{align-items:center;gap:8px;display:flex}.choices label .muted{text-align:right;margin-left:auto}.file-choice,.confirm{gap:4px;display:grid}.confirm .input{border:1px solid var(--border-strong);background:var(--bg-input);height:26px;font-family:var(--mono);border-radius:5px;padding:0 8px}.replaces ul{margin:4px 0 0;padding-left:18px}.progress{color:var(--text-dim);gap:4px;display:grid}.progress progress{width:100%;accent-color:var(--accent)}.dialog.import{width:min(620px,100vw - 32px)}.dialog.import:focus{outline:none}.import .dialog-body{max-height:min(70vh,640px)}.import .dialog-body h2{margin:0}.import-summary{gap:10px;display:grid}.import-tables{border:1px solid var(--border);border-radius:6px;max-height:140px;margin:0;padding:6px 8px 6px 24px;overflow:auto}.import .notice code,.import .notice pre{font-family:var(--mono);word-break:break-all;font-size:11.5px}.import .notice pre{max-height:96px;color:var(--text);background:0 0;margin:6px 0 0;padding:0}.import .agree{align-items:center;gap:8px;margin-top:6px;font-weight:600;display:flex}.import .notice-actions{justify-content:flex-end;margin-top:8px;display:flex}\n/*$vite$:1*/"}},"entry":{"script":"index-DW5OtN-I.js","style":"style-DNm72SIS.css"}}
|