-
Notifications
You must be signed in to change notification settings - Fork 26
/
worker.js
103 lines (101 loc) · 207 KB
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"use strict";var jo=Object.create;var Ye=Object.defineProperty;var Ho=Object.getOwnPropertyDescriptor;var Vo=Object.getOwnPropertyNames;var Zo=Object.getPrototypeOf,$o=Object.prototype.hasOwnProperty;var a=(n,e)=>Ye(n,"name",{value:e,configurable:!0});var T=(n,e)=>()=>(n&&(e=n(n=0)),e);var q=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Lr=(n,e)=>{for(var t in e)Ye(n,t,{get:e[t],enumerable:!0})},Nr=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vo(e))!$o.call(n,i)&&i!==t&&Ye(n,i,{get:()=>e[i],enumerable:!(r=Ho(e,i))||r.enumerable});return n};var xt=(n,e,t)=>(t=n!=null?jo(Zo(n)):{},Nr(e||!n||!n.__esModule?Ye(t,"default",{value:n,enumerable:!0}):t,n)),Cr=n=>Nr(Ye({},"__esModule",{value:!0}),n);var kr=q(hn=>{var Pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");hn.encode=function(n){if(0<=n&&n<Pr.length)return Pr[n];throw new TypeError("Must be between 0 and 63: "+n)};hn.decode=function(n){var e=65,t=90,r=97,i=122,o=48,s=57,l=43,u=47,c=26,d=52;return e<=n&&n<=t?n-e:r<=n&&n<=i?n-r+c:o<=n&&n<=s?n-o+d:n==l?62:n==u?63:-1}});var yn=q(bn=>{var Ar=kr(),gn=5,Fr=1<<gn,Or=Fr-1,Rr=Fr;function Go(n){return n<0?(-n<<1)+1:(n<<1)+0}a(Go,"toVLQSigned");function Ko(n){var e=(n&1)===1,t=n>>1;return e?-t:t}a(Ko,"fromVLQSigned");bn.encode=a(function(e){var t="",r,i=Go(e);do r=i&Or,i>>>=gn,i>0&&(r|=Rr),t+=Ar.encode(r);while(i>0);return t},"base64VLQ_encode");bn.decode=a(function(e,t,r){var i=e.length,o=0,s=0,l,u;do{if(t>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=Ar.decode(e.charCodeAt(t++)),u===-1)throw new Error("Invalid base64 digit: "+e.charAt(t-1));l=!!(u&Rr),u&=Or,o=o+(u<<s),s+=gn}while(l);r.value=Ko(o),r.rest=t},"base64VLQ_decode")});var De=q(j=>{function Jo(n,e,t){if(e in n)return n[e];if(arguments.length===3)return t;throw new Error('"'+e+'" is a required argument.')}a(Jo,"getArg");j.getArg=Jo;var Dr=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Qo=/^data:.+\,.+$/;function et(n){var e=n.match(Dr);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}a(et,"urlParse");j.urlParse=et;function Oe(n){var e="";return n.scheme&&(e+=n.scheme+":"),e+="//",n.auth&&(e+=n.auth+"@"),n.host&&(e+=n.host),n.port&&(e+=":"+n.port),n.path&&(e+=n.path),e}a(Oe,"urlGenerate");j.urlGenerate=Oe;function wn(n){var e=n,t=et(n);if(t){if(!t.path)return n;e=t.path}for(var r=j.isAbsolute(e),i=e.split(/\/+/),o,s=0,l=i.length-1;l>=0;l--)o=i[l],o==="."?i.splice(l,1):o===".."?s++:s>0&&(o===""?(i.splice(l+1,s),s=0):(i.splice(l,2),s--));return e=i.join("/"),e===""&&(e=r?"/":"."),t?(t.path=e,Oe(t)):e}a(wn,"normalize");j.normalize=wn;function Br(n,e){n===""&&(n="."),e===""&&(e=".");var t=et(e),r=et(n);if(r&&(n=r.path||"/"),t&&!t.scheme)return r&&(t.scheme=r.scheme),Oe(t);if(t||e.match(Qo))return e;if(r&&!r.host&&!r.path)return r.host=e,Oe(r);var i=e.charAt(0)==="/"?e:wn(n.replace(/\/+$/,"")+"/"+e);return r?(r.path=i,Oe(r)):i}a(Br,"join");j.join=Br;j.isAbsolute=function(n){return n.charAt(0)==="/"||Dr.test(n)};function Xo(n,e){n===""&&(n="."),n=n.replace(/\/$/,"");for(var t=0;e.indexOf(n+"/")!==0;){var r=n.lastIndexOf("/");if(r<0||(n=n.slice(0,r),n.match(/^([^\/]+:\/)?\/*$/)))return e;++t}return Array(t+1).join("../")+e.substr(n.length+1)}a(Xo,"relative");j.relative=Xo;var Wr=function(){var n=Object.create(null);return!("__proto__"in n)}();function Ur(n){return n}a(Ur,"identity");function Yo(n){return zr(n)?"$"+n:n}a(Yo,"toSetString");j.toSetString=Wr?Ur:Yo;function es(n){return zr(n)?n.slice(1):n}a(es,"fromSetString");j.fromSetString=Wr?Ur:es;function zr(n){if(!n)return!1;var e=n.length;if(e<9||n.charCodeAt(e-1)!==95||n.charCodeAt(e-2)!==95||n.charCodeAt(e-3)!==111||n.charCodeAt(e-4)!==116||n.charCodeAt(e-5)!==111||n.charCodeAt(e-6)!==114||n.charCodeAt(e-7)!==112||n.charCodeAt(e-8)!==95||n.charCodeAt(e-9)!==95)return!1;for(var t=e-10;t>=0;t--)if(n.charCodeAt(t)!==36)return!1;return!0}a(zr,"isProtoString");function ts(n,e,t){var r=Re(n.source,e.source);return r!==0||(r=n.originalLine-e.originalLine,r!==0)||(r=n.originalColumn-e.originalColumn,r!==0||t)||(r=n.generatedColumn-e.generatedColumn,r!==0)||(r=n.generatedLine-e.generatedLine,r!==0)?r:Re(n.name,e.name)}a(ts,"compareByOriginalPositions");j.compareByOriginalPositions=ts;function ns(n,e,t){var r=n.generatedLine-e.generatedLine;return r!==0||(r=n.generatedColumn-e.generatedColumn,r!==0||t)||(r=Re(n.source,e.source),r!==0)||(r=n.originalLine-e.originalLine,r!==0)||(r=n.originalColumn-e.originalColumn,r!==0)?r:Re(n.name,e.name)}a(ns,"compareByGeneratedPositionsDeflated");j.compareByGeneratedPositionsDeflated=ns;function Re(n,e){return n===e?0:n===null?1:e===null?-1:n>e?1:-1}a(Re,"strcmp");function rs(n,e){var t=n.generatedLine-e.generatedLine;return t!==0||(t=n.generatedColumn-e.generatedColumn,t!==0)||(t=Re(n.source,e.source),t!==0)||(t=n.originalLine-e.originalLine,t!==0)||(t=n.originalColumn-e.originalColumn,t!==0)?t:Re(n.name,e.name)}a(rs,"compareByGeneratedPositionsInflated");j.compareByGeneratedPositionsInflated=rs;function is(n){return JSON.parse(n.replace(/^\)]}'[^\n]*\n/,""))}a(is,"parseSourceMapInput");j.parseSourceMapInput=is;function os(n,e,t){if(e=e||"",n&&(n[n.length-1]!=="/"&&e[0]!=="/"&&(n+="/"),e=n+e),t){var r=et(t);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var i=r.path.lastIndexOf("/");i>=0&&(r.path=r.path.substring(0,i+1))}e=Br(Oe(r),e)}return wn(e)}a(os,"computeSourceURL");j.computeSourceURL=os});var En=q(qr=>{var Sn=De(),vn=Object.prototype.hasOwnProperty,Ee=typeof Map<"u";function ce(){this._array=[],this._set=Ee?new Map:Object.create(null)}a(ce,"ArraySet");ce.fromArray=a(function(e,t){for(var r=new ce,i=0,o=e.length;i<o;i++)r.add(e[i],t);return r},"ArraySet_fromArray");ce.prototype.size=a(function(){return Ee?this._set.size:Object.getOwnPropertyNames(this._set).length},"ArraySet_size");ce.prototype.add=a(function(e,t){var r=Ee?e:Sn.toSetString(e),i=Ee?this.has(e):vn.call(this._set,r),o=this._array.length;(!i||t)&&this._array.push(e),i||(Ee?this._set.set(e,o):this._set[r]=o)},"ArraySet_add");ce.prototype.has=a(function(e){if(Ee)return this._set.has(e);var t=Sn.toSetString(e);return vn.call(this._set,t)},"ArraySet_has");ce.prototype.indexOf=a(function(e){if(Ee){var t=this._set.get(e);if(t>=0)return t}else{var r=Sn.toSetString(e);if(vn.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},"ArraySet_indexOf");ce.prototype.at=a(function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},"ArraySet_at");ce.prototype.toArray=a(function(){return this._array.slice()},"ArraySet_toArray");qr.ArraySet=ce});var Vr=q(Hr=>{var jr=De();function ss(n,e){var t=n.generatedLine,r=e.generatedLine,i=n.generatedColumn,o=e.generatedColumn;return r>t||r==t&&o>=i||jr.compareByGeneratedPositionsInflated(n,e)<=0}a(ss,"generatedPositionAfter");function Mt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}a(Mt,"MappingList");Mt.prototype.unsortedForEach=a(function(e,t){this._array.forEach(e,t)},"MappingList_forEach");Mt.prototype.add=a(function(e){ss(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},"MappingList_add");Mt.prototype.toArray=a(function(){return this._sorted||(this._array.sort(jr.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},"MappingList_toArray");Hr.MappingList=Mt});var xn=q(Zr=>{var tt=yn(),B=De(),It=En().ArraySet,as=Vr().MappingList;function G(n){n||(n={}),this._file=B.getArg(n,"file",null),this._sourceRoot=B.getArg(n,"sourceRoot",null),this._skipValidation=B.getArg(n,"skipValidation",!1),this._sources=new It,this._names=new It,this._mappings=new as,this._sourcesContents=null}a(G,"SourceMapGenerator");G.prototype._version=3;G.fromSourceMap=a(function(e){var t=e.sourceRoot,r=new G({file:e.file,sourceRoot:t});return e.eachMapping(function(i){var o={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(o.source=i.source,t!=null&&(o.source=B.relative(t,o.source)),o.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(o.name=i.name)),r.addMapping(o)}),e.sources.forEach(function(i){var o=i;t!==null&&(o=B.relative(t,i)),r._sources.has(o)||r._sources.add(o);var s=e.sourceContentFor(i);s!=null&&r.setSourceContent(i,s)}),r},"SourceMapGenerator_fromSourceMap");G.prototype.addMapping=a(function(e){var t=B.getArg(e,"generated"),r=B.getArg(e,"original",null),i=B.getArg(e,"source",null),o=B.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,i,o),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:o})},"SourceMapGenerator_addMapping");G.prototype.setSourceContent=a(function(e,t){var r=e;this._sourceRoot!=null&&(r=B.relative(this._sourceRoot,r)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[B.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[B.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},"SourceMapGenerator_setSourceContent");G.prototype.applySourceMap=a(function(e,t,r){var i=t;if(t==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=e.file}var o=this._sourceRoot;o!=null&&(i=B.relative(o,i));var s=new It,l=new It;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var c=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});c.source!=null&&(u.source=c.source,r!=null&&(u.source=B.join(r,u.source)),o!=null&&(u.source=B.relative(o,u.source)),u.originalLine=c.line,u.originalColumn=c.column,c.name!=null&&(u.name=c.name))}var d=u.source;d!=null&&!s.has(d)&&s.add(d);var _=u.name;_!=null&&!l.has(_)&&l.add(_)},this),this._sources=s,this._names=l,e.sources.forEach(function(u){var c=e.sourceContentFor(u);c!=null&&(r!=null&&(u=B.join(r,u)),o!=null&&(u=B.relative(o,u)),this.setSourceContent(u,c))},this)},"SourceMapGenerator_applySourceMap");G.prototype._validateMapping=a(function(e,t,r,i){if(t&&typeof t.line!="number"&&typeof t.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!t&&!r&&!i)){if(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:i}))}},"SourceMapGenerator_validateMapping");G.prototype._serializeMappings=a(function(){for(var e=0,t=1,r=0,i=0,o=0,s=0,l="",u,c,d,_,p=this._mappings.toArray(),m=0,h=p.length;m<h;m++){if(c=p[m],u="",c.generatedLine!==t)for(e=0;c.generatedLine!==t;)u+=";",t++;else if(m>0){if(!B.compareByGeneratedPositionsInflated(c,p[m-1]))continue;u+=","}u+=tt.encode(c.generatedColumn-e),e=c.generatedColumn,c.source!=null&&(_=this._sources.indexOf(c.source),u+=tt.encode(_-s),s=_,u+=tt.encode(c.originalLine-1-i),i=c.originalLine-1,u+=tt.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(d=this._names.indexOf(c.name),u+=tt.encode(d-o),o=d)),l+=u}return l},"SourceMapGenerator_serializeMappings");G.prototype._generateSourcesContent=a(function(e,t){return e.map(function(r){if(!this._sourcesContents)return null;t!=null&&(r=B.relative(t,r));var i=B.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)},"SourceMapGenerator_generateSourcesContent");G.prototype.toJSON=a(function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},"SourceMapGenerator_toJSON");G.prototype.toString=a(function(){return JSON.stringify(this.toJSON())},"SourceMapGenerator_toString");Zr.SourceMapGenerator=G});var $r=q(xe=>{xe.GREATEST_LOWER_BOUND=1;xe.LEAST_UPPER_BOUND=2;function Mn(n,e,t,r,i,o){var s=Math.floor((e-n)/2)+n,l=i(t,r[s],!0);return l===0?s:l>0?e-s>1?Mn(s,e,t,r,i,o):o==xe.LEAST_UPPER_BOUND?e<r.length?e:-1:s:s-n>1?Mn(n,s,t,r,i,o):o==xe.LEAST_UPPER_BOUND?s:n<0?-1:n}a(Mn,"recursiveSearch");xe.search=a(function(e,t,r,i){if(t.length===0)return-1;var o=Mn(-1,t.length,e,t,r,i||xe.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&r(t[o],t[o-1],!0)===0;)--o;return o},"search")});var Kr=q(Gr=>{function In(n,e,t){var r=n[e];n[e]=n[t],n[t]=r}a(In,"swap");function ls(n,e){return Math.round(n+Math.random()*(e-n))}a(ls,"randomIntInRange");function Tn(n,e,t,r){if(t<r){var i=ls(t,r),o=t-1;In(n,i,r);for(var s=n[r],l=t;l<r;l++)e(n[l],s)<=0&&(o+=1,In(n,o,l));In(n,o+1,l);var u=o+1;Tn(n,e,t,u-1),Tn(n,e,u+1,r)}}a(Tn,"doQuickSort");Gr.quickSort=function(n,e){Tn(n,e,0,n.length-1)}});var Qr=q(Tt=>{var x=De(),Ln=$r(),Be=En().ArraySet,us=yn(),nt=Kr().quickSort;function F(n,e){var t=n;return typeof n=="string"&&(t=x.parseSourceMapInput(n)),t.sections!=null?new Y(t,e):new z(t,e)}a(F,"SourceMapConsumer");F.fromSourceMap=function(n,e){return z.fromSourceMap(n,e)};F.prototype._version=3;F.prototype.__generatedMappings=null;Object.defineProperty(F.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});F.prototype.__originalMappings=null;Object.defineProperty(F.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});F.prototype._charIsMappingSeparator=a(function(e,t){var r=e.charAt(t);return r===";"||r===","},"SourceMapConsumer_charIsMappingSeparator");F.prototype._parseMappings=a(function(e,t){throw new Error("Subclasses must implement _parseMappings")},"SourceMapConsumer_parseMappings");F.GENERATED_ORDER=1;F.ORIGINAL_ORDER=2;F.GREATEST_LOWER_BOUND=1;F.LEAST_UPPER_BOUND=2;F.prototype.eachMapping=a(function(e,t,r){var i=t||null,o=r||F.GENERATED_ORDER,s;switch(o){case F.GENERATED_ORDER:s=this._generatedMappings;break;case F.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var l=this.sourceRoot;s.map(function(u){var c=u.source===null?null:this._sources.at(u.source);return c=x.computeSourceURL(l,c,this._sourceMapURL),{source:c,generatedLine:u.generatedLine,generatedColumn:u.generatedColumn,originalLine:u.originalLine,originalColumn:u.originalColumn,name:u.name===null?null:this._names.at(u.name)}},this).forEach(e,i)},"SourceMapConsumer_eachMapping");F.prototype.allGeneratedPositionsFor=a(function(e){var t=x.getArg(e,"line"),r={source:x.getArg(e,"source"),originalLine:t,originalColumn:x.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var i=[],o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",x.compareByOriginalPositions,Ln.LEAST_UPPER_BOUND);if(o>=0){var s=this._originalMappings[o];if(e.column===void 0)for(var l=s.originalLine;s&&s.originalLine===l;)i.push({line:x.getArg(s,"generatedLine",null),column:x.getArg(s,"generatedColumn",null),lastColumn:x.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o];else for(var u=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==u;)i.push({line:x.getArg(s,"generatedLine",null),column:x.getArg(s,"generatedColumn",null),lastColumn:x.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++o]}return i},"SourceMapConsumer_allGeneratedPositionsFor");Tt.SourceMapConsumer=F;function z(n,e){var t=n;typeof n=="string"&&(t=x.parseSourceMapInput(n));var r=x.getArg(t,"version"),i=x.getArg(t,"sources"),o=x.getArg(t,"names",[]),s=x.getArg(t,"sourceRoot",null),l=x.getArg(t,"sourcesContent",null),u=x.getArg(t,"mappings"),c=x.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);s&&(s=x.normalize(s)),i=i.map(String).map(x.normalize).map(function(d){return s&&x.isAbsolute(s)&&x.isAbsolute(d)?x.relative(s,d):d}),this._names=Be.fromArray(o.map(String),!0),this._sources=Be.fromArray(i,!0),this._absoluteSources=this._sources.toArray().map(function(d){return x.computeSourceURL(s,d,e)}),this.sourceRoot=s,this.sourcesContent=l,this._mappings=u,this._sourceMapURL=e,this.file=c}a(z,"BasicSourceMapConsumer");z.prototype=Object.create(F.prototype);z.prototype.consumer=F;z.prototype._findSourceIndex=function(n){var e=n;if(this.sourceRoot!=null&&(e=x.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var t;for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==n)return t;return-1};z.fromSourceMap=a(function(e,t){var r=Object.create(z.prototype),i=r._names=Be.fromArray(e._names.toArray(),!0),o=r._sources=Be.fromArray(e._sources.toArray(),!0);r.sourceRoot=e._sourceRoot,r.sourcesContent=e._generateSourcesContent(r._sources.toArray(),r.sourceRoot),r.file=e._file,r._sourceMapURL=t,r._absoluteSources=r._sources.toArray().map(function(m){return x.computeSourceURL(r.sourceRoot,m,t)});for(var s=e._mappings.toArray().slice(),l=r.__generatedMappings=[],u=r.__originalMappings=[],c=0,d=s.length;c<d;c++){var _=s[c],p=new Jr;p.generatedLine=_.generatedLine,p.generatedColumn=_.generatedColumn,_.source&&(p.source=o.indexOf(_.source),p.originalLine=_.originalLine,p.originalColumn=_.originalColumn,_.name&&(p.name=i.indexOf(_.name)),u.push(p)),l.push(p)}return nt(r.__originalMappings,x.compareByOriginalPositions),r},"SourceMapConsumer_fromSourceMap");z.prototype._version=3;Object.defineProperty(z.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Jr(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}a(Jr,"Mapping");z.prototype._parseMappings=a(function(e,t){for(var r=1,i=0,o=0,s=0,l=0,u=0,c=e.length,d=0,_={},p={},m=[],h=[],f,g,S,b,M;d<c;)if(e.charAt(d)===";")r++,d++,i=0;else if(e.charAt(d)===",")d++;else{for(f=new Jr,f.generatedLine=r,b=d;b<c&&!this._charIsMappingSeparator(e,b);b++);if(g=e.slice(d,b),S=_[g],S)d+=g.length;else{for(S=[];d<b;)us.decode(e,d,p),M=p.value,d=p.rest,S.push(M);if(S.length===2)throw new Error("Found a source, but no line and column");if(S.length===3)throw new Error("Found a source and line, but no column");_[g]=S}f.generatedColumn=i+S[0],i=f.generatedColumn,S.length>1&&(f.source=l+S[1],l+=S[1],f.originalLine=o+S[2],o=f.originalLine,f.originalLine+=1,f.originalColumn=s+S[3],s=f.originalColumn,S.length>4&&(f.name=u+S[4],u+=S[4])),h.push(f),typeof f.originalLine=="number"&&m.push(f)}nt(h,x.compareByGeneratedPositionsDeflated),this.__generatedMappings=h,nt(m,x.compareByOriginalPositions),this.__originalMappings=m},"SourceMapConsumer_parseMappings");z.prototype._findMapping=a(function(e,t,r,i,o,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return Ln.search(e,t,o,s)},"SourceMapConsumer_findMapping");z.prototype.computeColumnSpans=a(function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},"SourceMapConsumer_computeColumnSpans");z.prototype.originalPositionFor=a(function(e){var t={generatedLine:x.getArg(e,"line"),generatedColumn:x.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",x.compareByGeneratedPositionsDeflated,x.getArg(e,"bias",F.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var o=x.getArg(i,"source",null);o!==null&&(o=this._sources.at(o),o=x.computeSourceURL(this.sourceRoot,o,this._sourceMapURL));var s=x.getArg(i,"name",null);return s!==null&&(s=this._names.at(s)),{source:o,line:x.getArg(i,"originalLine",null),column:x.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},"SourceMapConsumer_originalPositionFor");z.prototype.hasContentsOfAllSources=a(function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1},"BasicSourceMapConsumer_hasContentsOfAllSources");z.prototype.sourceContentFor=a(function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var i=e;this.sourceRoot!=null&&(i=x.relative(this.sourceRoot,i));var o;if(this.sourceRoot!=null&&(o=x.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,"");if(o.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!o.path||o.path=="/")&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(t)return null;throw new Error('"'+i+'" is not in the SourceMap.')},"SourceMapConsumer_sourceContentFor");z.prototype.generatedPositionFor=a(function(e){var t=x.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:x.getArg(e,"line"),originalColumn:x.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",x.compareByOriginalPositions,x.getArg(e,"bias",F.GREATEST_LOWER_BOUND));if(i>=0){var o=this._originalMappings[i];if(o.source===r.source)return{line:x.getArg(o,"generatedLine",null),column:x.getArg(o,"generatedColumn",null),lastColumn:x.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},"SourceMapConsumer_generatedPositionFor");Tt.BasicSourceMapConsumer=z;function Y(n,e){var t=n;typeof n=="string"&&(t=x.parseSourceMapInput(n));var r=x.getArg(t,"version"),i=x.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new Be,this._names=new Be;var o={line:-1,column:0};this._sections=i.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var l=x.getArg(s,"offset"),u=x.getArg(l,"line"),c=x.getArg(l,"column");if(u<o.line||u===o.line&&c<o.column)throw new Error("Section offsets must be ordered and non-overlapping.");return o=l,{generatedOffset:{generatedLine:u+1,generatedColumn:c+1},consumer:new F(x.getArg(s,"map"),e)}})}a(Y,"IndexedSourceMapConsumer");Y.prototype=Object.create(F.prototype);Y.prototype.constructor=F;Y.prototype._version=3;Object.defineProperty(Y.prototype,"sources",{get:function(){for(var n=[],e=0;e<this._sections.length;e++)for(var t=0;t<this._sections[e].consumer.sources.length;t++)n.push(this._sections[e].consumer.sources[t]);return n}});Y.prototype.originalPositionFor=a(function(e){var t={generatedLine:x.getArg(e,"line"),generatedColumn:x.getArg(e,"column")},r=Ln.search(t,this._sections,function(o,s){var l=o.generatedLine-s.generatedOffset.generatedLine;return l||o.generatedColumn-s.generatedOffset.generatedColumn}),i=this._sections[r];return i?i.consumer.originalPositionFor({line:t.generatedLine-(i.generatedOffset.generatedLine-1),column:t.generatedColumn-(i.generatedOffset.generatedLine===t.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},"IndexedSourceMapConsumer_originalPositionFor");Y.prototype.hasContentsOfAllSources=a(function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},"IndexedSourceMapConsumer_hasContentsOfAllSources");Y.prototype.sourceContentFor=a(function(e,t){for(var r=0;r<this._sections.length;r++){var i=this._sections[r],o=i.consumer.sourceContentFor(e,!0);if(o)return o}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},"IndexedSourceMapConsumer_sourceContentFor");Y.prototype.generatedPositionFor=a(function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(r.consumer._findSourceIndex(x.getArg(e,"source"))!==-1){var i=r.consumer.generatedPositionFor(e);if(i){var o={line:i.line+(r.generatedOffset.generatedLine-1),column:i.column+(r.generatedOffset.generatedLine===i.line?r.generatedOffset.generatedColumn-1:0)};return o}}}return{line:null,column:null}},"IndexedSourceMapConsumer_generatedPositionFor");Y.prototype._parseMappings=a(function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var i=this._sections[r],o=i.consumer._generatedMappings,s=0;s<o.length;s++){var l=o[s],u=i.consumer._sources.at(l.source);u=x.computeSourceURL(i.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var c=null;l.name&&(c=i.consumer._names.at(l.name),this._names.add(c),c=this._names.indexOf(c));var d={source:u,generatedLine:l.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(i.generatedOffset.generatedLine===l.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:c};this.__generatedMappings.push(d),typeof d.originalLine=="number"&&this.__originalMappings.push(d)}nt(this.__generatedMappings,x.compareByGeneratedPositionsDeflated),nt(this.__originalMappings,x.compareByOriginalPositions)},"IndexedSourceMapConsumer_parseMappings");Tt.IndexedSourceMapConsumer=Y});var Yr=q(Xr=>{var cs=xn().SourceMapGenerator,Lt=De(),ds=/(\r?\n)/,_s=10,We="$$$isSourceNode$$$";function V(n,e,t,r,i){this.children=[],this.sourceContents={},this.line=n??null,this.column=e??null,this.source=t??null,this.name=i??null,this[We]=!0,r!=null&&this.add(r)}a(V,"SourceNode");V.fromStringWithSourceMap=a(function(e,t,r){var i=new V,o=e.split(ds),s=0,l=a(function(){var p=h(),m=h()||"";return p+m;function h(){return s<o.length?o[s++]:void 0}},"shiftNextLine"),u=1,c=0,d=null;return t.eachMapping(function(p){if(d!==null)if(u<p.generatedLine)_(d,l()),u++,c=0;else{var m=o[s]||"",h=m.substr(0,p.generatedColumn-c);o[s]=m.substr(p.generatedColumn-c),c=p.generatedColumn,_(d,h),d=p;return}for(;u<p.generatedLine;)i.add(l()),u++;if(c<p.generatedColumn){var m=o[s]||"";i.add(m.substr(0,p.generatedColumn)),o[s]=m.substr(p.generatedColumn),c=p.generatedColumn}d=p},this),s<o.length&&(d&&_(d,l()),i.add(o.splice(s).join(""))),t.sources.forEach(function(p){var m=t.sourceContentFor(p);m!=null&&(r!=null&&(p=Lt.join(r,p)),i.setSourceContent(p,m))}),i;function _(p,m){if(p===null||p.source===void 0)i.add(m);else{var h=r?Lt.join(r,p.source):p.source;i.add(new V(p.originalLine,p.originalColumn,h,m,p.name))}}a(_,"addMappingWithCode")},"SourceNode_fromStringWithSourceMap");V.prototype.add=a(function(e){if(Array.isArray(e))e.forEach(function(t){this.add(t)},this);else if(e[We]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this},"SourceNode_add");V.prototype.prepend=a(function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[We]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this},"SourceNode_prepend");V.prototype.walk=a(function(e){for(var t,r=0,i=this.children.length;r<i;r++)t=this.children[r],t[We]?t.walk(e):t!==""&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},"SourceNode_walk");V.prototype.join=a(function(e){var t,r,i=this.children.length;if(i>0){for(t=[],r=0;r<i-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},"SourceNode_join");V.prototype.replaceRight=a(function(e,t){var r=this.children[this.children.length-1];return r[We]?r.replaceRight(e,t):typeof r=="string"?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},"SourceNode_replaceRight");V.prototype.setSourceContent=a(function(e,t){this.sourceContents[Lt.toSetString(e)]=t},"SourceNode_setSourceContent");V.prototype.walkSourceContents=a(function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][We]&&this.children[t].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),t=0,r=i.length;t<r;t++)e(Lt.fromSetString(i[t]),this.sourceContents[i[t]])},"SourceNode_walkSourceContents");V.prototype.toString=a(function(){var e="";return this.walk(function(t){e+=t}),e},"SourceNode_toString");V.prototype.toStringWithSourceMap=a(function(e){var t={code:"",line:1,column:0},r=new cs(e),i=!1,o=null,s=null,l=null,u=null;return this.walk(function(c,d){t.code+=c,d.source!==null&&d.line!==null&&d.column!==null?((o!==d.source||s!==d.line||l!==d.column||u!==d.name)&&r.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:t.line,column:t.column},name:d.name}),o=d.source,s=d.line,l=d.column,u=d.name,i=!0):i&&(r.addMapping({generated:{line:t.line,column:t.column}}),o=null,i=!1);for(var _=0,p=c.length;_<p;_++)c.charCodeAt(_)===_s?(t.line++,t.column=0,_+1===p?(o=null,i=!1):i&&r.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:t.line,column:t.column},name:d.name})):t.column++}),this.walkSourceContents(function(c,d){r.setSourceContent(c,d)}),{code:t.code,map:r}},"SourceNode_toStringWithSourceMap");Xr.SourceNode=V});var ei=q(Nt=>{Nt.SourceMapGenerator=xn().SourceMapGenerator;Nt.SourceMapConsumer=Qr().SourceMapConsumer;Nt.SourceNode=Yr().SourceNode});var ni=q((Ll,ti)=>{var ps=Object.prototype.toString,Nn=typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function ms(n){return ps.call(n).slice(8,-1)==="ArrayBuffer"}a(ms,"isArrayBuffer");function hs(n,e,t){e>>>=0;var r=n.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(t===void 0)t=r;else if(t>>>=0,t>r)throw new RangeError("'length' is out of bounds");return Nn?Buffer.from(n.slice(e,e+t)):new Buffer(new Uint8Array(n.slice(e,e+t)))}a(hs,"fromArrayBuffer");function gs(n,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return Nn?Buffer.from(n,e):new Buffer(n,e)}a(gs,"fromString");function bs(n,e,t){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return ms(n)?hs(n,e,t):typeof n=="string"?gs(n,e):Nn?Buffer.from(n):new Buffer(n)}a(bs,"bufferFrom");ti.exports=bs});var ci=q((Ie,An)=>{var ys=ei().SourceMapConsumer,Cn=require("path"),re;try{re=require("fs"),(!re.existsSync||!re.readFileSync)&&(re=null)}catch{}var ws=ni();function ri(n,e){return n.require(e)}a(ri,"dynamicRequire");var ii=!1,oi=!1,Pn=!1,rt="auto",Me={},it={},Ss=/^data:application\/json[^,]+base64,/,fe=[],me=[];function Fn(){return rt==="browser"?!0:rt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}a(Fn,"isInBrowser");function vs(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}a(vs,"hasGlobalProcessEventEmitter");function Es(){return typeof process=="object"&&process!==null?process.version:""}a(Es,"globalProcessVersion");function xs(){if(typeof process=="object"&&process!==null)return process.stderr}a(xs,"globalProcessStderr");function Ms(n){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(n)}a(Ms,"globalProcessExit");function Ct(n){return function(e){for(var t=0;t<n.length;t++){var r=n[t](e);if(r)return r}return null}}a(Ct,"handlerExec");var On=Ct(fe);fe.push(function(n){if(n=n.trim(),/^file:/.test(n)&&(n=n.replace(/file:\/\/\/(\w:)?/,function(r,i){return i?"":"/"})),n in Me)return Me[n];var e="";try{if(re)re.existsSync(n)&&(e=re.readFileSync(n,"utf8"));else{var t=new XMLHttpRequest;t.open("GET",n,!1),t.send(null),t.readyState===4&&t.status===200&&(e=t.responseText)}}catch{}return Me[n]=e});function kn(n,e){if(!n)return e;var t=Cn.dirname(n),r=/^\w+:\/\/[^\/]*/.exec(t),i=r?r[0]:"",o=t.slice(i.length);return i&&/^\/\w\:/.test(o)?(i+="/",i+Cn.resolve(t.slice(i.length),e).replace(/\\/g,"/")):i+Cn.resolve(t.slice(i.length),e)}a(kn,"supportRelativeURL");function Is(n){var e;if(Fn())try{var t=new XMLHttpRequest;t.open("GET",n,!1),t.send(null),e=t.readyState===4?t.responseText:null;var r=t.getResponseHeader("SourceMap")||t.getResponseHeader("X-SourceMap");if(r)return r}catch{}e=On(n);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,o,s;s=i.exec(e);)o=s;return o?o[1]:null}a(Is,"retrieveSourceMapURL");var Rn=Ct(me);me.push(function(n){var e=Is(n);if(!e)return null;var t;if(Ss.test(e)){var r=e.slice(e.indexOf(",")+1);t=ws(r,"base64").toString(),e=n}else e=kn(n,e),t=On(e);return t?{url:e,map:t}:null});function Dn(n){var e=it[n.source];if(!e){var t=Rn(n.source);t?(e=it[n.source]={url:t.url,map:new ys(t.map)},e.map.sourcesContent&&e.map.sources.forEach(function(i,o){var s=e.map.sourcesContent[o];if(s){var l=kn(e.url,i);Me[l]=s}})):e=it[n.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var r=e.map.originalPositionFor(n);if(r.source!==null)return r.source=kn(e.url,r.source),r}return n}a(Dn,"mapSourcePosition");function ai(n){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(n);if(e){var t=Dn({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+t.source+":"+t.line+":"+(t.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(n),e?"eval at "+e[1]+" ("+ai(e[2])+")":n}a(ai,"mapEvalOrigin");function Ts(){var n,e="";if(this.isNative())e="native";else{n=this.getScriptNameOrSourceURL(),!n&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),n?e+=n:e+="<anonymous>";var t=this.getLineNumber();if(t!=null){e+=":"+t;var r=this.getColumnNumber();r&&(e+=":"+r)}}var i="",o=this.getFunctionName(),s=!0,l=this.isConstructor(),u=!(this.isToplevel()||l);if(u){var c=this.getTypeName();c==="[object Object]"&&(c="null");var d=this.getMethodName();o?(c&&o.indexOf(c)!=0&&(i+=c+"."),i+=o,d&&o.indexOf("."+d)!=o.length-d.length-1&&(i+=" [as "+d+"]")):i+=c+"."+(d||"<anonymous>")}else l?i+="new "+(o||"<anonymous>"):o?i+=o:(i+=e,s=!1);return s&&(i+=" ("+e+")"),i}a(Ts,"CallSiteToString");function si(n){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(function(t){e[t]=/^(?:is|get)/.test(t)?function(){return n[t].call(n)}:n[t]}),e.toString=Ts,e}a(si,"cloneCallSite");function li(n,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),n.isNative())return e.curPosition=null,n;var t=n.getFileName()||n.getScriptNameOrSourceURL();if(t){var r=n.getLineNumber(),i=n.getColumnNumber()-1,o=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=o.test(Es())?0:62;r===1&&i>s&&!Fn()&&!n.isEval()&&(i-=s);var l=Dn({source:t,line:r,column:i});e.curPosition=l,n=si(n);var u=n.getFunctionName;return n.getFunctionName=function(){return e.nextPosition==null?u():e.nextPosition.name||u()},n.getFileName=function(){return l.source},n.getLineNumber=function(){return l.line},n.getColumnNumber=function(){return l.column+1},n.getScriptNameOrSourceURL=function(){return l.source},n}var c=n.isEval()&&n.getEvalOrigin();return c&&(c=ai(c),n=si(n),n.getEvalOrigin=function(){return c}),n}a(li,"wrapCallSite");function Ls(n,e){Pn&&(Me={},it={});for(var t=n.name||"Error",r=n.message||"",i=t+": "+r,o={nextPosition:null,curPosition:null},s=[],l=e.length-1;l>=0;l--)s.push(`
at `+li(e[l],o)),o.nextPosition=o.curPosition;return o.curPosition=o.nextPosition=null,i+s.reverse().join("")}a(Ls,"prepareStackTrace");function ui(n){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(n.stack);if(e){var t=e[1],r=+e[2],i=+e[3],o=Me[t];if(!o&&re&&re.existsSync(t))try{o=re.readFileSync(t,"utf8")}catch{o=""}if(o){var s=o.split(/(?:\r\n|\r|\n)/)[r-1];if(s)return t+":"+r+`
`+s+`
`+new Array(i).join(" ")+"^"}}return null}a(ui,"getErrorSource");function Ns(n){var e=ui(n),t=xs();t&&t._handle&&t._handle.setBlocking&&t._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(n.stack),Ms(1)}a(Ns,"printErrorAndExit");function Cs(){var n=process.emit;process.emit=function(e){if(e==="uncaughtException"){var t=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(t&&!r)return Ns(arguments[1])}return n.apply(this,arguments)}}a(Cs,"shimEmitUncaughtException");var Ps=fe.slice(0),ks=me.slice(0);Ie.wrapCallSite=li;Ie.getErrorSource=ui;Ie.mapSourcePosition=Dn;Ie.retrieveSourceMap=Rn;Ie.install=function(n){if(n=n||{},n.environment&&(rt=n.environment,["node","browser","auto"].indexOf(rt)===-1))throw new Error("environment "+rt+" was unknown. Available options are {auto, browser, node}");if(n.retrieveFile&&(n.overrideRetrieveFile&&(fe.length=0),fe.unshift(n.retrieveFile)),n.retrieveSourceMap&&(n.overrideRetrieveSourceMap&&(me.length=0),me.unshift(n.retrieveSourceMap)),n.hookRequire&&!Fn()){var e=ri(An,"module"),t=e.prototype._compile;t.__sourceMapSupport||(e.prototype._compile=function(o,s){return Me[s]=o,it[s]=void 0,t.call(this,o,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Pn||(Pn="emptyCacheBetweenOperations"in n?n.emptyCacheBetweenOperations:!1),ii||(ii=!0,Error.prepareStackTrace=Ls),!oi){var r="handleUncaughtExceptions"in n?n.handleUncaughtExceptions:!0;try{var i=ri(An,"worker_threads");i.isMainThread===!1&&(r=!1)}catch{}r&&vs()&&(oi=!0,Cs())}};Ie.resetRetrieveHandlers=function(){fe.length=0,me.length=0,fe=Ps.slice(0),me=ks.slice(0),Rn=Ct(me),On=Ct(fe)}});var Bn=q(()=>{ci().install()});function Rs(n){let e=Pt(Ue("!"),Ue("~")+1).concat(Pt(Ue("\xA1"),Ue("\xAC")+1),Pt(Ue("\xAE"),Ue("\xFF")+1)),t=e.slice(),r=0;for(let o=0;o<2**8;o++)e.includes(o)||(e.push(o),t.push(2**8+r),r=r+1);let i=t.map(o=>As(o));for(let o=0;o<e.length;o++)n.set(e[o],i[o])}function _i(n){let e=new Set,t=n[0];for(let r=1;r<n.length;r++){let i=n[r];e.add([t,i]),t=i}return e}function ee(n="cl100k"){let e=pi.get(n);return e!==void 0||(n==="mock"?e=new qn:e=new zn(n),pi.set(n,e)),e}var Wn,Un,kt,Pt,Ue,As,Fs,di,Os,At,pi,zn,qn,fi=T(()=>{"use strict";Wn=xt(require("fs")),Un=xt(require("path")),kt=require("util"),Pt=a((n,e)=>Array.from(Array(e).keys()).slice(n),"range"),Ue=a(n=>n.charCodeAt(0),"ord"),As=a(n=>String.fromCharCode(n),"chr"),Fs=new kt.TextDecoder("utf-8"),di=a(n=>Fs.decode(new Uint8Array(n)),"decodeStr"),Os=a((n,e)=>{let t=new Map;return n.forEach((r,i)=>{t.set(n[i],e[i])}),t},"dictZip");a(Rs,"bytes_to_unicode");a(_i,"get_char_pairs");At=(t=>(t.cl100k="cl100k",t.mock="mock",t))(At||{}),pi=new Map;a(ee,"getTokenizer");zn=class{constructor(e="cl100k"){this.decoder=new Map;this.byte_encoder=new Map;this.byte_decoder=new Map;this.cache=new Map;this.textEncoder=new kt.TextEncoder;this.encodeStr=e=>Array.from(this.textEncoder.encode(e));let t="",r="";if(e==="cl100k")t="vocab_cushman002.bpe",r="tokenizer_cushman002.json",this.pat=/'s|'t|'re|'ve|'m|'ll|'d|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;else throw new Error(`Unknown tokenizer name: ${e}`);let i,o;try{let l=Wn.readFileSync(Un.resolve(__dirname,"resources",e,r));i=JSON.parse(l.toString()),o=Wn.readFileSync(Un.resolve(__dirname,"resources",e,t),"utf-8")}catch(l){if((l.code==="ENOENT"||l.code==="EIO"||l.code==="EACCES"||l.code==="EPERM")&&l instanceof Error||l instanceof SyntaxError){let u=new Error(`Could not load tokenizer: ${e}`);throw u.code="CopilotPromptLoadFailure",u}throw l}this.encoder=new Map(Object.entries(i));for(let[l,u]of this.encoder)this.decoder.set(u,l);let s=o.split(`
`).slice(1).filter(l=>l.trim().length>0);this.bpe_ranks=Os(s,Pt(0,s.length)),Rs(this.byte_encoder),this.byte_encoder.forEach((l,u,c)=>{this.byte_decoder.set(l,u)})}static{a(this,"BPETokenizer")}byteEncodeStr(e){return this.encodeStr(e).map(t=>this.byte_encoder.get(t))}mutatingConcat(e,t){for(let r=0;r<t.length;r++)e.push(t[r]);return e}bpe(e){if(this.cache.has(e))return this.cache.get(e);let t=this.byteEncodeStr(e),r=_i(t);if(!r)return t.map(o=>this.encoder.get(o));for(;;){let o=new Map;r.forEach(p=>{let m=p.join(" "),h=this.bpe_ranks.get(m);o.set(h===void 0||isNaN(h)?1e11:h,p)});let s=Array.from(o.keys()).map(p=>Number(p)),l=o.get(Math.min(...s));if(!l||!this.bpe_ranks.has(l.join(" ")))break;let u=l[0],c=l[1],d=[],_=0;for(;_<t.length;){let p=t.indexOf(u,_);if(p===-1){this.mutatingConcat(d,t.slice(_));break}this.mutatingConcat(d,t.slice(_,p)),_=p,t[_]===u&&_<t.length-1&&t[_+1]===c?(d.push(u+c),_=_+2):(d.push(t[_]),_=_+1)}if(t=d,t.length===1)break;r=_i(t)}let i=t.map(o=>this.encoder.get(o));return this.cache.set(e,i),i}tokenize(e){let t=[],r=Array.from(e.matchAll(this.pat)).map(i=>i[0]);for(let i of r){let o=this.bpe(i);this.mutatingConcat(t,o)}return t}tokenLength(e){return this.tokenize(e).length}takeLastTokens(e,t){if(t<=0)return"";let r=4,i=1,o=Math.min(e.length,t*r),s=e.slice(-o),l=this.tokenize(s);for(;l.length<t+2&&o<e.length;)o=Math.min(e.length,o+t*i),s=e.slice(-o),l=this.tokenize(s);return l.length<t?e:(l=l.slice(-t),this.detokenize(l))}takeFirstTokens(e,t){if(t<=0)return{text:"",tokens:[]};let r=4,i=1,o=Math.min(e.length,t*r),s=e.slice(0,o),l=this.tokenize(s);for(;l.length<t+2&&o<e.length;)o=Math.min(e.length,o+t*i),s=e.slice(0,o),l=this.tokenize(s);return l.length<t?{text:e,tokens:l}:(l=l.slice(0,t),{text:this.detokenize(l),tokens:l})}takeLastLinesTokens(e,t){let r=this.takeLastTokens(e,t);if(r.length===e.length||e[e.length-r.length-1]===`
`)return r;let i=r.indexOf(`
`);return r.substring(i+1)}detokenize(e){let t=e.map(r=>this.decoder.get(r)).join("");return t=di(t.split("").map(r=>this.byte_decoder.get(r))),t}tokenizeStrings(e){return this.tokenize(e).map(r=>di(this.decoder.get(r).split("").map(i=>this.byte_decoder.get(i))))}},qn=class{constructor(){this.hash=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=(t<<5)-t+i,t&=t&65535}return t}}static{a(this,"MockTokenizer")}tokenize(e){return this.tokenizeStrings(e).map(this.hash)}detokenize(e){return e.map(t=>t.toString()).join(" ")}tokenizeStrings(e){return e.split(/\b/)}tokenLength(e){return this.tokenizeStrings(e).length}takeLastTokens(e,t){return this.tokenizeStrings(e).slice(-t).join("")}takeFirstTokens(e,t){let r=this.tokenizeStrings(e).slice(0,t);return{text:r.join(""),tokens:r.map(this.hash)}}takeLastLinesTokens(e,t){let r=this.takeLastTokens(e,t);if(r.length===e.length||e[e.length-r.length-1]===`
`)return r;let i=r.indexOf(`
`);return r.substring(i+1)}}});var ze=T(()=>{"use strict";fi()});function Ft(n,e,t){return{type:"virtual",indentation:n,subs:e,label:t}}function jn(n,e,t,r,i){if(t==="")throw new Error("Cannot create a line node with an empty source line");return{type:"line",indentation:n,lineNumber:e,sourceLine:t,subs:r,label:i}}function Ot(n){return{type:"blank",lineNumber:n,subs:[]}}function ot(n){return{type:"top",indentation:-1,subs:n??[]}}function R(n){return n.type==="blank"}function te(n){return n.type==="line"}function Z(n){return n.type==="virtual"}function he(n){return n.type==="top"}function Ds(n,e){function t(r){if(!Z(r)&&!he(r)&&r.lineNumber===e)return r.subs=[],!0;for(let i=0;i<r.subs.length;i++)if(t(r.subs[i]))return r.subs=r.subs.slice(0,i+1),!0;return!1}a(t,"cut"),t(n)}function Bs(n){return JSON.parse(JSON.stringify(n))}var Te=T(()=>{"use strict";a(Ft,"virtualNode");a(jn,"lineNode");a(Ot,"blankNode");a(ot,"topNode");a(R,"isBlank");a(te,"isLine");a(Z,"isVirtual");a(he,"isTop");a(Ds,"cutTreeAfterLine");a(Bs,"duplicateTree")});function mi(n){return D(n,e=>{e.label=void 0},"bottomUp"),n}function Hn(n,e){return D(n,t=>{t.label=t.label?e(t.label)?void 0:t.label:void 0},"bottomUp"),n}function ie(n,e){switch(n.type){case"line":case"virtual":let t=n.subs.map(r=>ie(r,e));return{...n,subs:t,label:n.label?e(n.label):void 0};case"blank":return{...n,label:n.label?e(n.label):void 0};case"top":return{...n,subs:n.subs.map(r=>ie(r,e)),label:n.label?e(n.label):void 0}}}function Ws(n){let e=0;function t(r){!Z(r)&&!he(r)&&(r.lineNumber=e,e++)}a(t,"visitor"),D(n,t,"topDown")}function D(n,e,t){function r(i){t==="topDown"&&e(i),i.subs.forEach(o=>{r(o)}),t==="bottomUp"&&e(i)}a(r,"_visit"),r(n)}function Us(n,e,t){function r(i){if(t==="topDown"&&!e(i))return!1;let o=!0;return i.subs.forEach(s=>{o=o&&r(s)}),t==="bottomUp"&&(o=o&&e(i)),o}a(r,"_visit"),r(n)}function st(n,e,t,r){let i=e;function o(s){i=t(s,i)}return a(o,"visitor"),D(n,o,r),i}function at(n,e,t){let r=a(o=>{if(t!==void 0&&t(o))return o;{let s=o.subs.map(r).filter(l=>l!==void 0);return o.subs=s,e(o)}},"rebuild"),i=r(n);return i!==void 0?i:ot()}var qe=T(()=>{"use strict";Te();a(mi,"clearLabels");a(Hn,"clearLabelsIf");a(ie,"mapLabels");a(Ws,"resetLineNumbers");a(D,"visitTree");a(Us,"visitTreeConditionally");a(st,"foldTree");a(at,"rebuildTree")});function hi(n){let e=n.split(`
`),t=e.map(c=>c.match(/^\s*/)[0].length),r=e.map(c=>c.trimLeft());function i(c){let[d,_]=o(c+1,t[c]);return[jn(t[c],c,r[c],d),_]}a(i,"parseNode");function o(c,d){let _,p=[],m=c,h;for(;m<r.length&&(r[m]===""||t[m]>d);)if(r[m]==="")h===void 0&&(h=m),m+=1;else{if(h!==void 0){for(let f=h;f<m;f++)p.push(Ot(f));h=void 0}[_,m]=i(m),p.push(_)}return h!==void 0&&(m=h),[p,m]}a(o,"parseSubs");let[s,l]=o(0,-1),u=l;for(;u<r.length&&r[u]==="";)s.push(Ot(u)),u+=1;if(u<r.length)throw new Error(`Parsing did not go to end of file. Ended at ${u} out of ${r.length}`);return ot(s)}function je(n,e){function t(r){if(te(r)){let i=e.find(o=>o.matches(r.sourceLine));i&&(r.label=i.label)}}a(t,"visitor"),D(n,t,"bottomUp")}function lt(n){function e(t){if(Z(t)&&t.label===void 0){let r=t.subs.filter(i=>!R(i));r.length===1&&(t.label=r[0].label)}}a(e,"visitor"),D(n,e,"bottomUp")}function He(n){return Object.keys(n).map(e=>{let t;return n[e].test?t=a(r=>n[e].test(r),"matches"):t=n[e],{matches:t,label:e}})}function Rt(n){let t=at(n,a(function(r){if(r.subs.length===0||r.subs.findIndex(s=>s.label==="closer"||s.label==="opener")===-1)return r;let i=[],o;for(let s=0;s<r.subs.length;s++){let l=r.subs[s],u=r.subs[s-1];if(l.label==="opener"&&u!==void 0&&te(u))u.subs.push(l),l.subs.forEach(c=>u.subs.push(c)),l.subs=[];else if(l.label==="closer"&&o!==void 0&&(te(l)||Z(l))&&l.indentation>=o.indentation){let c=i.length-1;for(;c>0&&R(i[c]);)c-=1;if(o.subs.push(...i.splice(c+1)),l.subs.length>0){let d=o.subs.findIndex(h=>h.label!=="newVirtual"),_=o.subs.slice(0,d),p=o.subs.slice(d),m=p.length>0?[Ft(l.indentation,p,"newVirtual")]:[];o.subs=[..._,...m,l]}else o.subs.push(l)}else i.push(l),R(l)||(o=l)}return r.subs=i,r},"rebuilder"));return Hn(n,r=>r==="newVirtual"),t}function Vn(n,e=R,t){return at(n,a(function(i){if(i.subs.length<=1)return i;let o=[],s=[],l,u=!1;function c(d=!1){if(l!==void 0&&(o.length>0||!d)){let _=Ft(l,s,t);o.push(_)}else s.forEach(_=>o.push(_))}a(c,"flushBlockIntoNewSubs");for(let d=0;d<i.subs.length;d++){let _=i.subs[d],p=e(_);!p&&u&&(c(),s=[]),u=p,s.push(_),R(_)||(l=l??_.indentation)}return c(!0),i.subs=o,i},"rebuilder"))}function oe(n){return at(n,a(function(t){return Z(t)&&t.label===void 0&&t.subs.length<=1?t.subs.length===0?void 0:t.subs[0]:(t.subs.length===1&&Z(t.subs[0])&&t.subs[0].label===void 0&&(t.subs=t.subs[0].subs),t)},"rebuilder"))}function Dt(n,e){gi[n]=e}function ge(n,e){let t=hi(n),r=gi[e??""];return r?r(t):(je(t,qs),Rt(t))}var zs,qs,gi,Ve=T(()=>{"use strict";Te();qe();a(hi,"parseRaw");a(je,"labelLines");a(lt,"labelVirtualInherited");a(He,"buildLabelRules");a(Rt,"combineClosersAndOpeners");a(Vn,"groupBlocks");a(oe,"flattenVirtual");zs={opener:/^[\[({]/,closer:/^[\])}]/},qs=He(zs),gi={};a(Dt,"registerLanguageSpecificParser");a(ge,"parseTree")});function bi(n){let e=n;return je(e,Hs),e=Rt(e),e=oe(e),lt(e),D(e,t=>{if(t.label==="class"||t.label==="interface")for(let r of t.subs)!R(r)&&(r.label===void 0||r.label==="annotation")&&(r.label="member")},"bottomUp"),e}var js,Hs,yi=T(()=>{"use strict";Te();qe();Ve();js={package:/^package /,import:/^import /,class:/\bclass /,interface:/\binterface /,javadoc:/^\/\*\*/,comment_multi:/^\/\*[^*]/,comment_single:/^\/\//,annotation:/^@/,opener:/^[\[({]/,closer:/^[\])}]/},Hs=He(js);a(bi,"processJava")});function wi(n){let e=n;if(je(e,Zs),R(e))return e;function t(o){if(o.label==="heading")return 1;if(o.label==="subheading")return 2;if(o.label==="subsubheading")return 3}a(t,"headingLevel");let r=[e],i=[...e.subs];e.subs=[];for(let o of i){let s=t(o);if(s===void 0||R(o))r[r.length-1].subs.push(o);else{for(;r.length<s;)r.push(r[r.length-1]);for(r[s-1].subs.push(o),r[s]=o;r.length>s+1;)r.pop()}}return e=Vn(e),e=oe(e),lt(e),e}var Vs,Zs,Si=T(()=>{"use strict";Te();Ve();Vs={heading:/^# /,subheading:/^## /,subsubheading:/### /},Zs=He(Vs);a(wi,"processMarkdown")});function ut(n){return" ".repeat(n.indentation)+n.sourceLine+`
`}function vi(n){function e(t,r){let i="";return te(t)?i=ut(t):R(t)&&(i=`
`),r+i}return a(e,"accumulator"),st(n,"",e,"topDown")}function $s(n,e){let t=new Set(e),r=[],i="";function o(s){s.label!==void 0&&t.has(s.label)?(i!==""&&r.push({label:void 0,source:i}),r.push({label:s.label,source:vi(s)}),i=""):(te(s)&&(i+=ut(s)),s.subs.forEach(o))}return a(o,"visit"),o(n),i!==""&&r.push({label:void 0,source:i}),r}function Ei(n,e=0){let t=" ".repeat(e);if(n===void 0)return"UNDEFINED NODE";let r;n.subs===void 0?r="UNDEFINED SUBS":r=n.subs.map(s=>Ei(s,e+2)).join(`,
`),r===""?r="[]":r=`[
${r}
${t}]`;let i=(Z(n)||he(n)?" ":String(n.lineNumber).padStart(3," "))+`: ${t}`,o=n.label===void 0?"":JSON.stringify(n.label);return Z(n)||he(n)?`${i}vnode(${n.indentation}, ${o}, ${r})`:R(n)?`${i}blank(${o??""})`:`${i}lnode(${n.indentation}, ${o}, ${JSON.stringify(n.sourceLine)}, ${r})`}function xi(n,e=""){let t=n.label===void 0?"":`, ${JSON.stringify(n.label)}`,r=!R(n)&&n.subs.length>0?`[
${n.subs.map(i=>xi(i,e+" ")).join(`,
`)}
${e}]`:"[]";switch(n.type){case"blank":return`${e}blankNode(${n.lineNumber}${t})`;case"top":return`topNode(${r}${t})`;case"virtual":return`${e}virtualNode(${n.indentation}, ${r}${t})`;case"line":return`${e}lineNode(${n.indentation}, ${n.lineNumber}, "${n.sourceLine}", ${r}${t})`}}function Mi(n){if(te(n)||R(n))return n.lineNumber;for(let e of n.subs){let t=Mi(e);if(t!==void 0)return t}}function Ii(n){let e,t=n.subs.length-1;for(;t>=0&&e===void 0;)e=Ii(n.subs[t]),t--;return e===void 0&&!Z(n)&&!he(n)?n.lineNumber:e}var Ti=T(()=>{"use strict";Te();qe();a(ut,"deparseLine");a(vi,"deparseTree");a($s,"deparseAndCutTree");a(Ei,"describeTree");a(xi,"encodeTree");a(Mi,"firstLineOf");a(Ii,"lastLineOf")});var ct=T(()=>{"use strict";yi();Si();Ve();Te();Ti();qe();Ve();Dt("markdown",wi);Dt("java",bi)});function Ze(n,e=Li){let t=ie(n,r=>r?1:void 0);return D(t,r=>{if(R(r))return;let i=Math.max(...r.subs.map(o=>o.label??0));r.label=Math.max(r.label??0,i*e.worthUp)},"bottomUp"),D(t,r=>{if(R(r))return;let i=r.subs.map(l=>l.label??0),o=[...i];for(let l=0;l<i.length;l++)i[l]!==0&&(o=o.map((u,c)=>Math.max(u,Math.pow(e.worthSibling,Math.abs(l-c))*i[l])));let s=r.label;s!==void 0&&(o=o.map(l=>Math.max(l,e.worthDown*s))),r.subs.forEach((l,u)=>l.label=o[u])},"topDown"),Ni(t)}function Ni(n){let e=st(n,[],(t,r)=>((t.type==="line"||t.type==="blank")&&r.push(t.type==="line"?[ut(t).trimEnd(),t.label??0]:["",t.label??0]),r),"topDown");return new dt(...e)}var Li,Bt=T(()=>{"use strict";ct();Zn();Li={worthUp:.9,worthSibling:.88,worthDown:.8};a(Ze,"fromTreeWithFocussedLines");a(Ni,"fromTreeWithValuedLines")});function $n(n,e=!0,t=!0){let r=typeof n=="string"?ge(n):ge(n.source,n.languageId);oe(r);let i=ie(r,o=>e&&o!=="closer");return D(i,o=>{o.label===void 0&&(o.label=e&&o.label!==!1)},"topDown"),e&&D(i,o=>{if(o.label){let s=!1;for(let l of[...o.subs].reverse())l.label&&!s?s=!0:l.label=!1}else for(let s of o.subs)s.label=!1;o.subs.length>0&&(o.label=!1)},"topDown"),t&&D(i,o=>{o.label||=(te(o)||R(o))&&o.lineNumber==0},"topDown"),Ze(i)}var Gn=T(()=>{"use strict";ct();Bt();a($n,"elidableTextForSourceCode")});var $e,Kn=T(()=>{"use strict";ze();$e=class n{constructor(e,t,r=ee().tokenLength(e+`
`),i="strict"){this.text=e;this._value=t;this._cost=r;if(e.includes(`
`)&&i!=="none")throw new Error("LineWithValueAndCost: text contains newline");if(t<0&&i!=="none")throw new Error("LineWithValueAndCost: value is negative");if(r<0&&i!=="none")throw new Error("LineWithValueAndCost: cost is negative");if(i=="strict"&&t>1)throw new Error("Value should normally be between 0 and 1 -- set validation to `loose` to ignore this error")}static{a(this,"LineWithValueAndCost")}get value(){return this._value}get cost(){return this._cost}adjustValue(e){return this._value*=e,this}recost(e=t=>ee().tokenLength(t+`
`)){return this._cost=e(this.text),this}copy(){return new n(this.text,this.value,this.cost,"none")}}});function Gs(n,e,t,r,i,o){if(o.tokenLength(t+`
`)>e)throw new Error("maxTokens must be larger than the ellipsis length");i==="removeLeastBangForBuck"&&n.forEach(_=>_.adjustValue(1/_.cost));let s=n.reduce((_,p)=>Math.max(_,p.value),0)+1,l=n.reduce((_,p)=>Math.max(_,p.text.length),0)+1,u=t.trim(),c=n.reduce((_,p)=>_+p.cost,0),d=n.length+1;for(;c>e&&d-->=-1;){let _=n.reduce((b,M)=>M.value<b.value?M:b),p=n.indexOf(_),m=n.slice(0,p+1).reverse().find(b=>b.text.trim()!=="")??{text:""},h=r?Math.min(m.text.match(/^\s*/)?.[0].length??0,n[p-1]?.text.trim()===u?n[p-1]?.text.match(/^\s*/)?.[0].length??0:l,n[p+1]?.text.trim()===u?n[p+1]?.text.match(/^\s*/)?.[0].length??0:l):0,f=" ".repeat(h)+t,g=new $e(f,s,o.tokenLength(f+`
`),"loose");n.splice(p,1,g),n[p+1]?.text.trim()===u&&n.splice(p+1,1),n[p-1]?.text.trim()===u&&n.splice(p-1,1);let S=n.reduce((b,M)=>b+M.cost,0);S>=c&&n.every(b=>b.value===s)&&(r=!1),c=S}if(d<0)throw new Error("Infinite loop in ElidableText.makePrompt: Defensive counter < 0 in ElidableText.makePrompt with end text");return n.map(_=>_.text).join(`
`)}var dt,Zn=T(()=>{"use strict";ze();Gn();Kn();dt=class n{constructor(...e){this.lines=[];let t=[];for(let r of e){let i=Array.isArray(r)?r[1]:1,o=Array.isArray(r)?r[0]:r;typeof o=="string"?o.split(`
`).forEach(s=>t.push(new $e(s,i))):o instanceof n?t.push(...o.lines.map(s=>s.copy().adjustValue(i))):"source"in o&&"languageId"in o&&t.push(...$n(o).lines.map(s=>s.copy().adjustValue(i)))}this.lines=t}static{a(this,"ElidableText")}adjust(e){this.lines.forEach(t=>t.adjustValue(e))}recost(e=t=>ee().tokenLength(t+`
`)){this.lines.forEach(t=>t.recost(e))}makePrompt(e,t="[...]",r=!0,i="removeLeastDesirable",o=ee()){let s=this.lines.map(l=>l.copy());return Gs(s,e,t,r,i,o)}};a(Gs,"makePrompt")});function de(){}function Ks(n,e,t,r,i){for(var o=0,s=e.length,l=0,u=0;o<s;o++){var c=e[o];if(c.removed){if(c.value=n.join(r.slice(u,u+c.count)),u+=c.count,o&&e[o-1].added){var _=e[o-1];e[o-1]=e[o],e[o]=_}}else{if(!c.added&&i){var d=t.slice(l,l+c.count);d=d.map(function(m,h){var f=r[u+h];return f.length>m.length?f:m}),c.value=n.join(d)}else c.value=n.join(t.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}var p=e[s-1];return s>1&&typeof p.value=="string"&&(p.added||p.removed)&&n.equals("",p.value)&&(e[s-2].value+=p.value,e.pop()),e}function Js(n){return{newPos:n.newPos,components:n.components.slice(0)}}function Qs(n,e,t){return er.diff(n,e,t)}function Wt(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wt=a(function(e){return typeof e},"_typeof"):Wt=a(function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},"_typeof"),Wt(n)}function Jn(n){return ea(n)||ta(n)||na(n)||ra()}function ea(n){if(Array.isArray(n))return Qn(n)}function ta(n){if(typeof Symbol<"u"&&Symbol.iterator in Object(n))return Array.from(n)}function na(n,e){if(n){if(typeof n=="string")return Qn(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Qn(n,e)}}function Qn(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function ra(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xn(n,e,t,r,i){e=e||[],t=t||[],r&&(n=r(i,n));var o;for(o=0;o<e.length;o+=1)if(e[o]===n)return t[o];var s;if(ia.call(n)==="[object Array]"){for(e.push(n),s=new Array(n.length),t.push(s),o=0;o<n.length;o+=1)s[o]=Xn(n[o],e,t,r,i);return e.pop(),t.pop(),s}if(n&&n.toJSON&&(n=n.toJSON()),Wt(n)==="object"&&n!==null){e.push(n),s={},t.push(s);var l=[],u;for(u in n)n.hasOwnProperty(u)&&l.push(u);for(l.sort(),o=0;o<l.length;o+=1)u=l[o],s[u]=Xn(n[u],e,t,r,u);e.pop(),t.pop()}else s=n;return s}function Ai(n,e,t,r,i,o,s){s||(s={}),typeof s.context>"u"&&(s.context=4);var l=Qs(t,r,s);if(!l)return;l.push({value:"",lines:[]});function u(S){return S.map(function(b){return" "+b})}a(u,"contextLines");for(var c=[],d=0,_=0,p=[],m=1,h=1,f=a(function(b){var M=l[b],N=M.lines||M.value.replace(/\n$/,"").split(`
`);if(M.lines=N,M.added||M.removed){var H;if(!d){var Q=l[b-1];d=m,_=h,Q&&(p=s.context>0?u(Q.lines.slice(-s.context)):[],d-=p.length,_-=p.length)}(H=p).push.apply(H,Jn(N.map(function(w){return(M.added?"+":"-")+w}))),M.added?h+=N.length:m+=N.length}else{if(d)if(N.length<=s.context*2&&b<l.length-2){var O;(O=p).push.apply(O,Jn(u(N)))}else{var W,X=Math.min(N.length,s.context);(W=p).push.apply(W,Jn(u(N.slice(0,X))));var A={oldStart:d,oldLines:m-d+X,newStart:_,newLines:h-_+X,lines:p};if(b>=l.length-2&&N.length<=s.context){var U=/\n$/.test(t),P=/\n$/.test(r),y=N.length==0&&p.length>A.oldLines;!U&&y&&t.length>0&&p.splice(A.oldLines,0,"\\ No newline at end of file"),(!U&&!y||!P)&&p.push("\\ No newline at end of file")}c.push(A),d=0,_=0,p=[]}m+=N.length,h+=N.length}},"_loop"),g=0;g<l.length;g++)f(g);return{oldFileName:n,newFileName:e,oldHeader:i,newHeader:o,hunks:c}}var Ku,Ci,Pi,ki,er,Xs,Ys,ia,_t,Yn,Fi=T(()=>{a(de,"Diff");de.prototype={diff:a(function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var o=this;function s(f){return i?(setTimeout(function(){i(void 0,f)},0),!0):f}a(s,"done"),e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var l=t.length,u=e.length,c=1,d=l+u;r.maxEditLength&&(d=Math.min(d,r.maxEditLength));var _=[{newPos:-1,components:[]}],p=this.extractCommon(_[0],t,e,0);if(_[0].newPos+1>=l&&p+1>=u)return s([{value:this.join(t),count:t.length}]);function m(){for(var f=-1*c;f<=c;f+=2){var g=void 0,S=_[f-1],b=_[f+1],M=(b?b.newPos:0)-f;S&&(_[f-1]=void 0);var N=S&&S.newPos+1<l,H=b&&0<=M&&M<u;if(!N&&!H){_[f]=void 0;continue}if(!N||H&&S.newPos<b.newPos?(g=Js(b),o.pushComponent(g.components,void 0,!0)):(g=S,g.newPos++,o.pushComponent(g.components,!0,void 0)),M=o.extractCommon(g,t,e,f),g.newPos+1>=l&&M+1>=u)return s(Ks(o,g.components,t,e,o.useLongestToken));_[f]=g}c++}if(a(m,"execEditLength"),i)a(function f(){setTimeout(function(){if(c>d)return i();m()||f()},0)},"exec")();else for(;c<=d;){var h=m();if(h)return h}},"diff"),pushComponent:a(function(e,t,r){var i=e[e.length-1];i&&i.added===t&&i.removed===r?e[e.length-1]={count:i.count+1,added:t,removed:r}:e.push({count:1,added:t,removed:r})},"pushComponent"),extractCommon:a(function(e,t,r,i){for(var o=t.length,s=r.length,l=e.newPos,u=l-i,c=0;l+1<o&&u+1<s&&this.equals(t[l+1],r[u+1]);)l++,u++,c++;return c&&e.components.push({count:c}),e.newPos=l,u},"extractCommon"),equals:a(function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},"equals"),removeEmpty:a(function(e){for(var t=[],r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t},"removeEmpty"),castInput:a(function(e){return e},"castInput"),tokenize:a(function(e){return e.split("")},"tokenize"),join:a(function(e){return e.join("")},"join")};a(Ks,"buildValues");a(Js,"clonePath");Ku=new de,Ci=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Pi=/\S/,ki=new de;ki.equals=function(n,e){return this.options.ignoreCase&&(n=n.toLowerCase(),e=e.toLowerCase()),n===e||this.options.ignoreWhitespace&&!Pi.test(n)&&!Pi.test(e)};ki.tokenize=function(n){for(var e=n.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<e.length-1;t++)!e[t+1]&&e[t+2]&&Ci.test(e[t])&&Ci.test(e[t+2])&&(e[t]+=e[t+2],e.splice(t+1,2),t--);return e};er=new de;er.tokenize=function(n){var e=[],t=n.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var r=0;r<t.length;r++){var i=t[r];r%2&&!this.options.newlineIsToken?e[e.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),e.push(i))}return e};a(Qs,"diffLines");Xs=new de;Xs.tokenize=function(n){return n.split(/(\S.+?[.!?])(?=\s+|$)/)};Ys=new de;Ys.tokenize=function(n){return n.split(/([{}:;,]|\s+)/)};a(Wt,"_typeof");a(Jn,"_toConsumableArray");a(ea,"_arrayWithoutHoles");a(ta,"_iterableToArray");a(na,"_unsupportedIterableToArray");a(Qn,"_arrayLikeToArray");a(ra,"_nonIterableSpread");ia=Object.prototype.toString,_t=new de;_t.useLongestToken=!0;_t.tokenize=er.tokenize;_t.castInput=function(n){var e=this.options,t=e.undefinedReplacement,r=e.stringifyReplacer,i=r===void 0?function(o,s){return typeof s>"u"?t:s}:r;return typeof n=="string"?n:JSON.stringify(Xn(n,null,null,i),i," ")};_t.equals=function(n,e){return de.prototype.equals.call(_t,n.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};a(Xn,"canonicalize");Yn=new de;Yn.tokenize=function(n){return n.slice()};Yn.join=Yn.removeEmpty=function(n){return n};a(Ai,"structuredPatch")});function sa(n,e){let t=typeof n=="string"?typeof e=="string"?void 0:e.languageId:typeof e=="string"||n.languageId===e.languageId?n.languageId:void 0;n=typeof n=="string"?n:n.source,e=typeof e=="string"?e:e.source;let r=Ai("","",n,e),i=new Set,o=new Set;for(let u of r.hunks){for(let c=u.oldStart;c<u.oldStart+u.oldLines;c++)i.add(c);for(let c=u.newStart;c<u.newStart+u.newLines;c++)o.add(c)}let s=ie(oe(ge(n,t)),()=>!1),l=ie(oe(ge(e,t)),()=>!1);return D(s,u=>{(u.type==="line"||u.type==="blank")&&i.has(u.lineNumber)&&(u.label=!0)},"topDown"),D(l,u=>{(u.type==="line"||u.type==="blank")&&o.has(u.lineNumber)&&(u.label=!0)},"topDown"),[Ze(s),Ze(l)]}var Oi=T(()=>{"use strict";Fi();ct();Bt();a(sa,"elidableTextForDiff")});var Ri=T(()=>{"use strict";Zn();Oi();Bt();Gn();Kn()});var Di={};Lr(Di,{FileSystem:()=>pt,defaultFileSystem:()=>nr});var tr,pt,nr,Ut=T(()=>{"use strict";tr=require("fs"),pt=class{static{a(this,"FileSystem")}},nr={readFile(n){return tr.promises.readFile(n)},async stat(n){let e=await tr.promises.stat(n);return{ctime:e.ctimeMs,mtime:e.mtimeMs,size:e.size}}}});function la({source:n}){return n.startsWith("#!")||n.startsWith("<!DOCTYPE")}function ft(n,e){let t=zt[e];if(t){let r=t.end==""?"":" "+t.end;return`${t.start} ${n}${r}`}return""}function qt(n,e){if(!zt[e]||n==="")return"";let t=n.endsWith(`
`),i=(t?n.slice(0,-1):n).split(`
`).map(o=>ft(o,e)).join(`
`);return t?i+`
`:i}function Wi(n){let{languageId:e}=n;return aa.indexOf(e)===-1&&!la(n)?e in Bi?Bi[e]:ft(`Language: ${e}`,e):""}function Ui(n){return n.relativePath?ft(`Path: ${n.relativePath}`,n.languageId):""}function be(n){return n===""||n.endsWith(`
`)?n:n+`
`}var zt,aa,Bi,Le=T(()=>{"use strict";zt={abap:{start:'"',end:""},bat:{start:"REM",end:""},bibtex:{start:"%",end:""},blade:{start:"#",end:""},c:{start:"//",end:""},clojure:{start:";",end:""},coffeescript:{start:"//",end:""},cpp:{start:"//",end:""},csharp:{start:"//",end:""},css:{start:"/*",end:"*/"},dart:{start:"//",end:""},dockerfile:{start:"#",end:""},elixir:{start:"#",end:""},erb:{start:"<%#",end:"%>"},erlang:{start:"%",end:""},fsharp:{start:"//",end:""},go:{start:"//",end:""},groovy:{start:"//",end:""},haml:{start:"-#",end:""},handlebars:{start:"{{!",end:"}}"},haskell:{start:"--",end:""},html:{start:"<!--",end:"-->"},ini:{start:";",end:""},java:{start:"//",end:""},javascript:{start:"//",end:""},javascriptreact:{start:"//",end:""},jsonc:{start:"//",end:""},jsx:{start:"//",end:""},julia:{start:"#",end:""},kotlin:{start:"//",end:""},latex:{start:"%",end:""},less:{start:"//",end:""},lua:{start:"--",end:""},makefile:{start:"#",end:""},markdown:{start:"[]: #",end:""},"objective-c":{start:"//",end:""},"objective-cpp":{start:"//",end:""},perl:{start:"#",end:""},php:{start:"//",end:""},powershell:{start:"#",end:""},pug:{start:"//",end:""},python:{start:"#",end:""},ql:{start:"//",end:""},r:{start:"#",end:""},razor:{start:"<!--",end:"-->"},ruby:{start:"#",end:""},rust:{start:"//",end:""},sass:{start:"//",end:""},scala:{start:"//",end:""},scss:{start:"//",end:""},shellscript:{start:"#",end:""},slim:{start:"/",end:""},solidity:{start:"//",end:""},sql:{start:"--",end:""},stylus:{start:"//",end:""},svelte:{start:"<!--",end:"-->"},swift:{start:"//",end:""},terraform:{start:"#",end:""},tex:{start:"%",end:""},typescript:{start:"//",end:""},typescriptreact:{start:"//",end:""},vb:{start:"'",end:""},verilog:{start:"//",end:""},"vue-html":{start:"<!--",end:"-->"},vue:{start:"//",end:""},xml:{start:"<!--",end:"-->"},xsl:{start:"<!--",end:"-->"},yaml:{start:"#",end:""}},aa=["php","plaintext"],Bi={html:"<!DOCTYPE html>",python:"#!/usr/bin/env python3",ruby:"#!/usr/bin/env ruby",shellscript:"#!/bin/sh",yaml:"# YAML data"};a(la,"hasLanguageMarker");a(ft,"comment");a(qt,"commentBlockAsSingles");a(Wi,"getLanguageMarker");a(Ui,"getPathMarker");a(be,"newLineEnded")});var zi=q((exports,module)=>{var Module=Module!==void 0?Module:{},TreeSitter=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{static{a(this,"Parser")}constructor(){this.initialize()}initialize(){throw new Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){return initPromise||(Module=Object.assign({},Module,moduleOptions),initPromise=new Promise(resolveInitPromise=>{var moduleOverrides=Object.assign({},Module),arguments_=[],thisProgram="./this.program",quit_=a((n,e)=>{throw e},"quit_"),ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",scriptDirectory="",read_,readAsync,readBinary,setWindowTitle;function locateFile(n){return Module.locateFile?Module.locateFile(n,scriptDirectory):scriptDirectory+n}a(locateFile,"locateFile");function logExceptionOnExit(n){n instanceof ExitStatus||err("exiting due to exception: "+n)}if(a(logExceptionOnExit,"logExceptionOnExit"),ENVIRONMENT_IS_NODE){var fs=require("fs"),nodePath=require("path");scriptDirectory=ENVIRONMENT_IS_WORKER?nodePath.dirname(scriptDirectory)+"/":__dirname+"/",read_=a((n,e)=>(n=isFileURI(n)?new URL(n):nodePath.normalize(n),fs.readFileSync(n,e?void 0:"utf8")),"read_"),readBinary=a(n=>{var e=read_(n,!0);return e.buffer||(e=new Uint8Array(e)),e},"readBinary"),readAsync=a((n,e,t)=>{n=isFileURI(n)?new URL(n):nodePath.normalize(n),fs.readFile(n,function(r,i){r?t(r):e(i.buffer)})},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),quit_=a((n,e)=>{if(keepRuntimeAlive())throw process.exitCode=n,e;logExceptionOnExit(e),process.exit(n)},"quit_"),Module.inspect=function(){return"[Emscripten Module object]"}}else(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(ENVIRONMENT_IS_WORKER?scriptDirectory=self.location.href:document!==void 0&&document.currentScript&&(scriptDirectory=document.currentScript.src),scriptDirectory=scriptDirectory.indexOf("blob:")!==0?scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1):"",read_=a(n=>{var e=new XMLHttpRequest;return e.open("GET",n,!1),e.send(null),e.responseText},"read_"),ENVIRONMENT_IS_WORKER&&(readBinary=a(n=>{var e=new XMLHttpRequest;return e.open("GET",n,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)},"readBinary")),readAsync=a((n,e,t)=>{var r=new XMLHttpRequest;r.open("GET",n,!0),r.responseType="arraybuffer",r.onload=()=>{r.status==200||r.status==0&&r.response?e(r.response):t()},r.onerror=t,r.send(null)},"readAsync"),setWindowTitle=a(n=>document.title=n,"setWindowTitle"));var out=Module.print||console.log.bind(console),err=Module.printErr||console.warn.bind(console);Object.assign(Module,moduleOverrides),moduleOverrides=null,Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.quit&&(quit_=Module.quit);var STACK_ALIGN=16,dynamicLibraries=Module.dynamicLibraries||[],wasmBinary;Module.wasmBinary&&(wasmBinary=Module.wasmBinary);var noExitRuntime=Module.noExitRuntime||!0,wasmMemory;typeof WebAssembly!="object"&&abort("no native wasm support detected");var ABORT=!1,EXITSTATUS,UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function UTF8ArrayToString(n,e,t){for(var r=e+t,i=e;n[i]&&!(i>=r);)++i;if(i-e>16&&n.buffer&&UTF8Decoder)return UTF8Decoder.decode(n.subarray(e,i));for(var o="";e<i;){var s=n[e++];if(128&s){var l=63&n[e++];if((224&s)!=192){var u=63&n[e++];if((s=(240&s)==224?(15&s)<<12|l<<6|u:(7&s)<<18|l<<12|u<<6|63&n[e++])<65536)o+=String.fromCharCode(s);else{var c=s-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&s)<<6|l)}else o+=String.fromCharCode(s)}return o}a(UTF8ArrayToString,"UTF8ArrayToString");function UTF8ToString(n,e){return n?UTF8ArrayToString(HEAPU8,n,e):""}a(UTF8ToString,"UTF8ToString");function stringToUTF8Array(n,e,t,r){if(!(r>0))return 0;for(var i=t,o=t+r-1,s=0;s<n.length;++s){var l=n.charCodeAt(s);if(l>=55296&&l<=57343&&(l=65536+((1023&l)<<10)|1023&n.charCodeAt(++s)),l<=127){if(t>=o)break;e[t++]=l}else if(l<=2047){if(t+1>=o)break;e[t++]=192|l>>6,e[t++]=128|63&l}else if(l<=65535){if(t+2>=o)break;e[t++]=224|l>>12,e[t++]=128|l>>6&63,e[t++]=128|63&l}else{if(t+3>=o)break;e[t++]=240|l>>18,e[t++]=128|l>>12&63,e[t++]=128|l>>6&63,e[t++]=128|63&l}}return e[t]=0,t-i}a(stringToUTF8Array,"stringToUTF8Array");function stringToUTF8(n,e,t){return stringToUTF8Array(n,HEAPU8,e,t)}a(stringToUTF8,"stringToUTF8");function lengthBytesUTF8(n){for(var e=0,t=0;t<n.length;++t){var r=n.charCodeAt(t);r<=127?e++:r<=2047?e+=2:r>=55296&&r<=57343?(e+=4,++t):e+=3}return e}a(lengthBytesUTF8,"lengthBytesUTF8");function updateGlobalBufferAndViews(n){buffer=n,Module.HEAP8=HEAP8=new Int8Array(n),Module.HEAP16=HEAP16=new Int16Array(n),Module.HEAP32=HEAP32=new Int32Array(n),Module.HEAPU8=HEAPU8=new Uint8Array(n),Module.HEAPU16=HEAPU16=new Uint16Array(n),Module.HEAPU32=HEAPU32=new Uint32Array(n),Module.HEAPF32=HEAPF32=new Float32Array(n),Module.HEAPF64=HEAPF64=new Float64Array(n)}a(updateGlobalBufferAndViews,"updateGlobalBufferAndViews");var INITIAL_MEMORY=Module.INITIAL_MEMORY||33554432;wasmMemory=Module.wasmMemory?Module.wasmMemory:new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768}),wasmMemory&&(buffer=wasmMemory.buffer),INITIAL_MEMORY=buffer.byteLength,updateGlobalBufferAndViews(buffer);var wasmTable=new WebAssembly.Table({initial:20,element:"anyfunc"}),__ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function keepRuntimeAlive(){return noExitRuntime}a(keepRuntimeAlive,"keepRuntimeAlive");function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}a(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}a(initRuntime,"initRuntime");function preMain(){callRuntimeCallbacks(__ATMAIN__)}a(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}a(postRun,"postRun");function addOnPreRun(n){__ATPRERUN__.unshift(n)}a(addOnPreRun,"addOnPreRun");function addOnInit(n){__ATINIT__.unshift(n)}a(addOnInit,"addOnInit");function addOnPostRun(n){__ATPOSTRUN__.unshift(n)}a(addOnPostRun,"addOnPostRun");var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function addRunDependency(n){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}a(addRunDependency,"addRunDependency");function removeRunDependency(n){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var e=dependenciesFulfilled;dependenciesFulfilled=null,e()}}a(removeRunDependency,"removeRunDependency");function abort(n){throw Module.onAbort&&Module.onAbort(n),err(n="Aborted("+n+")"),ABORT=!0,EXITSTATUS=1,n+=". Build with -sASSERTIONS for more info.",new WebAssembly.RuntimeError(n)}a(abort,"abort");var dataURIPrefix="data:application/octet-stream;base64,",wasmBinaryFile,tempDouble,tempI64;function isDataURI(n){return n.startsWith(dataURIPrefix)}a(isDataURI,"isDataURI");function isFileURI(n){return n.startsWith("file://")}a(isFileURI,"isFileURI");function getBinary(n){try{if(n==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(n);throw"both async and sync fetching of the wasm failed"}catch(e){abort(e)}}a(getBinary,"getBinary");function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile))return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+wasmBinaryFile+"'";return n.arrayBuffer()}).catch(function(){return getBinary(wasmBinaryFile)});if(readAsync)return new Promise(function(n,e){readAsync(wasmBinaryFile,function(t){n(new Uint8Array(t))},e)})}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}a(getBinaryPromise,"getBinaryPromise");function createWasm(){var n={env:asmLibraryArg,wasi_snapshot_preview1:asmLibraryArg,"GOT.mem":new Proxy(asmLibraryArg,GOTHandler),"GOT.func":new Proxy(asmLibraryArg,GOTHandler)};function e(i,o){var s=i.exports;s=relocateExports(s,1024);var l=getDylinkMetadata(o);l.neededDynlibs&&(dynamicLibraries=l.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(s,"main"),Module.asm=s,addOnInit(Module.asm.__wasm_call_ctors),__RELOC_FUNCS__.push(Module.asm.__wasm_apply_data_relocs),removeRunDependency("wasm-instantiate")}a(e,"t");function t(i){e(i.instance,i.module)}a(t,"r");function r(i){return getBinaryPromise().then(function(o){return WebAssembly.instantiate(o,n)}).then(function(o){return o}).then(i,function(o){err("failed to asynchronously prepare wasm: "+o),abort(o)})}if(a(r,"_"),addRunDependency("wasm-instantiate"),Module.instantiateWasm)try{return Module.instantiateWasm(n,e)}catch(i){return err("Module.instantiateWasm callback failed with error: "+i),!1}return wasmBinary||typeof WebAssembly.instantiateStreaming!="function"||isDataURI(wasmBinaryFile)||isFileURI(wasmBinaryFile)||ENVIRONMENT_IS_NODE||typeof fetch!="function"?r(t):fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(i){return WebAssembly.instantiateStreaming(i,n).then(t,function(o){return err("wasm streaming compile failed: "+o),err("falling back to ArrayBuffer instantiation"),r(t)})}),{}}a(createWasm,"createWasm"),wasmBinaryFile="tree-sitter.wasm",isDataURI(wasmBinaryFile)||(wasmBinaryFile=locateFile(wasmBinaryFile));var ASM_CONSTS={};function ExitStatus(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}a(ExitStatus,"ExitStatus");var GOT={},CurrentModuleWeakSymbols=new Set([]),GOTHandler={get:function(n,e){var t=GOT[e];return t||(t=GOT[e]=new WebAssembly.Global({value:"i32",mutable:!0})),CurrentModuleWeakSymbols.has(e)||(t.required=!0),t}};function callRuntimeCallbacks(n){for(;n.length>0;)n.shift()(Module)}a(callRuntimeCallbacks,"callRuntimeCallbacks");function getDylinkMetadata(n){var e=0,t=0;function r(){for(var S=0,b=1;;){var M=n[e++];if(S+=(127&M)*b,b*=128,!(128&M))break}return S}a(r,"_");function i(){var S=r();return UTF8ArrayToString(n,(e+=S)-S,S)}a(i,"n");function o(S,b){if(S)throw new Error(b)}a(o,"s");var s="dylink.0";if(n instanceof WebAssembly.Module){var l=WebAssembly.Module.customSections(n,s);l.length===0&&(s="dylink",l=WebAssembly.Module.customSections(n,s)),o(l.length===0,"need dylink section"),t=(n=new Uint8Array(l[0])).length}else{o(new Uint32Array(new Uint8Array(n.subarray(0,24)).buffer)[0]!=1836278016,"need to see wasm magic number"),o(n[8]!==0,"need the dylink section to be first"),e=9;var u=r();t=e+u,s=i()}var c={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(s=="dylink"){c.memorySize=r(),c.memoryAlign=r(),c.tableSize=r(),c.tableAlign=r();for(var d=r(),_=0;_<d;++_){var p=i();c.neededDynlibs.push(p)}}else for(o(s!=="dylink.0");e<t;){var m=n[e++],h=r();if(m===1)c.memorySize=r(),c.memoryAlign=r(),c.tableSize=r(),c.tableAlign=r();else if(m===2)for(d=r(),_=0;_<d;++_)p=i(),c.neededDynlibs.push(p);else if(m===3)for(var f=r();f--;){var g=i();256&r()&&c.tlsExports.add(g)}else if(m===4)for(f=r();f--;)i(),g=i(),(3&r())==1&&c.weakImports.add(g);else e+=h}return c}a(getDylinkMetadata,"getDylinkMetadata");function getValue(n,e="i8"){switch(e.endsWith("*")&&(e="*"),e){case"i1":case"i8":return HEAP8[n>>0];case"i16":return HEAP16[n>>1];case"i32":case"i64":return HEAP32[n>>2];case"float":return HEAPF32[n>>2];case"double":return HEAPF64[n>>3];case"*":return HEAPU32[n>>2];default:abort("invalid type for getValue: "+e)}return null}a(getValue,"getValue");function asmjsMangle(n){return n.indexOf("dynCall_")==0||["stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0"].includes(n)?n:"_"+n}a(asmjsMangle,"asmjsMangle");function mergeLibSymbols(n,e){for(var t in n)if(n.hasOwnProperty(t)){asmLibraryArg.hasOwnProperty(t)||(asmLibraryArg[t]=n[t]);var r=asmjsMangle(t);Module.hasOwnProperty(r)||(Module[r]=n[t]),t=="__main_argc_argv"&&(Module._main=n[t])}}a(mergeLibSymbols,"mergeLibSymbols");var LDSO={loadedLibsByName:{},loadedLibsByHandle:{}};function dynCallLegacy(n,e,t){var r=Module["dynCall_"+n];return t&&t.length?r.apply(null,[e].concat(t)):r.call(null,e)}a(dynCallLegacy,"dynCallLegacy");var wasmTableMirror=[];function getWasmTableEntry(n){var e=wasmTableMirror[n];return e||(n>=wasmTableMirror.length&&(wasmTableMirror.length=n+1),wasmTableMirror[n]=e=wasmTable.get(n)),e}a(getWasmTableEntry,"getWasmTableEntry");function dynCall(n,e,t){return n.includes("j")?dynCallLegacy(n,e,t):getWasmTableEntry(e).apply(null,t)}a(dynCall,"dynCall");function createInvokeFunction(n){return function(){var e=stackSave();try{return dynCall(n,arguments[0],Array.prototype.slice.call(arguments,1))}catch(t){if(stackRestore(e),t!==t+0)throw t;_setThrew(1,0)}}}a(createInvokeFunction,"createInvokeFunction");var ___heap_base=78144;function zeroMemory(n,e){return HEAPU8.fill(0,n,n+e),n}a(zeroMemory,"zeroMemory");function getMemory(n){if(runtimeInitialized)return zeroMemory(_malloc(n),n);var e=___heap_base,t=e+n+15&-16;return ___heap_base=t,GOT.__heap_base.value=t,e}a(getMemory,"getMemory");function isInternalSym(n){return["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm"].includes(n)}a(isInternalSym,"isInternalSym");function uleb128Encode(n,e){n<128?e.push(n):e.push(n%128|128,n>>7)}a(uleb128Encode,"uleb128Encode");function sigToWasmTypes(n){for(var e={i:"i32",j:"i32",f:"f32",d:"f64",p:"i32"},t={parameters:[],results:n[0]=="v"?[]:[e[n[0]]]},r=1;r<n.length;++r)t.parameters.push(e[n[r]]),n[r]==="j"&&t.parameters.push("i32");return t}a(sigToWasmTypes,"sigToWasmTypes");function generateFuncType(n,e){var t=n.slice(0,1),r=n.slice(1),i={i:127,p:127,j:126,f:125,d:124};e.push(96),uleb128Encode(r.length,e);for(var o=0;o<r.length;++o)e.push(i[r[o]]);t=="v"?e.push(0):e.push(1,i[t])}a(generateFuncType,"generateFuncType");function convertJsFunctionToWasm(n,e){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(e),n);var t=[1];generateFuncType(e,t);var r=[0,97,115,109,1,0,0,0,1];uleb128Encode(t.length,r),r.push.apply(r,t),r.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var i=new WebAssembly.Module(new Uint8Array(r));return new WebAssembly.Instance(i,{e:{f:n}}).exports.f}a(convertJsFunctionToWasm,"convertJsFunctionToWasm");function updateTableMap(n,e){if(functionsInTableMap)for(var t=n;t<n+e;t++){var r=getWasmTableEntry(t);r&&functionsInTableMap.set(r,t)}}a(updateTableMap,"updateTableMap");var functionsInTableMap=void 0,freeTableIndexes=[];function getEmptyTableSlot(){if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(n){throw n instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":n}return wasmTable.length-1}a(getEmptyTableSlot,"getEmptyTableSlot");function setWasmTableEntry(n,e){wasmTable.set(n,e),wasmTableMirror[n]=wasmTable.get(n)}a(setWasmTableEntry,"setWasmTableEntry");function addFunction(n,e){if(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.has(n))return functionsInTableMap.get(n);var t=getEmptyTableSlot();try{setWasmTableEntry(t,n)}catch(r){if(!(r instanceof TypeError))throw r;setWasmTableEntry(t,convertJsFunctionToWasm(n,e))}return functionsInTableMap.set(n,t),t}a(addFunction,"addFunction");function updateGOT(n,e){for(var t in n)if(!isInternalSym(t)){var r=n[t];t.startsWith("orig$")&&(t=t.split("$")[1],e=!0),GOT[t]||(GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),(e||GOT[t].value==0)&&(typeof r=="function"?GOT[t].value=addFunction(r):typeof r=="number"?GOT[t].value=r:err("unhandled export type for `"+t+"`: "+typeof r))}}a(updateGOT,"updateGOT");function relocateExports(n,e,t){var r={};for(var i in n){var o=n[i];typeof o=="object"&&(o=o.value),typeof o=="number"&&(o+=e),r[i]=o}return updateGOT(r,t),r}a(relocateExports,"relocateExports");function resolveGlobalSymbol(n,e){var t;return e&&(t=asmLibraryArg["orig$"+n]),t||(t=asmLibraryArg[n])&&t.stub&&(t=void 0),t||(t=Module[asmjsMangle(n)]),!t&&n.startsWith("invoke_")&&(t=createInvokeFunction(n.split("_")[1])),t}a(resolveGlobalSymbol,"resolveGlobalSymbol");function alignMemory(n,e){return Math.ceil(n/e)*e}a(alignMemory,"alignMemory");function loadWebAssemblyModule(binary,flags,handle){var metadata=getDylinkMetadata(binary);function loadModule(){var firstLoad=!handle||!HEAP8[handle+12>>0];if(firstLoad){var memAlign=Math.pow(2,metadata.memoryAlign);memAlign=Math.max(memAlign,STACK_ALIGN);var memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+12>>0]=1,HEAPU32[handle+16>>2]=memoryBase,HEAP32[handle+20>>2]=metadata.memorySize,HEAPU32[handle+24>>2]=tableBase,HEAP32[handle+28>>2]=metadata.tableSize)}else memoryBase=HEAPU32[handle+16>>2],tableBase=HEAPU32[handle+24>>2];var tableGrowthNeeded=tableBase+metadata.tableSize-wasmTable.length,moduleExports;function resolveSymbol(n){var e=resolveGlobalSymbol(n,!1);return e||(e=moduleExports[n]),e}a(resolveSymbol,"resolveSymbol"),tableGrowthNeeded>0&&wasmTable.grow(tableGrowthNeeded);var proxyHandler={get:function(n,e){switch(e){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(e in asmLibraryArg)return asmLibraryArg[e];var t;return e in n||(n[e]=function(){return t||(t=resolveSymbol(e)),t.apply(null,arguments)}),n[e]}},proxy=new Proxy({},proxyHandler),info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(instance){function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func="("+args+" ) => { "+body+"};";ASM_CONSTS[start]=eval(func)}if(a(addEmAsm,"addEmAsm"),updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols(),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start<stop;){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():__ATINIT__.push(init)),moduleExports}if(a(postInstantiation,"postInstantiation"),flags.loadAsync){if(binary instanceof WebAssembly.Module){var instance=new WebAssembly.Instance(binary,info);return Promise.resolve(postInstantiation(instance))}return WebAssembly.instantiate(binary,info).then(function(n){return postInstantiation(n.instance)})}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(instance)}return a(loadModule,"loadModule"),CurrentModuleWeakSymbols=metadata.weakImports,flags.loadAsync?metadata.neededDynlibs.reduce(function(n,e){return n.then(function(){return loadDynamicLibrary(e,flags)})},Promise.resolve()).then(function(){return loadModule()}):(metadata.neededDynlibs.forEach(function(n){loadDynamicLibrary(n,flags)}),loadModule())}a(loadWebAssemblyModule,"loadWebAssemblyModule");function loadDynamicLibrary(n,e,t){e=e||{global:!0,nodelete:!0};var r=LDSO.loadedLibsByName[n];if(r)return e.global&&!r.global&&(r.global=!0,r.module!=="loading"&&mergeLibSymbols(r.module,n)),e.nodelete&&r.refcount!==1/0&&(r.refcount=1/0),r.refcount++,t&&(LDSO.loadedLibsByHandle[t]=r),!e.loadAsync||Promise.resolve(!0);function i(l){if(e.fs&&e.fs.findObject(l)){var u=e.fs.readFile(l,{encoding:"binary"});return u instanceof Uint8Array||(u=new Uint8Array(u)),e.loadAsync?Promise.resolve(u):u}if(l=locateFile(l),e.loadAsync)return new Promise(function(c,d){readAsync(l,_=>c(new Uint8Array(_)),d)});if(!readBinary)throw new Error(l+": file not found, and synchronous loading of external files is not available");return readBinary(l)}a(i,"n");function o(){if(typeof preloadedWasm<"u"&&preloadedWasm[n]){var l=preloadedWasm[n];return e.loadAsync?Promise.resolve(l):l}return e.loadAsync?i(n).then(function(u){return loadWebAssemblyModule(u,e,t)}):loadWebAssemblyModule(i(n),e,t)}a(o,"s");function s(l){r.global&&mergeLibSymbols(l,n),r.module=l}return a(s,"a"),r={refcount:e.nodelete?1/0:1,name:n,module:"loading",global:e.global},LDSO.loadedLibsByName[n]=r,t&&(LDSO.loadedLibsByHandle[t]=r),e.loadAsync?o().then(function(l){return s(l),!0}):(s(o()),!0)}a(loadDynamicLibrary,"loadDynamicLibrary");function reportUndefinedSymbols(){for(var n in GOT)if(GOT[n].value==0){var e=resolveGlobalSymbol(n,!0);if(!e&&!GOT[n].required)continue;if(typeof e=="function")GOT[n].value=addFunction(e,e.sig);else{if(typeof e!="number")throw new Error("bad export type for `"+n+"`: "+typeof e);GOT[n].value=e}}}a(reportUndefinedSymbols,"reportUndefinedSymbols");function preloadDylibs(){dynamicLibraries.length?(addRunDependency("preloadDylibs"),dynamicLibraries.reduce(function(n,e){return n.then(function(){return loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})})},Promise.resolve()).then(function(){reportUndefinedSymbols(),removeRunDependency("preloadDylibs")})):reportUndefinedSymbols()}a(preloadDylibs,"preloadDylibs");function setValue(n,e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":HEAP8[n>>0]=e;break;case"i16":HEAP16[n>>1]=e;break;case"i32":HEAP32[n>>2]=e;break;case"i64":tempI64=[e>>>0,(tempDouble=e,+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[n>>2]=tempI64[0],HEAP32[n+4>>2]=tempI64[1];break;case"float":HEAPF32[n>>2]=e;break;case"double":HEAPF64[n>>3]=e;break;case"*":HEAPU32[n>>2]=e;break;default:abort("invalid type for setValue: "+t)}}a(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78144),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),nowIsMonotonic=!0,_emscripten_get_now;function __emscripten_get_now_is_monotonic(){return nowIsMonotonic}a(__emscripten_get_now_is_monotonic,"__emscripten_get_now_is_monotonic");function _abort(){abort("")}a(_abort,"_abort");function _emscripten_date_now(){return Date.now()}a(_emscripten_date_now,"_emscripten_date_now");function _emscripten_memcpy_big(n,e,t){HEAPU8.copyWithin(n,e,e+t)}a(_emscripten_memcpy_big,"_emscripten_memcpy_big");function getHeapMax(){return 2147483648}a(getHeapMax,"getHeapMax");function emscripten_realloc_buffer(n){try{return wasmMemory.grow(n-buffer.byteLength+65535>>>16),updateGlobalBufferAndViews(wasmMemory.buffer),1}catch{}}a(emscripten_realloc_buffer,"emscripten_realloc_buffer");function _emscripten_resize_heap(n){var e=HEAPU8.length;n>>>=0;var t=getHeapMax();if(n>t)return!1;for(var r=1;r<=4;r*=2){var i=e*(1+.2/r);if(i=Math.min(i,n+100663296),emscripten_realloc_buffer(Math.min(t,(o=Math.max(n,i))+((s=65536)-o%s)%s)))return!0}var o,s;return!1}a(_emscripten_resize_heap,"_emscripten_resize_heap"),__emscripten_get_now_is_monotonic.sig="i",Module._abort=_abort,_abort.sig="v",_emscripten_date_now.sig="d",_emscripten_get_now=ENVIRONMENT_IS_NODE?()=>{var n=process.hrtime();return 1e3*n[0]+n[1]/1e6}:()=>performance.now(),_emscripten_get_now.sig="d",_emscripten_memcpy_big.sig="vppp",_emscripten_resize_heap.sig="ip";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(n,e,t){if(PATH.isAbs(e))return e;var r;if(n===-100?r=FS.cwd():r=SYSCALLS.getStreamFromFD(n).path,e.length==0){if(!t)throw new FS.ErrnoError(44);return r}return PATH.join2(r,e)},doStat:function(n,e,t){try{var r=n(e)}catch(l){if(l&&l.node&&PATH.normalize(e)!==PATH.normalize(FS.getPath(l.node)))return-54;throw l}HEAP32[t>>2]=r.dev,HEAP32[t+8>>2]=r.ino,HEAP32[t+12>>2]=r.mode,HEAPU32[t+16>>2]=r.nlink,HEAP32[t+20>>2]=r.uid,HEAP32[t+24>>2]=r.gid,HEAP32[t+28>>2]=r.rdev,tempI64=[r.size>>>0,(tempDouble=r.size,+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t+40>>2]=tempI64[0],HEAP32[t+44>>2]=tempI64[1],HEAP32[t+48>>2]=4096,HEAP32[t+52>>2]=r.blocks;var i=r.atime.getTime(),o=r.mtime.getTime(),s=r.ctime.getTime();return tempI64=[Math.floor(i/1e3)>>>0,(tempDouble=Math.floor(i/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t+56>>2]=tempI64[0],HEAP32[t+60>>2]=tempI64[1],HEAPU32[t+64>>2]=i%1e3*1e3,tempI64=[Math.floor(o/1e3)>>>0,(tempDouble=Math.floor(o/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t+72>>2]=tempI64[0],HEAP32[t+76>>2]=tempI64[1],HEAPU32[t+80>>2]=o%1e3*1e3,tempI64=[Math.floor(s/1e3)>>>0,(tempDouble=Math.floor(s/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t+88>>2]=tempI64[0],HEAP32[t+92>>2]=tempI64[1],HEAPU32[t+96>>2]=s%1e3*1e3,tempI64=[r.ino>>>0,(tempDouble=r.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t+104>>2]=tempI64[0],HEAP32[t+108>>2]=tempI64[1],0},doMsync:function(n,e,t,r,i){if(!FS.isFile(e.node.mode))throw new FS.ErrnoError(43);if(2&r)return 0;var o=HEAPU8.slice(n,n+t);FS.msync(e,o,i,t,r)},varargs:void 0,get:function(){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(n){return UTF8ToString(n)},getStreamFromFD:function(n){var e=FS.getStream(n);if(!e)throw new FS.ErrnoError(8);return e}};function _proc_exit(n){EXITSTATUS=n,keepRuntimeAlive()||(Module.onExit&&Module.onExit(n),ABORT=!0),quit_(n,new ExitStatus(n))}a(_proc_exit,"_proc_exit");function exitJS(n,e){EXITSTATUS=n,_proc_exit(n)}a(exitJS,"exitJS"),_proc_exit.sig="vi";var _exit=exitJS;function _fd_close(n){try{var e=SYSCALLS.getStreamFromFD(n);return FS.close(e),0}catch(t){if(typeof FS>"u"||!(t instanceof FS.ErrnoError))throw t;return t.errno}}a(_fd_close,"_fd_close");function convertI32PairToI53Checked(n,e){return e+2097152>>>0<4194305-!!n?(n>>>0)+4294967296*e:NaN}a(convertI32PairToI53Checked,"convertI32PairToI53Checked");function _fd_seek(n,e,t,r,i){try{var o=convertI32PairToI53Checked(e,t);if(isNaN(o))return 61;var s=SYSCALLS.getStreamFromFD(n);return FS.llseek(s,o,r),tempI64=[s.position>>>0,(tempDouble=s.position,+Math.abs(tempDouble)>=1?tempDouble>0?(0|Math.min(+Math.floor(tempDouble/4294967296),4294967295))>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[i>>2]=tempI64[0],HEAP32[i+4>>2]=tempI64[1],s.getdents&&o===0&&r===0&&(s.getdents=null),0}catch(l){if(typeof FS>"u"||!(l instanceof FS.ErrnoError))throw l;return l.errno}}a(_fd_seek,"_fd_seek");function doWritev(n,e,t,r){for(var i=0,o=0;o<t;o++){var s=HEAPU32[e>>2],l=HEAPU32[e+4>>2];e+=8;var u=FS.write(n,HEAP8,s,l,r);if(u<0)return-1;i+=u,r!==void 0&&(r+=u)}return i}a(doWritev,"doWritev");function _fd_write(n,e,t,r){try{var i=doWritev(SYSCALLS.getStreamFromFD(n),e,t);return HEAPU32[r>>2]=i,0}catch(o){if(typeof FS>"u"||!(o instanceof FS.ErrnoError))throw o;return o.errno}}a(_fd_write,"_fd_write");function _tree_sitter_log_callback(n,e){if(currentLogCallback){let t=UTF8ToString(e);currentLogCallback(t,n!==0)}}a(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(n,e,t,r,i){var o=currentParseCallback(e,{row:t,column:r});typeof o=="string"?(setValue(i,o.length,"i32"),stringToUTF16(o,n,10240)):setValue(i,0,"i32")}a(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function handleException(n){if(n instanceof ExitStatus||n=="unwind")return EXITSTATUS;quit_(1,n)}a(handleException,"handleException");function allocateUTF8OnStack(n){var e=lengthBytesUTF8(n)+1,t=stackAlloc(e);return stringToUTF8Array(n,HEAP8,t,e),t}a(allocateUTF8OnStack,"allocateUTF8OnStack");function stringToUTF16(n,e,t){if(t===void 0&&(t=2147483647),t<2)return 0;for(var r=e,i=(t-=2)<2*n.length?t/2:n.length,o=0;o<i;++o){var s=n.charCodeAt(o);HEAP16[e>>1]=s,e+=2}return HEAP16[e>>1]=0,e-r}a(stringToUTF16,"stringToUTF16");function AsciiToString(n){for(var e="";;){var t=HEAPU8[n++>>0];if(!t)return e;e+=String.fromCharCode(t)}}a(AsciiToString,"AsciiToString"),_exit.sig="vi",_fd_close.sig="ii",_fd_seek.sig="iijip",_fd_write.sig="iippp";var asmLibraryArg={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_pointer:___stack_pointer,__table_base:___table_base,_emscripten_get_now_is_monotonic:__emscripten_get_now_is_monotonic,abort:_abort,emscripten_get_now:_emscripten_get_now,emscripten_memcpy_big:_emscripten_memcpy_big,emscripten_resize_heap:_emscripten_resize_heap,exit:_exit,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback},asm=createWasm(),___wasm_call_ctors=Module.___wasm_call_ctors=function(){return(___wasm_call_ctors=Module.___wasm_call_ctors=Module.asm.__wasm_call_ctors).apply(null,arguments)},___wasm_apply_data_relocs=Module.___wasm_apply_data_relocs=function(){return(___wasm_apply_data_relocs=Module.___wasm_apply_data_relocs=Module.asm.__wasm_apply_data_relocs).apply(null,arguments)},_malloc=Module._malloc=function(){return(_malloc=Module._malloc=Module.asm.malloc).apply(null,arguments)},_calloc=Module._calloc=function(){return(_calloc=Module._calloc=Module.asm.calloc).apply(null,arguments)},_realloc=Module._realloc=function(){return(_realloc=Module._realloc=Module.asm.realloc).apply(null,arguments)},_free=Module._free=function(){return(_free=Module._free=Module.asm.free).apply(null,arguments)},_ts_language_symbol_count=Module._ts_language_symbol_count=function(){return(_ts_language_symbol_count=Module._ts_language_symbol_count=Module.asm.ts_language_symbol_count).apply(null,arguments)},_ts_language_version=Module._ts_language_version=function(){return(_ts_language_version=Module._ts_language_version=Module.asm.ts_language_version).apply(null,arguments)},_ts_language_field_count=Module._ts_language_field_count=function(){return(_ts_language_field_count=Module._ts_language_field_count=Module.asm.ts_language_field_count).apply(null,arguments)},_ts_language_symbol_name=Module._ts_language_symbol_name=function(){return(_ts_language_symbol_name=Module._ts_language_symbol_name=Module.asm.ts_language_symbol_name).apply(null,arguments)},_ts_language_symbol_for_name=Module._ts_language_symbol_for_name=function(){return(_ts_language_symbol_for_name=Module._ts_language_symbol_for_name=Module.asm.ts_language_symbol_for_name).apply(null,arguments)},_ts_language_symbol_type=Module._ts_language_symbol_type=function(){return(_ts_language_symbol_type=Module._ts_language_symbol_type=Module.asm.ts_language_symbol_type).apply(null,arguments)},_ts_language_field_name_for_id=Module._ts_language_field_name_for_id=function(){return(_ts_language_field_name_for_id=Module._ts_language_field_name_for_id=Module.asm.ts_language_field_name_for_id).apply(null,arguments)},_memset=Module._memset=function(){return(_memset=Module._memset=Module.asm.memset).apply(null,arguments)},_memcpy=Module._memcpy=function(){return(_memcpy=Module._memcpy=Module.asm.memcpy).apply(null,arguments)},_ts_parser_delete=Module._ts_parser_delete=function(){return(_ts_parser_delete=Module._ts_parser_delete=Module.asm.ts_parser_delete).apply(null,arguments)},_ts_parser_reset=Module._ts_parser_reset=function(){return(_ts_parser_reset=Module._ts_parser_reset=Module.asm.ts_parser_reset).apply(null,arguments)},_ts_parser_set_language=Module._ts_parser_set_language=function(){return(_ts_parser_set_language=Module._ts_parser_set_language=Module.asm.ts_parser_set_language).apply(null,arguments)},_ts_parser_timeout_micros=Module._ts_parser_timeout_micros=function(){return(_ts_parser_timeout_micros=Module._ts_parser_timeout_micros=Module.asm.ts_parser_timeout_micros).apply(null,arguments)},_ts_parser_set_timeout_micros=Module._ts_parser_set_timeout_micros=function(){return(_ts_parser_set_timeout_micros=Module._ts_parser_set_timeout_micros=Module.asm.ts_parser_set_timeout_micros).apply(null,arguments)},_memmove=Module._memmove=function(){return(_memmove=Module._memmove=Module.asm.memmove).apply(null,arguments)},_memcmp=Module._memcmp=function(){return(_memcmp=Module._memcmp=Module.asm.memcmp).apply(null,arguments)},_ts_query_new=Module._ts_query_new=function(){return(_ts_query_new=Module._ts_query_new=Module.asm.ts_query_new).apply(null,arguments)},_ts_query_delete=Module._ts_query_delete=function(){return(_ts_query_delete=Module._ts_query_delete=Module.asm.ts_query_delete).apply(null,arguments)},_iswspace=Module._iswspace=function(){return(_iswspace=Module._iswspace=Module.asm.iswspace).apply(null,arguments)},_iswalnum=Module._iswalnum=function(){return(_iswalnum=Module._iswalnum=Module.asm.iswalnum).apply(null,arguments)},_ts_query_pattern_count=Module._ts_query_pattern_count=function(){return(_ts_query_pattern_count=Module._ts_query_pattern_count=Module.asm.ts_query_pattern_count).apply(null,arguments)},_ts_query_capture_count=Module._ts_query_capture_count=function(){return(_ts_query_capture_count=Module._ts_query_capture_count=Module.asm.ts_query_capture_count).apply(null,arguments)},_ts_query_string_count=Module._ts_query_string_count=function(){return(_ts_query_string_count=Module._ts_query_string_count=Module.asm.ts_query_string_count).apply(null,arguments)},_ts_query_capture_name_for_id=Module._ts_query_capture_name_for_id=function(){return(_ts_query_capture_name_for_id=Module._ts_query_capture_name_for_id=Module.asm.ts_query_capture_name_for_id).apply(null,arguments)},_ts_query_string_value_for_id=Module._ts_query_string_value_for_id=function(){return(_ts_query_string_value_for_id=Module._ts_query_string_value_for_id=Module.asm.ts_query_string_value_for_id).apply(null,arguments)},_ts_query_predicates_for_pattern=Module._ts_query_predicates_for_pattern=function(){return(_ts_query_predicates_for_pattern=Module._ts_query_predicates_for_pattern=Module.asm.ts_query_predicates_for_pattern).apply(null,arguments)},_ts_tree_copy=Module._ts_tree_copy=function(){return(_ts_tree_copy=Module._ts_tree_copy=Module.asm.ts_tree_copy).apply(null,arguments)},_ts_tree_delete=Module._ts_tree_delete=function(){return(_ts_tree_delete=Module._ts_tree_delete=Module.asm.ts_tree_delete).apply(null,arguments)},_ts_init=Module._ts_init=function(){return(_ts_init=Module._ts_init=Module.asm.ts_init).apply(null,arguments)},_ts_parser_new_wasm=Module._ts_parser_new_wasm=function(){return(_ts_parser_new_wasm=Module._ts_parser_new_wasm=Module.asm.ts_parser_new_wasm).apply(null,arguments)},_ts_parser_enable_logger_wasm=Module._ts_parser_enable_logger_wasm=function(){return(_ts_parser_enable_logger_wasm=Module._ts_parser_enable_logger_wasm=Module.asm.ts_parser_enable_logger_wasm).apply(null,arguments)},_ts_parser_parse_wasm=Module._ts_parser_parse_wasm=function(){return(_ts_parser_parse_wasm=Module._ts_parser_parse_wasm=Module.asm.ts_parser_parse_wasm).apply(null,arguments)},_ts_language_type_is_named_wasm=Module._ts_language_type_is_named_wasm=function(){return(_ts_language_type_is_named_wasm=Module._ts_language_type_is_named_wasm=Module.asm.ts_language_type_is_named_wasm).apply(null,arguments)},_ts_language_type_is_visible_wasm=Module._ts_language_type_is_visible_wasm=function(){return(_ts_language_type_is_visible_wasm=Module._ts_language_type_is_visible_wasm=Module.asm.ts_language_type_is_visible_wasm).apply(null,arguments)},_ts_tree_root_node_wasm=Module._ts_tree_root_node_wasm=function(){return(_ts_tree_root_node_wasm=Module._ts_tree_root_node_wasm=Module.asm.ts_tree_root_node_wasm).apply(null,arguments)},_ts_tree_edit_wasm=Module._ts_tree_edit_wasm=function(){return(_ts_tree_edit_wasm=Module._ts_tree_edit_wasm=Module.asm.ts_tree_edit_wasm).apply(null,arguments)},_ts_tree_get_changed_ranges_wasm=Module._ts_tree_get_changed_ranges_wasm=function(){return(_ts_tree_get_changed_ranges_wasm=Module._ts_tree_get_changed_ranges_wasm=Module.asm.ts_tree_get_changed_ranges_wasm).apply(null,arguments)},_ts_tree_cursor_new_wasm=Module._ts_tree_cursor_new_wasm=function(){return(_ts_tree_cursor_new_wasm=Module._ts_tree_cursor_new_wasm=Module.asm.ts_tree_cursor_new_wasm).apply(null,arguments)},_ts_tree_cursor_delete_wasm=Module._ts_tree_cursor_delete_wasm=function(){return(_ts_tree_cursor_delete_wasm=Module._ts_tree_cursor_delete_wasm=Module.asm.ts_tree_cursor_delete_wasm).apply(null,arguments)},_ts_tree_cursor_reset_wasm=Module._ts_tree_cursor_reset_wasm=function(){return(_ts_tree_cursor_reset_wasm=Module._ts_tree_cursor_reset_wasm=Module.asm.ts_tree_cursor_reset_wasm).apply(null,arguments)},_ts_tree_cursor_goto_first_child_wasm=Module._ts_tree_cursor_goto_first_child_wasm=function(){return(_ts_tree_cursor_goto_first_child_wasm=Module._ts_tree_cursor_goto_first_child_wasm=Module.asm.ts_tree_cursor_goto_first_child_wasm).apply(null,arguments)},_ts_tree_cursor_goto_next_sibling_wasm=Module._ts_tree_cursor_goto_next_sibling_wasm=function(){return(_ts_tree_cursor_goto_next_sibling_wasm=Module._ts_tree_cursor_goto_next_sibling_wasm=Module.asm.ts_tree_cursor_goto_next_sibling_wasm).apply(null,arguments)},_ts_tree_cursor_goto_parent_wasm=Module._ts_tree_cursor_goto_parent_wasm=function(){return(_ts_tree_cursor_goto_parent_wasm=Module._ts_tree_cursor_goto_parent_wasm=Module.asm.ts_tree_cursor_goto_parent_wasm).apply(null,arguments)},_ts_tree_cursor_current_node_type_id_wasm=Module._ts_tree_cursor_current_node_type_id_wasm=function(){return(_ts_tree_cursor_current_node_type_id_wasm=Module._ts_tree_cursor_current_node_type_id_wasm=Module.asm.ts_tree_cursor_current_node_type_id_wasm).apply(null,arguments)},_ts_tree_cursor_current_node_is_named_wasm=Module._ts_tree_cursor_current_node_is_named_wasm=function(){return(_ts_tree_cursor_current_node_is_named_wasm=Module._ts_tree_cursor_current_node_is_named_wasm=Module.asm.ts_tree_cursor_current_node_is_named_wasm).apply(null,arguments)},_ts_tree_cursor_current_node_is_missing_wasm=Module._ts_tree_cursor_current_node_is_missing_wasm=function(){return(_ts_tree_cursor_current_node_is_missing_wasm=Module._ts_tree_cursor_current_node_is_missing_wasm=Module.asm.ts_tree_cursor_current_node_is_missing_wasm).apply(null,arguments)},_ts_tree_cursor_current_node_id_wasm=Module._ts_tree_cursor_current_node_id_wasm=function(){return(_ts_tree_cursor_current_node_id_wasm=Module._ts_tree_cursor_current_node_id_wasm=Module.asm.ts_tree_cursor_current_node_id_wasm).apply(null,arguments)},_ts_tree_cursor_start_position_wasm=Module._ts_tree_cursor_start_position_wasm=function(){return(_ts_tree_cursor_start_position_wasm=Module._ts_tree_cursor_start_position_wasm=Module.asm.ts_tree_cursor_start_position_wasm).apply(null,arguments)},_ts_tree_cursor_end_position_wasm=Module._ts_tree_cursor_end_position_wasm=function(){return(_ts_tree_cursor_end_position_wasm=Module._ts_tree_cursor_end_position_wasm=Module.asm.ts_tree_cursor_end_position_wasm).apply(null,arguments)},_ts_tree_cursor_start_index_wasm=Module._ts_tree_cursor_start_index_wasm=function(){return(_ts_tree_cursor_start_index_wasm=Module._ts_tree_cursor_start_index_wasm=Module.asm.ts_tree_cursor_start_index_wasm).apply(null,arguments)},_ts_tree_cursor_end_index_wasm=Module._ts_tree_cursor_end_index_wasm=function(){return(_ts_tree_cursor_end_index_wasm=Module._ts_tree_cursor_end_index_wasm=Module.asm.ts_tree_cursor_end_index_wasm).apply(null,arguments)},_ts_tree_cursor_current_field_id_wasm=Module._ts_tree_cursor_current_field_id_wasm=function(){return(_ts_tree_cursor_current_field_id_wasm=Module._ts_tree_cursor_current_field_id_wasm=Module.asm.ts_tree_cursor_current_field_id_wasm).apply(null,arguments)},_ts_tree_cursor_current_node_wasm=Module._ts_tree_cursor_current_node_wasm=function(){return(_ts_tree_cursor_current_node_wasm=Module._ts_tree_cursor_current_node_wasm=Module.asm.ts_tree_cursor_current_node_wasm).apply(null,arguments)},_ts_node_symbol_wasm=Module._ts_node_symbol_wasm=function(){return(_ts_node_symbol_wasm=Module._ts_node_symbol_wasm=Module.asm.ts_node_symbol_wasm).apply(null,arguments)},_ts_node_child_count_wasm=Module._ts_node_child_count_wasm=function(){return(_ts_node_child_count_wasm=Module._ts_node_child_count_wasm=Module.asm.ts_node_child_count_wasm).apply(null,arguments)},_ts_node_named_child_count_wasm=Module._ts_node_named_child_count_wasm=function(){return(_ts_node_named_child_count_wasm=Module._ts_node_named_child_count_wasm=Module.asm.ts_node_named_child_count_wasm).apply(null,arguments)},_ts_node_child_wasm=Module._ts_node_child_wasm=function(){return(_ts_node_child_wasm=Module._ts_node_child_wasm=Module.asm.ts_node_child_wasm).apply(null,arguments)},_ts_node_named_child_wasm=Module._ts_node_named_child_wasm=function(){return(_ts_node_named_child_wasm=Module._ts_node_named_child_wasm=Module.asm.ts_node_named_child_wasm).apply(null,arguments)},_ts_node_child_by_field_id_wasm=Module._ts_node_child_by_field_id_wasm=function(){return(_ts_node_child_by_field_id_wasm=Module._ts_node_child_by_field_id_wasm=Module.asm.ts_node_child_by_field_id_wasm).apply(null,arguments)},_ts_node_next_sibling_wasm=Module._ts_node_next_sibling_wasm=function(){return(_ts_node_next_sibling_wasm=Module._ts_node_next_sibling_wasm=Module.asm.ts_node_next_sibling_wasm).apply(null,arguments)},_ts_node_prev_sibling_wasm=Module._ts_node_prev_sibling_wasm=function(){return(_ts_node_prev_sibling_wasm=Module._ts_node_prev_sibling_wasm=Module.asm.ts_node_prev_sibling_wasm).apply(null,arguments)},_ts_node_next_named_sibling_wasm=Module._ts_node_next_named_sibling_wasm=function(){return(_ts_node_next_named_sibling_wasm=Module._ts_node_next_named_sibling_wasm=Module.asm.ts_node_next_named_sibling_wasm).apply(null,arguments)},_ts_node_prev_named_sibling_wasm=Module._ts_node_prev_named_sibling_wasm=function(){return(_ts_node_prev_named_sibling_wasm=Module._ts_node_prev_named_sibling_wasm=Module.asm.ts_node_prev_named_sibling_wasm).apply(null,arguments)},_ts_node_parent_wasm=Module._ts_node_parent_wasm=function(){return(_ts_node_parent_wasm=Module._ts_node_parent_wasm=Module.asm.ts_node_parent_wasm).apply(null,arguments)},_ts_node_descendant_for_index_wasm=Module._ts_node_descendant_for_index_wasm=function(){return(_ts_node_descendant_for_index_wasm=Module._ts_node_descendant_for_index_wasm=Module.asm.ts_node_descendant_for_index_wasm).apply(null,arguments)},_ts_node_named_descendant_for_index_wasm=Module._ts_node_named_descendant_for_index_wasm=function(){return(_ts_node_named_descendant_for_index_wasm=Module._ts_node_named_descendant_for_index_wasm=Module.asm.ts_node_named_descendant_for_index_wasm).apply(null,arguments)},_ts_node_descendant_for_position_wasm=Module._ts_node_descendant_for_position_wasm=function(){return(_ts_node_descendant_for_position_wasm=Module._ts_node_descendant_for_position_wasm=Module.asm.ts_node_descendant_for_position_wasm).apply(null,arguments)},_ts_node_named_descendant_for_position_wasm=Module._ts_node_named_descendant_for_position_wasm=function(){return(_ts_node_named_descendant_for_position_wasm=Module._ts_node_named_descendant_for_position_wasm=Module.asm.ts_node_named_descendant_for_position_wasm).apply(null,arguments)},_ts_node_start_point_wasm=Module._ts_node_start_point_wasm=function(){return(_ts_node_start_point_wasm=Module._ts_node_start_point_wasm=Module.asm.ts_node_start_point_wasm).apply(null,arguments)},_ts_node_end_point_wasm=Module._ts_node_end_point_wasm=function(){return(_ts_node_end_point_wasm=Module._ts_node_end_point_wasm=Module.asm.ts_node_end_point_wasm).apply(null,arguments)},_ts_node_start_index_wasm=Module._ts_node_start_index_wasm=function(){return(_ts_node_start_index_wasm=Module._ts_node_start_index_wasm=Module.asm.ts_node_start_index_wasm).apply(null,arguments)},_ts_node_end_index_wasm=Module._ts_node_end_index_wasm=function(){return(_ts_node_end_index_wasm=Module._ts_node_end_index_wasm=Module.asm.ts_node_end_index_wasm).apply(null,arguments)},_ts_node_to_string_wasm=Module._ts_node_to_string_wasm=function(){return(_ts_node_to_string_wasm=Module._ts_node_to_string_wasm=Module.asm.ts_node_to_string_wasm).apply(null,arguments)},_ts_node_children_wasm=Module._ts_node_children_wasm=function(){return(_ts_node_children_wasm=Module._ts_node_children_wasm=Module.asm.ts_node_children_wasm).apply(null,arguments)},_ts_node_named_children_wasm=Module._ts_node_named_children_wasm=function(){return(_ts_node_named_children_wasm=Module._ts_node_named_children_wasm=Module.asm.ts_node_named_children_wasm).apply(null,arguments)},_ts_node_descendants_of_type_wasm=Module._ts_node_descendants_of_type_wasm=function(){return(_ts_node_descendants_of_type_wasm=Module._ts_node_descendants_of_type_wasm=Module.asm.ts_node_descendants_of_type_wasm).apply(null,arguments)},_ts_node_is_named_wasm=Module._ts_node_is_named_wasm=function(){return(_ts_node_is_named_wasm=Module._ts_node_is_named_wasm=Module.asm.ts_node_is_named_wasm).apply(null,arguments)},_ts_node_has_changes_wasm=Module._ts_node_has_changes_wasm=function(){return(_ts_node_has_changes_wasm=Module._ts_node_has_changes_wasm=Module.asm.ts_node_has_changes_wasm).apply(null,arguments)},_ts_node_has_error_wasm=Module._ts_node_has_error_wasm=function(){return(_ts_node_has_error_wasm=Module._ts_node_has_error_wasm=Module.asm.ts_node_has_error_wasm).apply(null,arguments)},_ts_node_is_missing_wasm=Module._ts_node_is_missing_wasm=function(){return(_ts_node_is_missing_wasm=Module._ts_node_is_missing_wasm=Module.asm.ts_node_is_missing_wasm).apply(null,arguments)},_ts_query_matches_wasm=Module._ts_query_matches_wasm=function(){return(_ts_query_matches_wasm=Module._ts_query_matches_wasm=Module.asm.ts_query_matches_wasm).apply(null,arguments)},_ts_query_captures_wasm=Module._ts_query_captures_wasm=function(){return(_ts_query_captures_wasm=Module._ts_query_captures_wasm=Module.asm.ts_query_captures_wasm).apply(null,arguments)},___cxa_atexit=Module.___cxa_atexit=function(){return(___cxa_atexit=Module.___cxa_atexit=Module.asm.__cxa_atexit).apply(null,arguments)},_iswdigit=Module._iswdigit=function(){return(_iswdigit=Module._iswdigit=Module.asm.iswdigit).apply(null,arguments)},_iswalpha=Module._iswalpha=function(){return(_iswalpha=Module._iswalpha=Module.asm.iswalpha).apply(null,arguments)},_iswlower=Module._iswlower=function(){return(_iswlower=Module._iswlower=Module.asm.iswlower).apply(null,arguments)},_memchr=Module._memchr=function(){return(_memchr=Module._memchr=Module.asm.memchr).apply(null,arguments)},_strlen=Module._strlen=function(){return(_strlen=Module._strlen=Module.asm.strlen).apply(null,arguments)},_towupper=Module._towupper=function(){return(_towupper=Module._towupper=Module.asm.towupper).apply(null,arguments)},_setThrew=Module._setThrew=function(){return(_setThrew=Module._setThrew=Module.asm.setThrew).apply(null,arguments)},stackSave=Module.stackSave=function(){return(stackSave=Module.stackSave=Module.asm.stackSave).apply(null,arguments)},stackRestore=Module.stackRestore=function(){return(stackRestore=Module.stackRestore=Module.asm.stackRestore).apply(null,arguments)},stackAlloc=Module.stackAlloc=function(){return(stackAlloc=Module.stackAlloc=Module.asm.stackAlloc).apply(null,arguments)},__Znwm=Module.__Znwm=function(){return(__Znwm=Module.__Znwm=Module.asm._Znwm).apply(null,arguments)},__ZdlPv=Module.__ZdlPv=function(){return(__ZdlPv=Module.__ZdlPv=Module.asm._ZdlPv).apply(null,arguments)},__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=function(){return(__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev).apply(null,arguments)},__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=function(){return(__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm).apply(null,arguments)},__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=function(){return(__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm).apply(null,arguments)},__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=function(){return(__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm).apply(null,arguments)},__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=function(){return(__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=Module.asm._ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm).apply(null,arguments)},__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=function(){return(__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc).apply(null,arguments)},__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=function(){return(__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev).apply(null,arguments)},__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=function(){return(__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw).apply(null,arguments)},__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEmw=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEmw=function(){return(__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEmw=Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEmw=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6resizeEmw).apply(null,arguments)},dynCall_jiji=Module.dynCall_jiji=function(){return(dynCall_jiji=Module.dynCall_jiji=Module.asm.dynCall_jiji).apply(null,arguments)},_orig$ts_parser_timeout_micros=Module._orig$ts_parser_timeout_micros=function(){return(_orig$ts_parser_timeout_micros=Module._orig$ts_parser_timeout_micros=Module.asm.orig$ts_parser_timeout_micros).apply(null,arguments)},_orig$ts_parser_set_timeout_micros=Module._orig$ts_parser_set_timeout_micros=function(){return(_orig$ts_parser_set_timeout_micros=Module._orig$ts_parser_set_timeout_micros=Module.asm.orig$ts_parser_set_timeout_micros).apply(null,arguments)},calledRun;function callMain(n){var e=Module._main;if(e){(n=n||[]).unshift(thisProgram);var t=n.length,r=stackAlloc(4*(t+1)),i=r>>2;n.forEach(s=>{HEAP32[i++]=allocateUTF8OnStack(s)}),HEAP32[i]=0;try{var o=e(t,r);return exitJS(o,!0),o}catch(s){return handleException(s)}}}a(callMain,"callMain"),Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,dependenciesFulfilled=a(function n(){calledRun||run(),calledRun||(dependenciesFulfilled=n)},"e");var dylibsLoaded=!1;function run(n){function e(){calledRun||(calledRun=!0,Module.calledRun=!0,ABORT||(initRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),shouldRunNow&&callMain(n),postRun()))}a(e,"t"),n=n||arguments_,runDependencies>0||!dylibsLoaded&&(preloadDylibs(),dylibsLoaded=!0,runDependencies>0)||(preRun(),runDependencies>0||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),e()},1)):e()))}if(a(run,"run"),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run();let C=Module,INTERNAL={},SIZE_OF_INT=4,SIZE_OF_NODE=5*SIZE_OF_INT,SIZE_OF_POINT=2*SIZE_OF_INT,SIZE_OF_RANGE=2*SIZE_OF_INT+2*SIZE_OF_POINT,ZERO_POINT={row:0,column:0},QUERY_WORD_REGEX=/[\w-.]*/g,PREDICATE_STEP_TYPE_CAPTURE=1,PREDICATE_STEP_TYPE_STRING=2,LANGUAGE_FUNCTION_REGEX=/^_?tree_sitter_\w+/;var VERSION,MIN_COMPATIBLE_VERSION,TRANSFER_BUFFER,currentParseCallback,currentLogCallback;class ParserImpl{static{a(this,"ParserImpl")}static init(){TRANSFER_BUFFER=C._ts_init(),VERSION=getValue(TRANSFER_BUFFER,"i32"),MIN_COMPATIBLE_VERSION=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}initialize(){C._ts_parser_new_wasm(),this[0]=getValue(TRANSFER_BUFFER,"i32"),this[1]=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}delete(){C._ts_parser_delete(this[0]),C._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(e){if(e.constructor!==Language)throw new Error("Argument must be a Language");{t=e[0];let r=C._ts_language_version(t);if(r<MIN_COMPATIBLE_VERSION||VERSION<r)throw new Error(`Incompatible language version ${r}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`)}}else t=0,e=null;return this.language=e,C._ts_parser_set_language(this[0],t),this}getLanguage(){return this.language}parse(e,t,r){if(typeof e=="string")currentParseCallback=a((u,c,d)=>e.slice(u,d),"currentParseCallback");else{if(typeof e!="function")throw new Error("Argument must be a string or a function");currentParseCallback=e}this.logCallback?(currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1)):(currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0));let i=0,o=0;if(r&&r.includedRanges){i=r.includedRanges.length,o=C._calloc(i,SIZE_OF_RANGE);let u=o;for(let c=0;c<i;c++)marshalRange(u,r.includedRanges[c]),u+=SIZE_OF_RANGE}let s=C._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,o,i);if(!s)throw currentParseCallback=null,currentLogCallback=null,new Error("Parsing failed");let l=new Tree(INTERNAL,s,this.language,currentParseCallback);return currentParseCallback=null,currentLogCallback=null,l}reset(){C._ts_parser_reset(this[0])}setTimeoutMicros(e){C._ts_parser_set_timeout_micros(this[0],e)}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setLogger(e){if(e){if(typeof e!="function")throw new Error("Logger callback must be a function")}else e=null;return this.logCallback=e,this}getLogger(){return this.logCallback}}class Tree{static{a(this,"Tree")}constructor(e,t,r,i){assertInternal(e),this[0]=t,this.language=r,this.textCallback=i}copy(){let e=C._ts_tree_copy(this[0]);return new Tree(INTERNAL,e,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}edit(e){marshalEdit(e),C._ts_tree_edit_wasm(this[0])}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(e){if(e.constructor!==Tree)throw new TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],e[0]);let t=getValue(TRANSFER_BUFFER,"i32"),r=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),i=new Array(t);if(t>0){let o=r;for(let s=0;s<t;s++)i[s]=unmarshalRange(o),o+=SIZE_OF_RANGE;C._free(r)}return i}}class Node{static{a(this,"Node")}constructor(e,t){assertInternal(e),this.tree=t}get typeId(){return marshalNode(this),C._ts_node_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get endPosition(){return marshalNode(this),C._ts_node_end_point_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endIndex(){return marshalNode(this),C._ts_node_end_index_wasm(this.tree[0])}get text(){return getText(this.tree,this.startIndex,this.endIndex)}isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}isMissing(){return marshalNode(this),C._ts_node_is_missing_wasm(this.tree[0])===1}equals(e){return this.id===e.id}child(e){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}namedChild(e){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldId(e){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldName(e){let t=this.tree.language.fields.indexOf(e);if(t!==-1)return this.childForFieldId(t)}get childCount(){return marshalNode(this),C._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return marshalNode(this),C._ts_node_named_child_count_wasm(this.tree[0])}get firstChild(){return this.child(0)}get firstNamedChild(){return this.namedChild(0)}get lastChild(){return this.child(this.childCount-1)}get lastNamedChild(){return this.namedChild(this.namedChildCount-1)}get children(){if(!this._children){marshalNode(this),C._ts_node_children_wasm(this.tree[0]);let e=getValue(TRANSFER_BUFFER,"i32"),t=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=new Array(e),e>0){let r=t;for(let i=0;i<e;i++)this._children[i]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let e=getValue(TRANSFER_BUFFER,"i32"),t=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=new Array(e),e>0){let r=t;for(let i=0;i<e;i++)this._namedChildren[i]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._namedChildren}descendantsOfType(e,t,r){Array.isArray(e)||(e=[e]),t||(t=ZERO_POINT),r||(r=ZERO_POINT);let i=[],o=this.tree.language.types;for(let d=0,_=o.length;d<_;d++)e.includes(o[d])&&i.push(d);let s=C._malloc(SIZE_OF_INT*i.length);for(let d=0,_=i.length;d<_;d++)setValue(s+d*SIZE_OF_INT,i[d],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],s,i.length,t.row,t.column,r.row,r.column);let l=getValue(TRANSFER_BUFFER,"i32"),u=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),c=new Array(l);if(l>0){let d=u;for(let _=0;_<l;_++)c[_]=unmarshalNode(this.tree,d),d+=SIZE_OF_NODE}return C._free(u),C._free(s),c}get nextSibling(){return marshalNode(this),C._ts_node_next_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get previousSibling(){return marshalNode(this),C._ts_node_prev_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get nextNamedSibling(){return marshalNode(this),C._ts_node_next_named_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get previousNamedSibling(){return marshalNode(this),C._ts_node_prev_named_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get parent(){return marshalNode(this),C._ts_node_parent_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");marshalNode(this);let r=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(r,e,"i32"),setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(e,t=e){if(typeof e!="number"||typeof t!="number")throw new Error("Arguments must be numbers");marshalNode(this);let r=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(r,e,"i32"),setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_named_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}walk(){return marshalNode(this),C._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(INTERNAL,this.tree)}toString(){marshalNode(this);let e=C._ts_node_to_string_wasm(this.tree[0]),t=AsciiToString(e);return C._free(e),t}}class TreeCursor{static{a(this,"TreeCursor")}constructor(e,t){assertInternal(e),this.tree=t,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(e){marshalNode(e),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){marshalTreeCursor(this);let e=C._ts_tree_cursor_start_index_wasm(this.tree[0]),t=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,e,t)}get startPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_start_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_end_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get startIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_end_index_wasm(this.tree[0])}currentNode(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_wasm(this.tree[0]),unmarshalNode(this.tree)}currentFieldId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_field_id_wasm(this.tree[0])}currentFieldName(){return this.tree.language.fields[this.currentFieldId()]}gotoFirstChild(){marshalTreeCursor(this);let e=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),e===1}gotoNextSibling(){marshalTreeCursor(this);let e=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),e===1}gotoParent(){marshalTreeCursor(this);let e=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),e===1}}class Language{static{a(this,"Language")}constructor(e,t){assertInternal(e),this[0]=t,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let r=0,i=this.types.length;r<i;r++)C._ts_language_symbol_type(this[0],r)<2&&(this.types[r]=UTF8ToString(C._ts_language_symbol_name(this[0],r)));this.fields=new Array(C._ts_language_field_count(this[0])+1);for(let r=0,i=this.fields.length;r<i;r++){let o=C._ts_language_field_name_for_id(this[0],r);this.fields[r]=o!==0?UTF8ToString(o):null}}get version(){return C._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}fieldIdForName(e){let t=this.fields.indexOf(e);return t!==-1?t:null}fieldNameForId(e){return this.fields[e]||null}idForNodeType(e,t){let r=lengthBytesUTF8(e),i=C._malloc(r+1);stringToUTF8(e,i,r+1);let o=C._ts_language_symbol_for_name(this[0],i,r,t);return C._free(i),o||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(e){let t=C._ts_language_symbol_name(this[0],e);return t?UTF8ToString(t):null}nodeTypeIsNamed(e){return!!C._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!C._ts_language_type_is_visible_wasm(this[0],e)}query(e){let t=lengthBytesUTF8(e),r=C._malloc(t+1);stringToUTF8(e,r,t+1);let i=C._ts_query_new(this[0],r,t,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!i){let f=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),g=UTF8ToString(r,getValue(TRANSFER_BUFFER,"i32")).length,S=e.substr(g,100).split(`
`)[0],b,M=S.match(QUERY_WORD_REGEX)[0];switch(f){case 2:b=new RangeError(`Bad node name '${M}'`);break;case 3:b=new RangeError(`Bad field name '${M}'`);break;case 4:b=new RangeError(`Bad capture name @${M}`);break;case 5:b=new TypeError(`Bad pattern structure at offset ${g}: '${S}'...`),M="";break;default:b=new SyntaxError(`Bad syntax at offset ${g}: '${S}'...`),M=""}throw b.index=g,b.length=M.length,C._free(r),b}let o=C._ts_query_string_count(i),s=C._ts_query_capture_count(i),l=C._ts_query_pattern_count(i),u=new Array(s),c=new Array(o);for(let f=0;f<s;f++){let g=C._ts_query_capture_name_for_id(i,f,TRANSFER_BUFFER),S=getValue(TRANSFER_BUFFER,"i32");u[f]=UTF8ToString(g,S)}for(let f=0;f<o;f++){let g=C._ts_query_string_value_for_id(i,f,TRANSFER_BUFFER),S=getValue(TRANSFER_BUFFER,"i32");c[f]=UTF8ToString(g,S)}let d=new Array(l),_=new Array(l),p=new Array(l),m=new Array(l),h=new Array(l);for(let f=0;f<l;f++){let g=C._ts_query_predicates_for_pattern(i,f,TRANSFER_BUFFER),S=getValue(TRANSFER_BUFFER,"i32");m[f]=[],h[f]=[];let b=[],M=g;for(let N=0;N<S;N++){let H=getValue(M,"i32");M+=SIZE_OF_INT;let Q=getValue(M,"i32");if(M+=SIZE_OF_INT,H===PREDICATE_STEP_TYPE_CAPTURE)b.push({type:"capture",name:u[Q]});else if(H===PREDICATE_STEP_TYPE_STRING)b.push({type:"string",value:c[Q]});else if(b.length>0){if(b[0].type!=="string")throw new Error("Predicates must begin with a literal value");let O=b[0].value,W=!0;switch(O){case"not-eq?":W=!1;case"eq?":if(b.length!==3)throw new Error("Wrong number of arguments to `#eq?` predicate. Expected 2, got "+(b.length-1));if(b[1].type!=="capture")throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${b[1].value}"`);if(b[2].type==="capture"){let P=b[1].name,y=b[2].name;h[f].push(function(w){let v,E;for(let L of w)L.name===P&&(v=L.node),L.name===y&&(E=L.node);return v===void 0||E===void 0||v.text===E.text===W})}else{let P=b[1].name,y=b[2].value;h[f].push(function(w){for(let v of w)if(v.name===P)return v.node.text===y===W;return!0})}break;case"not-match?":W=!1;case"match?":if(b.length!==3)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${b.length-1}.`);if(b[1].type!=="capture")throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${b[1].value}".`);if(b[2].type!=="string")throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${b[2].value}.`);let X=b[1].name,A=new RegExp(b[2].value);h[f].push(function(P){for(let y of P)if(y.name===X)return A.test(y.node.text)===W;return!0});break;case"set!":if(b.length<2||b.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${b.length-1}.`);if(b.some(P=>P.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');d[f]||(d[f]={}),d[f][b[1].value]=b[2]?b[2].value:null;break;case"is?":case"is-not?":if(b.length<2||b.length>3)throw new Error(`Wrong number of arguments to \`#${O}\` predicate. Expected 1 or 2. Got ${b.length-1}.`);if(b.some(P=>P.type!=="string"))throw new Error(`Arguments to \`#${O}\` predicate must be a strings.".`);let U=O==="is?"?_:p;U[f]||(U[f]={}),U[f][b[1].value]=b[2]?b[2].value:null;break;default:m[f].push({operator:O,operands:b.slice(1)})}b.length=0}}Object.freeze(d[f]),Object.freeze(_[f]),Object.freeze(p[f])}return C._free(r),new Query(INTERNAL,i,u,h,m,Object.freeze(d),Object.freeze(_),Object.freeze(p))}static load(e){let t;if(e instanceof Uint8Array)t=Promise.resolve(e);else{let i=e;if(typeof process<"u"&&process.versions&&process.versions.node){let o=require("fs");t=Promise.resolve(o.readFileSync(i))}else t=fetch(i).then(o=>o.arrayBuffer().then(s=>{if(o.ok)return new Uint8Array(s);{let l=new TextDecoder("utf-8").decode(s);throw new Error(`Language.load failed with status ${o.status}.
${l}`)}}))}let r=typeof loadSideModule=="function"?loadSideModule:loadWebAssemblyModule;return t.then(i=>r(i,{loadAsync:!0})).then(i=>{let o=Object.keys(i),s=o.find(u=>LANGUAGE_FUNCTION_REGEX.test(u)&&!u.includes("external_scanner_"));s||console.log(`Couldn't find language function in WASM file. Symbols:
${JSON.stringify(o,null,2)}`);let l=i[s]();return new Language(INTERNAL,l)})}}class Query{static{a(this,"Query")}constructor(e,t,r,i,o,s,l,u){assertInternal(e),this[0]=t,this.captureNames=r,this.textPredicates=i,this.predicates=o,this.setProperties=s,this.assertedProperties=l,this.refutedProperties=u,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(e,t,r,i){t||(t=ZERO_POINT),r||(r=ZERO_POINT),i||(i={});let o=i.matchLimit;if(o===void 0)o=0;else if(typeof o!="number")throw new Error("Arguments must be numbers");marshalNode(e),C._ts_query_matches_wasm(this[0],e.tree[0],t.row,t.column,r.row,r.column,o);let s=getValue(TRANSFER_BUFFER,"i32"),l=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),c=new Array(s);this.exceededMatchLimit=!!u;let d=0,_=l;for(let p=0;p<s;p++){let m=getValue(_,"i32");_+=SIZE_OF_INT;let h=getValue(_,"i32");_+=SIZE_OF_INT;let f=new Array(h);if(_=unmarshalCaptures(this,e.tree,_,f),this.textPredicates[m].every(g=>g(f))){c[d++]={pattern:m,captures:f};let g=this.setProperties[m];g&&(c[p].setProperties=g);let S=this.assertedProperties[m];S&&(c[p].assertedProperties=S);let b=this.refutedProperties[m];b&&(c[p].refutedProperties=b)}}return c.length=d,C._free(l),c}captures(e,t,r,i){t||(t=ZERO_POINT),r||(r=ZERO_POINT),i||(i={});let o=i.matchLimit;if(o===void 0)o=0;else if(typeof o!="number")throw new Error("Arguments must be numbers");marshalNode(e),C._ts_query_captures_wasm(this[0],e.tree[0],t.row,t.column,r.row,r.column,o);let s=getValue(TRANSFER_BUFFER,"i32"),l=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),c=[];this.exceededMatchLimit=!!u;let d=[],_=l;for(let p=0;p<s;p++){let m=getValue(_,"i32");_+=SIZE_OF_INT;let h=getValue(_,"i32");_+=SIZE_OF_INT;let f=getValue(_,"i32");if(_+=SIZE_OF_INT,d.length=h,_=unmarshalCaptures(this,e.tree,_,d),this.textPredicates[m].every(g=>g(d))){let g=d[f],S=this.setProperties[m];S&&(g.setProperties=S);let b=this.assertedProperties[m];b&&(g.assertedProperties=b);let M=this.refutedProperties[m];M&&(g.refutedProperties=M),c.push(g)}}return C._free(l),c}predicatesForPattern(e){return this.predicates[e]}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(n,e,t){let r=t-e,i=n.textCallback(e,null,t);for(e+=i.length;e<t;){let o=n.textCallback(e,null,t);if(!(o&&o.length>0))break;e+=o.length,i+=o}return e>t&&(i=i.slice(0,r)),i}a(getText,"getText");function unmarshalCaptures(n,e,t,r){for(let i=0,o=r.length;i<o;i++){let s=getValue(t,"i32"),l=unmarshalNode(e,t+=SIZE_OF_INT);t+=SIZE_OF_NODE,r[i]={name:n.captureNames[s],node:l}}return t}a(unmarshalCaptures,"unmarshalCaptures");function assertInternal(n){if(n!==INTERNAL)throw new Error("Illegal constructor")}a(assertInternal,"assertInternal");function isPoint(n){return n&&typeof n.row=="number"&&typeof n.column=="number"}a(isPoint,"isPoint");function marshalNode(n){let e=TRANSFER_BUFFER;setValue(e,n.id,"i32"),e+=SIZE_OF_INT,setValue(e,n.startIndex,"i32"),e+=SIZE_OF_INT,setValue(e,n.startPosition.row,"i32"),e+=SIZE_OF_INT,setValue(e,n.startPosition.column,"i32"),e+=SIZE_OF_INT,setValue(e,n[0],"i32")}a(marshalNode,"marshalNode");function unmarshalNode(n,e=TRANSFER_BUFFER){let t=getValue(e,"i32");if(t===0)return null;let r=getValue(e+=SIZE_OF_INT,"i32"),i=getValue(e+=SIZE_OF_INT,"i32"),o=getValue(e+=SIZE_OF_INT,"i32"),s=getValue(e+=SIZE_OF_INT,"i32"),l=new Node(INTERNAL,n);return l.id=t,l.startIndex=r,l.startPosition={row:i,column:o},l[0]=s,l}a(unmarshalNode,"unmarshalNode");function marshalTreeCursor(n,e=TRANSFER_BUFFER){setValue(e+0*SIZE_OF_INT,n[0],"i32"),setValue(e+1*SIZE_OF_INT,n[1],"i32"),setValue(e+2*SIZE_OF_INT,n[2],"i32")}a(marshalTreeCursor,"marshalTreeCursor");function unmarshalTreeCursor(n){n[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),n[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),n[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32")}a(unmarshalTreeCursor,"unmarshalTreeCursor");function marshalPoint(n,e){setValue(n,e.row,"i32"),setValue(n+SIZE_OF_INT,e.column,"i32")}a(marshalPoint,"marshalPoint");function unmarshalPoint(n){return{row:getValue(n,"i32"),column:getValue(n+SIZE_OF_INT,"i32")}}a(unmarshalPoint,"unmarshalPoint");function marshalRange(n,e){marshalPoint(n,e.startPosition),marshalPoint(n+=SIZE_OF_POINT,e.endPosition),setValue(n+=SIZE_OF_POINT,e.startIndex,"i32"),setValue(n+=SIZE_OF_INT,e.endIndex,"i32"),n+=SIZE_OF_INT}a(marshalRange,"marshalRange");function unmarshalRange(n){let e={};return e.startPosition=unmarshalPoint(n),n+=SIZE_OF_POINT,e.endPosition=unmarshalPoint(n),n+=SIZE_OF_POINT,e.startIndex=getValue(n,"i32"),n+=SIZE_OF_INT,e.endIndex=getValue(n,"i32"),e}a(unmarshalRange,"unmarshalRange");function marshalEdit(n){let e=TRANSFER_BUFFER;marshalPoint(e,n.startPosition),e+=SIZE_OF_POINT,marshalPoint(e,n.oldEndPosition),e+=SIZE_OF_POINT,marshalPoint(e,n.newEndPosition),e+=SIZE_OF_POINT,setValue(e,n.startIndex,"i32"),e+=SIZE_OF_INT,setValue(e,n.oldEndIndex,"i32"),e+=SIZE_OF_INT,setValue(e,n.newEndIndex,"i32"),e+=SIZE_OF_INT}a(marshalEdit,"marshalEdit");for(let n of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,n,{value:ParserImpl.prototype[n],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();typeof exports=="object"&&(module.exports=TreeSitter)});function _e(n){return n in Vt}function K(n){if(!(n in Vt))throw new Error(`Unrecognized language: ${n}`);return Vt[n]}async function ha(n){await Ht.default.init();let e=(0,Vi.resolve)(__dirname,"..","dist",`tree-sitter-${n}.wasm`);try{return Ht.default.Language.load(e)}catch(t){if((t.code==="ENOENT"||t.code==="EIO"||t.code==="EACCES"||t.code=="EPERM")&&t instanceof Error){let r=new Error(`Could not load tree-sitter-${n}.wasm`);throw r.code="CopilotPromptLoadFailure",r}throw t}}async function Gi(n){let e=K(n);if(!sr.has(e)){let t=await ha(e);sr.set(e,t)}return sr.get(e)}async function J(n,e){let t=await Gi(n),r=new Ht.default;r.setLanguage(t);let i=r.parse(e);return r.delete(),i}async function ga(n,e){let t=await J(n,e),r=!t.rootNode.hasError();return t.delete(),r}function ba(n){switch(K(n)){case"python":return null;case"javascript":case"typescript":case"tsx":case"go":return"}";case"ruby":return"end"}}function Ge(n,e){let t=[];for(let r of n){if(!r[1]){let i=e.tree.getLanguage();r[1]=i.query(r[0])}t.push(...r[1].matches(e))}return t}function Ki(n,e){let t=ua[K(n)];return Ge(t,e)}function ya(n,e){let t=da[K(n)];return Ge(t,e)}function ar(n,e){let t=_a[K(n)];return Ge(t,e)}function wa(n,e){let t=pa[K(n)];return Ge(t,e)}function lr(n){return Ge([Sa],n).length==1}function ur(n,e){let t=ma[K(n)];for(;e.parent;){if(t(e.parent))return e;e=e.parent}return e.parent?e:null}function jt(n,e){return fa[K(n)].has(e.type)}function cr(n,e){switch(K(n)){case"python":case"go":case"ruby":return jt(n,e);case"javascript":case"typescript":case"tsx":if(e.type==="function_declaration"||e.type==="generator_function_declaration"||e.type==="method_definition")return!0;if(e.type==="lexical_declaration"||e.type==="variable_declaration"){if(e.namedChildCount>1)return!1;let t=e.namedChild(0);if(t==null)return!1;let r=t.namedChild(1);return r!==null&&jt(n,r)}if(e.type==="expression_statement"){let t=e.namedChild(0);if(t?.type==="assignment_expression"){let r=t.namedChild(1);return r!==null&&jt(n,r)}}return!1}}function Ke(n){let e=n;for(;e.previousSibling?.type==="comment";){let t=e.previousSibling;if(t.endPosition.row<e.startPosition.row-1)break;e=t}return e?.type==="comment"?e:null}async function dr(n,e){let t=await J(n,e),i=Ki(n,t.rootNode).map(o=>{let s=o.captures.find(l=>l.name==="function").node;return{startIndex:s.startIndex,endIndex:s.endIndex}});return t.delete(),i}async function va(n){if(!(n.languageId in Hi))return[];let e=n.offset,t=n.source.substring(0,e),r=Math.max(t.length-5e3,0),i=t.substring(0,r).split(`
`).length-1;e-=r,t=t.substring(r),t=t+")))))";let o=[],s=await J(n.languageId,t),l=Hi[Vt[n.languageId]];return Ge(l,s.rootNode).forEach((c,d)=>{let _="",p=0,m=0,h=0,f=0;if(c.captures.forEach((g,S)=>{let b=g.node;g.name=="caller"?(_=t.substring(b.startIndex,b.endIndex),p=b.startPosition.row+i,m=b.startPosition.column):g.name=="args"&&(h=b.startIndex,f=b.endIndex)}),e>=h&&e<=f){let g={line:p,character:m};o.push([_,g])}}),s.delete(),o.map(([c,d])=>({name:c,position:d}))}var Vi,Ht,Zi,Vt,rr,ua,ca,qi,$i,ji,da,ir,_a,pa,or,fa,ma,sr,Sa,Hi,Je=T(()=>{"use strict";Vi=require("path"),Ht=xt(zi()),Zi=(s=>(s.Python="python",s.JavaScript="javascript",s.TypeScript="typescript",s.TSX="tsx",s.Go="go",s.Ruby="ruby",s))(Zi||{}),Vt={python:"python",javascript:"javascript",javascriptreact:"javascript",jsx:"javascript",typescript:"typescript",typescriptreact:"tsx",go:"go",ruby:"ruby"};a(_e,"isSupportedLanguageId");a(K,"languageIdToWasmLanguage");rr=`[
(function body: (statement_block) @body)
(function_declaration body: (statement_block) @body)
(generator_function body: (statement_block) @body)
(generator_function_declaration body: (statement_block) @body)
(method_definition body: (statement_block) @body)
(arrow_function body: (statement_block) @body)
] @function`,ua={python:[[`(function_definition body: (block
(expression_statement (string))? @docstring) @body) @function`],['(ERROR ("def" (identifier) (parameters))) @function']],javascript:[[rr]],typescript:[[rr]],tsx:[[rr]],go:[[`[
(function_declaration body: (block) @body)
(method_declaration body: (block) @body)
] @function`]],ruby:[[`[
(method name: (_) parameters: (method_parameters)? @params [(_)+ "end"] @body)
(singleton_method name: (_) parameters: (method_parameters)? @params [(_)+ "end"] @body)
] @function`]]},ca='(call_expression function: ((identifier) @req (#eq? @req "require")))',qi=`(variable_declarator value: ${ca})`,$i=`
(lexical_declaration ${qi}+)
(variable_declaration ${qi}+)
`,ji=[[`(program [ ${$i} ] @import)`],["(program [ (import_statement) (import_alias) ] @import)"]],da={python:[["(module (future_import_statement) @import)"],["(module (import_statement) @import)"],["(module (import_from_statement) @import)"]],javascript:[[`(program [ ${$i} ] @import)`],["(program [ (import_statement) ] @import)"]],typescript:ji,tsx:ji,go:[],ruby:[]},ir=[["(program (export_statement) @export)"]],_a={python:[],javascript:ir,typescript:ir,tsx:ir,go:[],ruby:[]},pa={python:[["(module (global_statement) @globalVar)"],["(module (expression_statement) @globalVar)"]],javascript:[],typescript:[],tsx:[],go:[],ruby:[]},or=["function","function_declaration","generator_function","generator_function_declaration","method_definition","arrow_function"],fa={python:new Set(["function_definition"]),javascript:new Set(or),typescript:new Set(or),tsx:new Set(or),go:new Set(["function_declaration","method_declaration"]),ruby:new Set(["method","singleton_method"])},ma={python:n=>n.type==="module"||n.type==="block"&&n.parent?.type==="class_definition",javascript:n=>n.type==="program"||n.type==="class_body",typescript:n=>n.type==="program"||n.type==="class_body",tsx:n=>n.type==="program"||n.type==="class_body",go:n=>n.type==="source_file",ruby:n=>n.type==="program"||n.type==="class"},sr=new Map;a(ha,"loadWasmLanguage");a(Gi,"getLanguage");a(J,"parseTreeSitter");a(ga,"parsesWithoutError");a(ba,"getBlockCloseToken");a(Ge,"innerQuery");a(Ki,"queryFunctions");a(ya,"queryImports");a(ar,"queryExports");a(wa,"queryGlobalVars");Sa=[`[
(class_definition (block (expression_statement (string))))
(function_definition (block (expression_statement (string))))
]`];a(lr,"queryPythonIsDocstring");a(ur,"getAncestorWithSiblingFunctions");a(jt,"isFunction");a(cr,"isFunctionDefinition");a(Ke,"getFirstPrecedingComment");a(dr,"getFunctionPositions");Hi={python:[[`(call
function: [
(identifier) @caller
(attribute attribute:(identifier) @caller)
]
arguments: (argument_list) @args
)`]],javascript:[],tsx:[],typescript:[],go:[],ruby:[]};a(va,"getCallSites")});async function Ji({source:n,offset:e,languageId:t}){if(_e(t)){let r=await J(t,n);try{let i=e;for(;i>=0&&/\s/.test(n[i]);)i--;let o=r.rootNode.descendantForIndex(i),s=ur(t,o);if(s){for(let l=s.nextSibling;l;l=l.nextSibling)if(cr(t,l)){let c=Ke(l)?.startIndex??l.startIndex;if(c<e)continue;return c}if(s.endIndex>=e)return s.endIndex}}finally{r.delete()}}return e}var Qi=T(()=>{"use strict";Je();a(Ji,"getSiblingFunctionStart")});function xa(n){return{...Ea,...n}}function Ne(n,e={}){let t=xa(e),r=ee(t.tokenizerName);if(t.maxLineCount!==void 0&&t.maxLineCount<0)throw new Error("maxLineCount must be non-negative if defined");if(t.maxTokenLength!==void 0&&t.maxTokenLength<0)throw new Error("maxTokenLength must be non-negative if defined");if(t.maxLineCount===0||t.maxTokenLength===0)return{context:"",lineCount:0,tokenLength:0,tokenizerName:t.tokenizerName};let i=n.source.slice(0,n.offset);return t.maxLineCount!==void 0&&(i=i.split(`
`).slice(-t.maxLineCount).join(`
`)),t.maxTokenLength!==void 0&&(i=r.takeLastLinesTokens(i,t.maxTokenLength)),{context:i,lineCount:i.split(`
`).length,tokenLength:r.tokenLength(i),tokenizerName:t.tokenizerName}}var Ea,Zt=T(()=>{"use strict";ze();Ea={tokenizerName:"cl100k"};a(xa,"cursorContextOptions");a(Ne,"getCursorContext")});function Ia(n,e){let t=Ma[n.semantics],i=(n.relativePath?`Compare this ${t} from ${n.relativePath}:`:`Compare this ${t}:`)+`
`+n.snippet;return i.endsWith(`
`)||(i+=`
`),qt(i,e)}function Ta(n,e){let t=e[n.provider];if(!t)throw new Error("Unknown snippet provider: "+n.provider);let{score:r,...i}=n,o=r;if(t.normalizationFunction==="affine"){let[s,l]=t.normalizationParams;o=s*r+l}else throw new Error(`Unknown normalization function ${t.normalizationFunction} for snippet provider ${n.provider}`);return{...i,providerScore:r,normalizedScore:o}}function $t(n){n.sort((e,t)=>t.normalizedScore-e.normalizedScore)}function La(n,e,t){if(e==0)return{reserved:[],candidates:[]};let r=n.map(u=>Ta(u,t)),i=new Map,o;for(o in t)i.set(o,[]);for(let u of r){let c=i.get(u.provider);if(!c)throw new Error("Unknown snippet provider: "+u.provider);c.push(u)}for(let[u,c]of i)$t(c);let s=[];for(o in t){let c=t[o].reservedSnippetCount||0;if(c>0){let d=i.get(o)||[];s=s.concat(d.slice(0,c)),i.set(o,d.slice(c))}}$t(s);let l=[];if(s.length>e)throw new Error("Reserved snippet count exceeds number of snippets");if(s.length<e){let u=Array.from(i.values()).flat();$t(u),l=u.slice(0,e-s.length)}return{reserved:s,candidates:l}}function Xi(n,e,t,r,i,o,s){let{reserved:l,candidates:u}=La(n,o,r),c=0,d=[],_=i.high,p=i.low;function m(h,f){let g=Ia(h,e),S=t.tokenLength(g),b;return f+S<=s?(b=_,_=i.priorities.justBelow(b)):(b=p,p=i.priorities.justBelow(b)),d.push({announcedSnippet:g,provider:h.provider,providerScore:h.providerScore,normalizedScore:h.normalizedScore,priority:b,tokens:S,relativePath:h.relativePath}),f+S}a(m,"process");for(let h of[...l,...u]){if(d.length>=o)break;c=m(h,c)}return $t(d),d.reverse(),d}var se,ye,Ma,we=T(()=>{"use strict";Le();se=(s=>(s.NeighboringTabs="neighboring-tabs",s.Retrieval="retrieval",s.SymbolDef="symbol-def",s.Language="language",s.Path="path",s.LocalImportContext="local-import-context",s))(se||{}),ye=(d=>(d.Function="function",d.Snippet="snippet",d.Variable="variable",d.Parameter="parameter",d.Method="method",d.Class="class",d.Module="module",d.Alias="alias",d.Enum="enum member",d.Interface="interface",d))(ye||{}),Ma={function:"function",snippet:"snippet",variable:"variable",parameter:"parameter",method:"method",class:"class",module:"module",alias:"alias","enum member":"enum member",interface:"interface"};a(Ia,"announceSnippet");a(Ta,"normalizeSnippetScore");a($t,"sortSnippetsDescending");a(La,"selectSnippets");a(Xi,"processSnippetsForWishlist")});async function Na(n){let e=[];if(_e(n.languageId)){let t=await dr(n.languageId,n.source);for(let r=0;r<t.length;r++){let{startIndex:i,endIndex:o}=t[r],s=n.source.substring(i,o);e.push({source:s,relativePath:n.relativePath,languageId:n.languageId,uri:n.uri})}}return e}function Ca(n){return n.split(/[^a-zA-Z0-9]/).filter(e=>e.length>0)}var _r,pr,Yi,Ce,Gt,Pa,ka,Aa,Kt=T(()=>{"use strict";Je();Se();we();_r=class{constructor(e){this.keys=[];this.cache={};this.size=e}static{a(this,"FifoCache")}put(e,t){if(this.cache[e]=t,this.keys.length>this.size){this.keys.push(e);let r=this.keys.shift()??"";delete this.cache[r]}}get(e){return this.cache[e]}},pr=class{static{a(this,"Tokenizer")}constructor(e){this.stopsForLanguage=Aa.get(e.languageId)??ka}tokenize(e){return new Set(Ca(e).filter(t=>!this.stopsForLanguage.has(t)))}},Yi=new _r(20),Ce=class{static{a(this,"WindowedMatcher")}constructor(e){this.referenceDoc=e,this.tokenizer=new pr(e)}get referenceTokens(){return this.tokenizer.tokenize(this._getCursorContextInfo(this.referenceDoc).context)}sortScoredSnippets(e,t="descending"){return t=="ascending"?e.sort((r,i)=>r.score>i.score?1:-1):t=="descending"?e.sort((r,i)=>r.score>i.score?-1:1):e}retrieveAllSnippets(e,t="descending"){let r=[];if(e.source.length===0||this.referenceTokens.size===0)return r;let i=e.source.split(`
`),o=this.id()+":"+e.source,s=Yi.get(o)??[],l=s.length==0,u=l?i.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[c,[d,_]]of this.getWindowsDelineations(i).entries()){if(l){let h=new Set;u.slice(d,_).forEach(f=>f.forEach(h.add,h)),s.push(h)}let p=s[c],m=this.similarityScore(p,this.referenceTokens);r.push({score:m,startLine:d,endLine:_})}return l&&Yi.put(o,s),this.sortScoredSnippets(r,t)}async findMatches(e,t="bestMatch",r){if(t=="bestMatch"){let i=await this.findBestMatch(e);return i?[i]:[]}return t=="topK"?await this.findTopKMatches(e,r)||[]:[]}async findBestMatch(e){if(e.source.length===0||this.referenceTokens.size===0)return;let t=e.source.split(`
`),r=this.retrieveAllSnippets(e,"descending");return r.length===0||r[0].score===0?void 0:{snippet:t.slice(r[0].startLine,r[0].endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...r[0]}}async findTopKMatches(e,t=1){if(e.source.length===0||this.referenceTokens.size===0||t<1)return;let r=e.source.split(`
`),i=this.retrieveAllSnippets(e,"descending");if(i.length===0||i[0].score===0)return;let o=[i[0]];for(let s=1;s<i.length&&o.length<t;s++)o.findIndex(l=>i[s].startLine<l.endLine&&i[s].endLine>l.startLine)==-1&&o.push(i[s]);return o.map(s=>({snippet:r.slice(s.startLine,s.endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...s}))}};a(Na,"getNeighboringFunctions");Gt=class extends Ce{static{a(this,"FunctionalMatcher")}constructor(e){super(e)}getMatchingScore(e){let t=this.tokenizer.tokenize(e.source),r=this.similarityScore(t,this.referenceTokens);return{snippet:e.source,score:r,startLine:0,endLine:0}}async findBestMatch(e){let t=await this.findMatches(e);if(t.length!==0&&t[0].score!==0)return t[0]}async findMatches(e,t,r){if(e.source.length===0||this.referenceTokens.size===0)return[];let i=await Na(e);if(i.length==0){let s=e.source.split(`
`),l=this.retrieveAllSnippets(e,"descending");return l.length===0?[]:l[0].score===0?[]:[{snippet:s.slice(l[0].startLine,l[0].endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...l[0]}]}let o=[];for(let s of i){let l=this.getMatchingScore(s);o.push({semantics:"function",provider:"neighboring-tabs",...l})}return o}};a(Ca,"splitIntoWords");Pa=new Set(["we","our","you","it","its","they","them","their","this","that","these","those","is","are","was","were","be","been","being","have","has","had","having","do","does","did","doing","can","don","t","s","will","would","should","what","which","who","when","where","why","how","a","an","the","and","or","not","no","but","because","as","until","again","further","then","once","here","there","all","any","both","each","few","more","most","other","some","such","above","below","to","during","before","after","of","at","by","about","between","into","through","from","up","down","in","out","on","off","over","under","only","own","same","so","than","too","very","just","now"]),ka=new Set(["if","then","else","for","while","with","def","function","return","TODO","import","try","catch","raise","finally","repeat","switch","case","match","assert","continue","break","const","class","enum","struct","static","new","super","this","var",...Pa]),Aa=new Map([])});function ht(n,e){let t=[],r=e.length;if(r==0)return[];if(r<n)return[[0,r]];for(let i=0;i<r-n+1;i++)t.push([i,i+n]);return t}var fr=T(()=>{"use strict";qe();Ve();a(ht,"getBasicWindowDelineations")});function Xt(n,e){let t=new Set;return n.forEach(r=>{e.has(r)&&t.add(r)}),t.size/(n.size+e.size-t.size)}var Jt,Qt,mr=T(()=>{"use strict";Zt();Kt();fr();Jt=class n extends Ce{constructor(t,r){super(t);this.windowLength=r}static{a(this,"FixedWindowSizeJaccardMatcher")}static{this.FACTORY=t=>({to:r=>new n(r,t)})}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return ht(this.windowLength,t)}_getCursorContextInfo(t){return Ne(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Xt(t,r)}},Qt=class n extends Gt{constructor(t,r){super(t);this.windowLength=r}static{a(this,"FunctionJaccardMatcher")}id(){return"function:"+this.windowLength}getWindowsDelineations(t){return ht(this.windowLength,t)}static{this.FACTORY=t=>({to:r=>new n(r,t)})}_getCursorContextInfo(t){return Ne(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Xt(t,r)}};a(Xt,"computeScore")});var Yt,hr,eo,gr,gt,en=T(()=>{"use strict";Se();Zt();mr();Kt();we();fr();Yt=(r=>(r.CursorOnly="cursoronly",r.CursorJaccard="cursorjaccard",r.JaccardCursor="jaccardcursor",r))(Yt||{}),hr=class{constructor(e){this.keys=[];this.cache={};this.size=e}static{a(this,"FifoCache")}put(e,t){if(this.cache[e]=t,this.keys.length>this.size){this.keys.push(e);let r=this.keys.shift()??"";delete this.cache[r]}}get(e){return this.cache[e]}},eo=new hr(20),gr=class extends Ce{constructor(t,r){super(t);this.windowLength=r}static{a(this,"CustomizedFixedWindowSizeJaccardMatcher")}id(){return"CustomizedFixedWindowSizeJaccardMatcher:"+this.windowLength}getWindowsDelineations(t){return ht(this.windowLength,t)}_getCursorContextInfo(t){return Ne(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Xt(t,r)}retrieveAllSnippets(t,r="descending",i){let o=[];if(t.source.length===0||this.referenceTokens.size===0)return o;let s=t.source.split(`
`),l=this.id()+":"+t.source,u=eo.get(l)??[],c=u.length==0,d=c?s.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[_,[p,m]]of this.getWindowsDelineations(s).entries()){if(c){let g=new Set;d.slice(p,m).forEach(S=>S.forEach(g.add,g)),u.push(g)}if(i!==void 0&&i.get(p)!==m)continue;let h=u[_],f=this.similarityScore(h,this.referenceTokens);o.push({score:f,startLine:p,endLine:m})}return c&&eo.put(l,u),this.sortScoredSnippets(o,r)}},gt=class n{static{a(this,"CursorHistoryMatcher")}constructor(e,t,r,i){this.windowLength=t,this.lineCursorHistory=r,this.jaccardMatcher=new gr(e,t),this.strategy=i}static{this.FACTORY=(e,t,r)=>({to:i=>new n(i,e,t,r)})}sortScoredSnippets(e,t="descending"){return t=="ascending"?e.sort((r,i)=>r.score>i.score?1:-1):t=="descending"?e.sort((r,i)=>r.score>i.score?-1:1):e}markerToSnippet(e,t){return e.map(r=>({snippet:t.slice(r.startLine,r.endLine).join(`
`),provider:"neighboring-tabs",semantics:"snippet",...r}))}async findMatches(e,t="bestMatch",r){if(t=="bestMatch"){let i=await this.findBestMatch(e);return i===void 0?[]:[i]}return t=="topK"?await this.findTopKMatches(e,r)||[]:[]}async findBestMatch(e){if(e.source.length!==0){if(this.strategy==="cursoronly"){let t=this.retrieveCursorSnippets(e);if(t=this.sortScoredSnippets(t,"descending"),t.length===0)return;let r=Math.max(...t.map(l=>l.score)),i=t.filter(l=>l.score===r),o=i.sort((l,u)=>l.startLine-u.startLine)[Math.floor(i.length/2)];return{snippet:e.source.split(`
`).slice(o.startLine,o.endLine).join(`
`),provider:"neighboring-tabs",semantics:"snippet",...o}}else if(this.strategy==="cursorjaccard"){let t=this.retrieveCursorSnippets(e);if(t=this.sortScoredSnippets(t,"descending"),t.length===0)return;let r=Math.max(...t.map(c=>c.score)),i=[],o=new Map;for(let c of t)c.score===r&&(i.push(c),o.set(c.startLine,c.endLine));let s=this.jaccardMatcher.retrieveAllSnippets(e,"descending",o);if(s.length===0)return;let l=s[0];for(let c of t)if(c.startLine===l.startLine&&c.endLine===l.endLine){l.score+=c.score;break}return{snippet:e.source.split(`
`).slice(l.startLine,l.endLine).join(`
`),provider:"neighboring-tabs",semantics:"snippet",...l}}else if(this.strategy==="jaccardcursor"){let t=await this.jaccardMatcher.findBestMatch(e);if(t===void 0)return;let r=this.retrieveCursorSnippets(e);if(r=this.sortScoredSnippets(r,"descending"),r.length===0)return;for(let i of r)if(i.startLine===t.startLine&&i.endLine===t.endLine){t.score+=i.score;break}return t}}}async findTopKMatches(e,t=1){if(e.source.length===0||t<1)return;let r=e.source.split(`
`),i=this.retrieveCursorSnippets(e);if(i.length!==0){if(this.strategy==="cursoronly"){i=this.sortScoredSnippets(i,"descending");let o=this.gatherNonOverlappingSnippets(i,t);return this.markerToSnippet(o,r)}else if(this.strategy==="cursorjaccard"){i=this.sortScoredSnippets(i,"descending");let o=new Map(i.map(c=>[c.startLine,c.endLine])),l=this.jaccardMatcher.retrieveAllSnippets(e,"descending",o).reduce((c,d)=>c.set([d.startLine,d.endLine].join(","),d.score),new Map);i.forEach(c=>c.score+=l.get([c.startLine,c.endLine].join(","))??0),i=this.sortScoredSnippets(i,"descending");let u=this.gatherNonOverlappingSnippets(i,t);return this.markerToSnippet(u,r)}else if(this.strategy==="jaccardcursor"){let o=await this.jaccardMatcher.findTopKMatches(e,t);if(o===void 0)return;let s=i.reduce((u,c)=>u.set([c.startLine,c.endLine].join(","),c.score),new Map);o.forEach(u=>u.score+=s.get([u.startLine,u.endLine].join(","))??0);let l=this.sortScoredSnippets(o,"descending");return this.markerToSnippet(l,r)}}}gatherNonOverlappingSnippets(e,t){let r=[e[0]];for(let i=1;i<e.length&&r.length<t;i++)r.findIndex(o=>e[i].startLine<o.endLine&&e[i].endLine>o.startLine)==-1&&r.push(e[i]);return r}retrieveCursorSnippets(e){let t=[];if(e.source.length===0)return t;let r=this.lineCursorHistory.get(e.uri);if(r===void 0)return t;let i=e.source.split(`
`),o;(_=>(_[_.leftBoundary=0]="leftBoundary",_[_.rightBoundary=1]="rightBoundary"))(o||={});let s=[];for(let[c,d]of r.entries())c>=i.length||(s.push([Math.max(0,c-this.windowLength+1),0,d]),s.push([c+1,1,d]));s.push([i.length,0,0]),s=s.sort((c,d)=>c[0]-d[0]);let l=0,u=0;for(let[c,d,_]of s){if(l>0)for(let p=u;p<c&&(p==0||p+this.windowLength<=i.length);p++)t.push({score:l,startLine:p,endLine:Math.min(i.length,p+this.windowLength)});d===0?l+=_:l-=_,u=c}return t}}});function Da(n,e,t,r,i="cursorjaccard"){let o;return e==="neighboringSnippet"?o=Jt.FACTORY(t.snippetLength):e==="neighboringFunction"?o=Qt.FACTORY(t.snippetLength):((0,to.ok)(r!==void 0,"lineCursorHistory should not be undefined"),o=gt.FACTORY(t.snippetLength,r,i)),o.to(n)}async function no(n,e,t,r,i,o,s,l){let u={...Fa[r]},c=Da(n,t,u,s,l);return u.numberOfSnippets===0?[]:(await e.filter(_=>_.source.length<Oa&&_.source.length>0).slice(0,Ra).reduce(async(_,p)=>(await _).concat((await c.findMatches(p,i,o)).map(m=>({relativePath:p.relativePath,...m}))),Promise.resolve([]))).filter(_=>_.score&&_.snippet&&_.score>u.threshold).sort((_,p)=>_.score-p.score).slice(-u.numberOfSnippets)}var to,bt,tn,Fa,Oa,Ra,yt=T(()=>{"use strict";to=require("assert");en();mr();bt=(u=>(u.None="none",u.Conservative="conservative",u.Medium="medium",u.Eager="eager",u.EagerButLittle="eagerButLittle",u.EagerButMedium="eagerButMedium",u.EagerButMuch="eagerButMuch",u.RetrievalComparable="retrievalComparable",u))(bt||{}),tn=(r=>(r.NeighboringFunctions="neighboringFunction",r.NeighboringSnippets="neighboringSnippet",r.CursorHistoryMatcher="cursorhistorymatcher",r))(tn||{}),Fa={none:{snippetLength:1,threshold:-1,numberOfSnippets:0},conservative:{snippetLength:10,threshold:.3,numberOfSnippets:1},medium:{snippetLength:20,threshold:.1,numberOfSnippets:2},eager:{snippetLength:60,threshold:0,numberOfSnippets:4},eagerButLittle:{snippetLength:10,threshold:0,numberOfSnippets:1},eagerButMedium:{snippetLength:20,threshold:0,numberOfSnippets:4},eagerButMuch:{snippetLength:60,threshold:0,numberOfSnippets:6},retrievalComparable:{snippetLength:30,threshold:0,numberOfSnippets:4}},Oa=1e4,Ra=20;a(Da,"getMatcher");a(no,"getNeighborSnippets")});function ro(n,e){if(n.length===0||e.length===0)return{score:n.length+e.length};let t=Array.from({length:n.length}).map(()=>Array.from({length:e.length}).map(()=>0));for(let r=0;r<n.length;r++)t[r][0]=r;for(let r=0;r<e.length;r++)t[0][r]=r;for(let r=0;r<e.length;r++)for(let i=0;i<n.length;i++)t[i][r]=Math.min((i==0?r:t[i-1][r])+1,(r==0?i:t[i][r-1])+1,(i==0||r==0?Math.max(i,r):t[i-1][r-1])+(n[i]==e[r]?0:1));return{score:t[n.length-1][e.length-1]}}var io=T(()=>{"use strict";a(ro,"findEditDistanceScore")});var br,yr,nn,rn,Pe,oo=T(()=>{"use strict";Se();br=class{constructor(){this.used=new Map;this.unused=new Map}static{a(this,"PromptBackground")}markUsed(e){this.IsSnippet(e)&&this.used.set(e.id,this.convert(e))}undoMarkUsed(e){this.IsSnippet(e)&&this.used.delete(e.id)}markUnused(e){this.IsSnippet(e)&&this.unused.set(e.id,this.convert(e))}convert(e){return{score:e.score.toFixed(4),length:e.text.length}}IsSnippet(e){return e.kind=="SimilarFile"||e.kind=="RetrievalSnippet"}},yr=class{constructor(){this.used=new Map;this.unused=new Map;this.usedCounts=new Map;this.unusedCounts=new Map}static{a(this,"PromptChoices")}markUsed(e){this.used.set(e.kind,(this.used.get(e.kind)||0)+e.tokens),this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)+1)}undoMarkUsed(e){this.used.set(e.kind,(this.used.get(e.kind)||0)-e.tokens),this.usedCounts.set(e.kind,(this.usedCounts.get(e.kind)||0)-1)}markUnused(e){this.unused.set(e.kind,(this.unused.get(e.kind)||0)+e.tokens),this.unusedCounts.set(e.kind,(this.unusedCounts.get(e.kind)||0)+1)}},nn=class{constructor(e){this.ranges=new Array;let t=0,r;for(let{element:i}of e)i.text.length!==0&&(r==="BeforeCursor"&&i.kind==="BeforeCursor"?this.ranges[this.ranges.length-1].end+=i.text.length:this.ranges.push({kind:i.kind,start:t,end:t+i.text.length}),r=i.kind,t+=i.text.length)}static{a(this,"PromptElementRanges")}},rn=class{constructor(e,t){this.tokenizer=e;this.content=[];this.tokenizer=e,this.lineEndingOption=t}static{a(this,"PromptWishlist")}getContent(){return[...this.content]}convertLineEndings(e){return this.lineEndingOption==="unix"&&(e=e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),e}append(e,t,r,i=this.tokenizer.tokenLength(e),o=NaN){e=this.convertLineEndings(e);let s=this.content.length;return this.content.push({id:s,text:e,kind:t,priority:r,tokens:i,requires:[],excludes:[],score:o}),s}appendLineForLine(e,t,r){e=this.convertLineEndings(e);let i=e.split(`
`);for(let l=0;l<i.length-1;l++)i[l]+=`
`;let o=[];i.forEach((l,u)=>{l===`
`&&o.length>0&&!o[o.length-1].endsWith(`
`)?o[o.length-1]+=`
`:o.push(l)});let s=[];return o.forEach((l,u)=>{l!==""&&(s.push(this.append(l,t,r)),u>0&&(this.content[this.content.length-2].requires=[this.content[this.content.length-1]]))}),s}require(e,t){let r=this.content.find(o=>o.id===e),i=this.content.find(o=>o.id===t);r&&i&&r.requires.push(i)}exclude(e,t){let r=this.content.find(o=>o.id===e),i=this.content.find(o=>o.id===t);r&&i&&r.excludes.push(i)}fulfill(e){let t=new yr,r=new br,i=this.content.map((h,f)=>({element:h,index:f}));i.sort((h,f)=>h.element.priority===f.element.priority?f.index-h.index:f.element.priority-h.element.priority);let o=new Set,s=new Set,l,u=[],c=e;i.forEach(h=>{let f=h.element;if(c>=0&&(c>0||l===void 0)&&f.requires.every(g=>o.has(g.id))&&!s.has(f.id)){let g=f.tokens;c>=g?(c-=g,o.add(f.id),f.excludes.forEach(S=>s.add(S.id)),t.markUsed(f),r.markUsed(f),u.push(h)):l===void 0?l=h:(t.markUnused(h.element),r.markUnused(h.element))}else t.markUnused(f),r.markUnused(f)}),u.sort((h,f)=>h.index-f.index);let d=u.reduce((h,f)=>h+f.element.text,""),_=this.tokenizer.tokenLength(d);for(;_>e;){u.sort((f,g)=>g.element.priority===f.element.priority?g.index-f.index:g.element.priority-f.element.priority);let h=u.pop();h&&(t.undoMarkUsed(h.element),t.markUnused(h.element),r.undoMarkUsed(h.element),r.markUnused(h.element),l!==void 0&&(t.markUnused(l.element),r.markUnused(l.element)),l=void 0),u.sort((f,g)=>f.index-g.index),d=u.reduce((f,g)=>f+g.element.text,""),_=this.tokenizer.tokenLength(d)}let p=[...u];if(l!==void 0){p.push(l),p.sort((g,S)=>g.index-S.index);let h=p.reduce((g,S)=>g+S.element.text,""),f=this.tokenizer.tokenLength(h);if(f<=e){t.markUsed(l.element),r.markUsed(l.element);let g=new nn(p);return{prefix:h,suffix:"",prefixLength:f,suffixLength:0,promptChoices:t,promptBackground:r,promptElementRanges:g}}else t.markUnused(l.element),r.markUnused(l.element)}let m=new nn(u);return{prefix:d,suffix:"",prefixLength:_,suffixLength:0,promptChoices:t,promptBackground:r,promptElementRanges:m}}},Pe=class n{constructor(){this.registeredPriorities=[0,1]}static{a(this,"Priorities")}static{this.TOP=1}static{this.BOTTOM=0}register(e){if(e>n.TOP||e<n.BOTTOM)throw new Error("Priority must be between 0 and 1");return this.registeredPriorities.push(e),e}justAbove(...e){let t=Math.max(...e),r=Math.min(...this.registeredPriorities.filter(i=>i>t));return this.register((r+t)/2)}justBelow(...e){let t=Math.min(...e),r=Math.max(...this.registeredPriorities.filter(i=>i<t));return this.register((r+t)/2)}between(e,t){if(this.registeredPriorities.some(r=>r>e&&r<t)||!(this.registeredPriorities.includes(e)&&this.registeredPriorities.includes(t)))throw new Error("Priorities must be adjacent in the list of priorities");return this.register((e+t)/2)}}});function Qe(n){return n=n.toLowerCase(),Ba[n]??n}async function Wa(n,e,t={},r=[]){let i=new sn(n,t),o=ee(i.tokenizerName),s=!1,{source:l,offset:u}=e;if(u<0||u>l.length)throw new Error(`Offset ${u} is out of range.`);e.languageId=Qe(e.languageId);let c=new Pe,d=c.justBelow(Pe.TOP),_=i.languageMarker==="always"?c.justBelow(Pe.TOP):c.justBelow(d),p=i.pathMarker==="always"?c.justBelow(Pe.TOP):c.justBelow(d),m=c.justBelow(d),h=c.justBelow(m),f=c.justAbove(d),g=new rn(o,i.lineEnding),S=r.find(A=>A.provider==="language"),b;i.languageMarker!=="nomarker"&&S&&(b=g.append(S.snippet,"LanguageMarker",_));let M=r.find(A=>A.provider==="path"),N;i.pathMarker!=="nomarker"&&M!==void 0&&M.snippet.length>0&&(N=g.append(M.snippet,"PathMarker",p));let H=r.filter(A=>A.provider==="local-import-context");if(i.localImportContext!=="nocontext")for(let A of H)g.append(be(A.snippet),"ImportedFile",m);r=r.filter(A=>A.provider!=="language"&&A.provider!=="path"&&A.provider!=="local-import-context");function Q(){let A=Math.round(i.snippetPercent/100*i.maxPromptLength);Xi(r,e.languageId,o,i.snippetProviderOptions,{priorities:c,low:h,high:f},i.numberOfSnippets,A).forEach(P=>{let y="SimilarFile";P.provider==="retrieval"?y="RetrievalSnippet":P.provider=="symbol-def"&&(y="SymbolDefinition"),g.append(P.announcedSnippet,y,P.priority,P.tokens,P.normalizedScore)})}a(Q,"addSnippetsNow"),i.snippetPosition==="top"&&Q();let O=[],W;if(W=l.substring(0,u),i.snippetPosition==="aboveCursor"){let A=W.lastIndexOf(`
`)+1,U=W.substring(0,A),P=W.substring(A);g.appendLineForLine(U,"BeforeCursor",d).forEach(y=>O.push(y)),Q(),P.length>0&&(O.push(g.append(P,"AfterCursor",d)),O.length>1&&g.require(O[O.length-2],O[O.length-1]))}else g.appendLineForLine(W,"BeforeCursor",d).forEach(A=>O.push(A));i.languageMarker==="top"&&O.length>0&&b!==void 0&&g.require(b,O[0]),i.pathMarker==="top"&&O.length>0&&N!==void 0&&(b?g.require(N,b):g.require(N,O[0])),b!==void 0&&N!==void 0&&g.exclude(N,b);let X=l.slice(u);if(i.suffixPercent===0||X.length<=i.fimSuffixLengthThreshold)return g.fulfill(i.maxPromptLength);{let A=e.offset;i.suffixStartMode!=="cursor"&&i.suffixStartMode!=="cursortrimstart"&&(A=await Ji(e));let U=i.maxPromptLength-ao,P=Math.floor(U*(100-i.suffixPercent)/100),y=g.fulfill(P),w=U-y.prefixLength,v=l.slice(A);(i.suffixStartMode==="siblingblocktrimstart"||i.suffixStartMode==="cursortrimstart")&&(v=v.trimStart());let E=o.takeFirstTokens(v,w);return E.tokens.length<=w-3&&(P=U-E.tokens.length,y=g.fulfill(P)),i.suffixMatchCriteria==="equal"?E.tokens.length===pe.tokens.length&&E.tokens.every((L,k)=>L===pe.tokens[k])&&(s=!0):i.suffixMatchCriteria==="levenshteineditdistance"&&E.tokens.length>0&&i.suffixMatchThreshold>0&&100*ro(E.tokens.slice(0,on),pe.tokens.slice(0,on))?.score<i.suffixMatchThreshold*Math.min(on,E.tokens.length)&&(s=!0),s===!0&&pe.tokens.length<=w?(pe.tokens.length<=w-3&&(P=U-pe.tokens.length,y=g.fulfill(P)),y.suffix=pe.text,y.suffixLength=pe.tokens.length):(y.suffix=E.text,y.suffixLength=E.tokens.length,pe=E),y}}var pe,so,on,ao,lo,uo,co,_o,mt,Sr,wr,po,fo,mo,sn,Ba,Se=T(()=>{"use strict";Le();Qi();en();yt();we();io();ze();oo();pe={text:"",tokens:[]},so=1500,on=50,ao=5,lo=4,uo=(r=>(r.NoMarker="nomarker",r.Top="top",r.Always="always",r))(uo||{}),co=(r=>(r.NoMarker="nomarker",r.Top="top",r.Always="always",r))(co||{}),_o=(r=>(r.TopOfText="top",r.DirectlyAboveCursor="aboveCursor",r.AfterSiblings="afterSiblings",r))(_o||{}),mt=(t=>(t.BestMatch="bestMatch",t.TopK="topK",t))(mt||{}),Sr=(t=>(t.NoContext="nocontext",t.Declarations="declarations",t))(Sr||{}),wr=(t=>(t.ConvertToUnix="unix",t.KeepOriginal="keep",t))(wr||{}),po=(t=>(t.None="none",t.FifteenPercent="fifteenPercent",t))(po||{}),fo=(t=>(t.Equal="equal",t.Levenshtein="levenshteineditdistance",t))(fo||{}),mo=(i=>(i.Cursor="cursor",i.CursorTrimStart="cursortrimstart",i.SiblingBlock="siblingblock",i.SiblingBlockTrimStart="siblingblocktrimstart",i))(mo||{}),sn=class{constructor(e,t){this.fs=e;this.maxPromptLength=so;this.languageMarker="top";this.pathMarker="top";this.localImportContext="nocontext";this.snippetPosition="top";this.numberOfSnippets=lo;this.snippetProviderOptions={"neighboring-tabs":{normalizationFunction:"affine",normalizationParams:[1,0]},retrieval:{normalizationFunction:"affine",normalizationParams:[-1,0]},"symbol-def":{normalizationFunction:"affine",normalizationParams:[1,0],reservedSnippetCount:2},language:{normalizationFunction:"affine",normalizationParams:[1,0]},path:{normalizationFunction:"affine",normalizationParams:[1,0]},"local-import-context":{normalizationFunction:"affine",normalizationParams:[1,0]}};this.neighboringTabs="eager";this.neighboringSnippetTypes="neighboringSnippet";this.lineEnding="unix";this.suffixPercent=0;this.snippetPercent=0;this.suffixStartMode="cursor";this.tokenizerName="cl100k";this.suffixMatchThreshold=0;this.suffixMatchCriteria="levenshteineditdistance";this.fimSuffixLengthThreshold=0;this.cursorSnippetsPickingStrategy="cursorjaccard";if(t){let r=t?.snippetSelection;if(r&&!Object.values(mt).includes(r))throw new Error(`Invalid value for snippetSelection: ${r}`);for(let i in t)if(i!=="snippetProviderOptions")this[i]=t[i];else{let o=t.snippetProviderOptions||{},s;for(s in o){let l=o[s];l&&(this.snippetProviderOptions[s]={...this.snippetProviderOptions[s],...l})}}}if(this.suffixPercent<0||this.suffixPercent>100)throw new Error(`suffixPercent must be between 0 and 100, but was ${this.suffixPercent}`);if(this.snippetPercent<0||this.snippetPercent>100)throw new Error(`snippetPercent must be between 0 and 100, but was ${this.snippetPercent}`);if(this.suffixMatchThreshold<0||this.suffixMatchThreshold>100)throw new Error(`suffixMatchThreshold must be at between 0 and 100, but was ${this.suffixMatchThreshold}`);if(this.fimSuffixLengthThreshold<-1)throw new Error(`fimSuffixLengthThreshold must be at least -1, but was ${this.fimSuffixLengthThreshold}`);if(this.snippetSelection==="topK"&&this.snippetSelectionK===void 0)throw new Error("snippetSelectionK must be defined.");if(this.snippetSelection==="topK"&&this.snippetSelectionK&&this.snippetSelectionK<=0)throw new Error(`snippetSelectionK must be greater than 0, but was ${this.snippetSelectionK}`)}static{a(this,"PromptOptions")}},Ba={javascriptreact:"javascript",jsx:"javascript",typescriptreact:"typescript",jade:"pug",cshtml:"razor"};a(Qe,"normalizeLanguageId");a(Wa,"getPrompt")});var ve,ae,ke=T(()=>{"use strict";Er();ve=class extends Error{static{a(this,"ProviderTimeoutError")}constructor(e){super(e),this.name="ProviderTimeoutError"}},ae=class{static{a(this,"SnippetProvider")}constructor(e){this.api=e}getSnippets(e,t){return new Promise((r,i)=>{t.aborted&&i({error:new ve("provider aborted"),providerType:this.type}),t.addEventListener("abort",()=>{i({error:new ve(`max runtime exceeded: ${vr} ms`),providerType:this.type})},{once:!0});let o=performance.now();this.buildSnippets(e).then(s=>{let l=performance.now();r({snippets:s,providerType:this.type,runtime:l-o})}).catch(s=>{i({error:s,providerType:this.type})})})}}});var an,ho=T(()=>{"use strict";Le();Se();we();ke();an=class extends ae{constructor(){super(...arguments);this.type="language"}static{a(this,"LanguageSnippetProvider")}async buildSnippets(t){let{currentFile:r}=t;return r.languageId=Qe(r.languageId),[{provider:this.type,semantics:"snippet",snippet:be(Wi(r)),relativePath:r.relativePath,startLine:0,endLine:0,score:0}]}}});var ln,go=T(()=>{"use strict";Le();Se();we();ke();ln=class extends ae{constructor(){super(...arguments);this.type="local-import-context"}static{a(this,"LocalImportContextSnippetProvider")}formSnippets(t,r){return t.map(i=>({provider:this.type,semantics:"snippet",snippet:be(i),relativePath:r.relativePath,startLine:0,endLine:0,score:1}))}async buildSnippets(t){let{currentFile:r,options:i,fileSystem:o}=t;if(i.localImportContext=="nocontext")return[];let s=await this.api.extractLocalImportContext(r,o);return this.formSnippets(s,r)}}});var un,bo=T(()=>{"use strict";xr();yt();ke();un=class extends ae{constructor(){super(...arguments);this.type="neighboring-tabs"}static{a(this,"NeighborFilesProvider")}async buildSnippets(t){let{currentFile:r,neighborFiles:i,options:o,lineCursorHistory:s}=t;return o&&i&&i.length&&o.neighboringTabs!=="none"?await this.api.getNeighborSnippets(r,i,o.neighboringSnippetTypes,o.neighboringTabs,o.snippetSelection,o.snippetSelectionK,s,o.cursorSnippetsPickingStrategy):[]}}});var cn,yo=T(()=>{"use strict";Le();Se();we();ke();cn=class extends ae{constructor(){super(...arguments);this.type="path"}static{a(this,"PathSnippetProvider")}async buildSnippets(t){let{currentFile:r}=t;return r.languageId=Qe(r.languageId),[{provider:this.type,semantics:"snippet",snippet:be(Ui(r)),relativePath:r.relativePath,startLine:0,endLine:0,score:0}]}}});var wo=q((wt,Mr)=>{(function(n,e){if(typeof wt=="object"&&typeof Mr=="object")Mr.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t=e();for(var r in t)(typeof wt=="object"?wt:n)[r]=t[r]}})(wt,()=>(()=>{"use strict";var n={470:i=>{function o(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}a(o,"e");function s(u,c){for(var d,_="",p=0,m=-1,h=0,f=0;f<=u.length;++f){if(f<u.length)d=u.charCodeAt(f);else{if(d===47)break;d=47}if(d===47){if(!(m===f-1||h===1))if(m!==f-1&&h===2){if(_.length<2||p!==2||_.charCodeAt(_.length-1)!==46||_.charCodeAt(_.length-2)!==46){if(_.length>2){var g=_.lastIndexOf("/");if(g!==_.length-1){g===-1?(_="",p=0):p=(_=_.slice(0,g)).length-1-_.lastIndexOf("/"),m=f,h=0;continue}}else if(_.length===2||_.length===1){_="",p=0,m=f,h=0;continue}}c&&(_.length>0?_+="/..":_="..",p=2)}else _.length>0?_+="/"+u.slice(m+1,f):_=u.slice(m+1,f),p=f-m-1;m=f,h=0}else d===46&&h!==-1?++h:h=-1}return _}a(s,"r");var l={resolve:function(){for(var u,c="",d=!1,_=arguments.length-1;_>=-1&&!d;_--){var p;_>=0?p=arguments[_]:(u===void 0&&(u=process.cwd()),p=u),o(p),p.length!==0&&(c=p+"/"+c,d=p.charCodeAt(0)===47)}return c=s(c,!d),d?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(o(u),u.length===0)return".";var c=u.charCodeAt(0)===47,d=u.charCodeAt(u.length-1)===47;return(u=s(u,!c)).length!==0||c||(u="."),u.length>0&&d&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return o(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var d=arguments[c];o(d),d.length>0&&(u===void 0?u=d:u+="/"+d)}return u===void 0?".":l.normalize(u)},relative:function(u,c){if(o(u),o(c),u===c||(u=l.resolve(u))===(c=l.resolve(c)))return"";for(var d=1;d<u.length&&u.charCodeAt(d)===47;++d);for(var _=u.length,p=_-d,m=1;m<c.length&&c.charCodeAt(m)===47;++m);for(var h=c.length-m,f=p<h?p:h,g=-1,S=0;S<=f;++S){if(S===f){if(h>f){if(c.charCodeAt(m+S)===47)return c.slice(m+S+1);if(S===0)return c.slice(m+S)}else p>f&&(u.charCodeAt(d+S)===47?g=S:S===0&&(g=0));break}var b=u.charCodeAt(d+S);if(b!==c.charCodeAt(m+S))break;b===47&&(g=S)}var M="";for(S=d+g+1;S<=_;++S)S!==_&&u.charCodeAt(S)!==47||(M.length===0?M+="..":M+="/..");return M.length>0?M+c.slice(m+g):(m+=g,c.charCodeAt(m)===47&&++m,c.slice(m))},_makeLong:function(u){return u},dirname:function(u){if(o(u),u.length===0)return".";for(var c=u.charCodeAt(0),d=c===47,_=-1,p=!0,m=u.length-1;m>=1;--m)if((c=u.charCodeAt(m))===47){if(!p){_=m;break}}else p=!1;return _===-1?d?"/":".":d&&_===1?"//":u.slice(0,_)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');o(u);var d,_=0,p=-1,m=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var h=c.length-1,f=-1;for(d=u.length-1;d>=0;--d){var g=u.charCodeAt(d);if(g===47){if(!m){_=d+1;break}}else f===-1&&(m=!1,f=d+1),h>=0&&(g===c.charCodeAt(h)?--h==-1&&(p=d):(h=-1,p=f))}return _===p?p=f:p===-1&&(p=u.length),u.slice(_,p)}for(d=u.length-1;d>=0;--d)if(u.charCodeAt(d)===47){if(!m){_=d+1;break}}else p===-1&&(m=!1,p=d+1);return p===-1?"":u.slice(_,p)},extname:function(u){o(u);for(var c=-1,d=0,_=-1,p=!0,m=0,h=u.length-1;h>=0;--h){var f=u.charCodeAt(h);if(f!==47)_===-1&&(p=!1,_=h+1),f===46?c===-1?c=h:m!==1&&(m=1):c!==-1&&(m=-1);else if(!p){d=h+1;break}}return c===-1||_===-1||m===0||m===1&&c===_-1&&c===d+1?"":u.slice(c,_)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,d){var _=d.dir||d.root,p=d.base||(d.name||"")+(d.ext||"");return _?_===d.root?_+p:_+"/"+p:p}(0,u)},parse:function(u){o(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var d,_=u.charCodeAt(0),p=_===47;p?(c.root="/",d=1):d=0;for(var m=-1,h=0,f=-1,g=!0,S=u.length-1,b=0;S>=d;--S)if((_=u.charCodeAt(S))!==47)f===-1&&(g=!1,f=S+1),_===46?m===-1?m=S:b!==1&&(b=1):m!==-1&&(b=-1);else if(!g){h=S+1;break}return m===-1||f===-1||b===0||b===1&&m===f-1&&m===h+1?f!==-1&&(c.base=c.name=h===0&&p?u.slice(1,f):u.slice(h,f)):(h===0&&p?(c.name=u.slice(1,m),c.base=u.slice(1,f)):(c.name=u.slice(h,m),c.base=u.slice(h,f)),c.ext=u.slice(m,f)),h>0?c.dir=u.slice(0,h-1):p&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};l.posix=l,i.exports=l},674:(i,o)=>{if(Object.defineProperty(o,"__esModule",{value:!0}),o.isWindows=void 0,typeof process=="object")o.isWindows=process.platform==="win32";else if(typeof navigator=="object"){var s=navigator.userAgent;o.isWindows=s.indexOf("Windows")>=0}},796:function(i,o,s){var l,u,c=this&&this.__extends||(l=a(function(y,w){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,E){v.__proto__=E}||function(v,E){for(var L in E)Object.prototype.hasOwnProperty.call(E,L)&&(v[L]=E[L])},l(y,w)},"n"),function(y,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function v(){this.constructor=y}a(v,"r"),l(y,w),y.prototype=w===null?Object.create(w):(v.prototype=w.prototype,new v)});Object.defineProperty(o,"__esModule",{value:!0}),o.uriToFsPath=o.URI=void 0;var d=s(674),_=/^\w[\w\d+.-]*$/,p=/^\//,m=/^\/\//;function h(y,w){if(!y.scheme&&w)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'.concat(y.authority,'", path: "').concat(y.path,'", query: "').concat(y.query,'", fragment: "').concat(y.fragment,'"}'));if(y.scheme&&!_.test(y.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(y.path){if(y.authority){if(!p.test(y.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(m.test(y.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}a(h,"f");var f="",g="/",S=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,b=function(){function y(w,v,E,L,k,I){I===void 0&&(I=!1),typeof w=="object"?(this.scheme=w.scheme||f,this.authority=w.authority||f,this.path=w.path||f,this.query=w.query||f,this.fragment=w.fragment||f):(this.scheme=function(ne,$){return ne||$?ne:"file"}(w,I),this.authority=v||f,this.path=function(ne,$){switch(ne){case"https":case"http":case"file":$?$[0]!==g&&($=g+$):$=g}return $}(this.scheme,E||f),this.query=L||f,this.fragment=k||f,h(this,I))}return a(y,"t"),y.isUri=function(w){return w instanceof y||!!w&&typeof w.authority=="string"&&typeof w.fragment=="string"&&typeof w.path=="string"&&typeof w.query=="string"&&typeof w.scheme=="string"&&typeof w.fsPath=="string"&&typeof w.with=="function"&&typeof w.toString=="function"},Object.defineProperty(y.prototype,"fsPath",{get:function(){return W(this,!1)},enumerable:!1,configurable:!0}),y.prototype.with=function(w){if(!w)return this;var v=w.scheme,E=w.authority,L=w.path,k=w.query,I=w.fragment;return v===void 0?v=this.scheme:v===null&&(v=f),E===void 0?E=this.authority:E===null&&(E=f),L===void 0?L=this.path:L===null&&(L=f),k===void 0?k=this.query:k===null&&(k=f),I===void 0?I=this.fragment:I===null&&(I=f),v===this.scheme&&E===this.authority&&L===this.path&&k===this.query&&I===this.fragment?this:new N(v,E,L,k,I)},y.parse=function(w,v){v===void 0&&(v=!1);var E=S.exec(w);return E?new N(E[2]||f,P(E[4]||f),P(E[5]||f),P(E[7]||f),P(E[9]||f),v):new N(f,f,f,f,f)},y.file=function(w){var v=f;if(d.isWindows&&(w=w.replace(/\\/g,g)),w[0]===g&&w[1]===g){var E=w.indexOf(g,2);E===-1?(v=w.substring(2),w=g):(v=w.substring(2,E),w=w.substring(E)||g)}return new N("file",v,w,f,f)},y.from=function(w){var v=new N(w.scheme,w.authority,w.path,w.query,w.fragment);return h(v,!0),v},y.prototype.toString=function(w){return w===void 0&&(w=!1),X(this,w)},y.prototype.toJSON=function(){return this},y.revive=function(w){if(w){if(w instanceof y)return w;var v=new N(w);return v._formatted=w.external,v._fsPath=w._sep===M?w.fsPath:null,v}return w},y}();o.URI=b;var M=d.isWindows?1:void 0,N=function(y){function w(){var v=y!==null&&y.apply(this,arguments)||this;return v._formatted=null,v._fsPath=null,v}return a(w,"e"),c(w,y),Object.defineProperty(w.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=W(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),w.prototype.toString=function(v){return v===void 0&&(v=!1),v?X(this,!0):(this._formatted||(this._formatted=X(this,!1)),this._formatted)},w.prototype.toJSON=function(){var v={$mid:1};return this._fsPath&&(v.fsPath=this._fsPath,v._sep=M),this._formatted&&(v.external=this._formatted),this.path&&(v.path=this.path),this.scheme&&(v.scheme=this.scheme),this.authority&&(v.authority=this.authority),this.query&&(v.query=this.query),this.fragment&&(v.fragment=this.fragment),v},w}(b),H=((u={})[58]="%3A",u[47]="%2F",u[63]="%3F",u[35]="%23",u[91]="%5B",u[93]="%5D",u[64]="%40",u[33]="%21",u[36]="%24",u[38]="%26",u[39]="%27",u[40]="%28",u[41]="%29",u[42]="%2A",u[43]="%2B",u[44]="%2C",u[59]="%3B",u[61]="%3D",u[32]="%20",u);function Q(y,w,v){for(var E=void 0,L=-1,k=0;k<y.length;k++){var I=y.charCodeAt(k);if(I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===45||I===46||I===95||I===126||w&&I===47||v&&I===91||v&&I===93||v&&I===58)L!==-1&&(E+=encodeURIComponent(y.substring(L,k)),L=-1),E!==void 0&&(E+=y.charAt(k));else{E===void 0&&(E=y.substr(0,k));var ne=H[I];ne!==void 0?(L!==-1&&(E+=encodeURIComponent(y.substring(L,k)),L=-1),E+=ne):L===-1&&(L=k)}}return L!==-1&&(E+=encodeURIComponent(y.substring(L))),E!==void 0?E:y}a(Q,"m");function O(y){for(var w=void 0,v=0;v<y.length;v++){var E=y.charCodeAt(v);E===35||E===63?(w===void 0&&(w=y.substr(0,v)),w+=H[E]):w!==void 0&&(w+=y[v])}return w!==void 0?w:y}a(O,"b");function W(y,w){var v;return v=y.authority&&y.path.length>1&&y.scheme==="file"?"//".concat(y.authority).concat(y.path):y.path.charCodeAt(0)===47&&(y.path.charCodeAt(1)>=65&&y.path.charCodeAt(1)<=90||y.path.charCodeAt(1)>=97&&y.path.charCodeAt(1)<=122)&&y.path.charCodeAt(2)===58?w?y.path.substr(1):y.path[1].toLowerCase()+y.path.substr(2):y.path,d.isWindows&&(v=v.replace(/\//g,"\\")),v}a(W,"C");function X(y,w){var v=w?O:Q,E="",L=y.scheme,k=y.authority,I=y.path,ne=y.query,$=y.fragment;if(L&&(E+=L,E+=":"),(k||L==="file")&&(E+=g,E+=g),k){var ue=k.indexOf("@");if(ue!==-1){var Et=k.substr(0,ue);k=k.substr(ue+1),(ue=Et.lastIndexOf(":"))===-1?E+=v(Et,!1,!1):(E+=v(Et.substr(0,ue),!1,!1),E+=":",E+=v(Et.substr(ue+1),!1,!0)),E+="@"}(ue=(k=k.toLowerCase()).lastIndexOf(":"))===-1?E+=v(k,!1,!0):(E+=v(k.substr(0,ue),!1,!0),E+=k.substr(ue))}if(I){if(I.length>=3&&I.charCodeAt(0)===47&&I.charCodeAt(2)===58)(Fe=I.charCodeAt(1))>=65&&Fe<=90&&(I="/".concat(String.fromCharCode(Fe+32),":").concat(I.substr(3)));else if(I.length>=2&&I.charCodeAt(1)===58){var Fe;(Fe=I.charCodeAt(0))>=65&&Fe<=90&&(I="".concat(String.fromCharCode(Fe+32),":").concat(I.substr(2)))}E+=v(I,!0,!1)}return ne&&(E+="?",E+=v(ne,!1,!1)),$&&(E+="#",E+=w?$:Q($,!1,!1)),E}a(X,"A");function A(y){try{return decodeURIComponent(y)}catch{return y.length>3?y.substr(0,3)+A(y.substr(3)):y}}a(A,"w"),o.uriToFsPath=W;var U=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function P(y){return y.match(U)?y.replace(U,function(w){return A(w)}):y}a(P,"x")},679:function(i,o,s){var l=this&&this.__spreadArray||function(p,m,h){if(h||arguments.length===2)for(var f,g=0,S=m.length;g<S;g++)!f&&g in m||(f||(f=Array.prototype.slice.call(m,0,g)),f[g]=m[g]);return p.concat(f||Array.prototype.slice.call(m))};Object.defineProperty(o,"__esModule",{value:!0}),o.Utils=void 0;var u,c=s(470),d=c.posix||c,_="/";(u=o.Utils||(o.Utils={})).joinPath=function(p){for(var m=[],h=1;h<arguments.length;h++)m[h-1]=arguments[h];return p.with({path:d.join.apply(d,l([p.path],m,!1))})},u.resolvePath=function(p){for(var m=[],h=1;h<arguments.length;h++)m[h-1]=arguments[h];var f=p.path,g=!1;f[0]!==_&&(f=_+f,g=!0);var S=d.resolve.apply(d,l([f],m,!1));return g&&S[0]===_&&!p.authority&&(S=S.substring(1)),p.with({path:S})},u.dirname=function(p){if(p.path.length===0||p.path===_)return p;var m=d.dirname(p.path);return m.length===1&&m.charCodeAt(0)===46&&(m=""),p.with({path:m})},u.basename=function(p){return d.basename(p.path)},u.extname=function(p){return d.extname(p.path)}}},e={};function t(i){var o=e[i];if(o!==void 0)return o.exports;var s=e[i]={exports:{}};return n[i].call(s.exports,s,s.exports,t),s.exports}a(t,"r");var r={};return(()=>{var i=r;Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=i.URI=void 0;var o=t(796);Object.defineProperty(i,"URI",{enumerable:!0,get:function(){return o.URI}});var s=t(679);Object.defineProperty(i,"Utils",{enumerable:!0,get:function(){return s.Utils}})})(),r})())});function Ua(n,e){let t=e.namedChild(1)?.text.slice(1,-1);if(!t||!t.startsWith("."))return null;if((0,Ae.extname)(t)==="")t=t+".ts";else if((0,Ae.extname)(t)!==".ts")return null;return(0,Ae.join)((0,Ae.dirname)(n),t)}function za(n){let e=[];if(n.namedChild(0)?.type==="import_clause"){let t=n.namedChild(0);if(t?.namedChild(0)?.type==="named_imports"){let r=t.namedChild(0);for(let i of r?.namedChildren??[])if(i.type==="import_specifier"){let o=i.childForFieldName("name")?.text;if(o){let s=i.childForFieldName("alias")?.text;e.push({name:o,alias:s})}}}}return e}function vo(n,e){let t=e?.childForFieldName("name")?.text??"";switch(e?.type){case"ambient_declaration":return vo(n,e.namedChild(0));case"interface_declaration":case"enum_declaration":case"type_alias_declaration":return{name:t,decl:e.text};case"function_declaration":case"function_signature":return{name:t,decl:Eo(n,e)};case"class_declaration":{let r=Va(n,e),i="";if(r){let o=e.childForFieldName("body");i=`declare ${n.substring(e.startIndex,o.startIndex+1)}`,i+=r.map(s=>`
`+s).join(""),i+=`
}`}return{name:t,decl:i}}}return{name:t,decl:""}}function Eo(n,e){let t=e.childForFieldName("return_type")?.endIndex??e.childForFieldName("parameters")?.endIndex;if(t!==void 0){let r=n.substring(e.startIndex,t)+";";return e.type==="function_declaration"||e.type==="function_signature"?"declare "+r:r}return""}function Ha(n,e){let t=e.startIndex-1;for(;t>=0&&(n[t]===" "||n[t]===" ");)t--;if(t<0||n[t]===`
`)return n.substring(t+1,e.startIndex)}function xo(n,e){let t=Ke(e);return t?n.substring(t.startIndex,e.startIndex):""}function Mo(n,e){if(e?.firstChild?.type==="accessibility_modifier"&&e.firstChild.text==="private")return"";let t=Ke(e),r=Ha(n,t??e)??" ",i=xo(n,e);switch(e.type){case"ambient_declaration":let o=e.namedChild(0);return o?r+i+Mo(n,o):"";case"method_definition":case"method_signature":return r+i+Eo(n,e);case"public_field_definition":{let s=e.childForFieldName("type")?.endIndex??e.childForFieldName("name")?.endIndex;if(s!==void 0)return r+i+n.substring(e.startIndex,s)+";"}}return""}function Va(n,e){let t=e.childForFieldName("body");return t?t.namedChildren.map(i=>Mo(n,i)).filter(i=>i):void 0}async function Za(n,e,t){let r=new Map,i=-1;try{i=(await t.stat(n)).mtime}catch{return r}let o=St.get(n);if(o&&o.mtime===i)return o.exports;if(e==="typescript"){let s=null;try{let u=(await t.readFile(n)).toString();s=await J(e,u);for(let c of ar(e,s.rootNode))for(let d of c.captures){let _=d.node;if(_.type==="export_statement"){let p=_.childForFieldName("declaration");if(p?.hasError())continue;let{name:m,decl:h}=vo(u,p);if(m){h=xo(u,_)+h;let f=r.get(m);f||(f=[],r.set(m,f)),f.push(h)}}}}catch{}finally{s&&s.delete()}}if(St.size>ja){for(let s of St.keys())if(St.delete(s),r.size<=qa)break}return St.set(n,{mtime:i,exports:r}),r}function $a(n){let e=[];for(let t of n.namedChildren)t.type==="import_statement"&&e.push(t);return e}function Ga(n){let e=-1;Ir.lastIndex=-1;let t;do t=Ir.exec(n),t&&(e=Ir.lastIndex+t.length);while(t);if(e===-1)return-1;let r=n.indexOf(`
`,e);return r!==-1?r:n.length}async function Ka(n,e,t){let r="typescript",i=[],o=Ga(n);if(o===-1)return i;n=n.substring(0,o);let s=await J(r,n);try{for(let l of $a(s.rootNode)){let u=Ua(e,l);if(!u)continue;let c=za(l);if(c.length===0)continue;let d=await Za(u,r,t);for(let _ of c)d.has(_.name)&&i.push(...d.get(_.name))}}finally{s.delete()}return i}async function Io(n,e){let{source:t,languageId:r}=n,i=So.URI.parse(n.uri);return r==="typescript"&&i.scheme==="file"?Ka(t,i.fsPath,e??nr):[]}var Ae,So,St,qa,ja,Ir,To=T(()=>{"use strict";Ae=require("path"),So=xt(wo());Ut();Je();a(Ua,"resolveLocalTypeScriptImport");a(za,"getTypescriptImportedNames");St=new Map,qa=1e3,ja=2e3;a(vo,"extractTypeScriptDeclaration");a(Eo,"extractTypeScriptFunctionDeclaration");a(Ha,"getIndentation");a(xo,"getDocComment");a(Mo,"extractTypeScriptMemberDeclaration");a(Va,"extractTypeScriptBodyDecls");a(Za,"getExportedDeclarations");a($a,"getTypeScriptImports");Ir=/^\s*import\s*(type|)\s*\{[^}]*\}\s*from\s*['"]\./gm;a(Ga,"lastTypeScriptLocalImportOffset");a(Ka,"extractTypeScriptLocalImportContext");a(Io,"extractLocalImportContext")});function Ja(n){return new Promise(e=>{setTimeout(()=>e(`delay: ${n}`),n)})}var No,le,Lo,Tr,dn,Co=T(()=>{"use strict";No=require("path"),le=require("worker_threads");To();yt();a(Ja,"sleep");Lo=["getNeighborSnippets","extractLocalImportContext","sleep"],Tr=class{constructor(){this.nextHandlerId=0;this.handlers=new Map;this.fns=new Map;this.extractLocalImportContext=Io;this.getNeighborSnippets=no;this.sleep=Ja;!le.isMainThread&&le.workerData?.port&&(Bn(),process.cwd=()=>le.workerData.cwd,this.configureWorkerResponse(le.workerData.port))}static{a(this,"WorkerProxy")}initWorker(){let{port1:e,port2:t}=new le.MessageChannel;this.port=e,this.worker=new le.Worker((0,No.resolve)(__dirname,"..","dist","workerProxy.js"),{workerData:{port:t,cwd:process.cwd()},transferList:[t]}),this.port.on("message",r=>this.handleMessage(r)),this.port.on("error",r=>this.handleError(r))}startThreading(){if(this.worker)throw new Error("Worker thread already initialized.");this.proxyFunctions(),this.initWorker()}stopThreading(){this.worker&&(this.worker.terminate(),this.worker.removeAllListeners(),this.worker=void 0,this.unproxyFunctions(),this.handlers.clear())}proxyFunctions(){for(let e of Lo)this.fns.set(e,this[e]),this.proxy(e)}unproxyFunctions(){for(let e of Lo){let t=this.fns.get(e);if(t)this[e]=t;else throw new Error(`Unproxy function not found: ${e}`)}}configureWorkerResponse(e){this.port=e,this.port.on("message",async({id:t,fn:r,args:i})=>{let o=this[r];if(!o)throw new Error(`Function not found: ${r}`);try{let s=await o.apply(this,i);this.port.postMessage({id:t,res:s})}catch(s){if(!(s instanceof Error))throw s;typeof s.code=="string"?this.port.postMessage({id:t,err:s,code:s.code}):this.port.postMessage({id:t,err:s})}})}handleMessage({id:e,err:t,code:r,res:i}){let o=this.handlers.get(e);o&&(this.handlers.delete(e),t?(t.code=r,o.reject(t)):o.resolve(i))}handleError(e){console.log(e);let t;if(e instanceof Error){t=e,t.code==="MODULE_NOT_FOUND"&&t.message?.endsWith("workerProxy.js'")&&(t=new Error("Failed to load workerProxy.js"),t.code="CopilotPromptLoadFailure");let r=new Error().stack;t.stack&&r?.match(/^Error\n/)&&(t.stack+=r.replace(/^Error/,""))}else e?.name==="ExitStatus"&&typeof e.status=="number"?(t=new Error(`workerProxy.js exited with status ${e.status}`),t.code=`CopilotPromptWorkerExit${e.status}`):t=new Error(`Non-error thrown: ${e}`);for(let r of this.handlers.values())r.reject(t);throw t}proxy(e){this[e]=function(...t){let r=this.nextHandlerId++;return new Promise((i,o)=>{this.handlers.set(r,{resolve:i,reject:o}),this.port?.postMessage({id:r,fn:e,args:t})})}}},dn=new Tr});function Po(n){return n.status==="fulfilled"}function Xa(n){return n.status==="rejected"}function ko(n){return n.filter(Po).flatMap(e=>e.value.snippets)}function Ao(n){return n.filter(Xa).flatMap(e=>e.reason)}function Fo(n){let e={},t={};return n.forEach(r=>{Po(r)?e[r.value.providerType]=Math.round(r.value.runtime):r.reason.error instanceof ve&&(t[r.reason.providerType]=!0)}),{runtimes:e,timeouts:t}}var vr,Qa,_n,Er=T(()=>{"use strict";ho();go();bo();yo();ke();Co();vr=300,Qa=[an,cn,un,ln];a(Po,"isFulfilledResult");a(Xa,"isRejectedResult");a(ko,"providersSnippets");a(Ao,"providersErrors");a(Fo,"providersPerformance");_n=class{constructor(e=Qa){this.startThreading=()=>dn.startThreading();this.stopThreading=()=>dn.stopThreading();this.providers=e.map(t=>new t(dn))}static{a(this,"SnippetOrchestrator")}async getSnippets(e){let t=AbortSignal.timeout(vr);return Promise.allSettled(this.providers.map(r=>r.getSnippets(e,t)))}}});function Ya(n,e){let t=n.lastIndexOf(`
`,e-1),r=n.indexOf(`
`,e);return r<0&&(r=n.length),n.slice(t+1,r)}function Ro(n,e){let t=e;for(;t>0&&/\s/.test(n.charAt(t-1));)t--;return t}function Oo(n,e){let t=n.startIndex,r=n.startIndex-n.startPosition.column,i=e.substring(r,t);if(/^\s*$/.test(i))return i}function el(n,e,t){if(e.startPosition.row<=n.startPosition.row)return!1;let r=Oo(n,t),i=Oo(e,t);return r!==void 0&&i!==void 0&&r.startsWith(i)}function mn(n){return tl[K(n)]}async function nl(n,e,t){return _e(n)?mn(n).isEmptyBlockStart(e,t):!1}async function rl(n,e,t,r){if(_e(n))return mn(n).isBlockBodyFinished(e,t,r)}async function il(n,e,t){if(_e(n))return mn(n).getNodeStart(e,t)}var pn,fn,Xe,tl,Do=T(()=>{"use strict";Je();pn=class{constructor(e,t,r){this.languageId=e;this.nodeMatch=t;this.nodeTypesWithBlockOrStmtChild=r}static{a(this,"BaseBlockParser")}async getNodeMatchAtPosition(e,t,r){let i=await J(this.languageId,e);try{let s=i.rootNode.descendantForIndex(t);for(;s;){let l=this.nodeMatch[s.type];if(l){if(!this.nodeTypesWithBlockOrStmtChild.has(s.type))break;let u=this.nodeTypesWithBlockOrStmtChild.get(s.type);if((u==""?s.namedChildren[0]:s.childForFieldName(u))?.type==l)break}s=s.parent}return s?r(s):void 0}finally{i.delete()}}getNextBlockAtPosition(e,t,r){return this.getNodeMatchAtPosition(e,t,i=>{let o=i.children.reverse().find(s=>s.type==this.nodeMatch[i.type]);if(o){if(this.languageId=="python"&&o.parent){let s=o.parent.type==":"?o.parent.parent:o.parent,l=s?.nextSibling;for(;l&&l.type=="comment";){let u=l.startPosition.row==o.endPosition.row&&l.startPosition.column>=o.endPosition.column,c=l.startPosition.row>s.endPosition.row&&l.startPosition.column>s.startPosition.column;if(u||c)o=l,l=l.nextSibling;else break}}if(!(o.endIndex>=o.tree.rootNode.endIndex-1&&(o.hasError()||o.parent.hasError())))return r(o)}})}async isBlockBodyFinished(e,t,r){let i=(e+t).trimEnd(),o=await this.getNextBlockAtPosition(i,r,s=>s.endIndex);if(o!==void 0&&o<i.length){let s=o-e.length;return s>0?s:void 0}}getNodeStart(e,t){let r=e.trimEnd();return this.getNodeMatchAtPosition(r,t,i=>i.startIndex)}},fn=class extends pn{constructor(t,r,i,o,s){super(t,o,s);this.blockEmptyMatch=r;this.lineMatch=i}static{a(this,"RegexBasedBlockParser")}isBlockStart(t){return this.lineMatch.test(t.trimStart())}async isBlockBodyEmpty(t,r){let i=await this.getNextBlockAtPosition(t,r,o=>{o.startIndex<r&&(r=o.startIndex);let s=t.substring(r,o.endIndex).trim();return s==""||s.replace(/\s/g,"")==this.blockEmptyMatch});return i===void 0||i}async isEmptyBlockStart(t,r){return r=Ro(t,r),this.isBlockStart(Ya(t,r))&&this.isBlockBodyEmpty(t,r)}};a(Ya,"getLineAtOffset");a(Ro,"rewindToNearestNonWs");a(Oo,"indent");a(el,"outdented");Xe=class extends pn{constructor(t,r,i,o,s,l,u){super(t,r,i);this.startKeywords=o;this.blockNodeType=s;this.emptyStatementType=l;this.curlyBraceLanguage=u}static{a(this,"TreeSitterBasedBlockParser")}isBlockEmpty(t,r){let i=t.text.trim();return this.curlyBraceLanguage&&(i.startsWith("{")&&(i=i.slice(1)),i.endsWith("}")&&(i=i.slice(0,-1)),i=i.trim()),!!(i.length==0||this.languageId=="python"&&(t.parent?.type=="class_definition"||t.parent?.type=="function_definition")&&t.children.length==1&&lr(t.parent))}async isEmptyBlockStart(t,r){if(r>t.length)throw new RangeError("Invalid offset");for(let o=r;o<t.length&&t.charAt(o)!=`
`;o++)if(/\S/.test(t.charAt(o)))return!1;r=Ro(t,r);let i=await J(this.languageId,t);try{let o=i.rootNode.descendantForIndex(r-1);if(o==null||this.curlyBraceLanguage&&o.type=="}")return!1;if((this.languageId=="javascript"||this.languageId=="typescript")&&o.parent&&o.parent.type=="object"&&o.parent.text.trim()=="{")return!0;if(this.languageId=="typescript"){let d=o;for(;d.parent;){if(d.type=="function_signature"||d.type=="method_signature"){let _=o.nextSibling;return _&&d.hasError()&&el(d,_,t)?!0:!d.children.find(m=>m.type==";")&&d.endIndex<=r}d=d.parent}}let s=null,l=null,u=null,c=o;for(;c!=null;){if(c.type==this.blockNodeType){l=c;break}if(this.nodeMatch[c.type]){u=c;break}if(c.type=="ERROR"){s=c;break}c=c.parent}if(l!=null){if(!l.parent||!this.nodeMatch[l.parent.type])return!1;if(this.languageId=="python"){let d=l.previousSibling;if(d!=null&&d.hasError()&&(d.text.startsWith('"""')||d.text.startsWith("'''")))return!0}return this.isBlockEmpty(l,r)}if(s!=null){if(s.previousSibling?.type=="module"||s.previousSibling?.type=="internal_module"||s.previousSibling?.type=="def")return!0;let d=[...s.children].reverse(),_=d.find(m=>this.startKeywords.includes(m.type)),p=d.find(m=>m.type==this.blockNodeType);if(_){switch(this.languageId){case"python":{_.type=="try"&&o.type=="identifier"&&o.text.length>4&&(p=d.find(f=>f.hasError())?.children.find(f=>f.type=="block"));let m,h=0;for(let f of s.children){if(f.type==":"&&h==0){m=f;break}f.type=="("&&(h+=1),f.type==")"&&(h-=1)}if(m&&_.endIndex<=m.startIndex&&m.nextSibling){if(_.type=="def"){let f=m.nextSibling;if(f.type=='"'||f.type=="'"||f.type=="ERROR"&&(f.text=='"""'||f.text=="'''"))return!0}return!1}break}case"javascript":{let m=d.find(g=>g.type=="formal_parameters");if(_.type=="class"&&m)return!0;let h=d.find(g=>g.type=="{");if(h&&h.startIndex>_.endIndex&&h.nextSibling!=null||d.find(g=>g.type=="do")&&_.type=="while"||_.type=="=>"&&_.nextSibling&&_.nextSibling.type!="{")return!1;break}case"typescript":{let m=d.find(f=>f.type=="{");if(m&&m.startIndex>_.endIndex&&m.nextSibling!=null||d.find(f=>f.type=="do")&&_.type=="while"||_.type=="=>"&&_.nextSibling&&_.nextSibling.type!="{")return!1;break}}return p&&p.startIndex>_.endIndex?this.isBlockEmpty(p,r):!0}}if(u!=null){let d=this.nodeMatch[u.type],_=u.children.slice().reverse().find(p=>p.type==d);if(_)return this.isBlockEmpty(_,r);if(this.nodeTypesWithBlockOrStmtChild.has(u.type)){let p=this.nodeTypesWithBlockOrStmtChild.get(u.type),m=p==""?u.children[0]:u.childForFieldName(p);if(m&&m.type!=this.blockNodeType&&m.type!=this.emptyStatementType)return!1}return!0}return!1}finally{i.delete()}}},tl={python:new Xe("python",{class_definition:"block",elif_clause:"block",else_clause:"block",except_clause:"block",finally_clause:"block",for_statement:"block",function_definition:"block",if_statement:"block",try_statement:"block",while_statement:"block",with_statement:"block"},new Map,["def","class","if","elif","else","for","while","try","except","finally","with"],"block",null,!1),javascript:new Xe("javascript",{arrow_function:"statement_block",catch_clause:"statement_block",do_statement:"statement_block",else_clause:"statement_block",finally_clause:"statement_block",for_in_statement:"statement_block",for_statement:"statement_block",function:"statement_block",function_declaration:"statement_block",generator_function:"statement_block",generator_function_declaration:"statement_block",if_statement:"statement_block",method_definition:"statement_block",try_statement:"statement_block",while_statement:"statement_block",with_statement:"statement_block",class:"class_body",class_declaration:"class_body"},new Map([["arrow_function","body"],["do_statement","body"],["else_clause",""],["for_in_statement","body"],["for_statement","body"],["if_statement","consequence"],["while_statement","body"],["with_statement","body"]]),["=>","try","catch","finally","do","for","if","else","while","with","function","function*","class"],"statement_block","empty_statement",!0),typescript:new Xe("typescript",{ambient_declaration:"statement_block",arrow_function:"statement_block",catch_clause:"statement_block",do_statement:"statement_block",else_clause:"statement_block",finally_clause:"statement_block",for_in_statement:"statement_block",for_statement:"statement_block",function:"statement_block",function_declaration:"statement_block",generator_function:"statement_block",generator_function_declaration:"statement_block",if_statement:"statement_block",internal_module:"statement_block",method_definition:"statement_block",module:"statement_block",try_statement:"statement_block",while_statement:"statement_block",abstract_class_declaration:"class_body",class:"class_body",class_declaration:"class_body"},new Map([["arrow_function","body"],["do_statement","body"],["else_clause",""],["for_in_statement","body"],["for_statement","body"],["if_statement","consequence"],["while_statement","body"],["with_statement","body"]]),["declare","=>","try","catch","finally","do","for","if","else","while","with","function","function*","class"],"statement_block","empty_statement",!0),tsx:new Xe("typescriptreact",{ambient_declaration:"statement_block",arrow_function:"statement_block",catch_clause:"statement_block",do_statement:"statement_block",else_clause:"statement_block",finally_clause:"statement_block",for_in_statement:"statement_block",for_statement:"statement_block",function:"statement_block",function_declaration:"statement_block",generator_function:"statement_block",generator_function_declaration:"statement_block",if_statement:"statement_block",internal_module:"statement_block",method_definition:"statement_block",module:"statement_block",try_statement:"statement_block",while_statement:"statement_block",abstract_class_declaration:"class_body",class:"class_body",class_declaration:"class_body"},new Map([["arrow_function","body"],["do_statement","body"],["else_clause",""],["for_in_statement","body"],["for_statement","body"],["if_statement","consequence"],["while_statement","body"],["with_statement","body"]]),["declare","=>","try","catch","finally","do","for","if","else","while","with","function","function*","class"],"statement_block","empty_statement",!0),go:new fn("go","{}",/\b(func|if|else|for)\b/,{communication_case:"block",default_case:"block",expression_case:"block",for_statement:"block",func_literal:"block",function_declaration:"block",if_statement:"block",labeled_statement:"block",method_declaration:"block",type_case:"block"},new Map),ruby:new fn("ruby","end",/\b(BEGIN|END|case|class|def|do|else|elsif|for|if|module|unless|until|while)\b|->/,{begin_block:"}",block:"}",end_block:"}",lambda:"block",for:"do",until:"do",while:"do",case:"end",do:"end",if:"end",method:"end",module:"end",unless:"end",do_block:"end"},new Map)};a(mn,"getBlockParser");a(nl,"isEmptyBlockStart");a(rl,"isBlockBodyFinished");a(il,"getNodeStart")});var Uo={};Lr(Uo,{CursorHistoryMatcher:()=>gt,CursorSnippetsPickingStrategy:()=>Yt,DEFAULT_NUM_OF_SNIPPETS:()=>lo,DEFAULT_TREE_TRAVERSAL_CONFIG:()=>Li,ElidableText:()=>dt,FileSystem:()=>pt,LanguageMarkerOption:()=>uo,LineEndingOptions:()=>wr,LineWithValueAndCost:()=>$e,LocalImportContextOption:()=>Sr,MAX_EDIT_DISTANCE_LENGTH:()=>on,MAX_PROMPT_LENGTH:()=>so,NeighboringSnippetType:()=>tn,NeighboringTabsOption:()=>bt,PathMarkerOption:()=>co,PromptOptions:()=>sn,ProviderTimeoutError:()=>ve,SnippetOrchestrator:()=>_n,SnippetPositionOption:()=>_o,SnippetProviderType:()=>se,SnippetSelectionOption:()=>mt,SnippetSemantics:()=>ye,SuffixMatchOption:()=>fo,SuffixOption:()=>po,SuffixStartMode:()=>mo,TOKENS_RESERVED_FOR_SUFFIX_ENCODING:()=>ao,TokenizerName:()=>At,WASMLanguage:()=>Zi,blankNode:()=>Ot,buildLabelRules:()=>He,clearLabels:()=>mi,clearLabelsIf:()=>Hn,combineClosersAndOpeners:()=>Rt,comment:()=>ft,commentBlockAsSingles:()=>qt,createWorker:()=>ol,cutTreeAfterLine:()=>Ds,deparseAndCutTree:()=>$s,deparseLine:()=>ut,deparseTree:()=>vi,describeTree:()=>Ei,duplicateTree:()=>Bs,elidableTextForDiff:()=>sa,elidableTextForSourceCode:()=>$n,encodeTree:()=>xi,firstLineOf:()=>Mi,flattenVirtual:()=>oe,foldTree:()=>st,fromTreeWithFocussedLines:()=>Ze,fromTreeWithValuedLines:()=>Ni,getAncestorWithSiblingFunctions:()=>ur,getBlockCloseToken:()=>ba,getBlockParser:()=>mn,getCallSites:()=>va,getCursorContext:()=>Ne,getFirstPrecedingComment:()=>Ke,getFunctionPositions:()=>dr,getLanguage:()=>Gi,getNodeStart:()=>il,getPrompt:()=>Wa,getTokenizer:()=>ee,groupBlocks:()=>Vn,isBlank:()=>R,isBlockBodyFinished:()=>rl,isEmptyBlockStart:()=>nl,isFunction:()=>jt,isFunctionDefinition:()=>cr,isLine:()=>te,isSupportedLanguageId:()=>_e,isTop:()=>he,isVirtual:()=>Z,labelLines:()=>je,labelVirtualInherited:()=>lt,languageCommentMarkers:()=>zt,languageIdToWasmLanguage:()=>K,lastLineOf:()=>Ii,lineNode:()=>jn,mapLabels:()=>ie,normalizeLanguageId:()=>Qe,parseRaw:()=>hi,parseTree:()=>ge,parseTreeSitter:()=>J,parsesWithoutError:()=>ga,providersErrors:()=>Ao,providersPerformance:()=>Fo,providersSnippets:()=>ko,queryExports:()=>ar,queryFunctions:()=>Ki,queryGlobalVars:()=>wa,queryImports:()=>ya,queryPythonIsDocstring:()=>lr,rebuildTree:()=>at,registerLanguageSpecificParser:()=>Dt,resetLineNumbers:()=>Ws,topNode:()=>ot,virtualNode:()=>Ft,visitTree:()=>D,visitTreeConditionally:()=>Us});function ol(){return new Wo.Worker((0,Bo.resolve)(__dirname,"..","dist","worker.js"),{workerData:{cwd:process.cwd()}})}var Bo,Wo,xr=T(()=>{"use strict";Bo=require("path"),Wo=require("worker_threads");Ri();Ut();ct();Le();Er();Je();Do();Se();Zt();en();yt();Kt();we();ke();ze();a(ol,"createWorker")});Bn();var zo=(xr(),Cr(Uo)),{parentPort:vt,workerData:qo}=require("worker_threads"),{defaultFileSystem:sl}=(Ut(),Cr(Di));qo?.cwd&&(process.cwd=()=>qo.cwd);vt.on("message",async({id:n,fn:e,args:t})=>{try{if(e==="getPrompt"){let r=await zo.getPrompt(sl,...t);vt.postMessage({id:n,res:r})}else{let r=await zo[e](...t);vt.postMessage({id:n,res:r})}}catch(r){if(!(r instanceof Error))throw r;typeof r.code=="string"?vt.postMessage({id:n,err:r,code:r.code}):vt.postMessage({id:n,err:r})}});
//# sourceMappingURL=worker.js.map