-
Notifications
You must be signed in to change notification settings - Fork 26
/
workerProxy.js
53 lines (52 loc) · 152 KB
/
workerProxy.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
"use strict";var qn=Object.create;var pe=Object.defineProperty;var jn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Vn=Object.getPrototypeOf,Hn=Object.prototype.hasOwnProperty;var s=(n,e)=>pe(n,"name",{value:e,configurable:!0});var k=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Gn=(n,e)=>{for(var t in e)pe(n,t,{get:e[t],enumerable:!0})},kt=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zn(e))!Hn.call(n,o)&&o!==t&&pe(n,o,{get:()=>e[o],enumerable:!(r=jn(e,o))||r.enumerable});return n};var Te=(n,e,t)=>(t=n!=null?qn(Vn(n)):{},kt(e||!n||!n.__esModule?pe(t,"default",{value:n,enumerable:!0}):t,n)),$n=n=>kt(pe({},"__esModule",{value:!0}),n);var Ot=k((me,je)=>{(function(n,e){if(typeof me=="object"&&typeof je=="object")je.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t=e();for(var r in t)(typeof me=="object"?me:n)[r]=t[r]}})(me,()=>(()=>{"use strict";var n={470:o=>{function i(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}s(i,"e");function a(u,c){for(var _,d="",p=0,f=-1,g=0,m=0;m<=u.length;++m){if(m<u.length)_=u.charCodeAt(m);else{if(_===47)break;_=47}if(_===47){if(!(f===m-1||g===1))if(f!==m-1&&g===2){if(d.length<2||p!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var v=d.lastIndexOf("/");if(v!==d.length-1){v===-1?(d="",p=0):p=(d=d.slice(0,v)).length-1-d.lastIndexOf("/"),f=m,g=0;continue}}else if(d.length===2||d.length===1){d="",p=0,f=m,g=0;continue}}c&&(d.length>0?d+="/..":d="..",p=2)}else d.length>0?d+="/"+u.slice(f+1,m):d=u.slice(f+1,m),p=m-f-1;f=m,g=0}else _===46&&g!==-1?++g:g=-1}return d}s(a,"r");var l={resolve:function(){for(var u,c="",_=!1,d=arguments.length-1;d>=-1&&!_;d--){var p;d>=0?p=arguments[d]:(u===void 0&&(u=process.cwd()),p=u),i(p),p.length!==0&&(c=p+"/"+c,_=p.charCodeAt(0)===47)}return c=a(c,!_),_?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(i(u),u.length===0)return".";var c=u.charCodeAt(0)===47,_=u.charCodeAt(u.length-1)===47;return(u=a(u,!c)).length!==0||c||(u="."),u.length>0&&_&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return i(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 _=arguments[c];i(_),_.length>0&&(u===void 0?u=_:u+="/"+_)}return u===void 0?".":l.normalize(u)},relative:function(u,c){if(i(u),i(c),u===c||(u=l.resolve(u))===(c=l.resolve(c)))return"";for(var _=1;_<u.length&&u.charCodeAt(_)===47;++_);for(var d=u.length,p=d-_,f=1;f<c.length&&c.charCodeAt(f)===47;++f);for(var g=c.length-f,m=p<g?p:g,v=-1,b=0;b<=m;++b){if(b===m){if(g>m){if(c.charCodeAt(f+b)===47)return c.slice(f+b+1);if(b===0)return c.slice(f+b)}else p>m&&(u.charCodeAt(_+b)===47?v=b:b===0&&(v=0));break}var S=u.charCodeAt(_+b);if(S!==c.charCodeAt(f+b))break;S===47&&(v=b)}var T="";for(b=_+v+1;b<=d;++b)b!==d&&u.charCodeAt(b)!==47||(T.length===0?T+="..":T+="/..");return T.length>0?T+c.slice(f+v):(f+=v,c.charCodeAt(f)===47&&++f,c.slice(f))},_makeLong:function(u){return u},dirname:function(u){if(i(u),u.length===0)return".";for(var c=u.charCodeAt(0),_=c===47,d=-1,p=!0,f=u.length-1;f>=1;--f)if((c=u.charCodeAt(f))===47){if(!p){d=f;break}}else p=!1;return d===-1?_?"/":".":_&&d===1?"//":u.slice(0,d)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');i(u);var _,d=0,p=-1,f=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var g=c.length-1,m=-1;for(_=u.length-1;_>=0;--_){var v=u.charCodeAt(_);if(v===47){if(!f){d=_+1;break}}else m===-1&&(f=!1,m=_+1),g>=0&&(v===c.charCodeAt(g)?--g==-1&&(p=_):(g=-1,p=m))}return d===p?p=m:p===-1&&(p=u.length),u.slice(d,p)}for(_=u.length-1;_>=0;--_)if(u.charCodeAt(_)===47){if(!f){d=_+1;break}}else p===-1&&(f=!1,p=_+1);return p===-1?"":u.slice(d,p)},extname:function(u){i(u);for(var c=-1,_=0,d=-1,p=!0,f=0,g=u.length-1;g>=0;--g){var m=u.charCodeAt(g);if(m!==47)d===-1&&(p=!1,d=g+1),m===46?c===-1?c=g:f!==1&&(f=1):c!==-1&&(f=-1);else if(!p){_=g+1;break}}return c===-1||d===-1||f===0||f===1&&c===d-1&&c===_+1?"":u.slice(c,d)},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,_){var d=_.dir||_.root,p=_.base||(_.name||"")+(_.ext||"");return d?d===_.root?d+p:d+"/"+p:p}(0,u)},parse:function(u){i(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var _,d=u.charCodeAt(0),p=d===47;p?(c.root="/",_=1):_=0;for(var f=-1,g=0,m=-1,v=!0,b=u.length-1,S=0;b>=_;--b)if((d=u.charCodeAt(b))!==47)m===-1&&(v=!1,m=b+1),d===46?f===-1?f=b:S!==1&&(S=1):f!==-1&&(S=-1);else if(!v){g=b+1;break}return f===-1||m===-1||S===0||S===1&&f===m-1&&f===g+1?m!==-1&&(c.base=c.name=g===0&&p?u.slice(1,m):u.slice(g,m)):(g===0&&p?(c.name=u.slice(1,f),c.base=u.slice(1,m)):(c.name=u.slice(g,f),c.base=u.slice(g,m)),c.ext=u.slice(f,m)),g>0?c.dir=u.slice(0,g-1):p&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};l.posix=l,o.exports=l},674:(o,i)=>{if(Object.defineProperty(i,"__esModule",{value:!0}),i.isWindows=void 0,typeof process=="object")i.isWindows=process.platform==="win32";else if(typeof navigator=="object"){var a=navigator.userAgent;i.isWindows=a.indexOf("Windows")>=0}},796:function(o,i,a){var l,u,c=this&&this.__extends||(l=s(function(y,h){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,E){w.__proto__=E}||function(w,E){for(var x in E)Object.prototype.hasOwnProperty.call(E,x)&&(w[x]=E[x])},l(y,h)},"n"),function(y,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function w(){this.constructor=y}s(w,"r"),l(y,h),y.prototype=h===null?Object.create(h):(w.prototype=h.prototype,new w)});Object.defineProperty(i,"__esModule",{value:!0}),i.uriToFsPath=i.URI=void 0;var _=a(674),d=/^\w[\w\d+.-]*$/,p=/^\//,f=/^\/\//;function g(y,h){if(!y.scheme&&h)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&&!d.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(f.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 ("//")')}}s(g,"f");var m="",v="/",b=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,S=function(){function y(h,w,E,x,N,I){I===void 0&&(I=!1),typeof h=="object"?(this.scheme=h.scheme||m,this.authority=h.authority||m,this.path=h.path||m,this.query=h.query||m,this.fragment=h.fragment||m):(this.scheme=function(W,D){return W||D?W:"file"}(h,I),this.authority=w||m,this.path=function(W,D){switch(W){case"https":case"http":case"file":D?D[0]!==v&&(D=v+D):D=v}return D}(this.scheme,E||m),this.query=x||m,this.fragment=N||m,g(this,I))}return s(y,"t"),y.isUri=function(h){return h instanceof y||!!h&&typeof h.authority=="string"&&typeof h.fragment=="string"&&typeof h.path=="string"&&typeof h.query=="string"&&typeof h.scheme=="string"&&typeof h.fsPath=="string"&&typeof h.with=="function"&&typeof h.toString=="function"},Object.defineProperty(y.prototype,"fsPath",{get:function(){return Z(this,!1)},enumerable:!1,configurable:!0}),y.prototype.with=function(h){if(!h)return this;var w=h.scheme,E=h.authority,x=h.path,N=h.query,I=h.fragment;return w===void 0?w=this.scheme:w===null&&(w=m),E===void 0?E=this.authority:E===null&&(E=m),x===void 0?x=this.path:x===null&&(x=m),N===void 0?N=this.query:N===null&&(N=m),I===void 0?I=this.fragment:I===null&&(I=m),w===this.scheme&&E===this.authority&&x===this.path&&N===this.query&&I===this.fragment?this:new j(w,E,x,N,I)},y.parse=function(h,w){w===void 0&&(w=!1);var E=b.exec(h);return E?new j(E[2]||m,F(E[4]||m),F(E[5]||m),F(E[7]||m),F(E[9]||m),w):new j(m,m,m,m,m)},y.file=function(h){var w=m;if(_.isWindows&&(h=h.replace(/\\/g,v)),h[0]===v&&h[1]===v){var E=h.indexOf(v,2);E===-1?(w=h.substring(2),h=v):(w=h.substring(2,E),h=h.substring(E)||v)}return new j("file",w,h,m,m)},y.from=function(h){var w=new j(h.scheme,h.authority,h.path,h.query,h.fragment);return g(w,!0),w},y.prototype.toString=function(h){return h===void 0&&(h=!1),de(this,h)},y.prototype.toJSON=function(){return this},y.revive=function(h){if(h){if(h instanceof y)return h;var w=new j(h);return w._formatted=h.external,w._fsPath=h._sep===T?h.fsPath:null,w}return h},y}();i.URI=S;var T=_.isWindows?1:void 0,j=function(y){function h(){var w=y!==null&&y.apply(this,arguments)||this;return w._formatted=null,w._fsPath=null,w}return s(h,"e"),c(h,y),Object.defineProperty(h.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=Z(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),h.prototype.toString=function(w){return w===void 0&&(w=!1),w?de(this,!0):(this._formatted||(this._formatted=de(this,!1)),this._formatted)},h.prototype.toJSON=function(){var w={$mid:1};return this._fsPath&&(w.fsPath=this._fsPath,w._sep=T),this._formatted&&(w.external=this._formatted),this.path&&(w.path=this.path),this.scheme&&(w.scheme=this.scheme),this.authority&&(w.authority=this.authority),this.query&&(w.query=this.query),this.fragment&&(w.fragment=this.fragment),w},h}(S),ce=((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 _e(y,h,w){for(var E=void 0,x=-1,N=0;N<y.length;N++){var I=y.charCodeAt(N);if(I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===45||I===46||I===95||I===126||h&&I===47||w&&I===91||w&&I===93||w&&I===58)x!==-1&&(E+=encodeURIComponent(y.substring(x,N)),x=-1),E!==void 0&&(E+=y.charAt(N));else{E===void 0&&(E=y.substr(0,N));var W=ce[I];W!==void 0?(x!==-1&&(E+=encodeURIComponent(y.substring(x,N)),x=-1),E+=W):x===-1&&(x=N)}}return x!==-1&&(E+=encodeURIComponent(y.substring(x))),E!==void 0?E:y}s(_e,"m");function K(y){for(var h=void 0,w=0;w<y.length;w++){var E=y.charCodeAt(w);E===35||E===63?(h===void 0&&(h=y.substr(0,w)),h+=ce[E]):h!==void 0&&(h+=y[w])}return h!==void 0?h:y}s(K,"b");function Z(y,h){var w;return w=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?h?y.path.substr(1):y.path[1].toLowerCase()+y.path.substr(2):y.path,_.isWindows&&(w=w.replace(/\//g,"\\")),w}s(Z,"C");function de(y,h){var w=h?K:_e,E="",x=y.scheme,N=y.authority,I=y.path,W=y.query,D=y.fragment;if(x&&(E+=x,E+=":"),(N||x==="file")&&(E+=v,E+=v),N){var V=N.indexOf("@");if(V!==-1){var xe=N.substr(0,V);N=N.substr(V+1),(V=xe.lastIndexOf(":"))===-1?E+=w(xe,!1,!1):(E+=w(xe.substr(0,V),!1,!1),E+=":",E+=w(xe.substr(V+1),!1,!0)),E+="@"}(V=(N=N.toLowerCase()).lastIndexOf(":"))===-1?E+=w(N,!1,!0):(E+=w(N.substr(0,V),!1,!0),E+=N.substr(V))}if(I){if(I.length>=3&&I.charCodeAt(0)===47&&I.charCodeAt(2)===58)(re=I.charCodeAt(1))>=65&&re<=90&&(I="/".concat(String.fromCharCode(re+32),":").concat(I.substr(3)));else if(I.length>=2&&I.charCodeAt(1)===58){var re;(re=I.charCodeAt(0))>=65&&re<=90&&(I="".concat(String.fromCharCode(re+32),":").concat(I.substr(2)))}E+=w(I,!0,!1)}return W&&(E+="?",E+=w(W,!1,!1)),D&&(E+="#",E+=h?D:_e(D,!1,!1)),E}s(de,"A");function Ie(y){try{return decodeURIComponent(y)}catch{return y.length>3?y.substr(0,3)+Ie(y.substr(3)):y}}s(Ie,"w"),i.uriToFsPath=Z;var ne=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function F(y){return y.match(ne)?y.replace(ne,function(h){return Ie(h)}):y}s(F,"x")},679:function(o,i,a){var l=this&&this.__spreadArray||function(p,f,g){if(g||arguments.length===2)for(var m,v=0,b=f.length;v<b;v++)!m&&v in f||(m||(m=Array.prototype.slice.call(f,0,v)),m[v]=f[v]);return p.concat(m||Array.prototype.slice.call(f))};Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=void 0;var u,c=a(470),_=c.posix||c,d="/";(u=i.Utils||(i.Utils={})).joinPath=function(p){for(var f=[],g=1;g<arguments.length;g++)f[g-1]=arguments[g];return p.with({path:_.join.apply(_,l([p.path],f,!1))})},u.resolvePath=function(p){for(var f=[],g=1;g<arguments.length;g++)f[g-1]=arguments[g];var m=p.path,v=!1;m[0]!==d&&(m=d+m,v=!0);var b=_.resolve.apply(_,l([m],f,!1));return v&&b[0]===d&&!p.authority&&(b=b.substring(1)),p.with({path:b})},u.dirname=function(p){if(p.path.length===0||p.path===d)return p;var f=_.dirname(p.path);return f.length===1&&f.charCodeAt(0)===46&&(f=""),p.with({path:f})},u.basename=function(p){return _.basename(p.path)},u.extname=function(p){return _.extname(p.path)}}},e={};function t(o){var i=e[o];if(i!==void 0)return i.exports;var a=e[o]={exports:{}};return n[o].call(a.exports,a,a.exports,t),a.exports}s(t,"r");var r={};return(()=>{var o=r;Object.defineProperty(o,"__esModule",{value:!0}),o.Utils=o.URI=void 0;var i=t(796);Object.defineProperty(o,"URI",{enumerable:!0,get:function(){return i.URI}});var a=t(679);Object.defineProperty(o,"Utils",{enumerable:!0,get:function(){return a.Utils}})})(),r})())});var Rt=k((exports,module)=>{var Module=Module!==void 0?Module:{},TreeSitter=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{static{s(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_=s((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}s(locateFile,"locateFile");function logExceptionOnExit(n){n instanceof ExitStatus||err("exiting due to exception: "+n)}if(s(logExceptionOnExit,"logExceptionOnExit"),ENVIRONMENT_IS_NODE){var fs=require("fs"),nodePath=require("path");scriptDirectory=ENVIRONMENT_IS_WORKER?nodePath.dirname(scriptDirectory)+"/":__dirname+"/",read_=s((n,e)=>(n=isFileURI(n)?new URL(n):nodePath.normalize(n),fs.readFileSync(n,e?void 0:"utf8")),"read_"),readBinary=s(n=>{var e=read_(n,!0);return e.buffer||(e=new Uint8Array(e)),e},"readBinary"),readAsync=s((n,e,t)=>{n=isFileURI(n)?new URL(n):nodePath.normalize(n),fs.readFile(n,function(r,o){r?t(r):e(o.buffer)})},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),quit_=s((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_=s(n=>{var e=new XMLHttpRequest;return e.open("GET",n,!1),e.send(null),e.responseText},"read_"),ENVIRONMENT_IS_WORKER&&(readBinary=s(n=>{var e=new XMLHttpRequest;return e.open("GET",n,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)},"readBinary")),readAsync=s((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=s(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,o=e;n[o]&&!(o>=r);)++o;if(o-e>16&&n.buffer&&UTF8Decoder)return UTF8Decoder.decode(n.subarray(e,o));for(var i="";e<o;){var a=n[e++];if(128&a){var l=63&n[e++];if((224&a)!=192){var u=63&n[e++];if((a=(240&a)==224?(15&a)<<12|l<<6|u:(7&a)<<18|l<<12|u<<6|63&n[e++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|l)}else i+=String.fromCharCode(a)}return i}s(UTF8ArrayToString,"UTF8ArrayToString");function UTF8ToString(n,e){return n?UTF8ArrayToString(HEAPU8,n,e):""}s(UTF8ToString,"UTF8ToString");function stringToUTF8Array(n,e,t,r){if(!(r>0))return 0;for(var o=t,i=t+r-1,a=0;a<n.length;++a){var l=n.charCodeAt(a);if(l>=55296&&l<=57343&&(l=65536+((1023&l)<<10)|1023&n.charCodeAt(++a)),l<=127){if(t>=i)break;e[t++]=l}else if(l<=2047){if(t+1>=i)break;e[t++]=192|l>>6,e[t++]=128|63&l}else if(l<=65535){if(t+2>=i)break;e[t++]=224|l>>12,e[t++]=128|l>>6&63,e[t++]=128|63&l}else{if(t+3>=i)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-o}s(stringToUTF8Array,"stringToUTF8Array");function stringToUTF8(n,e,t){return stringToUTF8Array(n,HEAPU8,e,t)}s(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}s(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)}s(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}s(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__)}s(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}s(initRuntime,"initRuntime");function preMain(){callRuntimeCallbacks(__ATMAIN__)}s(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__)}s(postRun,"postRun");function addOnPreRun(n){__ATPRERUN__.unshift(n)}s(addOnPreRun,"addOnPreRun");function addOnInit(n){__ATINIT__.unshift(n)}s(addOnInit,"addOnInit");function addOnPostRun(n){__ATPOSTRUN__.unshift(n)}s(addOnPostRun,"addOnPostRun");var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function addRunDependency(n){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}s(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()}}s(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)}s(abort,"abort");var dataURIPrefix="data:application/octet-stream;base64,",wasmBinaryFile,tempDouble,tempI64;function isDataURI(n){return n.startsWith(dataURIPrefix)}s(isDataURI,"isDataURI");function isFileURI(n){return n.startsWith("file://")}s(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)}}s(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)})}s(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(o,i){var a=o.exports;a=relocateExports(a,1024);var l=getDylinkMetadata(i);l.neededDynlibs&&(dynamicLibraries=l.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(a,"main"),Module.asm=a,addOnInit(Module.asm.__wasm_call_ctors),__RELOC_FUNCS__.push(Module.asm.__wasm_apply_data_relocs),removeRunDependency("wasm-instantiate")}s(e,"t");function t(o){e(o.instance,o.module)}s(t,"r");function r(o){return getBinaryPromise().then(function(i){return WebAssembly.instantiate(i,n)}).then(function(i){return i}).then(o,function(i){err("failed to asynchronously prepare wasm: "+i),abort(i)})}if(s(r,"_"),addRunDependency("wasm-instantiate"),Module.instantiateWasm)try{return Module.instantiateWasm(n,e)}catch(o){return err("Module.instantiateWasm callback failed with error: "+o),!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(o){return WebAssembly.instantiateStreaming(o,n).then(t,function(i){return err("wasm streaming compile failed: "+i),err("falling back to ArrayBuffer instantiation"),r(t)})}),{}}s(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}s(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)}s(callRuntimeCallbacks,"callRuntimeCallbacks");function getDylinkMetadata(n){var e=0,t=0;function r(){for(var b=0,S=1;;){var T=n[e++];if(b+=(127&T)*S,S*=128,!(128&T))break}return b}s(r,"_");function o(){var b=r();return UTF8ArrayToString(n,(e+=b)-b,b)}s(o,"n");function i(b,S){if(b)throw new Error(S)}s(i,"s");var a="dylink.0";if(n instanceof WebAssembly.Module){var l=WebAssembly.Module.customSections(n,a);l.length===0&&(a="dylink",l=WebAssembly.Module.customSections(n,a)),i(l.length===0,"need dylink section"),t=(n=new Uint8Array(l[0])).length}else{i(new Uint32Array(new Uint8Array(n.subarray(0,24)).buffer)[0]!=1836278016,"need to see wasm magic number"),i(n[8]!==0,"need the dylink section to be first"),e=9;var u=r();t=e+u,a=o()}var c={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(a=="dylink"){c.memorySize=r(),c.memoryAlign=r(),c.tableSize=r(),c.tableAlign=r();for(var _=r(),d=0;d<_;++d){var p=o();c.neededDynlibs.push(p)}}else for(i(a!=="dylink.0");e<t;){var f=n[e++],g=r();if(f===1)c.memorySize=r(),c.memoryAlign=r(),c.tableSize=r(),c.tableAlign=r();else if(f===2)for(_=r(),d=0;d<_;++d)p=o(),c.neededDynlibs.push(p);else if(f===3)for(var m=r();m--;){var v=o();256&r()&&c.tlsExports.add(v)}else if(f===4)for(m=r();m--;)o(),v=o(),(3&r())==1&&c.weakImports.add(v);else e+=g}return c}s(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}s(getValue,"getValue");function asmjsMangle(n){return n.indexOf("dynCall_")==0||["stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0"].includes(n)?n:"_"+n}s(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])}}s(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)}s(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}s(getWasmTableEntry,"getWasmTableEntry");function dynCall(n,e,t){return n.includes("j")?dynCallLegacy(n,e,t):getWasmTableEntry(e).apply(null,t)}s(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)}}}s(createInvokeFunction,"createInvokeFunction");var ___heap_base=78144;function zeroMemory(n,e){return HEAPU8.fill(0,n,n+e),n}s(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}s(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)}s(isInternalSym,"isInternalSym");function uleb128Encode(n,e){n<128?e.push(n):e.push(n%128|128,n>>7)}s(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}s(sigToWasmTypes,"sigToWasmTypes");function generateFuncType(n,e){var t=n.slice(0,1),r=n.slice(1),o={i:127,p:127,j:126,f:125,d:124};e.push(96),uleb128Encode(r.length,e);for(var i=0;i<r.length;++i)e.push(o[r[i]]);t=="v"?e.push(0):e.push(1,o[t])}s(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 o=new WebAssembly.Module(new Uint8Array(r));return new WebAssembly.Instance(o,{e:{f:n}}).exports.f}s(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)}}s(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}s(getEmptyTableSlot,"getEmptyTableSlot");function setWasmTableEntry(n,e){wasmTable.set(n,e),wasmTableMirror[n]=wasmTable.get(n)}s(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}s(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))}}s(updateGOT,"updateGOT");function relocateExports(n,e,t){var r={};for(var o in n){var i=n[o];typeof i=="object"&&(i=i.value),typeof i=="number"&&(i+=e),r[o]=i}return updateGOT(r,t),r}s(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}s(resolveGlobalSymbol,"resolveGlobalSymbol");function alignMemory(n,e){return Math.ceil(n/e)*e}s(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}s(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(s(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(s(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 s(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())}s(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 o(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,_){readAsync(l,d=>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)}s(o,"n");function i(){if(typeof preloadedWasm<"u"&&preloadedWasm[n]){var l=preloadedWasm[n];return e.loadAsync?Promise.resolve(l):l}return e.loadAsync?o(n).then(function(u){return loadWebAssemblyModule(u,e,t)}):loadWebAssemblyModule(o(n),e,t)}s(i,"s");function a(l){r.global&&mergeLibSymbols(l,n),r.module=l}return s(a,"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?i().then(function(l){return a(l),!0}):(a(i()),!0)}s(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}}}s(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()}s(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)}}s(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}s(__emscripten_get_now_is_monotonic,"__emscripten_get_now_is_monotonic");function _abort(){abort("")}s(_abort,"_abort");function _emscripten_date_now(){return Date.now()}s(_emscripten_date_now,"_emscripten_date_now");function _emscripten_memcpy_big(n,e,t){HEAPU8.copyWithin(n,e,e+t)}s(_emscripten_memcpy_big,"_emscripten_memcpy_big");function getHeapMax(){return 2147483648}s(getHeapMax,"getHeapMax");function emscripten_realloc_buffer(n){try{return wasmMemory.grow(n-buffer.byteLength+65535>>>16),updateGlobalBufferAndViews(wasmMemory.buffer),1}catch{}}s(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 o=e*(1+.2/r);if(o=Math.min(o,n+100663296),emscripten_realloc_buffer(Math.min(t,(i=Math.max(n,o))+((a=65536)-i%a)%a)))return!0}var i,a;return!1}s(_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 o=r.atime.getTime(),i=r.mtime.getTime(),a=r.ctime.getTime();return 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+56>>2]=tempI64[0],HEAP32[t+60>>2]=tempI64[1],HEAPU32[t+64>>2]=o%1e3*1e3,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+72>>2]=tempI64[0],HEAP32[t+76>>2]=tempI64[1],HEAPU32[t+80>>2]=i%1e3*1e3,tempI64=[Math.floor(a/1e3)>>>0,(tempDouble=Math.floor(a/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]=a%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,o){if(!FS.isFile(e.node.mode))throw new FS.ErrnoError(43);if(2&r)return 0;var i=HEAPU8.slice(n,n+t);FS.msync(e,i,o,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))}s(_proc_exit,"_proc_exit");function exitJS(n,e){EXITSTATUS=n,_proc_exit(n)}s(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}}s(_fd_close,"_fd_close");function convertI32PairToI53Checked(n,e){return e+2097152>>>0<4194305-!!n?(n>>>0)+4294967296*e:NaN}s(convertI32PairToI53Checked,"convertI32PairToI53Checked");function _fd_seek(n,e,t,r,o){try{var i=convertI32PairToI53Checked(e,t);if(isNaN(i))return 61;var a=SYSCALLS.getStreamFromFD(n);return FS.llseek(a,i,r),tempI64=[a.position>>>0,(tempDouble=a.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[o>>2]=tempI64[0],HEAP32[o+4>>2]=tempI64[1],a.getdents&&i===0&&r===0&&(a.getdents=null),0}catch(l){if(typeof FS>"u"||!(l instanceof FS.ErrnoError))throw l;return l.errno}}s(_fd_seek,"_fd_seek");function doWritev(n,e,t,r){for(var o=0,i=0;i<t;i++){var a=HEAPU32[e>>2],l=HEAPU32[e+4>>2];e+=8;var u=FS.write(n,HEAP8,a,l,r);if(u<0)return-1;o+=u,r!==void 0&&(r+=u)}return o}s(doWritev,"doWritev");function _fd_write(n,e,t,r){try{var o=doWritev(SYSCALLS.getStreamFromFD(n),e,t);return HEAPU32[r>>2]=o,0}catch(i){if(typeof FS>"u"||!(i instanceof FS.ErrnoError))throw i;return i.errno}}s(_fd_write,"_fd_write");function _tree_sitter_log_callback(n,e){if(currentLogCallback){let t=UTF8ToString(e);currentLogCallback(t,n!==0)}}s(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(n,e,t,r,o){var i=currentParseCallback(e,{row:t,column:r});typeof i=="string"?(setValue(o,i.length,"i32"),stringToUTF16(i,n,10240)):setValue(o,0,"i32")}s(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function handleException(n){if(n instanceof ExitStatus||n=="unwind")return EXITSTATUS;quit_(1,n)}s(handleException,"handleException");function allocateUTF8OnStack(n){var e=lengthBytesUTF8(n)+1,t=stackAlloc(e);return stringToUTF8Array(n,HEAP8,t,e),t}s(allocateUTF8OnStack,"allocateUTF8OnStack");function stringToUTF16(n,e,t){if(t===void 0&&(t=2147483647),t<2)return 0;for(var r=e,o=(t-=2)<2*n.length?t/2:n.length,i=0;i<o;++i){var a=n.charCodeAt(i);HEAP16[e>>1]=a,e+=2}return HEAP16[e>>1]=0,e-r}s(stringToUTF16,"stringToUTF16");function AsciiToString(n){for(var e="";;){var t=HEAPU8[n++>>0];if(!t)return e;e+=String.fromCharCode(t)}}s(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)),o=r>>2;n.forEach(a=>{HEAP32[o++]=allocateUTF8OnStack(a)}),HEAP32[o]=0;try{var i=e(t,r);return exitJS(i,!0),i}catch(a){return handleException(a)}}}s(callMain,"callMain"),Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,dependenciesFulfilled=s(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()))}s(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(s(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{s(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=s((u,c,_)=>e.slice(u,_),"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 o=0,i=0;if(r&&r.includedRanges){o=r.includedRanges.length,i=C._calloc(o,SIZE_OF_RANGE);let u=i;for(let c=0;c<o;c++)marshalRange(u,r.includedRanges[c]),u+=SIZE_OF_RANGE}let a=C._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,i,o);if(!a)throw currentParseCallback=null,currentLogCallback=null,new Error("Parsing failed");let l=new Tree(INTERNAL,a,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{s(this,"Tree")}constructor(e,t,r,o){assertInternal(e),this[0]=t,this.language=r,this.textCallback=o}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"),o=new Array(t);if(t>0){let i=r;for(let a=0;a<t;a++)o[a]=unmarshalRange(i),i+=SIZE_OF_RANGE;C._free(r)}return o}}class Node{static{s(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 o=0;o<e;o++)this._children[o]=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 o=0;o<e;o++)this._namedChildren[o]=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 o=[],i=this.tree.language.types;for(let _=0,d=i.length;_<d;_++)e.includes(i[_])&&o.push(_);let a=C._malloc(SIZE_OF_INT*o.length);for(let _=0,d=o.length;_<d;_++)setValue(a+_*SIZE_OF_INT,o[_],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],a,o.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 _=u;for(let d=0;d<l;d++)c[d]=unmarshalNode(this.tree,_),_+=SIZE_OF_NODE}return C._free(u),C._free(a),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{s(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{s(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,o=this.types.length;r<o;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,o=this.fields.length;r<o;r++){let i=C._ts_language_field_name_for_id(this[0],r);this.fields[r]=i!==0?UTF8ToString(i):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),o=C._malloc(r+1);stringToUTF8(e,o,r+1);let i=C._ts_language_symbol_for_name(this[0],o,r,t);return C._free(o),i||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 o=C._ts_query_new(this[0],r,t,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!o){let m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),v=UTF8ToString(r,getValue(TRANSFER_BUFFER,"i32")).length,b=e.substr(v,100).split(`
`)[0],S,T=b.match(QUERY_WORD_REGEX)[0];switch(m){case 2:S=new RangeError(`Bad node name '${T}'`);break;case 3:S=new RangeError(`Bad field name '${T}'`);break;case 4:S=new RangeError(`Bad capture name @${T}`);break;case 5:S=new TypeError(`Bad pattern structure at offset ${v}: '${b}'...`),T="";break;default:S=new SyntaxError(`Bad syntax at offset ${v}: '${b}'...`),T=""}throw S.index=v,S.length=T.length,C._free(r),S}let i=C._ts_query_string_count(o),a=C._ts_query_capture_count(o),l=C._ts_query_pattern_count(o),u=new Array(a),c=new Array(i);for(let m=0;m<a;m++){let v=C._ts_query_capture_name_for_id(o,m,TRANSFER_BUFFER),b=getValue(TRANSFER_BUFFER,"i32");u[m]=UTF8ToString(v,b)}for(let m=0;m<i;m++){let v=C._ts_query_string_value_for_id(o,m,TRANSFER_BUFFER),b=getValue(TRANSFER_BUFFER,"i32");c[m]=UTF8ToString(v,b)}let _=new Array(l),d=new Array(l),p=new Array(l),f=new Array(l),g=new Array(l);for(let m=0;m<l;m++){let v=C._ts_query_predicates_for_pattern(o,m,TRANSFER_BUFFER),b=getValue(TRANSFER_BUFFER,"i32");f[m]=[],g[m]=[];let S=[],T=v;for(let j=0;j<b;j++){let ce=getValue(T,"i32");T+=SIZE_OF_INT;let _e=getValue(T,"i32");if(T+=SIZE_OF_INT,ce===PREDICATE_STEP_TYPE_CAPTURE)S.push({type:"capture",name:u[_e]});else if(ce===PREDICATE_STEP_TYPE_STRING)S.push({type:"string",value:c[_e]});else if(S.length>0){if(S[0].type!=="string")throw new Error("Predicates must begin with a literal value");let K=S[0].value,Z=!0;switch(K){case"not-eq?":Z=!1;case"eq?":if(S.length!==3)throw new Error("Wrong number of arguments to `#eq?` predicate. Expected 2, got "+(S.length-1));if(S[1].type!=="capture")throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${S[1].value}"`);if(S[2].type==="capture"){let F=S[1].name,y=S[2].name;g[m].push(function(h){let w,E;for(let x of h)x.name===F&&(w=x.node),x.name===y&&(E=x.node);return w===void 0||E===void 0||w.text===E.text===Z})}else{let F=S[1].name,y=S[2].value;g[m].push(function(h){for(let w of h)if(w.name===F)return w.node.text===y===Z;return!0})}break;case"not-match?":Z=!1;case"match?":if(S.length!==3)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${S.length-1}.`);if(S[1].type!=="capture")throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${S[1].value}".`);if(S[2].type!=="string")throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${S[2].value}.`);let de=S[1].name,Ie=new RegExp(S[2].value);g[m].push(function(F){for(let y of F)if(y.name===de)return Ie.test(y.node.text)===Z;return!0});break;case"set!":if(S.length<2||S.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${S.length-1}.`);if(S.some(F=>F.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');_[m]||(_[m]={}),_[m][S[1].value]=S[2]?S[2].value:null;break;case"is?":case"is-not?":if(S.length<2||S.length>3)throw new Error(`Wrong number of arguments to \`#${K}\` predicate. Expected 1 or 2. Got ${S.length-1}.`);if(S.some(F=>F.type!=="string"))throw new Error(`Arguments to \`#${K}\` predicate must be a strings.".`);let ne=K==="is?"?d:p;ne[m]||(ne[m]={}),ne[m][S[1].value]=S[2]?S[2].value:null;break;default:f[m].push({operator:K,operands:S.slice(1)})}S.length=0}}Object.freeze(_[m]),Object.freeze(d[m]),Object.freeze(p[m])}return C._free(r),new Query(INTERNAL,o,u,g,f,Object.freeze(_),Object.freeze(d),Object.freeze(p))}static load(e){let t;if(e instanceof Uint8Array)t=Promise.resolve(e);else{let o=e;if(typeof process<"u"&&process.versions&&process.versions.node){let i=require("fs");t=Promise.resolve(i.readFileSync(o))}else t=fetch(o).then(i=>i.arrayBuffer().then(a=>{if(i.ok)return new Uint8Array(a);{let l=new TextDecoder("utf-8").decode(a);throw new Error(`Language.load failed with status ${i.status}.
${l}`)}}))}let r=typeof loadSideModule=="function"?loadSideModule:loadWebAssemblyModule;return t.then(o=>r(o,{loadAsync:!0})).then(o=>{let i=Object.keys(o),a=i.find(u=>LANGUAGE_FUNCTION_REGEX.test(u)&&!u.includes("external_scanner_"));a||console.log(`Couldn't find language function in WASM file. Symbols:
${JSON.stringify(i,null,2)}`);let l=o[a]();return new Language(INTERNAL,l)})}}class Query{static{s(this,"Query")}constructor(e,t,r,o,i,a,l,u){assertInternal(e),this[0]=t,this.captureNames=r,this.textPredicates=o,this.predicates=i,this.setProperties=a,this.assertedProperties=l,this.refutedProperties=u,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(e,t,r,o){t||(t=ZERO_POINT),r||(r=ZERO_POINT),o||(o={});let i=o.matchLimit;if(i===void 0)i=0;else if(typeof i!="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,i);let a=getValue(TRANSFER_BUFFER,"i32"),l=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),c=new Array(a);this.exceededMatchLimit=!!u;let _=0,d=l;for(let p=0;p<a;p++){let f=getValue(d,"i32");d+=SIZE_OF_INT;let g=getValue(d,"i32");d+=SIZE_OF_INT;let m=new Array(g);if(d=unmarshalCaptures(this,e.tree,d,m),this.textPredicates[f].every(v=>v(m))){c[_++]={pattern:f,captures:m};let v=this.setProperties[f];v&&(c[p].setProperties=v);let b=this.assertedProperties[f];b&&(c[p].assertedProperties=b);let S=this.refutedProperties[f];S&&(c[p].refutedProperties=S)}}return c.length=_,C._free(l),c}captures(e,t,r,o){t||(t=ZERO_POINT),r||(r=ZERO_POINT),o||(o={});let i=o.matchLimit;if(i===void 0)i=0;else if(typeof i!="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,i);let a=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<a;p++){let f=getValue(d,"i32");d+=SIZE_OF_INT;let g=getValue(d,"i32");d+=SIZE_OF_INT;let m=getValue(d,"i32");if(d+=SIZE_OF_INT,_.length=g,d=unmarshalCaptures(this,e.tree,d,_),this.textPredicates[f].every(v=>v(_))){let v=_[m],b=this.setProperties[f];b&&(v.setProperties=b);let S=this.assertedProperties[f];S&&(v.assertedProperties=S);let T=this.refutedProperties[f];T&&(v.refutedProperties=T),c.push(v)}}return C._free(l),c}predicatesForPattern(e){return this.predicates[e]}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(n,e,t){let r=t-e,o=n.textCallback(e,null,t);for(e+=o.length;e<t;){let i=n.textCallback(e,null,t);if(!(i&&i.length>0))break;e+=i.length,o+=i}return e>t&&(o=o.slice(0,r)),o}s(getText,"getText");function unmarshalCaptures(n,e,t,r){for(let o=0,i=r.length;o<i;o++){let a=getValue(t,"i32"),l=unmarshalNode(e,t+=SIZE_OF_INT);t+=SIZE_OF_NODE,r[o]={name:n.captureNames[a],node:l}}return t}s(unmarshalCaptures,"unmarshalCaptures");function assertInternal(n){if(n!==INTERNAL)throw new Error("Illegal constructor")}s(assertInternal,"assertInternal");function isPoint(n){return n&&typeof n.row=="number"&&typeof n.column=="number"}s(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")}s(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"),o=getValue(e+=SIZE_OF_INT,"i32"),i=getValue(e+=SIZE_OF_INT,"i32"),a=getValue(e+=SIZE_OF_INT,"i32"),l=new Node(INTERNAL,n);return l.id=t,l.startIndex=r,l.startPosition={row:o,column:i},l[0]=a,l}s(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")}s(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")}s(unmarshalTreeCursor,"unmarshalTreeCursor");function marshalPoint(n,e){setValue(n,e.row,"i32"),setValue(n+SIZE_OF_INT,e.column,"i32")}s(marshalPoint,"marshalPoint");function unmarshalPoint(n){return{row:getValue(n,"i32"),column:getValue(n+SIZE_OF_INT,"i32")}}s(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}s(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}s(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}s(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)});var sn=k(lt=>{var on="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");lt.encode=function(n){if(0<=n&&n<on.length)return on[n];throw new TypeError("Must be between 0 and 63: "+n)};lt.decode=function(n){var e=65,t=90,r=97,o=122,i=48,a=57,l=43,u=47,c=26,_=52;return e<=n&&n<=t?n-e:r<=n&&n<=o?n-r+c:i<=n&&n<=a?n-i+_:n==l?62:n==u?63:-1}});var dt=k(_t=>{var an=sn(),ct=5,un=1<<ct,ln=un-1,cn=un;function Fr(n){return n<0?(-n<<1)+1:(n<<1)+0}s(Fr,"toVLQSigned");function Rr(n){var e=(n&1)===1,t=n>>1;return e?-t:t}s(Rr,"fromVLQSigned");_t.encode=s(function(e){var t="",r,o=Fr(e);do r=o&ln,o>>>=ct,o>0&&(r|=cn),t+=an.encode(r);while(o>0);return t},"base64VLQ_encode");_t.decode=s(function(e,t,r){var o=e.length,i=0,a=0,l,u;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(u=an.decode(e.charCodeAt(t++)),u===-1)throw new Error("Invalid base64 digit: "+e.charAt(t-1));l=!!(u&cn),u&=ln,i=i+(u<<a),a+=ct}while(l);r.value=Rr(i),r.rest=t},"base64VLQ_decode")});var ae=k(O=>{function Dr(n,e,t){if(e in n)return n[e];if(arguments.length===3)return t;throw new Error('"'+e+'" is a required argument.')}s(Dr,"getArg");O.getArg=Dr;var _n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Ur=/^data:.+\,.+$/;function be(n){var e=n.match(_n);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}s(be,"urlParse");O.urlParse=be;function ie(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}s(ie,"urlGenerate");O.urlGenerate=ie;function pt(n){var e=n,t=be(n);if(t){if(!t.path)return n;e=t.path}for(var r=O.isAbsolute(e),o=e.split(/\/+/),i,a=0,l=o.length-1;l>=0;l--)i=o[l],i==="."?o.splice(l,1):i===".."?a++:a>0&&(i===""?(o.splice(l+1,a),a=0):(o.splice(l,2),a--));return e=o.join("/"),e===""&&(e=r?"/":"."),t?(t.path=e,ie(t)):e}s(pt,"normalize");O.normalize=pt;function dn(n,e){n===""&&(n="."),e===""&&(e=".");var t=be(e),r=be(n);if(r&&(n=r.path||"/"),t&&!t.scheme)return r&&(t.scheme=r.scheme),ie(t);if(t||e.match(Ur))return e;if(r&&!r.host&&!r.path)return r.host=e,ie(r);var o=e.charAt(0)==="/"?e:pt(n.replace(/\/+$/,"")+"/"+e);return r?(r.path=o,ie(r)):o}s(dn,"join");O.join=dn;O.isAbsolute=function(n){return n.charAt(0)==="/"||_n.test(n)};function Br(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)}s(Br,"relative");O.relative=Br;var pn=function(){var n=Object.create(null);return!("__proto__"in n)}();function mn(n){return n}s(mn,"identity");function Wr(n){return fn(n)?"$"+n:n}s(Wr,"toSetString");O.toSetString=pn?mn:Wr;function zr(n){return fn(n)?n.slice(1):n}s(zr,"fromSetString");O.fromSetString=pn?mn:zr;function fn(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}s(fn,"isProtoString");function qr(n,e,t){var r=se(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:se(n.name,e.name)}s(qr,"compareByOriginalPositions");O.compareByOriginalPositions=qr;function jr(n,e,t){var r=n.generatedLine-e.generatedLine;return r!==0||(r=n.generatedColumn-e.generatedColumn,r!==0||t)||(r=se(n.source,e.source),r!==0)||(r=n.originalLine-e.originalLine,r!==0)||(r=n.originalColumn-e.originalColumn,r!==0)?r:se(n.name,e.name)}s(jr,"compareByGeneratedPositionsDeflated");O.compareByGeneratedPositionsDeflated=jr;function se(n,e){return n===e?0:n===null?1:e===null?-1:n>e?1:-1}s(se,"strcmp");function Zr(n,e){var t=n.generatedLine-e.generatedLine;return t!==0||(t=n.generatedColumn-e.generatedColumn,t!==0)||(t=se(n.source,e.source),t!==0)||(t=n.originalLine-e.originalLine,t!==0)||(t=n.originalColumn-e.originalColumn,t!==0)?t:se(n.name,e.name)}s(Zr,"compareByGeneratedPositionsInflated");O.compareByGeneratedPositionsInflated=Zr;function Vr(n){return JSON.parse(n.replace(/^\)]}'[^\n]*\n/,""))}s(Vr,"parseSourceMapInput");O.parseSourceMapInput=Vr;function Hr(n,e,t){if(e=e||"",n&&(n[n.length-1]!=="/"&&e[0]!=="/"&&(n+="/"),e=n+e),t){var r=be(t);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var o=r.path.lastIndexOf("/");o>=0&&(r.path=r.path.substring(0,o+1))}e=dn(ie(r),e)}return pt(e)}s(Hr,"computeSourceURL");O.computeSourceURL=Hr});var ht=k(hn=>{var mt=ae(),ft=Object.prototype.hasOwnProperty,X=typeof Map<"u";function H(){this._array=[],this._set=X?new Map:Object.create(null)}s(H,"ArraySet");H.fromArray=s(function(e,t){for(var r=new H,o=0,i=e.length;o<i;o++)r.add(e[o],t);return r},"ArraySet_fromArray");H.prototype.size=s(function(){return X?this._set.size:Object.getOwnPropertyNames(this._set).length},"ArraySet_size");H.prototype.add=s(function(e,t){var r=X?e:mt.toSetString(e),o=X?this.has(e):ft.call(this._set,r),i=this._array.length;(!o||t)&&this._array.push(e),o||(X?this._set.set(e,i):this._set[r]=i)},"ArraySet_add");H.prototype.has=s(function(e){if(X)return this._set.has(e);var t=mt.toSetString(e);return ft.call(this._set,t)},"ArraySet_has");H.prototype.indexOf=s(function(e){if(X){var t=this._set.get(e);if(t>=0)return t}else{var r=mt.toSetString(e);if(ft.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},"ArraySet_indexOf");H.prototype.at=s(function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},"ArraySet_at");H.prototype.toArray=s(function(){return this._array.slice()},"ArraySet_toArray");hn.ArraySet=H});var bn=k(yn=>{var gn=ae();function Gr(n,e){var t=n.generatedLine,r=e.generatedLine,o=n.generatedColumn,i=e.generatedColumn;return r>t||r==t&&i>=o||gn.compareByGeneratedPositionsInflated(n,e)<=0}s(Gr,"generatedPositionAfter");function De(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}s(De,"MappingList");De.prototype.unsortedForEach=s(function(e,t){this._array.forEach(e,t)},"MappingList_forEach");De.prototype.add=s(function(e){Gr(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},"MappingList_add");De.prototype.toArray=s(function(){return this._sorted||(this._array.sort(gn.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},"MappingList_toArray");yn.MappingList=De});var gt=k(wn=>{var we=dt(),A=ae(),Ue=ht().ArraySet,$r=bn().MappingList;function U(n){n||(n={}),this._file=A.getArg(n,"file",null),this._sourceRoot=A.getArg(n,"sourceRoot",null),this._skipValidation=A.getArg(n,"skipValidation",!1),this._sources=new Ue,this._names=new Ue,this._mappings=new $r,this._sourcesContents=null}s(U,"SourceMapGenerator");U.prototype._version=3;U.fromSourceMap=s(function(e){var t=e.sourceRoot,r=new U({file:e.file,sourceRoot:t});return e.eachMapping(function(o){var i={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(i.source=o.source,t!=null&&(i.source=A.relative(t,i.source)),i.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(i.name=o.name)),r.addMapping(i)}),e.sources.forEach(function(o){var i=o;t!==null&&(i=A.relative(t,o)),r._sources.has(i)||r._sources.add(i);var a=e.sourceContentFor(o);a!=null&&r.setSourceContent(o,a)}),r},"SourceMapGenerator_fromSourceMap");U.prototype.addMapping=s(function(e){var t=A.getArg(e,"generated"),r=A.getArg(e,"original",null),o=A.getArg(e,"source",null),i=A.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,o,i),o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:o,name:i})},"SourceMapGenerator_addMapping");U.prototype.setSourceContent=s(function(e,t){var r=e;this._sourceRoot!=null&&(r=A.relative(this._sourceRoot,r)),t!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[A.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[A.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},"SourceMapGenerator_setSourceContent");U.prototype.applySourceMap=s(function(e,t,r){var o=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.`);o=e.file}var i=this._sourceRoot;i!=null&&(o=A.relative(i,o));var a=new Ue,l=new Ue;this._mappings.unsortedForEach(function(u){if(u.source===o&&u.originalLine!=null){var c=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});c.source!=null&&(u.source=c.source,r!=null&&(u.source=A.join(r,u.source)),i!=null&&(u.source=A.relative(i,u.source)),u.originalLine=c.line,u.originalColumn=c.column,c.name!=null&&(u.name=c.name))}var _=u.source;_!=null&&!a.has(_)&&a.add(_);var d=u.name;d!=null&&!l.has(d)&&l.add(d)},this),this._sources=a,this._names=l,e.sources.forEach(function(u){var c=e.sourceContentFor(u);c!=null&&(r!=null&&(u=A.join(r,u)),i!=null&&(u=A.relative(i,u)),this.setSourceContent(u,c))},this)},"SourceMapGenerator_applySourceMap");U.prototype._validateMapping=s(function(e,t,r,o){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&&!o)){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:o}))}},"SourceMapGenerator_validateMapping");U.prototype._serializeMappings=s(function(){for(var e=0,t=1,r=0,o=0,i=0,a=0,l="",u,c,_,d,p=this._mappings.toArray(),f=0,g=p.length;f<g;f++){if(c=p[f],u="",c.generatedLine!==t)for(e=0;c.generatedLine!==t;)u+=";",t++;else if(f>0){if(!A.compareByGeneratedPositionsInflated(c,p[f-1]))continue;u+=","}u+=we.encode(c.generatedColumn-e),e=c.generatedColumn,c.source!=null&&(d=this._sources.indexOf(c.source),u+=we.encode(d-a),a=d,u+=we.encode(c.originalLine-1-o),o=c.originalLine-1,u+=we.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(_=this._names.indexOf(c.name),u+=we.encode(_-i),i=_)),l+=u}return l},"SourceMapGenerator_serializeMappings");U.prototype._generateSourcesContent=s(function(e,t){return e.map(function(r){if(!this._sourcesContents)return null;t!=null&&(r=A.relative(t,r));var o=A.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)},"SourceMapGenerator_generateSourcesContent");U.prototype.toJSON=s(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");U.prototype.toString=s(function(){return JSON.stringify(this.toJSON())},"SourceMapGenerator_toString");wn.SourceMapGenerator=U});var Sn=k(Y=>{Y.GREATEST_LOWER_BOUND=1;Y.LEAST_UPPER_BOUND=2;function yt(n,e,t,r,o,i){var a=Math.floor((e-n)/2)+n,l=o(t,r[a],!0);return l===0?a:l>0?e-a>1?yt(a,e,t,r,o,i):i==Y.LEAST_UPPER_BOUND?e<r.length?e:-1:a:a-n>1?yt(n,a,t,r,o,i):i==Y.LEAST_UPPER_BOUND?a:n<0?-1:n}s(yt,"recursiveSearch");Y.search=s(function(e,t,r,o){if(t.length===0)return-1;var i=yt(-1,t.length,e,t,r,o||Y.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&r(t[i],t[i-1],!0)===0;)--i;return i},"search")});var En=k(vn=>{function bt(n,e,t){var r=n[e];n[e]=n[t],n[t]=r}s(bt,"swap");function Kr(n,e){return Math.round(n+Math.random()*(e-n))}s(Kr,"randomIntInRange");function wt(n,e,t,r){if(t<r){var o=Kr(t,r),i=t-1;bt(n,o,r);for(var a=n[r],l=t;l<r;l++)e(n[l],a)<=0&&(i+=1,bt(n,i,l));bt(n,i+1,l);var u=i+1;wt(n,e,t,u-1),wt(n,e,u+1,r)}}s(wt,"doQuickSort");vn.quickSort=function(n,e){wt(n,e,0,n.length-1)}});var In=k(Be=>{var M=ae(),St=Sn(),ue=ht().ArraySet,Jr=dt(),Se=En().quickSort;function L(n,e){var t=n;return typeof n=="string"&&(t=M.parseSourceMapInput(n)),t.sections!=null?new B(t,e):new P(t,e)}s(L,"SourceMapConsumer");L.fromSourceMap=function(n,e){return P.fromSourceMap(n,e)};L.prototype._version=3;L.prototype.__generatedMappings=null;Object.defineProperty(L.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});L.prototype.__originalMappings=null;Object.defineProperty(L.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});L.prototype._charIsMappingSeparator=s(function(e,t){var r=e.charAt(t);return r===";"||r===","},"SourceMapConsumer_charIsMappingSeparator");L.prototype._parseMappings=s(function(e,t){throw new Error("Subclasses must implement _parseMappings")},"SourceMapConsumer_parseMappings");L.GENERATED_ORDER=1;L.ORIGINAL_ORDER=2;L.GREATEST_LOWER_BOUND=1;L.LEAST_UPPER_BOUND=2;L.prototype.eachMapping=s(function(e,t,r){var o=t||null,i=r||L.GENERATED_ORDER,a;switch(i){case L.GENERATED_ORDER:a=this._generatedMappings;break;case L.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var l=this.sourceRoot;a.map(function(u){var c=u.source===null?null:this._sources.at(u.source);return c=M.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,o)},"SourceMapConsumer_eachMapping");L.prototype.allGeneratedPositionsFor=s(function(e){var t=M.getArg(e,"line"),r={source:M.getArg(e,"source"),originalLine:t,originalColumn:M.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var o=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",M.compareByOriginalPositions,St.LEAST_UPPER_BOUND);if(i>=0){var a=this._originalMappings[i];if(e.column===void 0)for(var l=a.originalLine;a&&a.originalLine===l;)o.push({line:M.getArg(a,"generatedLine",null),column:M.getArg(a,"generatedColumn",null),lastColumn:M.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i];else for(var u=a.originalColumn;a&&a.originalLine===t&&a.originalColumn==u;)o.push({line:M.getArg(a,"generatedLine",null),column:M.getArg(a,"generatedColumn",null),lastColumn:M.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i]}return o},"SourceMapConsumer_allGeneratedPositionsFor");Be.SourceMapConsumer=L;function P(n,e){var t=n;typeof n=="string"&&(t=M.parseSourceMapInput(n));var r=M.getArg(t,"version"),o=M.getArg(t,"sources"),i=M.getArg(t,"names",[]),a=M.getArg(t,"sourceRoot",null),l=M.getArg(t,"sourcesContent",null),u=M.getArg(t,"mappings"),c=M.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);a&&(a=M.normalize(a)),o=o.map(String).map(M.normalize).map(function(_){return a&&M.isAbsolute(a)&&M.isAbsolute(_)?M.relative(a,_):_}),this._names=ue.fromArray(i.map(String),!0),this._sources=ue.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(_){return M.computeSourceURL(a,_,e)}),this.sourceRoot=a,this.sourcesContent=l,this._mappings=u,this._sourceMapURL=e,this.file=c}s(P,"BasicSourceMapConsumer");P.prototype=Object.create(L.prototype);P.prototype.consumer=L;P.prototype._findSourceIndex=function(n){var e=n;if(this.sourceRoot!=null&&(e=M.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};P.fromSourceMap=s(function(e,t){var r=Object.create(P.prototype),o=r._names=ue.fromArray(e._names.toArray(),!0),i=r._sources=ue.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(f){return M.computeSourceURL(r.sourceRoot,f,t)});for(var a=e._mappings.toArray().slice(),l=r.__generatedMappings=[],u=r.__originalMappings=[],c=0,_=a.length;c<_;c++){var d=a[c],p=new Mn;p.generatedLine=d.generatedLine,p.generatedColumn=d.generatedColumn,d.source&&(p.source=i.indexOf(d.source),p.originalLine=d.originalLine,p.originalColumn=d.originalColumn,d.name&&(p.name=o.indexOf(d.name)),u.push(p)),l.push(p)}return Se(r.__originalMappings,M.compareByOriginalPositions),r},"SourceMapConsumer_fromSourceMap");P.prototype._version=3;Object.defineProperty(P.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Mn(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}s(Mn,"Mapping");P.prototype._parseMappings=s(function(e,t){for(var r=1,o=0,i=0,a=0,l=0,u=0,c=e.length,_=0,d={},p={},f=[],g=[],m,v,b,S,T;_<c;)if(e.charAt(_)===";")r++,_++,o=0;else if(e.charAt(_)===",")_++;else{for(m=new Mn,m.generatedLine=r,S=_;S<c&&!this._charIsMappingSeparator(e,S);S++);if(v=e.slice(_,S),b=d[v],b)_+=v.length;else{for(b=[];_<S;)Jr.decode(e,_,p),T=p.value,_=p.rest,b.push(T);if(b.length===2)throw new Error("Found a source, but no line and column");if(b.length===3)throw new Error("Found a source and line, but no column");d[v]=b}m.generatedColumn=o+b[0],o=m.generatedColumn,b.length>1&&(m.source=l+b[1],l+=b[1],m.originalLine=i+b[2],i=m.originalLine,m.originalLine+=1,m.originalColumn=a+b[3],a=m.originalColumn,b.length>4&&(m.name=u+b[4],u+=b[4])),g.push(m),typeof m.originalLine=="number"&&f.push(m)}Se(g,M.compareByGeneratedPositionsDeflated),this.__generatedMappings=g,Se(f,M.compareByOriginalPositions),this.__originalMappings=f},"SourceMapConsumer_parseMappings");P.prototype._findMapping=s(function(e,t,r,o,i,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[o]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[o]);return St.search(e,t,i,a)},"SourceMapConsumer_findMapping");P.prototype.computeColumnSpans=s(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");P.prototype.originalPositionFor=s(function(e){var t={generatedLine:M.getArg(e,"line"),generatedColumn:M.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",M.compareByGeneratedPositionsDeflated,M.getArg(e,"bias",L.GREATEST_LOWER_BOUND));if(r>=0){var o=this._generatedMappings[r];if(o.generatedLine===t.generatedLine){var i=M.getArg(o,"source",null);i!==null&&(i=this._sources.at(i),i=M.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var a=M.getArg(o,"name",null);return a!==null&&(a=this._names.at(a)),{source:i,line:M.getArg(o,"originalLine",null),column:M.getArg(o,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},"SourceMapConsumer_originalPositionFor");P.prototype.hasContentsOfAllSources=s(function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1},"BasicSourceMapConsumer_hasContentsOfAllSources");P.prototype.sourceContentFor=s(function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var o=e;this.sourceRoot!=null&&(o=M.relative(this.sourceRoot,o));var i;if(this.sourceRoot!=null&&(i=M.urlParse(this.sourceRoot))){var a=o.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];if((!i.path||i.path=="/")&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(t)return null;throw new Error('"'+o+'" is not in the SourceMap.')},"SourceMapConsumer_sourceContentFor");P.prototype.generatedPositionFor=s(function(e){var t=M.getArg(e,"source");if(t=this._findSourceIndex(t),t<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:M.getArg(e,"line"),originalColumn:M.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",M.compareByOriginalPositions,M.getArg(e,"bias",L.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:M.getArg(i,"generatedLine",null),column:M.getArg(i,"generatedColumn",null),lastColumn:M.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},"SourceMapConsumer_generatedPositionFor");Be.BasicSourceMapConsumer=P;function B(n,e){var t=n;typeof n=="string"&&(t=M.parseSourceMapInput(n));var r=M.getArg(t,"version"),o=M.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new ue,this._names=new ue;var i={line:-1,column:0};this._sections=o.map(function(a){if(a.url)throw new Error("Support for url field in sections not implemented.");var l=M.getArg(a,"offset"),u=M.getArg(l,"line"),c=M.getArg(l,"column");if(u<i.line||u===i.line&&c<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");return i=l,{generatedOffset:{generatedLine:u+1,generatedColumn:c+1},consumer:new L(M.getArg(a,"map"),e)}})}s(B,"IndexedSourceMapConsumer");B.prototype=Object.create(L.prototype);B.prototype.constructor=L;B.prototype._version=3;Object.defineProperty(B.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}});B.prototype.originalPositionFor=s(function(e){var t={generatedLine:M.getArg(e,"line"),generatedColumn:M.getArg(e,"column")},r=St.search(t,this._sections,function(i,a){var l=i.generatedLine-a.generatedOffset.generatedLine;return l||i.generatedColumn-a.generatedOffset.generatedColumn}),o=this._sections[r];return o?o.consumer.originalPositionFor({line:t.generatedLine-(o.generatedOffset.generatedLine-1),column:t.generatedColumn-(o.generatedOffset.generatedLine===t.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},"IndexedSourceMapConsumer_originalPositionFor");B.prototype.hasContentsOfAllSources=s(function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},"IndexedSourceMapConsumer_hasContentsOfAllSources");B.prototype.sourceContentFor=s(function(e,t){for(var r=0;r<this._sections.length;r++){var o=this._sections[r],i=o.consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},"IndexedSourceMapConsumer_sourceContentFor");B.prototype.generatedPositionFor=s(function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(r.consumer._findSourceIndex(M.getArg(e,"source"))!==-1){var o=r.consumer.generatedPositionFor(e);if(o){var i={line:o.line+(r.generatedOffset.generatedLine-1),column:o.column+(r.generatedOffset.generatedLine===o.line?r.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}},"IndexedSourceMapConsumer_generatedPositionFor");B.prototype._parseMappings=s(function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var o=this._sections[r],i=o.consumer._generatedMappings,a=0;a<i.length;a++){var l=i[a],u=o.consumer._sources.at(l.source);u=M.computeSourceURL(o.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var c=null;l.name&&(c=o.consumer._names.at(l.name),this._names.add(c),c=this._names.indexOf(c));var _={source:u,generatedLine:l.generatedLine+(o.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(o.generatedOffset.generatedLine===l.generatedLine?o.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:c};this.__generatedMappings.push(_),typeof _.originalLine=="number"&&this.__originalMappings.push(_)}Se(this.__generatedMappings,M.compareByGeneratedPositionsDeflated),Se(this.__originalMappings,M.compareByOriginalPositions)},"IndexedSourceMapConsumer_parseMappings");Be.IndexedSourceMapConsumer=B});var Tn=k(xn=>{var Qr=gt().SourceMapGenerator,We=ae(),Xr=/(\r?\n)/,Yr=10,le="$$$isSourceNode$$$";function R(n,e,t,r,o){this.children=[],this.sourceContents={},this.line=n??null,this.column=e??null,this.source=t??null,this.name=o??null,this[le]=!0,r!=null&&this.add(r)}s(R,"SourceNode");R.fromStringWithSourceMap=s(function(e,t,r){var o=new R,i=e.split(Xr),a=0,l=s(function(){var p=g(),f=g()||"";return p+f;function g(){return a<i.length?i[a++]:void 0}},"shiftNextLine"),u=1,c=0,_=null;return t.eachMapping(function(p){if(_!==null)if(u<p.generatedLine)d(_,l()),u++,c=0;else{var f=i[a]||"",g=f.substr(0,p.generatedColumn-c);i[a]=f.substr(p.generatedColumn-c),c=p.generatedColumn,d(_,g),_=p;return}for(;u<p.generatedLine;)o.add(l()),u++;if(c<p.generatedColumn){var f=i[a]||"";o.add(f.substr(0,p.generatedColumn)),i[a]=f.substr(p.generatedColumn),c=p.generatedColumn}_=p},this),a<i.length&&(_&&d(_,l()),o.add(i.splice(a).join(""))),t.sources.forEach(function(p){var f=t.sourceContentFor(p);f!=null&&(r!=null&&(p=We.join(r,p)),o.setSourceContent(p,f))}),o;function d(p,f){if(p===null||p.source===void 0)o.add(f);else{var g=r?We.join(r,p.source):p.source;o.add(new R(p.originalLine,p.originalColumn,g,f,p.name))}}s(d,"addMappingWithCode")},"SourceNode_fromStringWithSourceMap");R.prototype.add=s(function(e){if(Array.isArray(e))e.forEach(function(t){this.add(t)},this);else if(e[le]||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");R.prototype.prepend=s(function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else if(e[le]||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");R.prototype.walk=s(function(e){for(var t,r=0,o=this.children.length;r<o;r++)t=this.children[r],t[le]?t.walk(e):t!==""&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},"SourceNode_walk");R.prototype.join=s(function(e){var t,r,o=this.children.length;if(o>0){for(t=[],r=0;r<o-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},"SourceNode_join");R.prototype.replaceRight=s(function(e,t){var r=this.children[this.children.length-1];return r[le]?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");R.prototype.setSourceContent=s(function(e,t){this.sourceContents[We.toSetString(e)]=t},"SourceNode_setSourceContent");R.prototype.walkSourceContents=s(function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][le]&&this.children[t].walkSourceContents(e);for(var o=Object.keys(this.sourceContents),t=0,r=o.length;t<r;t++)e(We.fromSetString(o[t]),this.sourceContents[o[t]])},"SourceNode_walkSourceContents");R.prototype.toString=s(function(){var e="";return this.walk(function(t){e+=t}),e},"SourceNode_toString");R.prototype.toStringWithSourceMap=s(function(e){var t={code:"",line:1,column:0},r=new Qr(e),o=!1,i=null,a=null,l=null,u=null;return this.walk(function(c,_){t.code+=c,_.source!==null&&_.line!==null&&_.column!==null?((i!==_.source||a!==_.line||l!==_.column||u!==_.name)&&r.addMapping({source:_.source,original:{line:_.line,column:_.column},generated:{line:t.line,column:t.column},name:_.name}),i=_.source,a=_.line,l=_.column,u=_.name,o=!0):o&&(r.addMapping({generated:{line:t.line,column:t.column}}),i=null,o=!1);for(var d=0,p=c.length;d<p;d++)c.charCodeAt(d)===Yr?(t.line++,t.column=0,d+1===p?(i=null,o=!1):o&&r.addMapping({source:_.source,original:{line:_.line,column:_.column},generated:{line:t.line,column:t.column},name:_.name})):t.column++}),this.walkSourceContents(function(c,_){r.setSourceContent(c,_)}),{code:t.code,map:r}},"SourceNode_toStringWithSourceMap");xn.SourceNode=R});var Cn=k(ze=>{ze.SourceMapGenerator=gt().SourceMapGenerator;ze.SourceMapConsumer=In().SourceMapConsumer;ze.SourceNode=Tn().SourceNode});var Ln=k((la,Nn)=>{var eo=Object.prototype.toString,vt=typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function to(n){return eo.call(n).slice(8,-1)==="ArrayBuffer"}s(to,"isArrayBuffer");function no(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 vt?Buffer.from(n.slice(e,e+t)):new Buffer(new Uint8Array(n.slice(e,e+t)))}s(no,"fromArrayBuffer");function ro(n,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return vt?Buffer.from(n,e):new Buffer(n,e)}s(ro,"fromString");function oo(n,e,t){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return to(n)?no(n,e,t):typeof n=="string"?ro(n,e):vt?Buffer.from(n):new Buffer(n)}s(oo,"bufferFrom");Nn.exports=oo});var Un=k((te,xt)=>{var io=Cn().SourceMapConsumer,Et=require("path"),z;try{z=require("fs"),(!z.existsSync||!z.readFileSync)&&(z=null)}catch{}var so=Ln();function An(n,e){return n.require(e)}s(An,"dynamicRequire");var Pn=!1,kn=!1,Mt=!1,ve="auto",ee={},Ee={},ao=/^data:application\/json[^,]+base64,/,G=[],$=[];function Tt(){return ve==="browser"?!0:ve==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}s(Tt,"isInBrowser");function uo(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}s(uo,"hasGlobalProcessEventEmitter");function lo(){return typeof process=="object"&&process!==null?process.version:""}s(lo,"globalProcessVersion");function co(){if(typeof process=="object"&&process!==null)return process.stderr}s(co,"globalProcessStderr");function _o(n){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(n)}s(_o,"globalProcessExit");function qe(n){return function(e){for(var t=0;t<n.length;t++){var r=n[t](e);if(r)return r}return null}}s(qe,"handlerExec");var Ct=qe(G);G.push(function(n){if(n=n.trim(),/^file:/.test(n)&&(n=n.replace(/file:\/\/\/(\w:)?/,function(r,o){return o?"":"/"})),n in ee)return ee[n];var e="";try{if(z)z.existsSync(n)&&(e=z.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 ee[n]=e});function It(n,e){if(!n)return e;var t=Et.dirname(n),r=/^\w+:\/\/[^\/]*/.exec(t),o=r?r[0]:"",i=t.slice(o.length);return o&&/^\/\w\:/.test(i)?(o+="/",o+Et.resolve(t.slice(o.length),e).replace(/\\/g,"/")):o+Et.resolve(t.slice(o.length),e)}s(It,"supportRelativeURL");function po(n){var e;if(Tt())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=Ct(n);for(var o=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,i,a;a=o.exec(e);)i=a;return i?i[1]:null}s(po,"retrieveSourceMapURL");var Nt=qe($);$.push(function(n){var e=po(n);if(!e)return null;var t;if(ao.test(e)){var r=e.slice(e.indexOf(",")+1);t=so(r,"base64").toString(),e=n}else e=It(n,e),t=Ct(e);return t?{url:e,map:t}:null});function Lt(n){var e=Ee[n.source];if(!e){var t=Nt(n.source);t?(e=Ee[n.source]={url:t.url,map:new io(t.map)},e.map.sourcesContent&&e.map.sources.forEach(function(o,i){var a=e.map.sourcesContent[i];if(a){var l=It(e.url,o);ee[l]=a}})):e=Ee[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=It(e.url,r.source),r}return n}s(Lt,"mapSourcePosition");function Fn(n){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(n);if(e){var t=Lt({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]+" ("+Fn(e[2])+")":n}s(Fn,"mapEvalOrigin");function mo(){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 o="",i=this.getFunctionName(),a=!0,l=this.isConstructor(),u=!(this.isToplevel()||l);if(u){var c=this.getTypeName();c==="[object Object]"&&(c="null");var _=this.getMethodName();i?(c&&i.indexOf(c)!=0&&(o+=c+"."),o+=i,_&&i.indexOf("."+_)!=i.length-_.length-1&&(o+=" [as "+_+"]")):o+=c+"."+(_||"<anonymous>")}else l?o+="new "+(i||"<anonymous>"):i?o+=i:(o+=e,a=!1);return a&&(o+=" ("+e+")"),o}s(mo,"CallSiteToString");function On(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=mo,e}s(On,"cloneCallSite");function Rn(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(),o=n.getColumnNumber()-1,i=/^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)/,a=i.test(lo())?0:62;r===1&&o>a&&!Tt()&&!n.isEval()&&(o-=a);var l=Lt({source:t,line:r,column:o});e.curPosition=l,n=On(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=Fn(c),n=On(n),n.getEvalOrigin=function(){return c}),n}s(Rn,"wrapCallSite");function fo(n,e){Mt&&(ee={},Ee={});for(var t=n.name||"Error",r=n.message||"",o=t+": "+r,i={nextPosition:null,curPosition:null},a=[],l=e.length-1;l>=0;l--)a.push(`
at `+Rn(e[l],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,o+a.reverse().join("")}s(fo,"prepareStackTrace");function Dn(n){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(n.stack);if(e){var t=e[1],r=+e[2],o=+e[3],i=ee[t];if(!i&&z&&z.existsSync(t))try{i=z.readFileSync(t,"utf8")}catch{i=""}if(i){var a=i.split(/(?:\r\n|\r|\n)/)[r-1];if(a)return t+":"+r+`
`+a+`
`+new Array(o).join(" ")+"^"}}return null}s(Dn,"getErrorSource");function ho(n){var e=Dn(n),t=co();t&&t._handle&&t._handle.setBlocking&&t._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(n.stack),_o(1)}s(ho,"printErrorAndExit");function go(){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 ho(arguments[1])}return n.apply(this,arguments)}}s(go,"shimEmitUncaughtException");var yo=G.slice(0),bo=$.slice(0);te.wrapCallSite=Rn;te.getErrorSource=Dn;te.mapSourcePosition=Lt;te.retrieveSourceMap=Nt;te.install=function(n){if(n=n||{},n.environment&&(ve=n.environment,["node","browser","auto"].indexOf(ve)===-1))throw new Error("environment "+ve+" was unknown. Available options are {auto, browser, node}");if(n.retrieveFile&&(n.overrideRetrieveFile&&(G.length=0),G.unshift(n.retrieveFile)),n.retrieveSourceMap&&(n.overrideRetrieveSourceMap&&($.length=0),$.unshift(n.retrieveSourceMap)),n.hookRequire&&!Tt()){var e=An(xt,"module"),t=e.prototype._compile;t.__sourceMapSupport||(e.prototype._compile=function(i,a){return ee[a]=i,Ee[a]=void 0,t.call(this,i,a)},e.prototype._compile.__sourceMapSupport=!0)}if(Mt||(Mt="emptyCacheBetweenOperations"in n?n.emptyCacheBetweenOperations:!1),Pn||(Pn=!0,Error.prepareStackTrace=fo),!kn){var r="handleUncaughtExceptions"in n?n.handleUncaughtExceptions:!0;try{var o=An(xt,"worker_threads");o.isMainThread===!1&&(r=!1)}catch{}r&&uo()&&(kn=!0,go())}};te.resetRetrieveHandlers=function(){G.length=0,$.length=0,G=yo.slice(0),$=bo.slice(0),Nt=qe($),Ct=qe(G)}});var Bn=k(()=>{Un().install()});var So={};Gn(So,{WorkerProxy:()=>Me,reset:()=>wo,sleep:()=>zn,workerFns:()=>At,workerProxy:()=>Pt});module.exports=$n(So);var Wn=require("path"),q=require("worker_threads");var J=require("path"),Zt=Te(Ot());var Ze=require("fs");var Ft={readFile(n){return Ze.promises.readFile(n)},async stat(n){let e=await Ze.promises.stat(n);return{ctime:e.ctimeMs,mtime:e.mtimeMs,size:e.size}}};var Bt=require("path"),Ce=Te(Rt());var Ke={python:"python",javascript:"javascript",javascriptreact:"javascript",jsx:"javascript",typescript:"typescript",typescriptreact:"tsx",go:"go",ruby:"ruby"};function Je(n){return n in Ke}s(Je,"isSupportedLanguageId");function Qe(n){if(!(n in Ke))throw new Error(`Unrecognized language: ${n}`);return Ke[n]}s(Qe,"languageIdToWasmLanguage");var Ve=`[
(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`,Kn={python:[[`(function_definition body: (block
(expression_statement (string))? @docstring) @body) @function`],['(ERROR ("def" (identifier) (parameters))) @function']],javascript:[[Ve]],typescript:[[Ve]],tsx:[[Ve]],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`]]},Jn='(call_expression function: ((identifier) @req (#eq? @req "require")))',Dt=`(variable_declarator value: ${Jn})`,Wt=`
(lexical_declaration ${Dt}+)
(variable_declaration ${Dt}+)
`,Ut=[[`(program [ ${Wt} ] @import)`],["(program [ (import_statement) (import_alias) ] @import)"]],To={python:[["(module (future_import_statement) @import)"],["(module (import_statement) @import)"],["(module (import_from_statement) @import)"]],javascript:[[`(program [ ${Wt} ] @import)`],["(program [ (import_statement) ] @import)"]],typescript:Ut,tsx:Ut,go:[],ruby:[]},He=[["(program (export_statement) @export)"]],Qn={python:[],javascript:He,typescript:He,tsx:He,go:[],ruby:[]};var Ge=["function","function_declaration","generator_function","generator_function_declaration","method_definition","arrow_function"],Co={python:new Set(["function_definition"]),javascript:new Set(Ge),typescript:new Set(Ge),tsx:new Set(Ge),go:new Set(["function_declaration","method_declaration"]),ruby:new Set(["method","singleton_method"])};var $e=new Map;async function Xn(n){await Ce.default.init();let e=(0,Bt.resolve)(__dirname,"..","dist",`tree-sitter-${n}.wasm`);try{return Ce.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}}s(Xn,"loadWasmLanguage");async function Yn(n){let e=Qe(n);if(!$e.has(e)){let t=await Xn(e);$e.set(e,t)}return $e.get(e)}s(Yn,"getLanguage");async function fe(n,e){let t=await Yn(n),r=new Ce.default;r.setLanguage(t);let o=r.parse(e);return r.delete(),o}s(fe,"parseTreeSitter");function zt(n,e){let t=[];for(let r of n){if(!r[1]){let o=e.tree.getLanguage();r[1]=o.query(r[0])}t.push(...r[1].matches(e))}return t}s(zt,"innerQuery");function er(n,e){let t=Kn[Qe(n)];return zt(t,e)}s(er,"queryFunctions");function qt(n,e){let t=Qn[Qe(n)];return zt(t,e)}s(qt,"queryExports");function Ne(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}s(Ne,"getFirstPrecedingComment");async function jt(n,e){let t=await fe(n,e),o=er(n,t.rootNode).map(i=>{let a=i.captures.find(l=>l.name==="function").node;return{startIndex:a.startIndex,endIndex:a.endIndex}});return t.delete(),o}s(jt,"getFunctionPositions");function tr(n,e){let t=e.namedChild(1)?.text.slice(1,-1);if(!t||!t.startsWith("."))return null;if((0,J.extname)(t)==="")t=t+".ts";else if((0,J.extname)(t)!==".ts")return null;return(0,J.join)((0,J.dirname)(n),t)}s(tr,"resolveLocalTypeScriptImport");function nr(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 o of r?.namedChildren??[])if(o.type==="import_specifier"){let i=o.childForFieldName("name")?.text;if(i){let a=o.childForFieldName("alias")?.text;e.push({name:i,alias:a})}}}}return e}s(nr,"getTypescriptImportedNames");var he=new Map,rr=1e3,or=2e3;function Vt(n,e){let t=e?.childForFieldName("name")?.text??"";switch(e?.type){case"ambient_declaration":return Vt(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:Ht(n,e)};case"class_declaration":{let r=sr(n,e),o="";if(r){let i=e.childForFieldName("body");o=`declare ${n.substring(e.startIndex,i.startIndex+1)}`,o+=r.map(a=>`
`+a).join(""),o+=`
}`}return{name:t,decl:o}}}return{name:t,decl:""}}s(Vt,"extractTypeScriptDeclaration");function Ht(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""}s(Ht,"extractTypeScriptFunctionDeclaration");function ir(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)}s(ir,"getIndentation");function Gt(n,e){let t=Ne(e);return t?n.substring(t.startIndex,e.startIndex):""}s(Gt,"getDocComment");function $t(n,e){if(e?.firstChild?.type==="accessibility_modifier"&&e.firstChild.text==="private")return"";let t=Ne(e),r=ir(n,t??e)??" ",o=Gt(n,e);switch(e.type){case"ambient_declaration":let i=e.namedChild(0);return i?r+o+$t(n,i):"";case"method_definition":case"method_signature":return r+o+Ht(n,e);case"public_field_definition":{let a=e.childForFieldName("type")?.endIndex??e.childForFieldName("name")?.endIndex;if(a!==void 0)return r+o+n.substring(e.startIndex,a)+";"}}return""}s($t,"extractTypeScriptMemberDeclaration");function sr(n,e){let t=e.childForFieldName("body");return t?t.namedChildren.map(o=>$t(n,o)).filter(o=>o):void 0}s(sr,"extractTypeScriptBodyDecls");async function ar(n,e,t){let r=new Map,o=-1;try{o=(await t.stat(n)).mtime}catch{return r}let i=he.get(n);if(i&&i.mtime===o)return i.exports;if(e==="typescript"){let a=null;try{let u=(await t.readFile(n)).toString();a=await fe(e,u);for(let c of qt(e,a.rootNode))for(let _ of c.captures){let d=_.node;if(d.type==="export_statement"){let p=d.childForFieldName("declaration");if(p?.hasError())continue;let{name:f,decl:g}=Vt(u,p);if(f){g=Gt(u,d)+g;let m=r.get(f);m||(m=[],r.set(f,m)),m.push(g)}}}}catch{}finally{a&&a.delete()}}if(he.size>or){for(let a of he.keys())if(he.delete(a),r.size<=rr)break}return he.set(n,{mtime:o,exports:r}),r}s(ar,"getExportedDeclarations");function ur(n){let e=[];for(let t of n.namedChildren)t.type==="import_statement"&&e.push(t);return e}s(ur,"getTypeScriptImports");var Xe=/^\s*import\s*(type|)\s*\{[^}]*\}\s*from\s*['"]\./gm;function lr(n){let e=-1;Xe.lastIndex=-1;let t;do t=Xe.exec(n),t&&(e=Xe.lastIndex+t.length);while(t);if(e===-1)return-1;let r=n.indexOf(`
`,e);return r!==-1?r:n.length}s(lr,"lastTypeScriptLocalImportOffset");async function cr(n,e,t){let r="typescript",o=[],i=lr(n);if(i===-1)return o;n=n.substring(0,i);let a=await fe(r,n);try{for(let l of ur(a.rootNode)){let u=tr(e,l);if(!u)continue;let c=nr(l);if(c.length===0)continue;let _=await ar(u,r,t);for(let d of c)_.has(d.name)&&o.push(..._.get(d.name))}}finally{a.delete()}return o}s(cr,"extractTypeScriptLocalImportContext");async function Kt(n,e){let{source:t,languageId:r}=n,o=Zt.URI.parse(n.uri);return r==="typescript"&&o.scheme==="file"?cr(t,o.fsPath,e??Ft):[]}s(Kt,"extractLocalImportContext");var nn=require("assert");var Ye=Te(require("fs")),et=Te(require("path")),Ae=require("util");var Le=s((n,e)=>Array.from(Array(e).keys()).slice(n),"range"),oe=s(n=>n.charCodeAt(0),"ord"),_r=s(n=>String.fromCharCode(n),"chr"),dr=new Ae.TextDecoder("utf-8"),Jt=s(n=>dr.decode(new Uint8Array(n)),"decodeStr"),pr=s((n,e)=>{let t=new Map;return n.forEach((r,o)=>{t.set(n[o],e[o])}),t},"dictZip");function mr(n){let e=Le(oe("!"),oe("~")+1).concat(Le(oe("\xA1"),oe("\xAC")+1),Le(oe("\xAE"),oe("\xFF")+1)),t=e.slice(),r=0;for(let i=0;i<2**8;i++)e.includes(i)||(e.push(i),t.push(2**8+r),r=r+1);let o=t.map(i=>_r(i));for(let i=0;i<e.length;i++)n.set(e[i],o[i])}s(mr,"bytes_to_unicode");function Qt(n){let e=new Set,t=n[0];for(let r=1;r<n.length;r++){let o=n[r];e.add([t,o]),t=o}return e}s(Qt,"get_char_pairs");var Xt=new Map;function rt(n="cl100k"){let e=Xt.get(n);return e!==void 0||(n==="mock"?e=new nt:e=new tt(n),Xt.set(n,e)),e}s(rt,"getTokenizer");var tt=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 Ae.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 o,i;try{let l=Ye.readFileSync(et.resolve(__dirname,"resources",e,r));o=JSON.parse(l.toString()),i=Ye.readFileSync(et.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(o));for(let[l,u]of this.encoder)this.decoder.set(u,l);let a=i.split(`
`).slice(1).filter(l=>l.trim().length>0);this.bpe_ranks=pr(a,Le(0,a.length)),mr(this.byte_encoder),this.byte_encoder.forEach((l,u,c)=>{this.byte_decoder.set(l,u)})}static{s(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=Qt(t);if(!r)return t.map(i=>this.encoder.get(i));for(;;){let i=new Map;r.forEach(p=>{let f=p.join(" "),g=this.bpe_ranks.get(f);i.set(g===void 0||isNaN(g)?1e11:g,p)});let a=Array.from(i.keys()).map(p=>Number(p)),l=i.get(Math.min(...a));if(!l||!this.bpe_ranks.has(l.join(" ")))break;let u=l[0],c=l[1],_=[],d=0;for(;d<t.length;){let p=t.indexOf(u,d);if(p===-1){this.mutatingConcat(_,t.slice(d));break}this.mutatingConcat(_,t.slice(d,p)),d=p,t[d]===u&&d<t.length-1&&t[d+1]===c?(_.push(u+c),d=d+2):(_.push(t[d]),d=d+1)}if(t=_,t.length===1)break;r=Qt(t)}let o=t.map(i=>this.encoder.get(i));return this.cache.set(e,o),o}tokenize(e){let t=[],r=Array.from(e.matchAll(this.pat)).map(o=>o[0]);for(let o of r){let i=this.bpe(o);this.mutatingConcat(t,i)}return t}tokenLength(e){return this.tokenize(e).length}takeLastTokens(e,t){if(t<=0)return"";let r=4,o=1,i=Math.min(e.length,t*r),a=e.slice(-i),l=this.tokenize(a);for(;l.length<t+2&&i<e.length;)i=Math.min(e.length,i+t*o),a=e.slice(-i),l=this.tokenize(a);return l.length<t?e:(l=l.slice(-t),this.detokenize(l))}takeFirstTokens(e,t){if(t<=0)return{text:"",tokens:[]};let r=4,o=1,i=Math.min(e.length,t*r),a=e.slice(0,i),l=this.tokenize(a);for(;l.length<t+2&&i<e.length;)i=Math.min(e.length,i+t*o),a=e.slice(0,i),l=this.tokenize(a);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 o=r.indexOf(`
`);return r.substring(o+1)}detokenize(e){let t=e.map(r=>this.decoder.get(r)).join("");return t=Jt(t.split("").map(r=>this.byte_decoder.get(r))),t}tokenizeStrings(e){return this.tokenize(e).map(r=>Jt(this.decoder.get(r).split("").map(o=>this.byte_decoder.get(o))))}},nt=class{constructor(){this.hash=e=>{let t=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o,t&=t&65535}return t}}static{s(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 o=r.indexOf(`
`);return r.substring(o+1)}};var ot=class n{constructor(){this.registeredPriorities=[0,1]}static{s(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(o=>o>t));return this.register((r+t)/2)}justBelow(...e){let t=Math.min(...e),r=Math.max(...this.registeredPriorities.filter(o=>o<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)}};var gr={tokenizerName:"cl100k"};function yr(n){return{...gr,...n}}s(yr,"cursorContextOptions");function ge(n,e={}){let t=yr(e),r=rt(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 o=n.source.slice(0,n.offset);return t.maxLineCount!==void 0&&(o=o.split(`
`).slice(-t.maxLineCount).join(`
`)),t.maxTokenLength!==void 0&&(o=r.takeLastLinesTokens(o,t.maxTokenLength)),{context:o,lineCount:o.split(`
`).length,tokenLength:r.tokenLength(o),tokenizerName:t.tokenizerName}}s(ge,"getCursorContext");var it=class{constructor(e){this.keys=[];this.cache={};this.size=e}static{s(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]}};var st=class{static{s(this,"Tokenizer")}constructor(e){this.stopsForLanguage=Ir.get(e.languageId)??Mr}tokenize(e){return new Set(vr(e).filter(t=>!this.stopsForLanguage.has(t)))}},en=new it(20),Q=class{static{s(this,"WindowedMatcher")}constructor(e){this.referenceDoc=e,this.tokenizer=new st(e)}get referenceTokens(){return this.tokenizer.tokenize(this._getCursorContextInfo(this.referenceDoc).context)}sortScoredSnippets(e,t="descending"){return t=="ascending"?e.sort((r,o)=>r.score>o.score?1:-1):t=="descending"?e.sort((r,o)=>r.score>o.score?-1:1):e}retrieveAllSnippets(e,t="descending"){let r=[];if(e.source.length===0||this.referenceTokens.size===0)return r;let o=e.source.split(`
`),i=this.id()+":"+e.source,a=en.get(i)??[],l=a.length==0,u=l?o.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[c,[_,d]]of this.getWindowsDelineations(o).entries()){if(l){let g=new Set;u.slice(_,d).forEach(m=>m.forEach(g.add,g)),a.push(g)}let p=a[c],f=this.similarityScore(p,this.referenceTokens);r.push({score:f,startLine:_,endLine:d})}return l&&en.put(i,a),this.sortScoredSnippets(r,t)}async findMatches(e,t="bestMatch",r){if(t=="bestMatch"){let o=await this.findBestMatch(e);return o?[o]:[]}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(`
`),o=this.retrieveAllSnippets(e,"descending");if(o.length===0||o[0].score===0)return;let i=[o[0]];for(let a=1;a<o.length&&i.length<t;a++)i.findIndex(l=>o[a].startLine<l.endLine&&o[a].endLine>l.startLine)==-1&&i.push(o[a]);return i.map(a=>({snippet:r.slice(a.startLine,a.endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...a}))}};async function Sr(n){let e=[];if(Je(n.languageId)){let t=await jt(n.languageId,n.source);for(let r=0;r<t.length;r++){let{startIndex:o,endIndex:i}=t[r],a=n.source.substring(o,i);e.push({source:a,relativePath:n.relativePath,languageId:n.languageId,uri:n.uri})}}return e}s(Sr,"getNeighboringFunctions");var Pe=class extends Q{static{s(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 o=await Sr(e);if(o.length==0){let a=e.source.split(`
`),l=this.retrieveAllSnippets(e,"descending");return l.length===0?[]:l[0].score===0?[]:[{snippet:a.slice(l[0].startLine,l[0].endLine).join(`
`),semantics:"snippet",provider:"neighboring-tabs",...l[0]}]}let i=[];for(let a of o){let l=this.getMatchingScore(a);i.push({semantics:"function",provider:"neighboring-tabs",...l})}return i}};function vr(n){return n.split(/[^a-zA-Z0-9]/).filter(e=>e.length>0)}s(vr,"splitIntoWords");var Er=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"]),Mr=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",...Er]),Ir=new Map([]);function Nr(n){return Object.keys(n).map(e=>{let t;return n[e].test?t=s(r=>n[e].test(r),"matches"):t=n[e],{matches:t,label:e}})}s(Nr,"buildLabelRules");var Lr={opener:/^[\[({]/,closer:/^[\])}]/},ls=Nr(Lr);function ye(n,e){let t=[],r=e.length;if(r==0)return[];if(r<n)return[[0,r]];for(let o=0;o<r-n+1;o++)t.push([o,o+n]);return t}s(ye,"getBasicWindowDelineations");var ke=class n extends Q{constructor(t,r){super(t);this.windowLength=r}static{s(this,"FixedWindowSizeJaccardMatcher")}static{this.FACTORY=t=>({to:r=>new n(r,t)})}id(){return"fixed:"+this.windowLength}getWindowsDelineations(t){return ye(this.windowLength,t)}_getCursorContextInfo(t){return ge(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Fe(t,r)}},Oe=class n extends Pe{constructor(t,r){super(t);this.windowLength=r}static{s(this,"FunctionJaccardMatcher")}id(){return"function:"+this.windowLength}getWindowsDelineations(t){return ye(this.windowLength,t)}static{this.FACTORY=t=>({to:r=>new n(r,t)})}_getCursorContextInfo(t){return ge(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Fe(t,r)}};function Fe(n,e){let t=new Set;return n.forEach(r=>{e.has(r)&&t.add(r)}),t.size/(n.size+e.size-t.size)}s(Fe,"computeScore");var at=class{constructor(e){this.keys=[];this.cache={};this.size=e}static{s(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]}},tn=new at(20),ut=class extends Q{constructor(t,r){super(t);this.windowLength=r}static{s(this,"CustomizedFixedWindowSizeJaccardMatcher")}id(){return"CustomizedFixedWindowSizeJaccardMatcher:"+this.windowLength}getWindowsDelineations(t){return ye(this.windowLength,t)}_getCursorContextInfo(t){return ge(t,{maxLineCount:this.windowLength})}similarityScore(t,r){return Fe(t,r)}retrieveAllSnippets(t,r="descending",o){let i=[];if(t.source.length===0||this.referenceTokens.size===0)return i;let a=t.source.split(`
`),l=this.id()+":"+t.source,u=tn.get(l)??[],c=u.length==0,_=c?a.map(this.tokenizer.tokenize,this.tokenizer):[];for(let[d,[p,f]]of this.getWindowsDelineations(a).entries()){if(c){let v=new Set;_.slice(p,f).forEach(b=>b.forEach(v.add,v)),u.push(v)}if(o!==void 0&&o.get(p)!==f)continue;let g=u[d],m=this.similarityScore(g,this.referenceTokens);i.push({score:m,startLine:p,endLine:f})}return c&&tn.put(l,u),this.sortScoredSnippets(i,r)}},Re=class n{static{s(this,"CursorHistoryMatcher")}constructor(e,t,r,o){this.windowLength=t,this.lineCursorHistory=r,this.jaccardMatcher=new ut(e,t),this.strategy=o}static{this.FACTORY=(e,t,r)=>({to:o=>new n(o,e,t,r)})}sortScoredSnippets(e,t="descending"){return t=="ascending"?e.sort((r,o)=>r.score>o.score?1:-1):t=="descending"?e.sort((r,o)=>r.score>o.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 o=await this.findBestMatch(e);return o===void 0?[]:[o]}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)),o=t.filter(l=>l.score===r),i=o.sort((l,u)=>l.startLine-u.startLine)[Math.floor(o.length/2)];return{snippet:e.source.split(`
`).slice(i.startLine,i.endLine).join(`
`),provider:"neighboring-tabs",semantics:"snippet",...i}}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)),o=[],i=new Map;for(let c of t)c.score===r&&(o.push(c),i.set(c.startLine,c.endLine));let a=this.jaccardMatcher.retrieveAllSnippets(e,"descending",i);if(a.length===0)return;let l=a[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 o of r)if(o.startLine===t.startLine&&o.endLine===t.endLine){t.score+=o.score;break}return t}}}async findTopKMatches(e,t=1){if(e.source.length===0||t<1)return;let r=e.source.split(`
`),o=this.retrieveCursorSnippets(e);if(o.length!==0){if(this.strategy==="cursoronly"){o=this.sortScoredSnippets(o,"descending");let i=this.gatherNonOverlappingSnippets(o,t);return this.markerToSnippet(i,r)}else if(this.strategy==="cursorjaccard"){o=this.sortScoredSnippets(o,"descending");let i=new Map(o.map(c=>[c.startLine,c.endLine])),l=this.jaccardMatcher.retrieveAllSnippets(e,"descending",i).reduce((c,_)=>c.set([_.startLine,_.endLine].join(","),_.score),new Map);o.forEach(c=>c.score+=l.get([c.startLine,c.endLine].join(","))??0),o=this.sortScoredSnippets(o,"descending");let u=this.gatherNonOverlappingSnippets(o,t);return this.markerToSnippet(u,r)}else if(this.strategy==="jaccardcursor"){let i=await this.jaccardMatcher.findTopKMatches(e,t);if(i===void 0)return;let a=o.reduce((u,c)=>u.set([c.startLine,c.endLine].join(","),c.score),new Map);i.forEach(u=>u.score+=a.get([u.startLine,u.endLine].join(","))??0);let l=this.sortScoredSnippets(i,"descending");return this.markerToSnippet(l,r)}}}gatherNonOverlappingSnippets(e,t){let r=[e[0]];for(let o=1;o<e.length&&r.length<t;o++)r.findIndex(i=>e[o].startLine<i.endLine&&e[o].endLine>i.startLine)==-1&&r.push(e[o]);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 o=e.source.split(`
`),i;(d=>(d[d.leftBoundary=0]="leftBoundary",d[d.rightBoundary=1]="rightBoundary"))(i||={});let a=[];for(let[c,_]of r.entries())c>=o.length||(a.push([Math.max(0,c-this.windowLength+1),0,_]),a.push([c+1,1,_]));a.push([o.length,0,0]),a=a.sort((c,_)=>c[0]-_[0]);let l=0,u=0;for(let[c,_,d]of a){if(l>0)for(let p=u;p<c&&(p==0||p+this.windowLength<=o.length);p++)t.push({score:l,startLine:p,endLine:Math.min(o.length,p+this.windowLength)});_===0?l+=d:l-=d,u=c}return t}};var Ar={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}},Pr=1e4,kr=20;function Or(n,e,t,r,o="cursorjaccard"){let i;return e==="neighboringSnippet"?i=ke.FACTORY(t.snippetLength):e==="neighboringFunction"?i=Oe.FACTORY(t.snippetLength):((0,nn.ok)(r!==void 0,"lineCursorHistory should not be undefined"),i=Re.FACTORY(t.snippetLength,r,o)),i.to(n)}s(Or,"getMatcher");async function rn(n,e,t,r,o,i,a,l){let u={...Ar[r]},c=Or(n,t,u,a,l);return u.numberOfSnippets===0?[]:(await e.filter(d=>d.source.length<Pr&&d.source.length>0).slice(0,kr).reduce(async(d,p)=>(await d).concat((await c.findMatches(p,o,i)).map(f=>({relativePath:p.relativePath,...f}))),Promise.resolve([]))).filter(d=>d.score&&d.snippet&&d.score>u.threshold).sort((d,p)=>d.score-p.score).slice(-u.numberOfSnippets)}s(rn,"getNeighborSnippets");function zn(n){return new Promise(e=>{setTimeout(()=>e(`delay: ${n}`),n)})}s(zn,"sleep");var At=["getNeighborSnippets","extractLocalImportContext","sleep"],Me=class{constructor(){this.nextHandlerId=0;this.handlers=new Map;this.fns=new Map;this.extractLocalImportContext=Kt;this.getNeighborSnippets=rn;this.sleep=zn;!q.isMainThread&&q.workerData?.port&&(Bn(),process.cwd=()=>q.workerData.cwd,this.configureWorkerResponse(q.workerData.port))}static{s(this,"WorkerProxy")}initWorker(){let{port1:e,port2:t}=new q.MessageChannel;this.port=e,this.worker=new q.Worker((0,Wn.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 At)this.fns.set(e,this[e]),this.proxy(e)}unproxyFunctions(){for(let e of At){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:o})=>{let i=this[r];if(!i)throw new Error(`Function not found: ${r}`);try{let a=await i.apply(this,o);this.port.postMessage({id:t,res:a})}catch(a){if(!(a instanceof Error))throw a;typeof a.code=="string"?this.port.postMessage({id:t,err:a,code:a.code}):this.port.postMessage({id:t,err:a})}})}handleMessage({id:e,err:t,code:r,res:o}){let i=this.handlers.get(e);i&&(this.handlers.delete(e),t?(t.code=r,i.reject(t)):i.resolve(o))}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((o,i)=>{this.handlers.set(r,{resolve:o,reject:i}),this.port?.postMessage({id:r,fn:e,args:t})})}}},Pt=new Me,wo=s(()=>{Pt.stopThreading(),Pt=new Me},"reset");0&&(module.exports={WorkerProxy,reset,sleep,workerFns,workerProxy});
//# sourceMappingURL=workerProxy.js.map