2 lines
48 KiB
JavaScript
2 lines
48 KiB
JavaScript
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var n,r,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,n="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,r=!_&&!n&&!a;var u,i,l,d,c,m="";n?(m=a?require("path").dirname(m)+"/":__dirname+"/",u=function(e,t){return d||(d=require("fs")),c||(c=require("path")),e=c.normalize(e),d.readFileSync(e,t?null:"utf8")},l=function(e){var t=u(e,!0);return t.buffer||(t=new Uint8Array(t)),x(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),o=function(e){process.exit(e)},Module.inspect=function(){return"[Emscripten Module object]"}):r?("undefined"!=typeof read&&(u=function(e){return read(e)}),l=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(x("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?s=scriptArgs:void 0!==arguments&&(s=arguments),"function"==typeof quit&&(o=function(e){quit(e)}),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(_||a)&&(a?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),m=0!==m.indexOf("blob:")?m.substr(0,m.lastIndexOf("/")+1):"",u=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},a&&(l=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)});Module.print||console.log.bind(console);var f=Module.printErr||console.warn.bind(console);for(e in t)t.hasOwnProperty(e)&&(Module[e]=t[e]);t=null,Module.arguments&&(s=Module.arguments),Module.thisProgram&&Module.thisProgram,Module.quit&&(o=Module.quit);var p=16;var h,g=[];function w(e,t){if(!h){h=new WeakMap;for(var n=0;n<D.length;n++){var r=D.get(n);r&&h.set(r,n)}}if(h.has(e))return h.get(e);var s=function(){if(g.length)return g.pop();try{D.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return D.length-1}();try{D.set(s,e)}catch(n){if(!(n instanceof TypeError))throw n;var o=function(e,t){if("function"==typeof WebAssembly.Function){for(var n={i:"i32",j:"i64",f:"f32",d:"f64"},r={parameters:[],results:"v"==t[0]?[]:[n[t[0]]]},s=1;s<t.length;++s)r.parameters.push(n[t[s]]);return new WebAssembly.Function(r,e)}var o=[1,0,1,96],_=t.slice(0,1),a=t.slice(1),u={i:127,j:126,f:125,d:124};for(o.push(a.length),s=0;s<a.length;++s)o.push(u[a[s]]);"v"==_?o.push(0):o=o.concat([1,u[_]]),o[1]=o.length-2;var i=new Uint8Array([0,97,115,109,1,0,0,0].concat(o,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),l=new WebAssembly.Module(i);return new WebAssembly.Instance(l,{e:{f:e}}).exports.f}(e,t);D.set(s,o)}return h.set(e,s),s}var M,y,b,E=function(e){e};function v(e,t,n,r){switch("*"===(n=n||"i8").charAt(n.length-1)&&(n="i32"),n){case"i1":case"i8":P[e>>0]=t;break;case"i16":C[e>>1]=t;break;case"i32":R[e>>2]=t;break;case"i64":ie=[t>>>0,(ue=t,+Math.abs(ue)>=1?ue>0?(0|Math.min(+Math.floor(ue/4294967296),4294967295))>>>0:~~+Math.ceil((ue-+(~~ue>>>0))/4294967296)>>>0:0)],R[e>>2]=ie[0],R[e+4>>2]=ie[1];break;case"float":q[e>>2]=t;break;case"double":T[e>>3]=t;break;default:te("invalid type for setValue: "+n)}}function I(e,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return P[e>>0];case"i16":return C[e>>1];case"i32":case"i64":return R[e>>2];case"float":return q[e>>2];case"double":return T[e>>3];default:te("invalid type for getValue: "+t)}return null}Module.wasmBinary&&(M=Module.wasmBinary),Module.noExitRuntime&&(y=Module.noExitRuntime),"object"!=typeof WebAssembly&&te("no native wasm support detected");var S=!1;function x(e,t){e||te("Assertion failed: "+t)}var N=1;var A,P,k,C,R,q,T,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Z(e,t,n){for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.subarray&&L)return L.decode(e.subarray(t,s));for(var o="";t<s;){var _=e[t++];if(128&_){var a=63&e[t++];if(192!=(224&_)){var u=63&e[t++];if((_=224==(240&_)?(15&_)<<12|a<<6|u:(7&_)<<18|a<<12|u<<6|63&e[t++])<65536)o+=String.fromCharCode(_);else{var i=_-65536;o+=String.fromCharCode(55296|i>>10,56320|1023&i)}}else o+=String.fromCharCode((31&_)<<6|a)}else o+=String.fromCharCode(_)}return o}function F(e,t){return e?Z(k,e,t):""}function W(e,t,n){return function(e,t,n,r){if(!(r>0))return 0;for(var s=n,o=n+r-1,_=0;_<e.length;++_){var a=e.charCodeAt(_);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++_)),a<=127){if(n>=o)break;t[n++]=a}else if(a<=2047){if(n+1>=o)break;t[n++]=192|a>>6,t[n++]=128|63&a}else if(a<=65535){if(n+2>=o)break;t[n++]=224|a>>12,t[n++]=128|a>>6&63,t[n++]=128|63&a}else{if(n+3>=o)break;t[n++]=240|a>>18,t[n++]=128|a>>12&63,t[n++]=128|a>>6&63,t[n++]=128|63&a}}return t[n]=0,n-s}(e,k,t,n)}function O(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++n)),r<=127?++t:t+=r<=2047?2:r<=65535?3:4}return t}function $(e){A=e,Module.HEAP8=P=new Int8Array(e),Module.HEAP16=C=new Int16Array(e),Module.HEAP32=R=new Int32Array(e),Module.HEAPU8=k=new Uint8Array(e),Module.HEAPU16=new Uint16Array(e),Module.HEAPU32=new Uint32Array(e),Module.HEAPF32=q=new Float32Array(e),Module.HEAPF64=T=new Float64Array(e)}var U=new WebAssembly.Global({value:"i32",mutable:!0},5250848);Module.___heap_base=5250848;var j=Module.INITIAL_MEMORY||33554432;(b=Module.wasmMemory?Module.wasmMemory:new WebAssembly.Memory({initial:j/65536,maximum:32768}))&&(A=b.buffer),j=A.byteLength,$(A);var D=new WebAssembly.Table({initial:13,element:"anyfunc"}),G=[],B=[],H=[],K=[],z=!1;function V(e){G.unshift(e)}B.push({func:function(){Re()}});var X=0,Q=null,Y=null;function J(e){X++,Module.monitorRunDependencies&&Module.monitorRunDependencies(X)}function ee(e){if(X--,Module.monitorRunDependencies&&Module.monitorRunDependencies(X),0==X&&(null!==Q&&(clearInterval(Q),Q=null),Y)){var t=Y;Y=null,t()}}function te(e){throw Module.onAbort&&Module.onAbort(e),f(e+=""),S=!0,1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(e)}function ne(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}Module.preloadedImages={},Module.preloadedAudios={},Module.preloadedWasm={},V(function(){var e=[];Module.dynamicLibraries&&(e=e.concat(Module.dynamicLibraries));if(!e.length)return void ve();if(!l)return J(),void Promise.all(e.map(function(e){return Ee(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})})).then(function(){ee(),ve()});e.forEach(function(e){Ee(e,{global:!0,nodelete:!0,allowUndefined:!0})}),ve()});var re="data:application/octet-stream;base64,";function se(e){return ne(e,re)}var oe="file://";function _e(e){return ne(e,oe)}var ae,ue,ie,le="tree-sitter.wasm";function de(e){try{if(e==le&&M)return new Uint8Array(M);if(l)return l(e);throw"both async and sync fetching of the wasm failed"}catch(e){te(e)}}se(le)||(ae=le,le=Module.locateFile?Module.locateFile(ae,m):m+ae);var ce={},me={get:function(e,t){return ce[t]||(ce[t]=new WebAssembly.Global({value:"i32",mutable:!0})),ce[t]}};function fe(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?D.get(n)():D.get(n)(t.arg):n(void 0===t.arg?null:t.arg)}else t(Module)}}var pe,he={nextHandle:1,loadedLibs:{},loadedLibNames:{}};function ge(e){return-1!=["__cpp_exception","__wasm_apply_data_relocs","__dso_handle","__set_stack_limits"].indexOf(e)}function we(e,t){var n={};for(var r in e){var s=e[r];"object"==typeof s&&(s=s.value),"number"==typeof s&&(s+=t),n[r]=s}return function(e){for(var t in e)if(!ge(t)){var n=!1,r=e[t];0==t.indexOf("orig$")&&(t=t.split("$")[1],n=!0),ce[t]||(ce[t]=new WebAssembly.Global({value:"i32",mutable:!0})),(n||0==ce[t].value)&&("function"==typeof r?ce[t].value=w(r):"number"==typeof r?ce[t].value=r:f("unhandled export type for `"+t+"`: "+typeof r))}}(n),n}function Me(e){return 0==e.indexOf("dynCall_")||-1!=["setTempRet0","getTempRet0","stackAlloc","stackSave","stackRestore"].indexOf(e)?e:"_"+e}function ye(e,t){var n,r;return t&&(n=Module.asm["orig$"+e]),n||(n=Module.asm[e]),!n&&t&&(n=Module["_orig$"+e]),n||(n=Module[Me(e)]),n||0!=e.indexOf("invoke_")||(r=e.split("_")[1],n=function(){var e=Le();try{return dynCall(r,arguments[0],Array.prototype.slice.call(arguments,1))}catch(t){if(Ze(e),t!==t+0&&"longjmp"!==t)throw t;_setThrew(1,0)}}),n}function be(e,t){x(1836278016==new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer)[0],"need to see wasm magic number"),x(0===e[8],"need the dylink section to be first");var n=9;function r(){for(var t=0,r=1;;){var s=e[n++];if(t+=(127&s)*r,r*=128,!(128&s))break}return t}r();x(6===e[n]),x(e[++n]==="d".charCodeAt(0)),x(e[++n]==="y".charCodeAt(0)),x(e[++n]==="l".charCodeAt(0)),x(e[++n]==="i".charCodeAt(0)),x(e[++n]==="n".charCodeAt(0)),x(e[++n]==="k".charCodeAt(0)),n++;for(var s=r(),o=r(),_=r(),a=r(),u=r(),i=[],l=0;l<u;++l){var d=r(),c=e.subarray(n,n+d);n+=d;var m=Z(c,0);i.push(m)}function f(){o=Math.pow(2,o),a=Math.pow(2,a),o=Math.max(o,p);var n,r,u,i=(n=function(e){if(z)return qe(e);var t=Module.___heap_base,n=t+e+15&-16;return Module.___heap_base=n,ce.__heap_base.value=n,t}(s+o),(r=o)||(r=p),Math.ceil(n/r)*r),l=Ce,d=D,c=d.length,m=d;d.grow(_),x(d===m);for(var f=i;f<i+s;f++)P[f]=0;for(f=c;f<c+_;f++)d.set(f,null);for(var h in Module)h in l||(l[h]=Module[h]);var g=new Proxy(l,{get:function(e,t){switch(t){case"__memory_base":return i;case"__table_base":return c}return t in e?e[t]:e[t]=function(){return n||(n=function(e){var t=ye(e,!1);return t||(t=u[e]),t}(t)),n.apply(null,arguments)};var n}}),w={"GOT.mem":new Proxy(Ce,me),"GOT.func":new Proxy(Ce,me),env:g,wasi_snapshot_preview1:g};function M(e){u=we(e.exports,i),t.allowUndefined||ve();var n=u.__post_instantiate;return n&&(z?n():B.push(n)),u}return t.loadAsync?WebAssembly.instantiate(e,w).then(function(e){return M(e.instance)}):M(new WebAssembly.Instance(new WebAssembly.Module(e),w))}return t.loadAsync?Promise.all(i.map(function(e){return Ee(e,t)})).then(function(){return f()}):(i.forEach(function(e){Ee(e,t)}),f())}function Ee(e,t){"__main__"!=e||he.loadedLibNames[e]||(he.loadedLibs[-1]={refcount:1/0,name:"__main__",module:Module.asm,global:!0},he.loadedLibNames.__main__=-1),t=t||{global:!0,nodelete:!0};var n,r=he.loadedLibNames[e];if(r)return n=he.loadedLibs[r],t.global&&!n.global&&(n.global=!0,"loading"!==n.module&&_(n.module)),t.nodelete&&n.refcount!==1/0&&(n.refcount=1/0),n.refcount++,t.loadAsync?Promise.resolve(r):r;function s(e){if(t.fs){var n=t.fs.readFile(e,{encoding:"binary"});return n instanceof Uint8Array||(n=new Uint8Array(n)),t.loadAsync?Promise.resolve(n):n}return t.loadAsync?(r=e,fetch(r,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load binary file at '"+r+"'";return e.arrayBuffer()}).then(function(e){return new Uint8Array(e)})):l(e);var r}function o(){if(void 0!==Module.preloadedWasm&&void 0!==Module.preloadedWasm[e]){var n=Module.preloadedWasm[e];return t.loadAsync?Promise.resolve(n):n}return t.loadAsync?s(e).then(function(e){return be(e,t)}):be(s(e),t)}function _(e){for(var t in e)if(e.hasOwnProperty(t)){var n=Me(t);Module.hasOwnProperty(n)||(Module[n]=e[t])}}function a(e){n.global&&_(e),n.module=e}return r=he.nextHandle++,n={refcount:t.nodelete?1/0:1,name:e,module:"loading",global:t.global},he.loadedLibNames[e]=r,he.loadedLibs[r]=n,t.loadAsync?o().then(function(e){return a(e),r}):(a(o()),r)}function ve(){for(var e in ce)if(0==ce[e].value){var t=ye(e,!0);"function"==typeof t?ce[e].value=w(t,t.sig):"number"==typeof t?ce[e].value=t:x(!1,"bad export type for `"+e+"`: "+typeof t)}}function Ie(){te()}Module._abort=Ie,Ie.sig="v",pe=n?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof dateNow?dateNow:function(){return performance.now()};var Se=!0;function xe(e,t){var n,r;if(0===e)n=Date.now();else{if(1!==e&&4!==e||!Se)return r=28,R[Te()>>2]=r,-1;n=pe()}return R[t>>2]=n/1e3|0,R[t+4>>2]=n%1e3*1e3*1e3|0,0}function Ne(e){try{return b.grow(e-A.byteLength+65535>>>16),$(b.buffer),1}catch(e){}}function Ae(e){$e(e)}function Pe(e){E(0|e)}xe.sig="iii",Ae.sig="vi",Pe.sig="vi";var ke,Ce={__indirect_function_table:D,__memory_base:1024,__stack_pointer:U,__table_base:1,abort:Ie,clock_gettime:xe,emscripten_memcpy_big:function(e,t,n){k.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){e>>>=0;var t=k.length;if(e>2147483648)return!1;for(var n,r,s=1;s<=4;s*=2){var o=t*(1+.2/s);if(o=Math.min(o,e+100663296),Ne(Math.min(2147483648,((n=Math.max(16777216,e,o))%(r=65536)>0&&(n+=r-n%r),n))))return!0}return!1},exit:Ae,memory:b,setTempRet0:Pe,tree_sitter_log_callback:function(e,t){if(rt){const n=F(t);rt(n,0!==e)}},tree_sitter_parse_callback:function(e,t,n,r,s){var o=nt(t,{row:n,column:r});"string"==typeof o?(v(s,o.length,"i32"),function(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var r=(n-=2)<2*e.length?n/2:e.length,s=0;s<r;++s){var o=e.charCodeAt(s);C[t>>1]=o,t+=2}C[t>>1]=0}(o,e,10240)):v(s,0,"i32")}},Re=(function(){var e={env:Ce,wasi_snapshot_preview1:Ce,"GOT.mem":new Proxy(Ce,me),"GOT.func":new Proxy(Ce,me)};function t(e,t){var n=e.exports;n=we(n,1024),Module.asm=n,ee()}function n(e){t(e.instance)}function r(t){return function(){if(!M&&(_||a)){if("function"==typeof fetch&&!_e(le))return fetch(le,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+le+"'";return e.arrayBuffer()}).catch(function(){return de(le)});if(i)return new Promise(function(e,t){i(le,function(t){e(new Uint8Array(t))},t)})}return Promise.resolve().then(function(){return de(le)})}().then(function(t){return WebAssembly.instantiate(t,e)}).then(t,function(e){f("failed to asynchronously prepare wasm: "+e),te(e)})}if(J(),Module.instantiateWasm)try{return Module.instantiateWasm(e,t)}catch(e){return f("Module.instantiateWasm callback failed with error: "+e),!1}M||"function"!=typeof WebAssembly.instantiateStreaming||se(le)||_e(le)||"function"!=typeof fetch?r(n):fetch(le,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,e).then(n,function(e){return f("wasm streaming compile failed: "+e),f("falling back to ArrayBuffer instantiation"),r(n)})})}(),Module.___wasm_call_ctors=function(){return(Re=Module.___wasm_call_ctors=Module.asm.__wasm_call_ctors).apply(null,arguments)}),qe=Module._malloc=function(){return(qe=Module._malloc=Module.asm.malloc).apply(null,arguments)},Te=(Module._ts_language_symbol_count=function(){return(Module._ts_language_symbol_count=Module.asm.ts_language_symbol_count).apply(null,arguments)},Module._ts_language_version=function(){return(Module._ts_language_version=Module.asm.ts_language_version).apply(null,arguments)},Module._ts_language_field_count=function(){return(Module._ts_language_field_count=Module.asm.ts_language_field_count).apply(null,arguments)},Module._ts_language_symbol_name=function(){return(Module._ts_language_symbol_name=Module.asm.ts_language_symbol_name).apply(null,arguments)},Module._ts_language_symbol_for_name=function(){return(Module._ts_language_symbol_for_name=Module.asm.ts_language_symbol_for_name).apply(null,arguments)},Module._ts_language_symbol_type=function(){return(Module._ts_language_symbol_type=Module.asm.ts_language_symbol_type).apply(null,arguments)},Module._ts_language_field_name_for_id=function(){return(Module._ts_language_field_name_for_id=Module.asm.ts_language_field_name_for_id).apply(null,arguments)},Module._memcpy=function(){return(Module._memcpy=Module.asm.memcpy).apply(null,arguments)},Module._free=function(){return(Module._free=Module.asm.free).apply(null,arguments)},Module._calloc=function(){return(Module._calloc=Module.asm.calloc).apply(null,arguments)},Module._ts_parser_delete=function(){return(Module._ts_parser_delete=Module.asm.ts_parser_delete).apply(null,arguments)},Module._ts_parser_set_language=function(){return(Module._ts_parser_set_language=Module.asm.ts_parser_set_language).apply(null,arguments)},Module._ts_parser_timeout_micros=function(){return(Module._ts_parser_timeout_micros=Module.asm.ts_parser_timeout_micros).apply(null,arguments)},Module._ts_parser_set_timeout_micros=function(){return(Module._ts_parser_set_timeout_micros=Module.asm.ts_parser_set_timeout_micros).apply(null,arguments)},Module._memcmp=function(){return(Module._memcmp=Module.asm.memcmp).apply(null,arguments)},Module._ts_query_new=function(){return(Module._ts_query_new=Module.asm.ts_query_new).apply(null,arguments)},Module._iswspace=function(){return(Module._iswspace=Module.asm.iswspace).apply(null,arguments)},Module._ts_query_delete=function(){return(Module._ts_query_delete=Module.asm.ts_query_delete).apply(null,arguments)},Module._iswalnum=function(){return(Module._iswalnum=Module.asm.iswalnum).apply(null,arguments)},Module._ts_query_pattern_count=function(){return(Module._ts_query_pattern_count=Module.asm.ts_query_pattern_count).apply(null,arguments)},Module._ts_query_capture_count=function(){return(Module._ts_query_capture_count=Module.asm.ts_query_capture_count).apply(null,arguments)},Module._ts_query_string_count=function(){return(Module._ts_query_string_count=Module.asm.ts_query_string_count).apply(null,arguments)},Module._ts_query_capture_name_for_id=function(){return(Module._ts_query_capture_name_for_id=Module.asm.ts_query_capture_name_for_id).apply(null,arguments)},Module._ts_query_string_value_for_id=function(){return(Module._ts_query_string_value_for_id=Module.asm.ts_query_string_value_for_id).apply(null,arguments)},Module._ts_query_predicates_for_pattern=function(){return(Module._ts_query_predicates_for_pattern=Module.asm.ts_query_predicates_for_pattern).apply(null,arguments)},Module._ts_tree_copy=function(){return(Module._ts_tree_copy=Module.asm.ts_tree_copy).apply(null,arguments)},Module._ts_tree_delete=function(){return(Module._ts_tree_delete=Module.asm.ts_tree_delete).apply(null,arguments)},Module._ts_init=function(){return(Module._ts_init=Module.asm.ts_init).apply(null,arguments)},Module._ts_parser_new_wasm=function(){return(Module._ts_parser_new_wasm=Module.asm.ts_parser_new_wasm).apply(null,arguments)},Module._ts_parser_enable_logger_wasm=function(){return(Module._ts_parser_enable_logger_wasm=Module.asm.ts_parser_enable_logger_wasm).apply(null,arguments)},Module._ts_parser_parse_wasm=function(){return(Module._ts_parser_parse_wasm=Module.asm.ts_parser_parse_wasm).apply(null,arguments)},Module._ts_language_type_is_named_wasm=function(){return(Module._ts_language_type_is_named_wasm=Module.asm.ts_language_type_is_named_wasm).apply(null,arguments)},Module._ts_language_type_is_visible_wasm=function(){return(Module._ts_language_type_is_visible_wasm=Module.asm.ts_language_type_is_visible_wasm).apply(null,arguments)},Module._ts_tree_root_node_wasm=function(){return(Module._ts_tree_root_node_wasm=Module.asm.ts_tree_root_node_wasm).apply(null,arguments)},Module._ts_tree_edit_wasm=function(){return(Module._ts_tree_edit_wasm=Module.asm.ts_tree_edit_wasm).apply(null,arguments)},Module._ts_tree_get_changed_ranges_wasm=function(){return(Module._ts_tree_get_changed_ranges_wasm=Module.asm.ts_tree_get_changed_ranges_wasm).apply(null,arguments)},Module._ts_tree_cursor_new_wasm=function(){return(Module._ts_tree_cursor_new_wasm=Module.asm.ts_tree_cursor_new_wasm).apply(null,arguments)},Module._ts_tree_cursor_delete_wasm=function(){return(Module._ts_tree_cursor_delete_wasm=Module.asm.ts_tree_cursor_delete_wasm).apply(null,arguments)},Module._ts_tree_cursor_reset_wasm=function(){return(Module._ts_tree_cursor_reset_wasm=Module.asm.ts_tree_cursor_reset_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_first_child_wasm=function(){return(Module._ts_tree_cursor_goto_first_child_wasm=Module.asm.ts_tree_cursor_goto_first_child_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_next_sibling_wasm=function(){return(Module._ts_tree_cursor_goto_next_sibling_wasm=Module.asm.ts_tree_cursor_goto_next_sibling_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_parent_wasm=function(){return(Module._ts_tree_cursor_goto_parent_wasm=Module.asm.ts_tree_cursor_goto_parent_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_type_id_wasm=function(){return(Module._ts_tree_cursor_current_node_type_id_wasm=Module.asm.ts_tree_cursor_current_node_type_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_is_named_wasm=function(){return(Module._ts_tree_cursor_current_node_is_named_wasm=Module.asm.ts_tree_cursor_current_node_is_named_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_is_missing_wasm=function(){return(Module._ts_tree_cursor_current_node_is_missing_wasm=Module.asm.ts_tree_cursor_current_node_is_missing_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_id_wasm=function(){return(Module._ts_tree_cursor_current_node_id_wasm=Module.asm.ts_tree_cursor_current_node_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_start_position_wasm=function(){return(Module._ts_tree_cursor_start_position_wasm=Module.asm.ts_tree_cursor_start_position_wasm).apply(null,arguments)},Module._ts_tree_cursor_end_position_wasm=function(){return(Module._ts_tree_cursor_end_position_wasm=Module.asm.ts_tree_cursor_end_position_wasm).apply(null,arguments)},Module._ts_tree_cursor_start_index_wasm=function(){return(Module._ts_tree_cursor_start_index_wasm=Module.asm.ts_tree_cursor_start_index_wasm).apply(null,arguments)},Module._ts_tree_cursor_end_index_wasm=function(){return(Module._ts_tree_cursor_end_index_wasm=Module.asm.ts_tree_cursor_end_index_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_field_id_wasm=function(){return(Module._ts_tree_cursor_current_field_id_wasm=Module.asm.ts_tree_cursor_current_field_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_wasm=function(){return(Module._ts_tree_cursor_current_node_wasm=Module.asm.ts_tree_cursor_current_node_wasm).apply(null,arguments)},Module._ts_node_symbol_wasm=function(){return(Module._ts_node_symbol_wasm=Module.asm.ts_node_symbol_wasm).apply(null,arguments)},Module._ts_node_child_count_wasm=function(){return(Module._ts_node_child_count_wasm=Module.asm.ts_node_child_count_wasm).apply(null,arguments)},Module._ts_node_named_child_count_wasm=function(){return(Module._ts_node_named_child_count_wasm=Module.asm.ts_node_named_child_count_wasm).apply(null,arguments)},Module._ts_node_child_wasm=function(){return(Module._ts_node_child_wasm=Module.asm.ts_node_child_wasm).apply(null,arguments)},Module._ts_node_named_child_wasm=function(){return(Module._ts_node_named_child_wasm=Module.asm.ts_node_named_child_wasm).apply(null,arguments)},Module._ts_node_child_by_field_id_wasm=function(){return(Module._ts_node_child_by_field_id_wasm=Module.asm.ts_node_child_by_field_id_wasm).apply(null,arguments)},Module._ts_node_next_sibling_wasm=function(){return(Module._ts_node_next_sibling_wasm=Module.asm.ts_node_next_sibling_wasm).apply(null,arguments)},Module._ts_node_prev_sibling_wasm=function(){return(Module._ts_node_prev_sibling_wasm=Module.asm.ts_node_prev_sibling_wasm).apply(null,arguments)},Module._ts_node_next_named_sibling_wasm=function(){return(Module._ts_node_next_named_sibling_wasm=Module.asm.ts_node_next_named_sibling_wasm).apply(null,arguments)},Module._ts_node_prev_named_sibling_wasm=function(){return(Module._ts_node_prev_named_sibling_wasm=Module.asm.ts_node_prev_named_sibling_wasm).apply(null,arguments)},Module._ts_node_parent_wasm=function(){return(Module._ts_node_parent_wasm=Module.asm.ts_node_parent_wasm).apply(null,arguments)},Module._ts_node_descendant_for_index_wasm=function(){return(Module._ts_node_descendant_for_index_wasm=Module.asm.ts_node_descendant_for_index_wasm).apply(null,arguments)},Module._ts_node_named_descendant_for_index_wasm=function(){return(Module._ts_node_named_descendant_for_index_wasm=Module.asm.ts_node_named_descendant_for_index_wasm).apply(null,arguments)},Module._ts_node_descendant_for_position_wasm=function(){return(Module._ts_node_descendant_for_position_wasm=Module.asm.ts_node_descendant_for_position_wasm).apply(null,arguments)},Module._ts_node_named_descendant_for_position_wasm=function(){return(Module._ts_node_named_descendant_for_position_wasm=Module.asm.ts_node_named_descendant_for_position_wasm).apply(null,arguments)},Module._ts_node_start_point_wasm=function(){return(Module._ts_node_start_point_wasm=Module.asm.ts_node_start_point_wasm).apply(null,arguments)},Module._ts_node_end_point_wasm=function(){return(Module._ts_node_end_point_wasm=Module.asm.ts_node_end_point_wasm).apply(null,arguments)},Module._ts_node_start_index_wasm=function(){return(Module._ts_node_start_index_wasm=Module.asm.ts_node_start_index_wasm).apply(null,arguments)},Module._ts_node_end_index_wasm=function(){return(Module._ts_node_end_index_wasm=Module.asm.ts_node_end_index_wasm).apply(null,arguments)},Module._ts_node_to_string_wasm=function(){return(Module._ts_node_to_string_wasm=Module.asm.ts_node_to_string_wasm).apply(null,arguments)},Module._ts_node_children_wasm=function(){return(Module._ts_node_children_wasm=Module.asm.ts_node_children_wasm).apply(null,arguments)},Module._ts_node_named_children_wasm=function(){return(Module._ts_node_named_children_wasm=Module.asm.ts_node_named_children_wasm).apply(null,arguments)},Module._ts_node_descendants_of_type_wasm=function(){return(Module._ts_node_descendants_of_type_wasm=Module.asm.ts_node_descendants_of_type_wasm).apply(null,arguments)},Module._ts_node_is_named_wasm=function(){return(Module._ts_node_is_named_wasm=Module.asm.ts_node_is_named_wasm).apply(null,arguments)},Module._ts_node_has_changes_wasm=function(){return(Module._ts_node_has_changes_wasm=Module.asm.ts_node_has_changes_wasm).apply(null,arguments)},Module._ts_node_has_error_wasm=function(){return(Module._ts_node_has_error_wasm=Module.asm.ts_node_has_error_wasm).apply(null,arguments)},Module._ts_node_is_missing_wasm=function(){return(Module._ts_node_is_missing_wasm=Module.asm.ts_node_is_missing_wasm).apply(null,arguments)},Module._ts_query_matches_wasm=function(){return(Module._ts_query_matches_wasm=Module.asm.ts_query_matches_wasm).apply(null,arguments)},Module._ts_query_captures_wasm=function(){return(Module._ts_query_captures_wasm=Module.asm.ts_query_captures_wasm).apply(null,arguments)},Module._towupper=function(){return(Module._towupper=Module.asm.towupper).apply(null,arguments)},Module._iswdigit=function(){return(Module._iswdigit=Module.asm.iswdigit).apply(null,arguments)},Module._iswalpha=function(){return(Module._iswalpha=Module.asm.iswalpha).apply(null,arguments)},Module._iswlower=function(){return(Module._iswlower=Module.asm.iswlower).apply(null,arguments)},Module._memchr=function(){return(Module._memchr=Module.asm.memchr).apply(null,arguments)},Module.___errno_location=function(){return(Te=Module.___errno_location=Module.asm.__errno_location).apply(null,arguments)}),Le=(Module._strlen=function(){return(Module._strlen=Module.asm.strlen).apply(null,arguments)},Module.stackSave=function(){return(Le=Module.stackSave=Module.asm.stackSave).apply(null,arguments)}),Ze=Module.stackRestore=function(){return(Ze=Module.stackRestore=Module.asm.stackRestore).apply(null,arguments)},Fe=Module.stackAlloc=function(){return(Fe=Module.stackAlloc=Module.asm.stackAlloc).apply(null,arguments)};Module.__Znwm=function(){return(Module.__Znwm=Module.asm._Znwm).apply(null,arguments)},Module.__ZdlPv=function(){return(Module.__ZdlPv=Module.asm._ZdlPv).apply(null,arguments)},Module.__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv=function(){return(Module.__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv=Module.asm._ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc).apply(null,arguments)},Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=function(){return(Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=Module.asm._ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=function(){return(Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev).apply(null,arguments)},Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=function(){return(Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_).apply(null,arguments)},Module._orig$ts_parser_timeout_micros=function(){return(Module._orig$ts_parser_timeout_micros=Module.asm.orig$ts_parser_timeout_micros).apply(null,arguments)},Module._orig$ts_parser_set_timeout_micros=function(){return(Module._orig$ts_parser_set_timeout_micros=Module.asm.orig$ts_parser_set_timeout_micros).apply(null,arguments)},Module._TRANSFER_BUFFER=2480,Module.___cxa_new_handler=7124;function We(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Module.allocate=function(e,t){var n;return n=t==N?Fe(e.length):qe(e.length),e.subarray||e.slice?k.set(e,n):k.set(new Uint8Array(e),n),n};function Oe(e){function t(){ke||(ke=!0,Module.calledRun=!0,S||(z=!0,fe(B),fe(H),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Ue&&function(e){var t=Module._main;if(t)try{$e(t(0,0),!0)}catch(e){if(e instanceof We)return;if("unwind"==e)return void(y=!0);var n=e;e&&"object"==typeof e&&e.stack&&(n=[e,e.stack]),f("exception thrown: "+n),o(1,e)}finally{!0}}(),function(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)e=Module.postRun.shift(),K.unshift(e);var e;fe(K)}()))}e=e||s,X>0||(!function(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)V(Module.preRun.shift());fe(G)}(),X>0||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()))}function $e(e,t){t&&y&&0===e||(y||(e,!0,Module.onExit&&Module.onExit(e),S=!0),o(e,new We(e)))}if(Y=function e(){ke||Oe(),ke||(Y=e)},Module.run=Oe,Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var Ue=!0;Module.noInitialRun&&(Ue=!1),y=!0,Oe();const je=Module,De={},Ge=4,Be=5*Ge,He=2*Ge,Ke=2*Ge+2*He,ze={row:0,column:0},Ve=/[\w-.]*/g,Xe=1,Qe=2,Ye=/^_?tree_sitter_\w+/;var Je,et,tt,nt,rt,st=new Promise(e=>{Module.onRuntimeInitialized=e}).then(()=>{tt=je._ts_init(),Je=I(tt,"i32"),et=I(tt+Ge,"i32")});class Parser{static init(){return st}constructor(){if(null==tt)throw new Error("You must first call Parser.init() and wait for it to resolve.");je._ts_parser_new_wasm(),this[0]=I(tt,"i32"),this[1]=I(tt+Ge,"i32")}delete(){je._ts_parser_delete(this[0]),je._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];const n=je._ts_language_version(t);if(n<et||Je<n)throw new Error(`Incompatible language version ${n}. `+`Compatibility range ${et} through ${Je}.`)}}else t=0,e=null;return this.language=e,je._ts_parser_set_language(this[0],t),this}getLanguage(){return this.language}parse(e,t,n){if("string"==typeof e)nt=((t,n,r)=>e.slice(t,r));else{if("function"!=typeof e)throw new Error("Argument must be a string or a function");nt=e}this.logCallback?(rt=this.logCallback,je._ts_parser_enable_logger_wasm(this[0],1)):(rt=null,je._ts_parser_enable_logger_wasm(this[0],0));let r=0,s=0;if(n&&n.includedRanges){r=n.includedRanges.length;let e=s=je._calloc(r,Ke);for(let t=0;t<r;t++)pt(e,n.includedRanges[t]),e+=Ke}const o=je._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,s,r);if(!o)throw nt=null,rt=null,new Error("Parsing failed");const _=new Tree(De,o,this.language,nt);return nt=null,rt=null,_}reset(){je._ts_parser_parse_wasm(this[0])}setTimeoutMicros(e){je._ts_parser_set_timeout_micros(this[0],e)}getTimeoutMicros(){return je._ts_parser_timeout_micros(this[0])}setLogger(e){if(e){if("function"!=typeof e)throw new Error("Logger callback must be a function")}else e=null;return this.logCallback=e,this}getLogger(){return this.logCallback}}class Tree{constructor(e,t,n,r){at(e),this[0]=t,this.language=n,this.textCallback=r}copy(){const e=je._ts_tree_copy(this[0]);return new Tree(De,e,this.language,this.textCallback)}delete(){je._ts_tree_delete(this[0]),this[0]=0}edit(e){!function(e){let t=tt;mt(t,e.startPosition),mt(t+=He,e.oldEndPosition),mt(t+=He,e.newEndPosition),v(t+=He,e.startIndex,"i32"),v(t+=Ge,e.oldEndIndex,"i32"),v(t+=Ge,e.newEndIndex,"i32"),t+=Ge}(e),je._ts_tree_edit_wasm(this[0])}get rootNode(){return je._ts_tree_root_node_wasm(this[0]),lt(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(e){if(e.constructor!==Tree)throw new TypeError("Argument must be a Tree");je._ts_tree_get_changed_ranges_wasm(this[0],e[0]);const t=I(tt,"i32"),n=I(tt+Ge,"i32"),r=new Array(t);if(t>0){let e=n;for(let n=0;n<t;n++)r[n]=ht(e),e+=Ke;je._free(n)}return r}}class Node{constructor(e,t){at(e),this.tree=t}get typeId(){return it(this),je._ts_node_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get endPosition(){return it(this),je._ts_node_end_point_wasm(this.tree[0]),ft(tt)}get endIndex(){return it(this),je._ts_node_end_index_wasm(this.tree[0])}get text(){return ot(this.tree,this.startIndex,this.endIndex)}isNamed(){return it(this),1===je._ts_node_is_named_wasm(this.tree[0])}hasError(){return it(this),1===je._ts_node_has_error_wasm(this.tree[0])}hasChanges(){return it(this),1===je._ts_node_has_changes_wasm(this.tree[0])}isMissing(){return it(this),1===je._ts_node_is_missing_wasm(this.tree[0])}equals(e){return this.id===e.id}child(e){return it(this),je._ts_node_child_wasm(this.tree[0],e),lt(this.tree)}namedChild(e){return it(this),je._ts_node_named_child_wasm(this.tree[0],e),lt(this.tree)}childForFieldId(e){return it(this),je._ts_node_child_by_field_id_wasm(this.tree[0],e),lt(this.tree)}childForFieldName(e){const t=this.tree.language.fields.indexOf(e);if(-1!==t)return this.childForFieldId(t)}get childCount(){return it(this),je._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return it(this),je._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){it(this),je._ts_node_children_wasm(this.tree[0]);const e=I(tt,"i32"),t=I(tt+Ge,"i32");if(this._children=new Array(e),e>0){let n=t;for(let t=0;t<e;t++)this._children[t]=lt(this.tree,n),n+=Be;je._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){it(this),je._ts_node_named_children_wasm(this.tree[0]);const e=I(tt,"i32"),t=I(tt+Ge,"i32");if(this._namedChildren=new Array(e),e>0){let n=t;for(let t=0;t<e;t++)this._namedChildren[t]=lt(this.tree,n),n+=Be;je._free(t)}}return this._namedChildren}descendantsOfType(e,t,n){Array.isArray(e)||(e=[e]),t||(t=ze),n||(n=ze);const r=[],s=this.tree.language.types;for(let t=0,n=s.length;t<n;t++)e.includes(s[t])&&r.push(t);const o=je._malloc(Ge*r.count);for(let e=0,t=r.length;e<t;e++)v(o+e*Ge,r[e],"i32");it(this),je._ts_node_descendants_of_type_wasm(this.tree[0],o,r.length,t.row,t.column,n.row,n.column);const _=I(tt,"i32"),a=I(tt+Ge,"i32"),u=new Array(_);if(_>0){let e=a;for(let t=0;t<_;t++)u[t]=lt(this.tree,e),e+=Be}return je._free(a),je._free(o),u}get nextSibling(){return it(this),je._ts_node_next_sibling_wasm(this.tree[0]),lt(this.tree)}get previousSibling(){return it(this),je._ts_node_prev_sibling_wasm(this.tree[0]),lt(this.tree)}get nextNamedSibling(){return it(this),je._ts_node_next_named_sibling_wasm(this.tree[0]),lt(this.tree)}get previousNamedSibling(){return it(this),je._ts_node_prev_named_sibling_wasm(this.tree[0]),lt(this.tree)}get parent(){return it(this),je._ts_node_parent_wasm(this.tree[0]),lt(this.tree)}descendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");it(this);let n=tt+Be;return v(n,e,"i32"),v(n+Ge,t,"i32"),je._ts_node_descendant_for_index_wasm(this.tree[0]),lt(this.tree)}namedDescendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");it(this);let n=tt+Be;return v(n,e,"i32"),v(n+Ge,t,"i32"),je._ts_node_named_descendant_for_index_wasm(this.tree[0]),lt(this.tree)}descendantForPosition(e,t=e){if(!ut(e)||!ut(t))throw new Error("Arguments must be {row, column} objects");it(this);let n=tt+Be;return mt(n,e),mt(n+He,t),je._ts_node_descendant_for_position_wasm(this.tree[0]),lt(this.tree)}namedDescendantForPosition(e,t=e){if(!ut(e)||!ut(t))throw new Error("Arguments must be {row, column} objects");it(this);let n=tt+Be;return mt(n,e),mt(n+He,t),je._ts_node_named_descendant_for_position_wasm(this.tree[0]),lt(this.tree)}walk(){return it(this),je._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(De,this.tree)}toString(){it(this);const e=je._ts_node_to_string_wasm(this.tree[0]),t=function(e){for(var t="";;){var n=k[e++>>0];if(!n)return t;t+=String.fromCharCode(n)}}(e);return je._free(e),t}}class TreeCursor{constructor(e,t){at(e),this.tree=t,ct(this)}delete(){dt(this),je._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(e){it(e),dt(this,tt+Be),je._ts_tree_cursor_reset_wasm(this.tree[0]),ct(this)}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return dt(this),je._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeId(){return dt(this),je._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return dt(this),1===je._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])}get nodeIsMissing(){return dt(this),1===je._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])}get nodeText(){dt(this);const e=je._ts_tree_cursor_start_index_wasm(this.tree[0]),t=je._ts_tree_cursor_end_index_wasm(this.tree[0]);return ot(this.tree,e,t)}get startPosition(){return dt(this),je._ts_tree_cursor_start_position_wasm(this.tree[0]),ft(tt)}get endPosition(){return dt(this),je._ts_tree_cursor_end_position_wasm(this.tree[0]),ft(tt)}get startIndex(){return dt(this),je._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return dt(this),je._ts_tree_cursor_end_index_wasm(this.tree[0])}currentNode(){return dt(this),je._ts_tree_cursor_current_node_wasm(this.tree[0]),lt(this.tree)}currentFieldId(){return dt(this),je._ts_tree_cursor_current_field_id_wasm(this.tree[0])}currentFieldName(){return this.tree.language.fields[this.currentFieldId()]}gotoFirstChild(){dt(this);const e=je._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return ct(this),1===e}gotoNextSibling(){dt(this);const e=je._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return ct(this),1===e}gotoParent(){dt(this);const e=je._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return ct(this),1===e}}class Language{constructor(e,t){at(e),this[0]=t,this.types=new Array(je._ts_language_symbol_count(this[0]));for(let e=0,t=this.types.length;e<t;e++)je._ts_language_symbol_type(this[0],e)<2&&(this.types[e]=F(je._ts_language_symbol_name(this[0],e)));this.fields=new Array(je._ts_language_field_count(this[0])+1);for(let e=0,t=this.fields.length;e<t;e++){const t=je._ts_language_field_name_for_id(this[0],e);this.fields[e]=0!==t?F(t):null}}get version(){return je._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}fieldIdForName(e){const t=this.fields.indexOf(e);return-1!==t?t:null}fieldNameForId(e){return this.fields[e]||null}idForNodeType(e,t){const n=O(e),r=je._malloc(n+1);W(e,r,n+1);const s=je._ts_language_symbol_for_name(this[0],r,n,t);return je._free(r),s||null}get nodeTypeCount(){return je._ts_language_symbol_count(this[0])}nodeTypeForId(e){const t=je._ts_language_symbol_name(this[0],e);return t?F(t):null}nodeTypeIsNamed(e){return!!je._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!je._ts_language_type_is_visible_wasm(this[0],e)}query(e){const t=O(e),n=je._malloc(t+1);W(e,n,t+1);const r=je._ts_query_new(this[0],n,t,tt,tt+Ge);if(!r){const t=I(tt+Ge,"i32"),r=F(n,I(tt,"i32")).length,s=e.substr(r,100).split("\n")[0];let o,_=s.match(Ve)[0];switch(t){case 2:o=new RangeError(`Bad node name '${_}'`);break;case 3:o=new RangeError(`Bad field name '${_}'`);break;case 4:o=new RangeError(`Bad capture name @${_}`);break;case 5:o=new TypeError(`Bad pattern structure at offset ${r}: '${s}'...`),_="";break;default:o=new SyntaxError(`Bad syntax at offset ${r}: '${s}'...`),_=""}throw o.index=r,o.length=_.length,je._free(n),o}const s=je._ts_query_string_count(r),o=je._ts_query_capture_count(r),_=je._ts_query_pattern_count(r),a=new Array(o),u=new Array(s);for(let e=0;e<o;e++){const t=je._ts_query_capture_name_for_id(r,e,tt),n=I(tt,"i32");a[e]=F(t,n)}for(let e=0;e<s;e++){const t=je._ts_query_string_value_for_id(r,e,tt),n=I(tt,"i32");u[e]=F(t,n)}const i=new Array(_),l=new Array(_),d=new Array(_),c=new Array(_),m=new Array(_);for(let e=0;e<_;e++){const t=je._ts_query_predicates_for_pattern(r,e,tt),n=I(tt,"i32");c[e]=[],m[e]=[];const s=[];let o=t;for(let t=0;t<n;t++){const t=I(o,"i32"),n=I(o+=Ge,"i32");if(o+=Ge,t===Xe)s.push({type:"capture",name:a[n]});else if(t===Qe)s.push({type:"string",value:u[n]});else if(s.length>0){if("string"!==s[0].type)throw new Error("Predicates must begin with a literal value");const t=s[0].value;let n=!0;switch(t){case"not-eq?":n=!1;case"eq?":if(3!==s.length)throw new Error(`Wrong number of arguments to \`#eq?\` predicate. Expected 2, got ${s.length-1}`);if("capture"!==s[1].type)throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${s[1].value}"`);if("capture"===s[2].type){const t=s[1].name,r=s[2].name;m[e].push(function(e){let s,o;for(const n of e)n.name===t&&(s=n.node),n.name===r&&(o=n.node);return s.text===o.text===n})}else{const t=s[1].name,r=s[2].value;m[e].push(function(e){for(const s of e)if(s.name===t)return s.node.text===r===n;return!1})}break;case"not-match?":n=!1;case"match?":if(3!==s.length)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${s.length-1}.`);if("capture"!==s[1].type)throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${s[1].value}".`);if("string"!==s[2].type)throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${s[2].value}.`);const r=s[1].name,o=new RegExp(s[2].value);m[e].push(function(e){for(const t of e)if(t.name===r)return o.test(t.node.text)===n;return!1});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(e=>"string"!==e.type))throw new Error('Arguments to `#set!` predicate must be a strings.".');i[e]||(i[e]={}),i[e][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 \`#${t}\` predicate. Expected 1 or 2. Got ${s.length-1}.`);if(s.some(e=>"string"!==e.type))throw new Error(`Arguments to \`#${t}\` predicate must be a strings.".`);const _="is?"===t?l:d;_[e]||(_[e]={}),_[e][s[1].value]=s[2]?s[2].value:null;break;default:c[e].push({operator:t,operands:s.slice(1)})}s.length=0}}Object.freeze(i[e]),Object.freeze(l[e]),Object.freeze(d[e])}return je._free(n),new Query(De,r,a,m,c,Object.freeze(i),Object.freeze(l),Object.freeze(d))}static load(e){let t;if(e instanceof Uint8Array)t=Promise.resolve(e);else{const n=e;if("undefined"!=typeof process&&process.versions&&process.versions.node){const e=require("fs");t=Promise.resolve(e.readFileSync(n))}else t=fetch(n).then(e=>e.arrayBuffer().then(t=>{if(e.ok)return new Uint8Array(t);{const n=new TextDecoder("utf-8").decode(t);throw new Error(`Language.load failed with status ${e.status}.\n\n${n}`)}}))}const n="function"==typeof loadSideModule?loadSideModule:be;return t.then(e=>n(e,{loadAsync:!0})).then(e=>{const t=Object.keys(e),n=t.find(e=>Ye.test(e)&&!e.includes("external_scanner_"));n||console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(t,null,2)}`);const r=e[n]();return new Language(De,r)})}}class Query{constructor(e,t,n,r,s,o,_,a){at(e),this[0]=t,this.captureNames=n,this.textPredicates=r,this.predicates=s,this.setProperties=o,this.assertedProperties=_,this.refutedProperties=a}delete(){je._ts_query_delete(this[0]),this[0]=0}matches(e,t,n){t||(t=ze),n||(n=ze),it(e),je._ts_query_matches_wasm(this[0],e.tree[0],t.row,t.column,n.row,n.column);const r=I(tt,"i32"),s=I(tt+Ge,"i32"),o=new Array(r);let _=0,a=s;for(let t=0;t<r;t++){const n=I(a,"i32"),r=I(a+=Ge,"i32");a+=Ge;const s=new Array(r);if(a=_t(this,e.tree,a,s),this.textPredicates[n].every(e=>e(s))){o[_++]={pattern:n,captures:s};const e=this.setProperties[n];e&&(o[t].setProperties=e);const r=this.assertedProperties[n];r&&(o[t].assertedProperties=r);const a=this.refutedProperties[n];a&&(o[t].refutedProperties=a)}}return o.length=_,je._free(s),o}captures(e,t,n){t||(t=ze),n||(n=ze),it(e),je._ts_query_captures_wasm(this[0],e.tree[0],t.row,t.column,n.row,n.column);const r=I(tt,"i32"),s=I(tt+Ge,"i32"),o=[],_=[];let a=s;for(let t=0;t<r;t++){const t=I(a,"i32"),n=I(a+=Ge,"i32"),r=I(a+=Ge,"i32");if(a+=Ge,_.length=n,a=_t(this,e.tree,a,_),this.textPredicates[t].every(e=>e(_))){const e=_[r],n=this.setProperties[t];n&&(e.setProperties=n);const s=this.assertedProperties[t];s&&(e.assertedProperties=s);const a=this.refutedProperties[t];a&&(e.refutedProperties=a),o.push(e)}}return je._free(s),o}predicatesForPattern(e){return this.predicates[e]}}function ot(e,t,n){const r=n-t;let s=e.textCallback(t,null,n);for(t+=s.length;t<n;){const r=e.textCallback(t,null,n);if(!(r&&r.length>0))break;t+=r.length,s+=r}return t>n&&(s=s.slice(0,r)),s}function _t(e,t,n,r){for(let s=0,o=r.length;s<o;s++){const o=I(n,"i32"),_=lt(t,n+=Ge);n+=Be,r[s]={name:e.captureNames[o],node:_}}return n}function at(e){if(e!==De)throw new Error("Illegal constructor")}function ut(e){return e&&"number"==typeof e.row&&"number"==typeof e.column}function it(e){let t=tt;v(t,e.id,"i32"),v(t+=Ge,e.startIndex,"i32"),v(t+=Ge,e.startPosition.row,"i32"),v(t+=Ge,e.startPosition.column,"i32"),v(t+=Ge,e[0],"i32")}function lt(e,t=tt){const n=I(t,"i32");if(0===n)return null;const r=I(t+=Ge,"i32"),s=I(t+=Ge,"i32"),o=I(t+=Ge,"i32"),_=I(t+=Ge,"i32"),a=new Node(De,e);return a.id=n,a.startIndex=r,a.startPosition={row:s,column:o},a[0]=_,a}function dt(e,t=tt){v(t+0*Ge,e[0],"i32"),v(t+1*Ge,e[1],"i32"),v(t+2*Ge,e[2],"i32")}function ct(e){e[0]=I(tt+0*Ge,"i32"),e[1]=I(tt+1*Ge,"i32"),e[2]=I(tt+2*Ge,"i32")}function mt(e,t){v(e,t.row,"i32"),v(e+Ge,t.column,"i32")}function ft(e){return{row:I(e,"i32"),column:I(e+Ge,"i32")}}function pt(e,t){mt(e,t.startPosition),mt(e+=He,t.endPosition),v(e+=He,t.startIndex,"i32"),v(e+=Ge,t.endIndex,"i32"),e+=Ge}function ht(e){const t={};return t.startPosition=ft(e),e+=He,t.endPosition=ft(e),e+=He,t.startIndex=I(e,"i32"),e+=Ge,t.endIndex=I(e,"i32"),t}return Parser.Language=Language,Parser.Parser=Parser,Parser});
|