trueline-mcp 2.7.3 → 2.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,22 +1,24 @@
1
- import{createRequire as cQ}from"node:module";var xQ=Object.create;var{getPrototypeOf:MQ,defineProperty:lJ,getOwnPropertyNames:yQ}=Object;var bQ=Object.prototype.hasOwnProperty;function gQ(J){return this[J]}var hQ,fQ,mQ=(J,Q,$)=>{var Z=J!=null&&typeof J==="object";if(Z){var Y=Q?hQ??=new WeakMap:fQ??=new WeakMap,G=Y.get(J);if(G)return G}$=J!=null?xQ(MQ(J)):{};let K=Q||!J||!J.__esModule?lJ($,"default",{value:J,enumerable:!0}):$;for(let V of yQ(J))if(!bQ.call(K,V))lJ(K,V,{get:gQ.bind(J,V),enumerable:!0});if(Z)Y.set(J,K);return K};var pQ=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var vJ=cQ(import.meta.url);var WQ=pQ((CJ,zJ)=>{var __dirname="/home/runner/work/trueline-mcp/trueline-mcp/node_modules/web-tree-sitter",X=typeof X<"u"?X:{},k$=typeof window=="object",gJ=typeof importScripts=="function",zQ=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",_$=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){if(initPromise)return initPromise;return X=Object.assign({},X,moduleOptions),initPromise=new Promise((resolveInitPromise)=>{var moduleOverrides=Object.assign({},X),arguments_=[],thisProgram="./this.program",quit_=(J,Q)=>{throw Q},scriptDirectory="";function locateFile(J){if(X.locateFile)return X.locateFile(J,scriptDirectory);return scriptDirectory+J}var readAsync,readBinary;if(zQ){var fs=vJ("fs"),nodePath=vJ("path");if(scriptDirectory=__dirname+"/",readBinary=(J)=>{J=isFileURI(J)?new URL(J):nodePath.normalize(J);var Q=fs.readFileSync(J);return Q},readAsync=(J,Q=!0)=>{return J=isFileURI(J)?new URL(J):nodePath.normalize(J),new Promise(($,Z)=>{fs.readFile(J,Q?void 0:"utf8",(Y,G)=>{if(Y)Z(Y);else $(Q?G.buffer:G)})})},!X.thisProgram&&process.argv.length>1)thisProgram=process.argv[1].replace(/\\/g,"/");if(arguments_=process.argv.slice(2),typeof zJ<"u")zJ.exports=X;quit_=(J,Q)=>{throw process.exitCode=J,Q}}else if(k$||gJ){if(gJ)scriptDirectory=self.location.href;else if(typeof document<"u"&&document.currentScript)scriptDirectory=document.currentScript.src;if(scriptDirectory.startsWith("blob:"))scriptDirectory="";else scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);{if(gJ)readBinary=(J)=>{var Q=new XMLHttpRequest;return Q.open("GET",J,!1),Q.responseType="arraybuffer",Q.send(null),new Uint8Array(Q.response)};readAsync=(J)=>{if(isFileURI(J))return new Promise((Q,$)=>{var Z=new XMLHttpRequest;Z.open("GET",J,!0),Z.responseType="arraybuffer",Z.onload=()=>{if(Z.status==200||Z.status==0&&Z.response)$(Z.response);Q(Z.status)},Z.onerror=Q,Z.send(null)});return fetch(J,{credentials:"same-origin"}).then((Q)=>{if(Q.ok)return Q.arrayBuffer();return Promise.reject(Error(Q.status+" : "+Q.url))})}}}var out=X.print||console.log.bind(console),err=X.printErr||console.error.bind(console);if(Object.assign(X,moduleOverrides),moduleOverrides=null,X.arguments)arguments_=X.arguments;if(X.thisProgram)thisProgram=X.thisProgram;if(X.quit)quit_=X.quit;var dynamicLibraries=X.dynamicLibraries||[],wasmBinary;if(X.wasmBinary)wasmBinary=X.wasmBinary;var wasmMemory,ABORT=!1,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP_DATA_VIEW;function updateMemoryViews(){var J=wasmMemory.buffer;X.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(J),X.HEAP8=HEAP8=new Int8Array(J),X.HEAP16=HEAP16=new Int16Array(J),X.HEAPU8=HEAPU8=new Uint8Array(J),X.HEAPU16=HEAPU16=new Uint16Array(J),X.HEAP32=HEAP32=new Int32Array(J),X.HEAPU32=HEAPU32=new Uint32Array(J),X.HEAPF32=HEAPF32=new Float32Array(J),X.HEAPF64=HEAPF64=new Float64Array(J)}if(X.wasmMemory)wasmMemory=X.wasmMemory;else{var INITIAL_MEMORY=X.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews();var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function preRun(){if(X.preRun){if(typeof X.preRun=="function")X.preRun=[X.preRun];while(X.preRun.length)addOnPreRun(X.preRun.shift())}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(X.postRun){if(typeof X.postRun=="function")X.postRun=[X.postRun];while(X.postRun.length)addOnPostRun(X.postRun.shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(J){__ATPRERUN__.unshift(J)}function addOnInit(J){__ATINIT__.unshift(J)}function addOnPostRun(J){__ATPOSTRUN__.unshift(J)}var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(J){return J}function addRunDependency(J){runDependencies++,X.monitorRunDependencies?.(runDependencies)}function removeRunDependency(J){if(runDependencies--,X.monitorRunDependencies?.(runDependencies),runDependencies==0){if(runDependencyWatcher!==null)clearInterval(runDependencyWatcher),runDependencyWatcher=null;if(dependenciesFulfilled){var Q=dependenciesFulfilled;dependenciesFulfilled=null,Q()}}}function abort(J){X.onAbort?.(J),J="Aborted("+J+")",err(J),ABORT=!0,EXITSTATUS=1,J+=". Build with -sASSERTIONS for more info.";var Q=new WebAssembly.RuntimeError(J);throw Q}var dataURIPrefix="data:application/octet-stream;base64,",isDataURI=(J)=>J.startsWith(dataURIPrefix),isFileURI=(J)=>J.startsWith("file://");function findWasmBinary(){var J="tree-sitter.wasm";if(!isDataURI(J))return locateFile(J);return J}var wasmBinaryFile;function getBinarySync(J){if(J==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(J);throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(J){if(!wasmBinary)return readAsync(J).then((Q)=>new Uint8Array(Q),()=>getBinarySync(J));return Promise.resolve().then(()=>getBinarySync(J))}function instantiateArrayBuffer(J,Q,$){return getBinaryPromise(J).then((Z)=>WebAssembly.instantiate(Z,Q)).then($,(Z)=>{err(`failed to asynchronously prepare wasm: ${Z}`),abort(Z)})}function instantiateAsync(J,Q,$,Z){if(!J&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(Q)&&!isFileURI(Q)&&!zQ&&typeof fetch=="function")return fetch(Q,{credentials:"same-origin"}).then((Y)=>{var G=WebAssembly.instantiateStreaming(Y,$);return G.then(Z,function(K){return err(`wasm streaming compile failed: ${K}`),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(Q,$,Z)})});return instantiateArrayBuffer(Q,$,Z)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var J=getWasmImports();function Q(Z,Y){wasmExports=Z.exports,wasmExports=relocateExports(wasmExports,1024);var G=getDylinkMetadata(Y);if(G.neededDynlibs)dynamicLibraries=G.neededDynlibs.concat(dynamicLibraries);return mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),addOnInit(wasmExports.__wasm_call_ctors),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),removeRunDependency("wasm-instantiate"),wasmExports}addRunDependency("wasm-instantiate");function $(Z){Q(Z.instance,Z.module)}if(X.instantiateWasm)try{return X.instantiateWasm(J,Q)}catch(Z){return err(`Module.instantiateWasm callback failed with error: ${Z}`),!1}if(!wasmBinaryFile)wasmBinaryFile=findWasmBinary();return instantiateAsync(wasmBinary,wasmBinaryFile,J,$),{}}var ASM_CONSTS={};function ExitStatus(J){this.name="ExitStatus",this.message=`Program terminated with exit(${J})`,this.status=J}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(J,Q){var $=GOT[Q];if(!$)$=GOT[Q]=new WebAssembly.Global({value:"i32",mutable:!0});if(!currentModuleWeakSymbols.has(Q))$.required=!0;return $}},LE_HEAP_LOAD_F32=(J)=>HEAP_DATA_VIEW.getFloat32(J,!0),LE_HEAP_LOAD_F64=(J)=>HEAP_DATA_VIEW.getFloat64(J,!0),LE_HEAP_LOAD_I16=(J)=>HEAP_DATA_VIEW.getInt16(J,!0),LE_HEAP_LOAD_I32=(J)=>HEAP_DATA_VIEW.getInt32(J,!0),LE_HEAP_LOAD_U32=(J)=>HEAP_DATA_VIEW.getUint32(J,!0),LE_HEAP_STORE_F32=(J,Q)=>HEAP_DATA_VIEW.setFloat32(J,Q,!0),LE_HEAP_STORE_F64=(J,Q)=>HEAP_DATA_VIEW.setFloat64(J,Q,!0),LE_HEAP_STORE_I16=(J,Q)=>HEAP_DATA_VIEW.setInt16(J,Q,!0),LE_HEAP_STORE_I32=(J,Q)=>HEAP_DATA_VIEW.setInt32(J,Q,!0),LE_HEAP_STORE_U32=(J,Q)=>HEAP_DATA_VIEW.setUint32(J,Q,!0),callRuntimeCallbacks=(J)=>{while(J.length>0)J.shift()(X)},UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,UTF8ArrayToString=(J,Q,$)=>{var Z=Q+$,Y=Q;while(J[Y]&&!(Y>=Z))++Y;if(Y-Q>16&&J.buffer&&UTF8Decoder)return UTF8Decoder.decode(J.subarray(Q,Y));var G="";while(Q<Y){var K=J[Q++];if(!(K&128)){G+=String.fromCharCode(K);continue}var V=J[Q++]&63;if((K&224)==192){G+=String.fromCharCode((K&31)<<6|V);continue}var z=J[Q++]&63;if((K&240)==224)K=(K&15)<<12|V<<6|z;else K=(K&7)<<18|V<<12|z<<6|J[Q++]&63;if(K<65536)G+=String.fromCharCode(K);else{var q=K-65536;G+=String.fromCharCode(55296|q>>10,56320|q&1023)}}return G},getDylinkMetadata=(J)=>{var Q=0,$=0;function Z(){return J[Q++]}function Y(){var v=0,D=1;while(!0){var B=J[Q++];if(v+=(B&127)*D,D*=128,!(B&128))break}return v}function G(){var v=Y();return Q+=v,UTF8ArrayToString(J,Q-v,v)}function K(v,D){if(v)throw Error(D)}var V="dylink.0";if(J instanceof WebAssembly.Module){var z=WebAssembly.Module.customSections(J,V);if(z.length===0)V="dylink",z=WebAssembly.Module.customSections(J,V);K(z.length===0,"need dylink section"),J=new Uint8Array(z[0]),$=J.length}else{var q=new Uint32Array(new Uint8Array(J.subarray(0,24)).buffer),A=q[0]==1836278016||q[0]==6386541;K(!A,"need to see wasm magic number"),K(J[8]!==0,"need the dylink section to be first"),Q=9;var U=Y();$=Q+U,V=G()}var W={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(V=="dylink"){W.memorySize=Y(),W.memoryAlign=Y(),W.tableSize=Y(),W.tableAlign=Y();var T=Y();for(var F=0;F<T;++F){var H=G();W.neededDynlibs.push(H)}}else{K(V!=="dylink.0");var O=1,j=2,E=3,I=4,_=256,P=3,x=1;while(Q<$){var S=Z(),f=Y();if(S===O)W.memorySize=Y(),W.memoryAlign=Y(),W.tableSize=Y(),W.tableAlign=Y();else if(S===j){var T=Y();for(var F=0;F<T;++F)H=G(),W.neededDynlibs.push(H)}else if(S===E){var N=Y();while(N--){var b=G(),u=Y();if(u&_)W.tlsExports.add(b)}}else if(S===I){var N=Y();while(N--){var r=G(),b=G(),u=Y();if((u&P)==x)W.weakImports.add(b)}}else Q+=f}}return W};function getValue(J,Q="i8"){if(Q.endsWith("*"))Q="*";switch(Q){case"i1":return HEAP8[J];case"i8":return HEAP8[J];case"i16":return LE_HEAP_LOAD_I16((J>>1)*2);case"i32":return LE_HEAP_LOAD_I32((J>>2)*4);case"i64":abort("to do getValue(i64) use WASM_BIGINT");case"float":return LE_HEAP_LOAD_F32((J>>2)*4);case"double":return LE_HEAP_LOAD_F64((J>>3)*8);case"*":return LE_HEAP_LOAD_U32((J>>2)*4);default:abort(`invalid type for getValue: ${Q}`)}}var newDSO=(J,Q,$)=>{var Z={refcount:1/0,name:J,exports:$,global:!0};if(LDSO.loadedLibsByName[J]=Z,Q!=null)LDSO.loadedLibsByHandle[Q]=Z;return Z},LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78112,zeroMemory=(J,Q)=>{return HEAPU8.fill(0,J,J+Q),J},alignMemory=(J,Q)=>Math.ceil(J/Q)*Q,getMemory=(J)=>{if(runtimeInitialized)return zeroMemory(_malloc(J),J);var Q=___heap_base,$=Q+alignMemory(J,16);return ___heap_base=$,GOT.__heap_base.value=$,Q},isInternalSym=(J)=>["__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","__start_em_js","__stop_em_js"].includes(J)||J.startsWith("__em_js__"),uleb128Encode=(J,Q)=>{if(J<128)Q.push(J);else Q.push(J%128|128,J>>7)},sigToWasmTypes=(J)=>{var Q={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},$={parameters:[],results:J[0]=="v"?[]:[Q[J[0]]]};for(var Z=1;Z<J.length;++Z)$.parameters.push(Q[J[Z]]);return $},generateFuncType=(J,Q)=>{var $=J.slice(0,1),Z=J.slice(1),Y={i:127,p:127,j:126,f:125,d:124,e:111};Q.push(96),uleb128Encode(Z.length,Q);for(var G=0;G<Z.length;++G)Q.push(Y[Z[G]]);if($=="v")Q.push(0);else Q.push(1,Y[$])},convertJsFunctionToWasm=(J,Q)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(Q),J);var $=[1];generateFuncType(Q,$);var Z=[0,97,115,109,1,0,0,0,1];uleb128Encode($.length,Z),Z.push(...$),Z.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var Y=new WebAssembly.Module(new Uint8Array(Z)),G=new WebAssembly.Instance(Y,{e:{f:J}}),K=G.exports.f;return K},wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:28,element:"anyfunc"}),getWasmTableEntry=(J)=>{var Q=wasmTableMirror[J];if(!Q){if(J>=wasmTableMirror.length)wasmTableMirror.length=J+1;wasmTableMirror[J]=Q=wasmTable.get(J)}return Q},updateTableMap=(J,Q)=>{if(functionsInTableMap)for(var $=J;$<J+Q;$++){var Z=getWasmTableEntry($);if(Z)functionsInTableMap.set(Z,$)}},functionsInTableMap,getFunctionAddress=(J)=>{if(!functionsInTableMap)functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length);return functionsInTableMap.get(J)||0},freeTableIndexes=[],getEmptyTableSlot=()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(J){if(!(J instanceof RangeError))throw J;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1},setWasmTableEntry=(J,Q)=>{wasmTable.set(J,Q),wasmTableMirror[J]=wasmTable.get(J)},addFunction=(J,Q)=>{var $=getFunctionAddress(J);if($)return $;var Z=getEmptyTableSlot();try{setWasmTableEntry(Z,J)}catch(G){if(!(G instanceof TypeError))throw G;var Y=convertJsFunctionToWasm(J,Q);setWasmTableEntry(Z,Y)}return functionsInTableMap.set(J,Z),Z},updateGOT=(J,Q)=>{for(var $ in J){if(isInternalSym($))continue;var Z=J[$];if($.startsWith("orig$"))$=$.split("$")[1],Q=!0;if(GOT[$]||=new WebAssembly.Global({value:"i32",mutable:!0}),Q||GOT[$].value==0)if(typeof Z=="function")GOT[$].value=addFunction(Z);else if(typeof Z=="number")GOT[$].value=Z;else err(`unhandled export type for '${$}': ${typeof Z}`)}},relocateExports=(J,Q,$)=>{var Z={};for(var Y in J){var G=J[Y];if(typeof G=="object")G=G.value;if(typeof G=="number")G+=Q;Z[Y]=G}return updateGOT(Z,$),Z},isSymbolDefined=(J)=>{var Q=wasmImports[J];if(!Q||Q.stub)return!1;return!0},dynCallLegacy=(J,Q,$)=>{J=J.replace(/p/g,"i");var Z=X["dynCall_"+J];return Z(Q,...$)},dynCall=(J,Q,$=[])=>{if(J.includes("j"))return dynCallLegacy(J,Q,$);var Z=getWasmTableEntry(Q)(...$);return Z},stackSave=()=>_emscripten_stack_get_current(),stackRestore=(J)=>__emscripten_stack_restore(J),createInvokeFunction=(J)=>(Q,...$)=>{var Z=stackSave();try{return dynCall(J,Q,$)}catch(Y){if(stackRestore(Z),Y!==Y+0)throw Y;_setThrew(1,0)}},resolveGlobalSymbol=(J,Q=!1)=>{var $;if(Q&&"orig$"+J in wasmImports)J="orig$"+J;if(isSymbolDefined(J))$=wasmImports[J];else if(J.startsWith("invoke_"))$=wasmImports[J]=createInvokeFunction(J.split("_")[1]);return{sym:$,name:J}},UTF8ToString=(J,Q)=>J?UTF8ArrayToString(HEAPU8,J,Q):"",loadWebAssemblyModule=(binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);currentModuleWeakSymbols=metadata.weakImports;function loadModule(){var firstLoad=!handle||!HEAP8[handle+8];if(firstLoad){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;if(handle)HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)}else memoryBase=LE_HEAP_LOAD_U32((handle+12>>2)*4),tableBase=LE_HEAP_LOAD_U32((handle+20>>2)*4);var tableGrowthNeeded=tableBase+metadata.tableSize-wasmTable.length;if(tableGrowthNeeded>0)wasmTable.grow(tableGrowthNeeded);var moduleExports;function resolveSymbol(J){var Q=resolveGlobalSymbol(J).sym;if(!Q&&localScope)Q=localScope[J];if(!Q)Q=moduleExports[J];return Q}var proxyHandler={get(J,Q){switch(Q){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(Q in wasmImports&&!wasmImports[Q].stub)return wasmImports[Q];if(!(Q in J)){var $;J[Q]=(...Z)=>{return $||=resolveSymbol(Q),$(...Z)}}return J[Q]}},proxy=new Proxy({},proxyHandler),info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),!flags.allowUndefined)reportUndefinedSymbols();function addEmAsm(addr,body){var args=[],arity=0;for(;arity<16;arity++)if(body.indexOf("$"+arity)!=-1)args.push("$"+arity);else break;args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports){var{__start_em_asm:start,__stop_em_asm:stop}=moduleExports;while(start<stop){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;if(applyRelocs)if(runtimeInitialized)applyRelocs();else __RELOC_FUNCS__.push(applyRelocs);var init=moduleExports.__wasm_call_ctors;if(init)if(runtimeInitialized)init();else __ATINIT__.push(init);return moduleExports}if(flags.loadAsync){if(binary instanceof WebAssembly.Module){var instance=new WebAssembly.Instance(binary,info);return Promise.resolve(postInstantiation(binary,instance))}return WebAssembly.instantiate(binary,info).then((J)=>postInstantiation(J.module,J.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}if(flags.loadAsync)return metadata.neededDynlibs.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,flags,localScope)),Promise.resolve()).then(loadModule);return metadata.neededDynlibs.forEach((J)=>loadDynamicLibrary(J,flags,localScope)),loadModule()},mergeLibSymbols=(J,Q)=>{for(var[$,Z]of Object.entries(J)){let Y=(K)=>{if(!isSymbolDefined(K))wasmImports[K]=Z};Y($);let G="__main_argc_argv";if($=="main")Y(G);if($==G)Y("main");if($.startsWith("dynCall_")&&!X.hasOwnProperty($))X[$]=Z}},asyncLoad=(J,Q,$,Z)=>{var Y=!Z?getUniqueRunDependency(`al ${J}`):"";if(readAsync(J).then((G)=>{if(Q(new Uint8Array(G)),Y)removeRunDependency(Y)},(G)=>{if($)$();else throw`Loading data file "${J}" failed.`}),Y)addRunDependency(Y)};function loadDynamicLibrary(J,Q={global:!0,nodelete:!0},$,Z){var Y=LDSO.loadedLibsByName[J];if(Y){if(!Q.global){if($)Object.assign($,Y.exports)}else if(!Y.global)Y.global=!0,mergeLibSymbols(Y.exports,J);if(Q.nodelete&&Y.refcount!==1/0)Y.refcount=1/0;if(Y.refcount++,Z)LDSO.loadedLibsByHandle[Z]=Y;return Q.loadAsync?Promise.resolve(!0):!0}Y=newDSO(J,Z,"loading"),Y.refcount=Q.nodelete?1/0:1,Y.global=Q.global;function G(){if(Z){var z=LE_HEAP_LOAD_U32((Z+28>>2)*4),q=LE_HEAP_LOAD_U32((Z+32>>2)*4);if(z&&q){var A=HEAP8.slice(z,z+q);return Q.loadAsync?Promise.resolve(A):A}}var U=locateFile(J);if(Q.loadAsync)return new Promise(function(W,T){asyncLoad(U,W,T)});if(!readBinary)throw Error(`${U}: file not found, and synchronous loading of external files is not available`);return readBinary(U)}function K(){if(Q.loadAsync)return G().then((z)=>loadWebAssemblyModule(z,Q,J,$,Z));return loadWebAssemblyModule(G(),Q,J,$,Z)}function V(z){if(Y.global)mergeLibSymbols(z,J);else if($)Object.assign($,z);Y.exports=z}if(Q.loadAsync)return K().then((z)=>{return V(z),!0});return V(K()),!0}var reportUndefinedSymbols=()=>{for(var[J,Q]of Object.entries(GOT))if(Q.value==0){var $=resolveGlobalSymbol(J,!0).sym;if(!$&&!Q.required)continue;if(typeof $=="function")Q.value=addFunction($,$.sig);else if(typeof $=="number")Q.value=$;else throw Error(`bad export type for '${J}': ${typeof $}`)}},loadDylibs=()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs"),dynamicLibraries.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})},noExitRuntime=X.noExitRuntime||!0;function setValue(J,Q,$="i8"){if($.endsWith("*"))$="*";switch($){case"i1":HEAP8[J]=Q;break;case"i8":HEAP8[J]=Q;break;case"i16":LE_HEAP_STORE_I16((J>>1)*2,Q);break;case"i32":LE_HEAP_STORE_I32((J>>2)*4,Q);break;case"i64":abort("to do setValue(i64) use WASM_BIGINT");case"float":LE_HEAP_STORE_F32((J>>2)*4,Q);break;case"double":LE_HEAP_STORE_F64((J>>3)*8,Q);break;case"*":LE_HEAP_STORE_U32((J>>2)*4,Q);break;default:abort(`invalid type for setValue: ${$}`)}}var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78112),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=()=>{abort("")};__abort_js.sig="v";var nowIsMonotonic=1,__emscripten_get_now_is_monotonic=()=>nowIsMonotonic;__emscripten_get_now_is_monotonic.sig="i";var __emscripten_memcpy_js=(J,Q,$)=>HEAPU8.copyWithin(J,Q,Q+$);__emscripten_memcpy_js.sig="vppp";var _emscripten_date_now=()=>Date.now();_emscripten_date_now.sig="d";var _emscripten_get_now=()=>performance.now();_emscripten_get_now.sig="d";var getHeapMax=()=>2147483648,growMemory=(J)=>{var Q=wasmMemory.buffer,$=(J-Q.byteLength+65535)/65536;try{return wasmMemory.grow($),updateMemoryViews(),1}catch(Z){}},_emscripten_resize_heap=(J)=>{var Q=HEAPU8.length;J>>>=0;var $=getHeapMax();if(J>$)return!1;var Z=(z,q)=>z+(q-z%q)%q;for(var Y=1;Y<=4;Y*=2){var G=Q*(1+0.2/Y);G=Math.min(G,J+100663296);var K=Math.min($,Z(Math.max(J,G),65536)),V=growMemory(K);if(V)return!0}return!1};_emscripten_resize_heap.sig="ip";var _fd_close=(J)=>52;_fd_close.sig="ii";var convertI32PairToI53Checked=(J,Q)=>Q+2097152>>>0<4194305-!!J?(J>>>0)+Q*4294967296:NaN;function _fd_seek(J,Q,$,Z,Y){var G=convertI32PairToI53Checked(Q,$);return 70}_fd_seek.sig="iiiiip";var printCharBuffers=[null,[],[]],printChar=(J,Q)=>{var $=printCharBuffers[J];if(Q===0||Q===10)(J===1?out:err)(UTF8ArrayToString($,0)),$.length=0;else $.push(Q)},_fd_write=(J,Q,$,Z)=>{var Y=0;for(var G=0;G<$;G++){var K=LE_HEAP_LOAD_U32((Q>>2)*4),V=LE_HEAP_LOAD_U32((Q+4>>2)*4);Q+=8;for(var z=0;z<V;z++)printChar(J,HEAPU8[K+z]);Y+=V}return LE_HEAP_STORE_U32((Z>>2)*4,Y),0};_fd_write.sig="iippp";function _tree_sitter_log_callback(J,Q){if(currentLogCallback){let $=UTF8ToString(Q);currentLogCallback($,J!==0)}}function _tree_sitter_parse_callback(J,Q,$,Z,Y){let K=currentParseCallback(Q,{row:$,column:Z});if(typeof K==="string")setValue(Y,K.length,"i32"),stringToUTF16(K,J,10240);else setValue(Y,0,"i32")}var runtimeKeepaliveCounter=0,keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0,_proc_exit=(J)=>{if(EXITSTATUS=J,!keepRuntimeAlive())X.onExit?.(J),ABORT=!0;quit_(J,new ExitStatus(J))};_proc_exit.sig="vi";var exitJS=(J,Q)=>{EXITSTATUS=J,_proc_exit(J)},handleException=(J)=>{if(J instanceof ExitStatus||J=="unwind")return EXITSTATUS;quit_(1,J)},lengthBytesUTF8=(J)=>{var Q=0;for(var $=0;$<J.length;++$){var Z=J.charCodeAt($);if(Z<=127)Q++;else if(Z<=2047)Q+=2;else if(Z>=55296&&Z<=57343)Q+=4,++$;else Q+=3}return Q},stringToUTF8Array=(J,Q,$,Z)=>{if(!(Z>0))return 0;var Y=$,G=$+Z-1;for(var K=0;K<J.length;++K){var V=J.charCodeAt(K);if(V>=55296&&V<=57343){var z=J.charCodeAt(++K);V=65536+((V&1023)<<10)|z&1023}if(V<=127){if($>=G)break;Q[$++]=V}else if(V<=2047){if($+1>=G)break;Q[$++]=192|V>>6,Q[$++]=128|V&63}else if(V<=65535){if($+2>=G)break;Q[$++]=224|V>>12,Q[$++]=128|V>>6&63,Q[$++]=128|V&63}else{if($+3>=G)break;Q[$++]=240|V>>18,Q[$++]=128|V>>12&63,Q[$++]=128|V>>6&63,Q[$++]=128|V&63}}return Q[$]=0,$-Y},stringToUTF8=(J,Q,$)=>stringToUTF8Array(J,HEAPU8,Q,$),stackAlloc=(J)=>__emscripten_stack_alloc(J),stringToUTF8OnStack=(J)=>{var Q=lengthBytesUTF8(J)+1,$=stackAlloc(Q);return stringToUTF8(J,$,Q),$},stringToUTF16=(J,Q,$)=>{if($??=2147483647,$<2)return 0;$-=2;var Z=Q,Y=$<J.length*2?$/2:J.length;for(var G=0;G<Y;++G){var K=J.charCodeAt(G);LE_HEAP_STORE_I16((Q>>1)*2,K),Q+=2}return LE_HEAP_STORE_I16((Q>>1)*2,0),Q-Z},AsciiToString=(J)=>{var Q="";while(!0){var $=HEAPU8[J++];if(!$)return Q;Q+=String.fromCharCode($)}},wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,_emscripten_get_now_is_monotonic:__emscripten_get_now_is_monotonic,_emscripten_memcpy_js:__emscripten_memcpy_js,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,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},wasmExports=createWasm(),___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports.__wasm_call_ctors)(),___wasm_apply_data_relocs=()=>(___wasm_apply_data_relocs=wasmExports.__wasm_apply_data_relocs)(),_malloc=X._malloc=(J)=>(_malloc=X._malloc=wasmExports.malloc)(J),_calloc=X._calloc=(J,Q)=>(_calloc=X._calloc=wasmExports.calloc)(J,Q),_realloc=X._realloc=(J,Q)=>(_realloc=X._realloc=wasmExports.realloc)(J,Q),_free=X._free=(J)=>(_free=X._free=wasmExports.free)(J),_ts_language_symbol_count=X._ts_language_symbol_count=(J)=>(_ts_language_symbol_count=X._ts_language_symbol_count=wasmExports.ts_language_symbol_count)(J),_ts_language_state_count=X._ts_language_state_count=(J)=>(_ts_language_state_count=X._ts_language_state_count=wasmExports.ts_language_state_count)(J),_ts_language_version=X._ts_language_version=(J)=>(_ts_language_version=X._ts_language_version=wasmExports.ts_language_version)(J),_ts_language_field_count=X._ts_language_field_count=(J)=>(_ts_language_field_count=X._ts_language_field_count=wasmExports.ts_language_field_count)(J),_ts_language_next_state=X._ts_language_next_state=(J,Q,$)=>(_ts_language_next_state=X._ts_language_next_state=wasmExports.ts_language_next_state)(J,Q,$),_ts_language_symbol_name=X._ts_language_symbol_name=(J,Q)=>(_ts_language_symbol_name=X._ts_language_symbol_name=wasmExports.ts_language_symbol_name)(J,Q),_ts_language_symbol_for_name=X._ts_language_symbol_for_name=(J,Q,$,Z)=>(_ts_language_symbol_for_name=X._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name)(J,Q,$,Z),_strncmp=X._strncmp=(J,Q,$)=>(_strncmp=X._strncmp=wasmExports.strncmp)(J,Q,$),_ts_language_symbol_type=X._ts_language_symbol_type=(J,Q)=>(_ts_language_symbol_type=X._ts_language_symbol_type=wasmExports.ts_language_symbol_type)(J,Q),_ts_language_field_name_for_id=X._ts_language_field_name_for_id=(J,Q)=>(_ts_language_field_name_for_id=X._ts_language_field_name_for_id=wasmExports.ts_language_field_name_for_id)(J,Q),_ts_lookahead_iterator_new=X._ts_lookahead_iterator_new=(J,Q)=>(_ts_lookahead_iterator_new=X._ts_lookahead_iterator_new=wasmExports.ts_lookahead_iterator_new)(J,Q),_ts_lookahead_iterator_delete=X._ts_lookahead_iterator_delete=(J)=>(_ts_lookahead_iterator_delete=X._ts_lookahead_iterator_delete=wasmExports.ts_lookahead_iterator_delete)(J),_ts_lookahead_iterator_reset_state=X._ts_lookahead_iterator_reset_state=(J,Q)=>(_ts_lookahead_iterator_reset_state=X._ts_lookahead_iterator_reset_state=wasmExports.ts_lookahead_iterator_reset_state)(J,Q),_ts_lookahead_iterator_reset=X._ts_lookahead_iterator_reset=(J,Q,$)=>(_ts_lookahead_iterator_reset=X._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset)(J,Q,$),_ts_lookahead_iterator_next=X._ts_lookahead_iterator_next=(J)=>(_ts_lookahead_iterator_next=X._ts_lookahead_iterator_next=wasmExports.ts_lookahead_iterator_next)(J),_ts_lookahead_iterator_current_symbol=X._ts_lookahead_iterator_current_symbol=(J)=>(_ts_lookahead_iterator_current_symbol=X._ts_lookahead_iterator_current_symbol=wasmExports.ts_lookahead_iterator_current_symbol)(J),_memset=X._memset=(J,Q,$)=>(_memset=X._memset=wasmExports.memset)(J,Q,$),_memcpy=X._memcpy=(J,Q,$)=>(_memcpy=X._memcpy=wasmExports.memcpy)(J,Q,$),_ts_parser_delete=X._ts_parser_delete=(J)=>(_ts_parser_delete=X._ts_parser_delete=wasmExports.ts_parser_delete)(J),_ts_parser_reset=X._ts_parser_reset=(J)=>(_ts_parser_reset=X._ts_parser_reset=wasmExports.ts_parser_reset)(J),_ts_parser_set_language=X._ts_parser_set_language=(J,Q)=>(_ts_parser_set_language=X._ts_parser_set_language=wasmExports.ts_parser_set_language)(J,Q),_ts_parser_timeout_micros=X._ts_parser_timeout_micros=(J)=>(_ts_parser_timeout_micros=X._ts_parser_timeout_micros=wasmExports.ts_parser_timeout_micros)(J),_ts_parser_set_timeout_micros=X._ts_parser_set_timeout_micros=(J,Q,$)=>(_ts_parser_set_timeout_micros=X._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros)(J,Q,$),_ts_parser_set_included_ranges=X._ts_parser_set_included_ranges=(J,Q,$)=>(_ts_parser_set_included_ranges=X._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges)(J,Q,$),_memmove=X._memmove=(J,Q,$)=>(_memmove=X._memmove=wasmExports.memmove)(J,Q,$),_memcmp=X._memcmp=(J,Q,$)=>(_memcmp=X._memcmp=wasmExports.memcmp)(J,Q,$),_ts_query_new=X._ts_query_new=(J,Q,$,Z,Y)=>(_ts_query_new=X._ts_query_new=wasmExports.ts_query_new)(J,Q,$,Z,Y),_ts_query_delete=X._ts_query_delete=(J)=>(_ts_query_delete=X._ts_query_delete=wasmExports.ts_query_delete)(J),_iswspace=X._iswspace=(J)=>(_iswspace=X._iswspace=wasmExports.iswspace)(J),_iswalnum=X._iswalnum=(J)=>(_iswalnum=X._iswalnum=wasmExports.iswalnum)(J),_ts_query_pattern_count=X._ts_query_pattern_count=(J)=>(_ts_query_pattern_count=X._ts_query_pattern_count=wasmExports.ts_query_pattern_count)(J),_ts_query_capture_count=X._ts_query_capture_count=(J)=>(_ts_query_capture_count=X._ts_query_capture_count=wasmExports.ts_query_capture_count)(J),_ts_query_string_count=X._ts_query_string_count=(J)=>(_ts_query_string_count=X._ts_query_string_count=wasmExports.ts_query_string_count)(J),_ts_query_capture_name_for_id=X._ts_query_capture_name_for_id=(J,Q,$)=>(_ts_query_capture_name_for_id=X._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id)(J,Q,$),_ts_query_string_value_for_id=X._ts_query_string_value_for_id=(J,Q,$)=>(_ts_query_string_value_for_id=X._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id)(J,Q,$),_ts_query_predicates_for_pattern=X._ts_query_predicates_for_pattern=(J,Q,$)=>(_ts_query_predicates_for_pattern=X._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern)(J,Q,$),_ts_query_disable_capture=X._ts_query_disable_capture=(J,Q,$)=>(_ts_query_disable_capture=X._ts_query_disable_capture=wasmExports.ts_query_disable_capture)(J,Q,$),_ts_tree_copy=X._ts_tree_copy=(J)=>(_ts_tree_copy=X._ts_tree_copy=wasmExports.ts_tree_copy)(J),_ts_tree_delete=X._ts_tree_delete=(J)=>(_ts_tree_delete=X._ts_tree_delete=wasmExports.ts_tree_delete)(J),_ts_init=X._ts_init=()=>(_ts_init=X._ts_init=wasmExports.ts_init)(),_ts_parser_new_wasm=X._ts_parser_new_wasm=()=>(_ts_parser_new_wasm=X._ts_parser_new_wasm=wasmExports.ts_parser_new_wasm)(),_ts_parser_enable_logger_wasm=X._ts_parser_enable_logger_wasm=(J,Q)=>(_ts_parser_enable_logger_wasm=X._ts_parser_enable_logger_wasm=wasmExports.ts_parser_enable_logger_wasm)(J,Q),_ts_parser_parse_wasm=X._ts_parser_parse_wasm=(J,Q,$,Z,Y)=>(_ts_parser_parse_wasm=X._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm)(J,Q,$,Z,Y),_ts_parser_included_ranges_wasm=X._ts_parser_included_ranges_wasm=(J)=>(_ts_parser_included_ranges_wasm=X._ts_parser_included_ranges_wasm=wasmExports.ts_parser_included_ranges_wasm)(J),_ts_language_type_is_named_wasm=X._ts_language_type_is_named_wasm=(J,Q)=>(_ts_language_type_is_named_wasm=X._ts_language_type_is_named_wasm=wasmExports.ts_language_type_is_named_wasm)(J,Q),_ts_language_type_is_visible_wasm=X._ts_language_type_is_visible_wasm=(J,Q)=>(_ts_language_type_is_visible_wasm=X._ts_language_type_is_visible_wasm=wasmExports.ts_language_type_is_visible_wasm)(J,Q),_ts_tree_root_node_wasm=X._ts_tree_root_node_wasm=(J)=>(_ts_tree_root_node_wasm=X._ts_tree_root_node_wasm=wasmExports.ts_tree_root_node_wasm)(J),_ts_tree_root_node_with_offset_wasm=X._ts_tree_root_node_with_offset_wasm=(J)=>(_ts_tree_root_node_with_offset_wasm=X._ts_tree_root_node_with_offset_wasm=wasmExports.ts_tree_root_node_with_offset_wasm)(J),_ts_tree_edit_wasm=X._ts_tree_edit_wasm=(J)=>(_ts_tree_edit_wasm=X._ts_tree_edit_wasm=wasmExports.ts_tree_edit_wasm)(J),_ts_tree_included_ranges_wasm=X._ts_tree_included_ranges_wasm=(J)=>(_ts_tree_included_ranges_wasm=X._ts_tree_included_ranges_wasm=wasmExports.ts_tree_included_ranges_wasm)(J),_ts_tree_get_changed_ranges_wasm=X._ts_tree_get_changed_ranges_wasm=(J,Q)=>(_ts_tree_get_changed_ranges_wasm=X._ts_tree_get_changed_ranges_wasm=wasmExports.ts_tree_get_changed_ranges_wasm)(J,Q),_ts_tree_cursor_new_wasm=X._ts_tree_cursor_new_wasm=(J)=>(_ts_tree_cursor_new_wasm=X._ts_tree_cursor_new_wasm=wasmExports.ts_tree_cursor_new_wasm)(J),_ts_tree_cursor_delete_wasm=X._ts_tree_cursor_delete_wasm=(J)=>(_ts_tree_cursor_delete_wasm=X._ts_tree_cursor_delete_wasm=wasmExports.ts_tree_cursor_delete_wasm)(J),_ts_tree_cursor_reset_wasm=X._ts_tree_cursor_reset_wasm=(J)=>(_ts_tree_cursor_reset_wasm=X._ts_tree_cursor_reset_wasm=wasmExports.ts_tree_cursor_reset_wasm)(J),_ts_tree_cursor_reset_to_wasm=X._ts_tree_cursor_reset_to_wasm=(J,Q)=>(_ts_tree_cursor_reset_to_wasm=X._ts_tree_cursor_reset_to_wasm=wasmExports.ts_tree_cursor_reset_to_wasm)(J,Q),_ts_tree_cursor_goto_first_child_wasm=X._ts_tree_cursor_goto_first_child_wasm=(J)=>(_ts_tree_cursor_goto_first_child_wasm=X._ts_tree_cursor_goto_first_child_wasm=wasmExports.ts_tree_cursor_goto_first_child_wasm)(J),_ts_tree_cursor_goto_last_child_wasm=X._ts_tree_cursor_goto_last_child_wasm=(J)=>(_ts_tree_cursor_goto_last_child_wasm=X._ts_tree_cursor_goto_last_child_wasm=wasmExports.ts_tree_cursor_goto_last_child_wasm)(J),_ts_tree_cursor_goto_first_child_for_index_wasm=X._ts_tree_cursor_goto_first_child_for_index_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_index_wasm=X._ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm)(J),_ts_tree_cursor_goto_first_child_for_position_wasm=X._ts_tree_cursor_goto_first_child_for_position_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_position_wasm=X._ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm)(J),_ts_tree_cursor_goto_next_sibling_wasm=X._ts_tree_cursor_goto_next_sibling_wasm=(J)=>(_ts_tree_cursor_goto_next_sibling_wasm=X._ts_tree_cursor_goto_next_sibling_wasm=wasmExports.ts_tree_cursor_goto_next_sibling_wasm)(J),_ts_tree_cursor_goto_previous_sibling_wasm=X._ts_tree_cursor_goto_previous_sibling_wasm=(J)=>(_ts_tree_cursor_goto_previous_sibling_wasm=X._ts_tree_cursor_goto_previous_sibling_wasm=wasmExports.ts_tree_cursor_goto_previous_sibling_wasm)(J),_ts_tree_cursor_goto_descendant_wasm=X._ts_tree_cursor_goto_descendant_wasm=(J,Q)=>(_ts_tree_cursor_goto_descendant_wasm=X._ts_tree_cursor_goto_descendant_wasm=wasmExports.ts_tree_cursor_goto_descendant_wasm)(J,Q),_ts_tree_cursor_goto_parent_wasm=X._ts_tree_cursor_goto_parent_wasm=(J)=>(_ts_tree_cursor_goto_parent_wasm=X._ts_tree_cursor_goto_parent_wasm=wasmExports.ts_tree_cursor_goto_parent_wasm)(J),_ts_tree_cursor_current_node_type_id_wasm=X._ts_tree_cursor_current_node_type_id_wasm=(J)=>(_ts_tree_cursor_current_node_type_id_wasm=X._ts_tree_cursor_current_node_type_id_wasm=wasmExports.ts_tree_cursor_current_node_type_id_wasm)(J),_ts_tree_cursor_current_node_state_id_wasm=X._ts_tree_cursor_current_node_state_id_wasm=(J)=>(_ts_tree_cursor_current_node_state_id_wasm=X._ts_tree_cursor_current_node_state_id_wasm=wasmExports.ts_tree_cursor_current_node_state_id_wasm)(J),_ts_tree_cursor_current_node_is_named_wasm=X._ts_tree_cursor_current_node_is_named_wasm=(J)=>(_ts_tree_cursor_current_node_is_named_wasm=X._ts_tree_cursor_current_node_is_named_wasm=wasmExports.ts_tree_cursor_current_node_is_named_wasm)(J),_ts_tree_cursor_current_node_is_missing_wasm=X._ts_tree_cursor_current_node_is_missing_wasm=(J)=>(_ts_tree_cursor_current_node_is_missing_wasm=X._ts_tree_cursor_current_node_is_missing_wasm=wasmExports.ts_tree_cursor_current_node_is_missing_wasm)(J),_ts_tree_cursor_current_node_id_wasm=X._ts_tree_cursor_current_node_id_wasm=(J)=>(_ts_tree_cursor_current_node_id_wasm=X._ts_tree_cursor_current_node_id_wasm=wasmExports.ts_tree_cursor_current_node_id_wasm)(J),_ts_tree_cursor_start_position_wasm=X._ts_tree_cursor_start_position_wasm=(J)=>(_ts_tree_cursor_start_position_wasm=X._ts_tree_cursor_start_position_wasm=wasmExports.ts_tree_cursor_start_position_wasm)(J),_ts_tree_cursor_end_position_wasm=X._ts_tree_cursor_end_position_wasm=(J)=>(_ts_tree_cursor_end_position_wasm=X._ts_tree_cursor_end_position_wasm=wasmExports.ts_tree_cursor_end_position_wasm)(J),_ts_tree_cursor_start_index_wasm=X._ts_tree_cursor_start_index_wasm=(J)=>(_ts_tree_cursor_start_index_wasm=X._ts_tree_cursor_start_index_wasm=wasmExports.ts_tree_cursor_start_index_wasm)(J),_ts_tree_cursor_end_index_wasm=X._ts_tree_cursor_end_index_wasm=(J)=>(_ts_tree_cursor_end_index_wasm=X._ts_tree_cursor_end_index_wasm=wasmExports.ts_tree_cursor_end_index_wasm)(J),_ts_tree_cursor_current_field_id_wasm=X._ts_tree_cursor_current_field_id_wasm=(J)=>(_ts_tree_cursor_current_field_id_wasm=X._ts_tree_cursor_current_field_id_wasm=wasmExports.ts_tree_cursor_current_field_id_wasm)(J),_ts_tree_cursor_current_depth_wasm=X._ts_tree_cursor_current_depth_wasm=(J)=>(_ts_tree_cursor_current_depth_wasm=X._ts_tree_cursor_current_depth_wasm=wasmExports.ts_tree_cursor_current_depth_wasm)(J),_ts_tree_cursor_current_descendant_index_wasm=X._ts_tree_cursor_current_descendant_index_wasm=(J)=>(_ts_tree_cursor_current_descendant_index_wasm=X._ts_tree_cursor_current_descendant_index_wasm=wasmExports.ts_tree_cursor_current_descendant_index_wasm)(J),_ts_tree_cursor_current_node_wasm=X._ts_tree_cursor_current_node_wasm=(J)=>(_ts_tree_cursor_current_node_wasm=X._ts_tree_cursor_current_node_wasm=wasmExports.ts_tree_cursor_current_node_wasm)(J),_ts_node_symbol_wasm=X._ts_node_symbol_wasm=(J)=>(_ts_node_symbol_wasm=X._ts_node_symbol_wasm=wasmExports.ts_node_symbol_wasm)(J),_ts_node_field_name_for_child_wasm=X._ts_node_field_name_for_child_wasm=(J,Q)=>(_ts_node_field_name_for_child_wasm=X._ts_node_field_name_for_child_wasm=wasmExports.ts_node_field_name_for_child_wasm)(J,Q),_ts_node_children_by_field_id_wasm=X._ts_node_children_by_field_id_wasm=(J,Q)=>(_ts_node_children_by_field_id_wasm=X._ts_node_children_by_field_id_wasm=wasmExports.ts_node_children_by_field_id_wasm)(J,Q),_ts_node_first_child_for_byte_wasm=X._ts_node_first_child_for_byte_wasm=(J)=>(_ts_node_first_child_for_byte_wasm=X._ts_node_first_child_for_byte_wasm=wasmExports.ts_node_first_child_for_byte_wasm)(J),_ts_node_first_named_child_for_byte_wasm=X._ts_node_first_named_child_for_byte_wasm=(J)=>(_ts_node_first_named_child_for_byte_wasm=X._ts_node_first_named_child_for_byte_wasm=wasmExports.ts_node_first_named_child_for_byte_wasm)(J),_ts_node_grammar_symbol_wasm=X._ts_node_grammar_symbol_wasm=(J)=>(_ts_node_grammar_symbol_wasm=X._ts_node_grammar_symbol_wasm=wasmExports.ts_node_grammar_symbol_wasm)(J),_ts_node_child_count_wasm=X._ts_node_child_count_wasm=(J)=>(_ts_node_child_count_wasm=X._ts_node_child_count_wasm=wasmExports.ts_node_child_count_wasm)(J),_ts_node_named_child_count_wasm=X._ts_node_named_child_count_wasm=(J)=>(_ts_node_named_child_count_wasm=X._ts_node_named_child_count_wasm=wasmExports.ts_node_named_child_count_wasm)(J),_ts_node_child_wasm=X._ts_node_child_wasm=(J,Q)=>(_ts_node_child_wasm=X._ts_node_child_wasm=wasmExports.ts_node_child_wasm)(J,Q),_ts_node_named_child_wasm=X._ts_node_named_child_wasm=(J,Q)=>(_ts_node_named_child_wasm=X._ts_node_named_child_wasm=wasmExports.ts_node_named_child_wasm)(J,Q),_ts_node_child_by_field_id_wasm=X._ts_node_child_by_field_id_wasm=(J,Q)=>(_ts_node_child_by_field_id_wasm=X._ts_node_child_by_field_id_wasm=wasmExports.ts_node_child_by_field_id_wasm)(J,Q),_ts_node_next_sibling_wasm=X._ts_node_next_sibling_wasm=(J)=>(_ts_node_next_sibling_wasm=X._ts_node_next_sibling_wasm=wasmExports.ts_node_next_sibling_wasm)(J),_ts_node_prev_sibling_wasm=X._ts_node_prev_sibling_wasm=(J)=>(_ts_node_prev_sibling_wasm=X._ts_node_prev_sibling_wasm=wasmExports.ts_node_prev_sibling_wasm)(J),_ts_node_next_named_sibling_wasm=X._ts_node_next_named_sibling_wasm=(J)=>(_ts_node_next_named_sibling_wasm=X._ts_node_next_named_sibling_wasm=wasmExports.ts_node_next_named_sibling_wasm)(J),_ts_node_prev_named_sibling_wasm=X._ts_node_prev_named_sibling_wasm=(J)=>(_ts_node_prev_named_sibling_wasm=X._ts_node_prev_named_sibling_wasm=wasmExports.ts_node_prev_named_sibling_wasm)(J),_ts_node_descendant_count_wasm=X._ts_node_descendant_count_wasm=(J)=>(_ts_node_descendant_count_wasm=X._ts_node_descendant_count_wasm=wasmExports.ts_node_descendant_count_wasm)(J),_ts_node_parent_wasm=X._ts_node_parent_wasm=(J)=>(_ts_node_parent_wasm=X._ts_node_parent_wasm=wasmExports.ts_node_parent_wasm)(J),_ts_node_descendant_for_index_wasm=X._ts_node_descendant_for_index_wasm=(J)=>(_ts_node_descendant_for_index_wasm=X._ts_node_descendant_for_index_wasm=wasmExports.ts_node_descendant_for_index_wasm)(J),_ts_node_named_descendant_for_index_wasm=X._ts_node_named_descendant_for_index_wasm=(J)=>(_ts_node_named_descendant_for_index_wasm=X._ts_node_named_descendant_for_index_wasm=wasmExports.ts_node_named_descendant_for_index_wasm)(J),_ts_node_descendant_for_position_wasm=X._ts_node_descendant_for_position_wasm=(J)=>(_ts_node_descendant_for_position_wasm=X._ts_node_descendant_for_position_wasm=wasmExports.ts_node_descendant_for_position_wasm)(J),_ts_node_named_descendant_for_position_wasm=X._ts_node_named_descendant_for_position_wasm=(J)=>(_ts_node_named_descendant_for_position_wasm=X._ts_node_named_descendant_for_position_wasm=wasmExports.ts_node_named_descendant_for_position_wasm)(J),_ts_node_start_point_wasm=X._ts_node_start_point_wasm=(J)=>(_ts_node_start_point_wasm=X._ts_node_start_point_wasm=wasmExports.ts_node_start_point_wasm)(J),_ts_node_end_point_wasm=X._ts_node_end_point_wasm=(J)=>(_ts_node_end_point_wasm=X._ts_node_end_point_wasm=wasmExports.ts_node_end_point_wasm)(J),_ts_node_start_index_wasm=X._ts_node_start_index_wasm=(J)=>(_ts_node_start_index_wasm=X._ts_node_start_index_wasm=wasmExports.ts_node_start_index_wasm)(J),_ts_node_end_index_wasm=X._ts_node_end_index_wasm=(J)=>(_ts_node_end_index_wasm=X._ts_node_end_index_wasm=wasmExports.ts_node_end_index_wasm)(J),_ts_node_to_string_wasm=X._ts_node_to_string_wasm=(J)=>(_ts_node_to_string_wasm=X._ts_node_to_string_wasm=wasmExports.ts_node_to_string_wasm)(J),_ts_node_children_wasm=X._ts_node_children_wasm=(J)=>(_ts_node_children_wasm=X._ts_node_children_wasm=wasmExports.ts_node_children_wasm)(J),_ts_node_named_children_wasm=X._ts_node_named_children_wasm=(J)=>(_ts_node_named_children_wasm=X._ts_node_named_children_wasm=wasmExports.ts_node_named_children_wasm)(J),_ts_node_descendants_of_type_wasm=X._ts_node_descendants_of_type_wasm=(J,Q,$,Z,Y,G,K)=>(_ts_node_descendants_of_type_wasm=X._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm)(J,Q,$,Z,Y,G,K),_ts_node_is_named_wasm=X._ts_node_is_named_wasm=(J)=>(_ts_node_is_named_wasm=X._ts_node_is_named_wasm=wasmExports.ts_node_is_named_wasm)(J),_ts_node_has_changes_wasm=X._ts_node_has_changes_wasm=(J)=>(_ts_node_has_changes_wasm=X._ts_node_has_changes_wasm=wasmExports.ts_node_has_changes_wasm)(J),_ts_node_has_error_wasm=X._ts_node_has_error_wasm=(J)=>(_ts_node_has_error_wasm=X._ts_node_has_error_wasm=wasmExports.ts_node_has_error_wasm)(J),_ts_node_is_error_wasm=X._ts_node_is_error_wasm=(J)=>(_ts_node_is_error_wasm=X._ts_node_is_error_wasm=wasmExports.ts_node_is_error_wasm)(J),_ts_node_is_missing_wasm=X._ts_node_is_missing_wasm=(J)=>(_ts_node_is_missing_wasm=X._ts_node_is_missing_wasm=wasmExports.ts_node_is_missing_wasm)(J),_ts_node_is_extra_wasm=X._ts_node_is_extra_wasm=(J)=>(_ts_node_is_extra_wasm=X._ts_node_is_extra_wasm=wasmExports.ts_node_is_extra_wasm)(J),_ts_node_parse_state_wasm=X._ts_node_parse_state_wasm=(J)=>(_ts_node_parse_state_wasm=X._ts_node_parse_state_wasm=wasmExports.ts_node_parse_state_wasm)(J),_ts_node_next_parse_state_wasm=X._ts_node_next_parse_state_wasm=(J)=>(_ts_node_next_parse_state_wasm=X._ts_node_next_parse_state_wasm=wasmExports.ts_node_next_parse_state_wasm)(J),_ts_query_matches_wasm=X._ts_query_matches_wasm=(J,Q,$,Z,Y,G,K,V,z,q,A)=>(_ts_query_matches_wasm=X._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm)(J,Q,$,Z,Y,G,K,V,z,q,A),_ts_query_captures_wasm=X._ts_query_captures_wasm=(J,Q,$,Z,Y,G,K,V,z,q,A)=>(_ts_query_captures_wasm=X._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm)(J,Q,$,Z,Y,G,K,V,z,q,A),_iswalpha=X._iswalpha=(J)=>(_iswalpha=X._iswalpha=wasmExports.iswalpha)(J),_iswblank=X._iswblank=(J)=>(_iswblank=X._iswblank=wasmExports.iswblank)(J),_iswdigit=X._iswdigit=(J)=>(_iswdigit=X._iswdigit=wasmExports.iswdigit)(J),_iswlower=X._iswlower=(J)=>(_iswlower=X._iswlower=wasmExports.iswlower)(J),_iswupper=X._iswupper=(J)=>(_iswupper=X._iswupper=wasmExports.iswupper)(J),_iswxdigit=X._iswxdigit=(J)=>(_iswxdigit=X._iswxdigit=wasmExports.iswxdigit)(J),_memchr=X._memchr=(J,Q,$)=>(_memchr=X._memchr=wasmExports.memchr)(J,Q,$),_strlen=X._strlen=(J)=>(_strlen=X._strlen=wasmExports.strlen)(J),_strcmp=X._strcmp=(J,Q)=>(_strcmp=X._strcmp=wasmExports.strcmp)(J,Q),_strncat=X._strncat=(J,Q,$)=>(_strncat=X._strncat=wasmExports.strncat)(J,Q,$),_strncpy=X._strncpy=(J,Q,$)=>(_strncpy=X._strncpy=wasmExports.strncpy)(J,Q,$),_towlower=X._towlower=(J)=>(_towlower=X._towlower=wasmExports.towlower)(J),_towupper=X._towupper=(J)=>(_towupper=X._towupper=wasmExports.towupper)(J),_setThrew=(J,Q)=>(_setThrew=wasmExports.setThrew)(J,Q),__emscripten_stack_restore=(J)=>(__emscripten_stack_restore=wasmExports._emscripten_stack_restore)(J),__emscripten_stack_alloc=(J)=>(__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc)(J),_emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current)(),dynCall_jiji=X.dynCall_jiji=(J,Q,$,Z,Y)=>(dynCall_jiji=X.dynCall_jiji=wasmExports.dynCall_jiji)(J,Q,$,Z,Y),_orig$ts_parser_timeout_micros=X._orig$ts_parser_timeout_micros=(J)=>(_orig$ts_parser_timeout_micros=X._orig$ts_parser_timeout_micros=wasmExports.orig$ts_parser_timeout_micros)(J),_orig$ts_parser_set_timeout_micros=X._orig$ts_parser_set_timeout_micros=(J,Q)=>(_orig$ts_parser_set_timeout_micros=X._orig$ts_parser_set_timeout_micros=wasmExports.orig$ts_parser_set_timeout_micros)(J,Q);X.AsciiToString=AsciiToString,X.stringToUTF16=stringToUTF16;var calledRun;dependenciesFulfilled=function J(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=J};function callMain(J=[]){var Q=resolveGlobalSymbol("main").sym;if(!Q)return;J.unshift(thisProgram);var $=J.length,Z=stackAlloc(($+1)*4),Y=Z;J.forEach((K)=>{LE_HEAP_STORE_U32((Y>>2)*4,stringToUTF8OnStack(K)),Y+=4}),LE_HEAP_STORE_U32((Y>>2)*4,0);try{var G=Q($,Z);return exitJS(G,!0),G}catch(K){return handleException(K)}}function run(J=arguments_){if(runDependencies>0)return;if(preRun(),runDependencies>0)return;function Q(){if(calledRun)return;if(calledRun=!0,X.calledRun=!0,ABORT)return;if(initRuntime(),preMain(),X.onRuntimeInitialized?.(),shouldRunNow)callMain(J);postRun()}if(X.setStatus)X.setStatus("Running..."),setTimeout(function(){setTimeout(function(){X.setStatus("")},1),Q()},1);else Q()}if(X.preInit){if(typeof X.preInit=="function")X.preInit=[X.preInit];while(X.preInit.length>0)X.preInit.pop()()}var shouldRunNow=!0;if(X.noInitialRun)shouldRunNow=!1;run();let C=X,INTERNAL={},SIZE_OF_INT=4,SIZE_OF_CURSOR=4*SIZE_OF_INT,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+/,VERSION,MIN_COMPATIBLE_VERSION,TRANSFER_BUFFER,currentParseCallback,currentLogCallback;class 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(J){let Q;if(!J)Q=0,J=null;else if(J.constructor===Language){Q=J[0];let $=C._ts_language_version(Q);if($<MIN_COMPATIBLE_VERSION||VERSION<$)throw Error(`Incompatible language version ${$}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`)}else throw Error("Argument must be a Language");return this.language=J,C._ts_parser_set_language(this[0],Q),this}getLanguage(){return this.language}parse(J,Q,$){if(typeof J==="string")currentParseCallback=(V,z)=>J.slice(V);else if(typeof J==="function")currentParseCallback=J;else throw Error("Argument must be a string or a function");if(this.logCallback)currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1);else currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0);let Z=0,Y=0;if($?.includedRanges){Z=$.includedRanges.length,Y=C._calloc(Z,SIZE_OF_RANGE);let V=Y;for(let z=0;z<Z;z++)marshalRange(V,$.includedRanges[z]),V+=SIZE_OF_RANGE}let G=C._ts_parser_parse_wasm(this[0],this[1],Q?Q[0]:0,Y,Z);if(!G)throw currentParseCallback=null,currentLogCallback=null,Error("Parsing failed");let K=new Tree(INTERNAL,G,this.language,currentParseCallback);return currentParseCallback=null,currentLogCallback=null,K}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let Y=0;Y<J;Y++)$[Y]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setTimeoutMicros(J){C._ts_parser_set_timeout_micros(this[0],J)}setLogger(J){if(!J)J=null;else if(typeof J!=="function")throw Error("Logger callback must be a function");return this.logCallback=J,this}getLogger(){return this.logCallback}}class Tree{constructor(J,Q,$,Z){assertInternal(J),this[0]=Q,this.language=$,this.textCallback=Z}copy(){let J=C._ts_tree_copy(this[0]);return new Tree(INTERNAL,J,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}edit(J){marshalEdit(J),C._ts_tree_edit_wasm(this[0])}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(J,Q){let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),marshalPoint($+SIZE_OF_INT,Q),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(J){if(J.constructor!==Tree)throw TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],J[0]);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let Y=$;for(let G=0;G<Q;G++)Z[G]=unmarshalRange(Y),Y+=SIZE_OF_RANGE;C._free($)}return Z}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let Y=0;Y<J;Y++)$[Y]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}}class Node{constructor(J,Q){assertInternal(J),this.tree=Q}get typeId(){return marshalNode(this),C._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return marshalNode(this),C._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"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)}get parseState(){return marshalNode(this),C._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return marshalNode(this),C._ts_node_next_parse_state_wasm(this.tree[0])}get isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}get hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}get hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}get isError(){return marshalNode(this),C._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return marshalNode(this),C._ts_node_is_missing_wasm(this.tree[0])===1}get isExtra(){return marshalNode(this),C._ts_node_is_extra_wasm(this.tree[0])===1}equals(J){return this.id===J.id}child(J){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}namedChild(J){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldId(J){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1)return this.childForFieldId(Q);return null}fieldNameForChild(J){marshalNode(this);let Q=C._ts_node_field_name_for_child_wasm(this.tree[0],J);if(!Q)return null;return AsciiToString(Q)}childrenForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1&&Q!==0)return this.childrenForFieldId(Q);return[]}childrenForFieldId(J){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],J);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let Y=$;for(let G=0;G<Q;G++)Z[G]=unmarshalNode(this.tree,Y),Y+=SIZE_OF_NODE;C._free($)}return Z}firstChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_named_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}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 J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._children[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._namedChildren[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._namedChildren}descendantsOfType(J,Q,$){if(!Array.isArray(J))J=[J];if(!Q)Q=ZERO_POINT;if(!$)$=ZERO_POINT;let Z=[],Y=this.tree.language.types;for(let q=0,A=Y.length;q<A;q++)if(J.includes(Y[q]))Z.push(q);let G=C._malloc(SIZE_OF_INT*Z.length);for(let q=0,A=Z.length;q<A;q++)setValue(G+q*SIZE_OF_INT,Z[q],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],G,Z.length,Q.row,Q.column,$.row,$.column);let K=getValue(TRANSFER_BUFFER,"i32"),V=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),z=Array(K);if(K>0){let q=V;for(let A=0;A<K;A++)z[A]=unmarshalNode(this.tree,q),q+=SIZE_OF_NODE}return C._free(V),C._free(G),z}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 descendantCount(){return marshalNode(this),C._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return marshalNode(this),C._ts_node_parent_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),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 J=C._ts_node_to_string_wasm(this.tree[0]),Q=AsciiToString(J);return C._free(J),Q}}class TreeCursor{constructor(J,Q){assertInternal(J),this.tree=Q,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(J){marshalNode(J),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(J){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(J,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],J.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 nodeStateId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_state_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 J=C._ts_tree_cursor_start_index_wasm(this.tree[0]),Q=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,J,Q)}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])}get currentNode(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_wasm(this.tree[0]),unmarshalNode(this.tree)}get currentFieldId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return marshalTreeCursor(this),C._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}gotoFirstChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoLastChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoFirstChildForIndex(J){marshalTreeCursor(this),setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,J,"i32");let Q=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoFirstChildForPosition(J){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,J);let Q=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoNextSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoPreviousSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoDescendant(J){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],J),unmarshalTreeCursor(this)}gotoParent(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}}class Language{constructor(J,Q){assertInternal(J),this[0]=Q,this.types=Array(C._ts_language_symbol_count(this[0]));for(let $=0,Z=this.types.length;$<Z;$++)if(C._ts_language_symbol_type(this[0],$)<2)this.types[$]=UTF8ToString(C._ts_language_symbol_name(this[0],$));this.fields=Array(C._ts_language_field_count(this[0])+1);for(let $=0,Z=this.fields.length;$<Z;$++){let Y=C._ts_language_field_name_for_id(this[0],$);if(Y!==0)this.fields[$]=UTF8ToString(Y);else this.fields[$]=null}}get version(){return C._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(J){let Q=this.fields.indexOf(J);if(Q!==-1)return Q;else return null}fieldNameForId(J){return this.fields[J]||null}idForNodeType(J,Q){let $=lengthBytesUTF8(J),Z=C._malloc($+1);stringToUTF8(J,Z,$+1);let Y=C._ts_language_symbol_for_name(this[0],Z,$,Q);return C._free(Z),Y||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(J){let Q=C._ts_language_symbol_name(this[0],J);return Q?UTF8ToString(Q):null}nodeTypeIsNamed(J){return C._ts_language_type_is_named_wasm(this[0],J)?!0:!1}nodeTypeIsVisible(J){return C._ts_language_type_is_visible_wasm(this[0],J)?!0:!1}nextState(J,Q){return C._ts_language_next_state(this[0],J,Q)}lookaheadIterator(J){let Q=C._ts_lookahead_iterator_new(this[0],J);if(Q)return new LookaheadIterable(INTERNAL,Q,this);return null}query(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1);let Z=C._ts_query_new(this[0],$,Q,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!Z){let F=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),H=getValue(TRANSFER_BUFFER,"i32"),O=UTF8ToString($,H).length,j=J.substr(O,100).split(`
2
- `)[0],E=j.match(QUERY_WORD_REGEX)[0],I;switch(F){case 2:I=RangeError(`Bad node name '${E}'`);break;case 3:I=RangeError(`Bad field name '${E}'`);break;case 4:I=RangeError(`Bad capture name @${E}`);break;case 5:I=TypeError(`Bad pattern structure at offset ${O}: '${j}'...`),E="";break;default:I=SyntaxError(`Bad syntax at offset ${O}: '${j}'...`),E="";break}throw I.index=O,I.length=E.length,C._free($),I}let Y=C._ts_query_string_count(Z),G=C._ts_query_capture_count(Z),K=C._ts_query_pattern_count(Z),V=Array(G),z=Array(Y);for(let F=0;F<G;F++){let H=C._ts_query_capture_name_for_id(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");V[F]=UTF8ToString(H,O)}for(let F=0;F<Y;F++){let H=C._ts_query_string_value_for_id(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");z[F]=UTF8ToString(H,O)}let q=Array(K),A=Array(K),U=Array(K),W=Array(K),T=Array(K);for(let F=0;F<K;F++){let H=C._ts_query_predicates_for_pattern(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");W[F]=[],T[F]=[];let j=[],E=H;for(let I=0;I<O;I++){let _=getValue(E,"i32");E+=SIZE_OF_INT;let P=getValue(E,"i32");if(E+=SIZE_OF_INT,_===PREDICATE_STEP_TYPE_CAPTURE)j.push({type:"capture",name:V[P]});else if(_===PREDICATE_STEP_TYPE_STRING)j.push({type:"string",value:z[P]});else if(j.length>0){if(j[0].type!=="string")throw Error("Predicates must begin with a literal value");let x=j[0].value,S=!0,f=!0,N;switch(x){case"any-not-eq?":case"not-eq?":S=!1;case"any-eq?":case"eq?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${x}\` predicate. Expected 2, got ${j.length-1}`);if(j[1].type!=="capture")throw Error(`First argument of \`#${x}\` predicate must be a capture. Got "${j[1].value}"`);if(f=!x.startsWith("any-"),j[2].type==="capture"){let v=j[1].name,D=j[2].name;T[F].push((B)=>{let w=[],g=[];for(let h of B){if(h.name===v)w.push(h.node);if(h.name===D)g.push(h.node)}let m=(h,p,s)=>s?h.text===p.text:h.text!==p.text;return f?w.every((h)=>g.some((p)=>m(h,p,S))):w.some((h)=>g.some((p)=>m(h,p,S)))})}else{N=j[1].name;let v=j[2].value,D=(w)=>w.text===v,B=(w)=>w.text!==v;T[F].push((w)=>{let g=[];for(let h of w)if(h.name===N)g.push(h.node);let m=S?D:B;return f?g.every(m):g.some(m)})}break;case"any-not-match?":case"not-match?":S=!1;case"any-match?":case"match?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${x}\` predicate. Expected 2, got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${x}\` predicate must be a capture. Got "${j[1].value}".`);if(j[2].type!=="string")throw Error(`Second argument of \`#${x}\` predicate must be a string. Got @${j[2].value}.`);N=j[1].name;let b=new RegExp(j[2].value);f=!x.startsWith("any-"),T[F].push((v)=>{let D=[];for(let w of v)if(w.name===N)D.push(w.node.text);let B=(w,g)=>g?b.test(w):!b.test(w);if(D.length===0)return!S;return f?D.every((w)=>B(w,S)):D.some((w)=>B(w,S))});break;case"set!":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((v)=>v.type!=="string"))throw Error('Arguments to `#set!` predicate must be a strings.".');if(!q[F])q[F]={};q[F][j[1].value]=j[2]?j[2].value:null;break;case"is?":case"is-not?":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#${x}\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((v)=>v.type!=="string"))throw Error(`Arguments to \`#${x}\` predicate must be a strings.".`);let u=x==="is?"?A:U;if(!u[F])u[F]={};u[F][j[1].value]=j[2]?j[2].value:null;break;case"not-any-of?":S=!1;case"any-of?":if(j.length<2)throw Error(`Wrong number of arguments to \`#${x}\` predicate. Expected at least 1. Got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${x}\` predicate must be a capture. Got "${j[1].value}".`);for(let v=2;v<j.length;v++)if(j[v].type!=="string")throw Error(`Arguments to \`#${x}\` predicate must be a strings.".`);N=j[1].name;let r=j.slice(2).map((v)=>v.value);T[F].push((v)=>{let D=[];for(let B of v)if(B.name===N)D.push(B.node.text);if(D.length===0)return!S;return D.every((B)=>r.includes(B))===S});break;default:W[F].push({operator:x,operands:j.slice(1)})}j.length=0}}Object.freeze(q[F]),Object.freeze(A[F]),Object.freeze(U[F])}return C._free($),new Query(INTERNAL,Z,V,T,W,Object.freeze(q),Object.freeze(A),Object.freeze(U))}static load(J){let Q;if(J instanceof Uint8Array)Q=Promise.resolve(J);else{let $=J;if(typeof process<"u"&&process.versions&&process.versions.node){let Z=vJ("fs");Q=Promise.resolve(Z.readFileSync($))}else Q=fetch($).then((Z)=>Z.arrayBuffer().then((Y)=>{if(Z.ok)return new Uint8Array(Y);else{let G=new TextDecoder("utf-8").decode(Y);throw Error(`Language.load failed with status ${Z.status}.
1
+ import{createRequire as cQ}from"node:module";var xQ=Object.create;var{getPrototypeOf:MQ,defineProperty:lJ,getOwnPropertyNames:yQ}=Object;var bQ=Object.prototype.hasOwnProperty;function gQ(J){return this[J]}var hQ,fQ,mQ=(J,Q,$)=>{var Z=J!=null&&typeof J==="object";if(Z){var Y=Q?hQ??=new WeakMap:fQ??=new WeakMap,G=Y.get(J);if(G)return G}$=J!=null?xQ(MQ(J)):{};let K=Q||!J||!J.__esModule?lJ($,"default",{value:J,enumerable:!0}):$;for(let V of yQ(J))if(!bQ.call(K,V))lJ(K,V,{get:gQ.bind(J,V),enumerable:!0});if(Z)Y.set(J,K);return K};var pQ=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var vJ=cQ(import.meta.url);var WQ=pQ((CJ,zJ)=>{var __dirname="/home/runner/work/trueline-mcp/trueline-mcp/node_modules/web-tree-sitter",X=typeof X<"u"?X:{},k$=typeof window=="object",gJ=typeof importScripts=="function",zQ=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",_$=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){if(initPromise)return initPromise;return X=Object.assign({},X,moduleOptions),initPromise=new Promise((resolveInitPromise)=>{var moduleOverrides=Object.assign({},X),arguments_=[],thisProgram="./this.program",quit_=(J,Q)=>{throw Q},scriptDirectory="";function locateFile(J){if(X.locateFile)return X.locateFile(J,scriptDirectory);return scriptDirectory+J}var readAsync,readBinary;if(zQ){var fs=vJ("fs"),nodePath=vJ("path");if(scriptDirectory=__dirname+"/",readBinary=(J)=>{J=isFileURI(J)?new URL(J):nodePath.normalize(J);var Q=fs.readFileSync(J);return Q},readAsync=(J,Q=!0)=>{return J=isFileURI(J)?new URL(J):nodePath.normalize(J),new Promise(($,Z)=>{fs.readFile(J,Q?void 0:"utf8",(Y,G)=>{if(Y)Z(Y);else $(Q?G.buffer:G)})})},!X.thisProgram&&process.argv.length>1)thisProgram=process.argv[1].replace(/\\/g,"/");if(arguments_=process.argv.slice(2),typeof zJ<"u")zJ.exports=X;quit_=(J,Q)=>{throw process.exitCode=J,Q}}else if(k$||gJ){if(gJ)scriptDirectory=self.location.href;else if(typeof document<"u"&&document.currentScript)scriptDirectory=document.currentScript.src;if(scriptDirectory.startsWith("blob:"))scriptDirectory="";else scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);{if(gJ)readBinary=(J)=>{var Q=new XMLHttpRequest;return Q.open("GET",J,!1),Q.responseType="arraybuffer",Q.send(null),new Uint8Array(Q.response)};readAsync=(J)=>{if(isFileURI(J))return new Promise((Q,$)=>{var Z=new XMLHttpRequest;Z.open("GET",J,!0),Z.responseType="arraybuffer",Z.onload=()=>{if(Z.status==200||Z.status==0&&Z.response)$(Z.response);Q(Z.status)},Z.onerror=Q,Z.send(null)});return fetch(J,{credentials:"same-origin"}).then((Q)=>{if(Q.ok)return Q.arrayBuffer();return Promise.reject(Error(Q.status+" : "+Q.url))})}}}var out=X.print||console.log.bind(console),err=X.printErr||console.error.bind(console);if(Object.assign(X,moduleOverrides),moduleOverrides=null,X.arguments)arguments_=X.arguments;if(X.thisProgram)thisProgram=X.thisProgram;if(X.quit)quit_=X.quit;var dynamicLibraries=X.dynamicLibraries||[],wasmBinary;if(X.wasmBinary)wasmBinary=X.wasmBinary;var wasmMemory,ABORT=!1,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP_DATA_VIEW;function updateMemoryViews(){var J=wasmMemory.buffer;X.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(J),X.HEAP8=HEAP8=new Int8Array(J),X.HEAP16=HEAP16=new Int16Array(J),X.HEAPU8=HEAPU8=new Uint8Array(J),X.HEAPU16=HEAPU16=new Uint16Array(J),X.HEAP32=HEAP32=new Int32Array(J),X.HEAPU32=HEAPU32=new Uint32Array(J),X.HEAPF32=HEAPF32=new Float32Array(J),X.HEAPF64=HEAPF64=new Float64Array(J)}if(X.wasmMemory)wasmMemory=X.wasmMemory;else{var INITIAL_MEMORY=X.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews();var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function preRun(){if(X.preRun){if(typeof X.preRun=="function")X.preRun=[X.preRun];while(X.preRun.length)addOnPreRun(X.preRun.shift())}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(X.postRun){if(typeof X.postRun=="function")X.postRun=[X.postRun];while(X.postRun.length)addOnPostRun(X.postRun.shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(J){__ATPRERUN__.unshift(J)}function addOnInit(J){__ATINIT__.unshift(J)}function addOnPostRun(J){__ATPOSTRUN__.unshift(J)}var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(J){return J}function addRunDependency(J){runDependencies++,X.monitorRunDependencies?.(runDependencies)}function removeRunDependency(J){if(runDependencies--,X.monitorRunDependencies?.(runDependencies),runDependencies==0){if(runDependencyWatcher!==null)clearInterval(runDependencyWatcher),runDependencyWatcher=null;if(dependenciesFulfilled){var Q=dependenciesFulfilled;dependenciesFulfilled=null,Q()}}}function abort(J){X.onAbort?.(J),J="Aborted("+J+")",err(J),ABORT=!0,EXITSTATUS=1,J+=". Build with -sASSERTIONS for more info.";var Q=new WebAssembly.RuntimeError(J);throw Q}var dataURIPrefix="data:application/octet-stream;base64,",isDataURI=(J)=>J.startsWith(dataURIPrefix),isFileURI=(J)=>J.startsWith("file://");function findWasmBinary(){var J="tree-sitter.wasm";if(!isDataURI(J))return locateFile(J);return J}var wasmBinaryFile;function getBinarySync(J){if(J==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(J);throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(J){if(!wasmBinary)return readAsync(J).then((Q)=>new Uint8Array(Q),()=>getBinarySync(J));return Promise.resolve().then(()=>getBinarySync(J))}function instantiateArrayBuffer(J,Q,$){return getBinaryPromise(J).then((Z)=>WebAssembly.instantiate(Z,Q)).then($,(Z)=>{err(`failed to asynchronously prepare wasm: ${Z}`),abort(Z)})}function instantiateAsync(J,Q,$,Z){if(!J&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(Q)&&!isFileURI(Q)&&!zQ&&typeof fetch=="function")return fetch(Q,{credentials:"same-origin"}).then((Y)=>{var G=WebAssembly.instantiateStreaming(Y,$);return G.then(Z,function(K){return err(`wasm streaming compile failed: ${K}`),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(Q,$,Z)})});return instantiateArrayBuffer(Q,$,Z)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var J=getWasmImports();function Q(Z,Y){wasmExports=Z.exports,wasmExports=relocateExports(wasmExports,1024);var G=getDylinkMetadata(Y);if(G.neededDynlibs)dynamicLibraries=G.neededDynlibs.concat(dynamicLibraries);return mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),addOnInit(wasmExports.__wasm_call_ctors),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),removeRunDependency("wasm-instantiate"),wasmExports}addRunDependency("wasm-instantiate");function $(Z){Q(Z.instance,Z.module)}if(X.instantiateWasm)try{return X.instantiateWasm(J,Q)}catch(Z){return err(`Module.instantiateWasm callback failed with error: ${Z}`),!1}if(!wasmBinaryFile)wasmBinaryFile=findWasmBinary();return instantiateAsync(wasmBinary,wasmBinaryFile,J,$),{}}var ASM_CONSTS={};function ExitStatus(J){this.name="ExitStatus",this.message=`Program terminated with exit(${J})`,this.status=J}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(J,Q){var $=GOT[Q];if(!$)$=GOT[Q]=new WebAssembly.Global({value:"i32",mutable:!0});if(!currentModuleWeakSymbols.has(Q))$.required=!0;return $}},LE_HEAP_LOAD_F32=(J)=>HEAP_DATA_VIEW.getFloat32(J,!0),LE_HEAP_LOAD_F64=(J)=>HEAP_DATA_VIEW.getFloat64(J,!0),LE_HEAP_LOAD_I16=(J)=>HEAP_DATA_VIEW.getInt16(J,!0),LE_HEAP_LOAD_I32=(J)=>HEAP_DATA_VIEW.getInt32(J,!0),LE_HEAP_LOAD_U32=(J)=>HEAP_DATA_VIEW.getUint32(J,!0),LE_HEAP_STORE_F32=(J,Q)=>HEAP_DATA_VIEW.setFloat32(J,Q,!0),LE_HEAP_STORE_F64=(J,Q)=>HEAP_DATA_VIEW.setFloat64(J,Q,!0),LE_HEAP_STORE_I16=(J,Q)=>HEAP_DATA_VIEW.setInt16(J,Q,!0),LE_HEAP_STORE_I32=(J,Q)=>HEAP_DATA_VIEW.setInt32(J,Q,!0),LE_HEAP_STORE_U32=(J,Q)=>HEAP_DATA_VIEW.setUint32(J,Q,!0),callRuntimeCallbacks=(J)=>{while(J.length>0)J.shift()(X)},UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,UTF8ArrayToString=(J,Q,$)=>{var Z=Q+$,Y=Q;while(J[Y]&&!(Y>=Z))++Y;if(Y-Q>16&&J.buffer&&UTF8Decoder)return UTF8Decoder.decode(J.subarray(Q,Y));var G="";while(Q<Y){var K=J[Q++];if(!(K&128)){G+=String.fromCharCode(K);continue}var V=J[Q++]&63;if((K&224)==192){G+=String.fromCharCode((K&31)<<6|V);continue}var z=J[Q++]&63;if((K&240)==224)K=(K&15)<<12|V<<6|z;else K=(K&7)<<18|V<<12|z<<6|J[Q++]&63;if(K<65536)G+=String.fromCharCode(K);else{var q=K-65536;G+=String.fromCharCode(55296|q>>10,56320|q&1023)}}return G},getDylinkMetadata=(J)=>{var Q=0,$=0;function Z(){return J[Q++]}function Y(){var v=0,D=1;while(!0){var _=J[Q++];if(v+=(_&127)*D,D*=128,!(_&128))break}return v}function G(){var v=Y();return Q+=v,UTF8ArrayToString(J,Q-v,v)}function K(v,D){if(v)throw Error(D)}var V="dylink.0";if(J instanceof WebAssembly.Module){var z=WebAssembly.Module.customSections(J,V);if(z.length===0)V="dylink",z=WebAssembly.Module.customSections(J,V);K(z.length===0,"need dylink section"),J=new Uint8Array(z[0]),$=J.length}else{var q=new Uint32Array(new Uint8Array(J.subarray(0,24)).buffer),A=q[0]==1836278016||q[0]==6386541;K(!A,"need to see wasm magic number"),K(J[8]!==0,"need the dylink section to be first"),Q=9;var U=Y();$=Q+U,V=G()}var W={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(V=="dylink"){W.memorySize=Y(),W.memoryAlign=Y(),W.tableSize=Y(),W.tableAlign=Y();var T=Y();for(var F=0;F<T;++F){var H=G();W.neededDynlibs.push(H)}}else{K(V!=="dylink.0");var O=1,j=2,E=3,I=4,B=256,R=3,S=1;while(Q<$){var L=Z(),f=Y();if(L===O)W.memorySize=Y(),W.memoryAlign=Y(),W.tableSize=Y(),W.tableAlign=Y();else if(L===j){var T=Y();for(var F=0;F<T;++F)H=G(),W.neededDynlibs.push(H)}else if(L===E){var N=Y();while(N--){var b=G(),m=Y();if(m&B)W.tlsExports.add(b)}}else if(L===I){var N=Y();while(N--){var r=G(),b=G(),m=Y();if((m&R)==S)W.weakImports.add(b)}}else Q+=f}}return W};function getValue(J,Q="i8"){if(Q.endsWith("*"))Q="*";switch(Q){case"i1":return HEAP8[J];case"i8":return HEAP8[J];case"i16":return LE_HEAP_LOAD_I16((J>>1)*2);case"i32":return LE_HEAP_LOAD_I32((J>>2)*4);case"i64":abort("to do getValue(i64) use WASM_BIGINT");case"float":return LE_HEAP_LOAD_F32((J>>2)*4);case"double":return LE_HEAP_LOAD_F64((J>>3)*8);case"*":return LE_HEAP_LOAD_U32((J>>2)*4);default:abort(`invalid type for getValue: ${Q}`)}}var newDSO=(J,Q,$)=>{var Z={refcount:1/0,name:J,exports:$,global:!0};if(LDSO.loadedLibsByName[J]=Z,Q!=null)LDSO.loadedLibsByHandle[Q]=Z;return Z},LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78112,zeroMemory=(J,Q)=>{return HEAPU8.fill(0,J,J+Q),J},alignMemory=(J,Q)=>Math.ceil(J/Q)*Q,getMemory=(J)=>{if(runtimeInitialized)return zeroMemory(_malloc(J),J);var Q=___heap_base,$=Q+alignMemory(J,16);return ___heap_base=$,GOT.__heap_base.value=$,Q},isInternalSym=(J)=>["__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","__start_em_js","__stop_em_js"].includes(J)||J.startsWith("__em_js__"),uleb128Encode=(J,Q)=>{if(J<128)Q.push(J);else Q.push(J%128|128,J>>7)},sigToWasmTypes=(J)=>{var Q={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},$={parameters:[],results:J[0]=="v"?[]:[Q[J[0]]]};for(var Z=1;Z<J.length;++Z)$.parameters.push(Q[J[Z]]);return $},generateFuncType=(J,Q)=>{var $=J.slice(0,1),Z=J.slice(1),Y={i:127,p:127,j:126,f:125,d:124,e:111};Q.push(96),uleb128Encode(Z.length,Q);for(var G=0;G<Z.length;++G)Q.push(Y[Z[G]]);if($=="v")Q.push(0);else Q.push(1,Y[$])},convertJsFunctionToWasm=(J,Q)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(Q),J);var $=[1];generateFuncType(Q,$);var Z=[0,97,115,109,1,0,0,0,1];uleb128Encode($.length,Z),Z.push(...$),Z.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var Y=new WebAssembly.Module(new Uint8Array(Z)),G=new WebAssembly.Instance(Y,{e:{f:J}}),K=G.exports.f;return K},wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:28,element:"anyfunc"}),getWasmTableEntry=(J)=>{var Q=wasmTableMirror[J];if(!Q){if(J>=wasmTableMirror.length)wasmTableMirror.length=J+1;wasmTableMirror[J]=Q=wasmTable.get(J)}return Q},updateTableMap=(J,Q)=>{if(functionsInTableMap)for(var $=J;$<J+Q;$++){var Z=getWasmTableEntry($);if(Z)functionsInTableMap.set(Z,$)}},functionsInTableMap,getFunctionAddress=(J)=>{if(!functionsInTableMap)functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length);return functionsInTableMap.get(J)||0},freeTableIndexes=[],getEmptyTableSlot=()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(J){if(!(J instanceof RangeError))throw J;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1},setWasmTableEntry=(J,Q)=>{wasmTable.set(J,Q),wasmTableMirror[J]=wasmTable.get(J)},addFunction=(J,Q)=>{var $=getFunctionAddress(J);if($)return $;var Z=getEmptyTableSlot();try{setWasmTableEntry(Z,J)}catch(G){if(!(G instanceof TypeError))throw G;var Y=convertJsFunctionToWasm(J,Q);setWasmTableEntry(Z,Y)}return functionsInTableMap.set(J,Z),Z},updateGOT=(J,Q)=>{for(var $ in J){if(isInternalSym($))continue;var Z=J[$];if($.startsWith("orig$"))$=$.split("$")[1],Q=!0;if(GOT[$]||=new WebAssembly.Global({value:"i32",mutable:!0}),Q||GOT[$].value==0)if(typeof Z=="function")GOT[$].value=addFunction(Z);else if(typeof Z=="number")GOT[$].value=Z;else err(`unhandled export type for '${$}': ${typeof Z}`)}},relocateExports=(J,Q,$)=>{var Z={};for(var Y in J){var G=J[Y];if(typeof G=="object")G=G.value;if(typeof G=="number")G+=Q;Z[Y]=G}return updateGOT(Z,$),Z},isSymbolDefined=(J)=>{var Q=wasmImports[J];if(!Q||Q.stub)return!1;return!0},dynCallLegacy=(J,Q,$)=>{J=J.replace(/p/g,"i");var Z=X["dynCall_"+J];return Z(Q,...$)},dynCall=(J,Q,$=[])=>{if(J.includes("j"))return dynCallLegacy(J,Q,$);var Z=getWasmTableEntry(Q)(...$);return Z},stackSave=()=>_emscripten_stack_get_current(),stackRestore=(J)=>__emscripten_stack_restore(J),createInvokeFunction=(J)=>(Q,...$)=>{var Z=stackSave();try{return dynCall(J,Q,$)}catch(Y){if(stackRestore(Z),Y!==Y+0)throw Y;_setThrew(1,0)}},resolveGlobalSymbol=(J,Q=!1)=>{var $;if(Q&&"orig$"+J in wasmImports)J="orig$"+J;if(isSymbolDefined(J))$=wasmImports[J];else if(J.startsWith("invoke_"))$=wasmImports[J]=createInvokeFunction(J.split("_")[1]);return{sym:$,name:J}},UTF8ToString=(J,Q)=>J?UTF8ArrayToString(HEAPU8,J,Q):"",loadWebAssemblyModule=(binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);currentModuleWeakSymbols=metadata.weakImports;function loadModule(){var firstLoad=!handle||!HEAP8[handle+8];if(firstLoad){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;if(handle)HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize)}else memoryBase=LE_HEAP_LOAD_U32((handle+12>>2)*4),tableBase=LE_HEAP_LOAD_U32((handle+20>>2)*4);var tableGrowthNeeded=tableBase+metadata.tableSize-wasmTable.length;if(tableGrowthNeeded>0)wasmTable.grow(tableGrowthNeeded);var moduleExports;function resolveSymbol(J){var Q=resolveGlobalSymbol(J).sym;if(!Q&&localScope)Q=localScope[J];if(!Q)Q=moduleExports[J];return Q}var proxyHandler={get(J,Q){switch(Q){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(Q in wasmImports&&!wasmImports[Q].stub)return wasmImports[Q];if(!(Q in J)){var $;J[Q]=(...Z)=>{return $||=resolveSymbol(Q),$(...Z)}}return J[Q]}},proxy=new Proxy({},proxyHandler),info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),!flags.allowUndefined)reportUndefinedSymbols();function addEmAsm(addr,body){var args=[],arity=0;for(;arity<16;arity++)if(body.indexOf("$"+arity)!=-1)args.push("$"+arity);else break;args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports){var{__start_em_asm:start,__stop_em_asm:stop}=moduleExports;while(start<stop){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;if(applyRelocs)if(runtimeInitialized)applyRelocs();else __RELOC_FUNCS__.push(applyRelocs);var init=moduleExports.__wasm_call_ctors;if(init)if(runtimeInitialized)init();else __ATINIT__.push(init);return moduleExports}if(flags.loadAsync){if(binary instanceof WebAssembly.Module){var instance=new WebAssembly.Instance(binary,info);return Promise.resolve(postInstantiation(binary,instance))}return WebAssembly.instantiate(binary,info).then((J)=>postInstantiation(J.module,J.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}if(flags.loadAsync)return metadata.neededDynlibs.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,flags,localScope)),Promise.resolve()).then(loadModule);return metadata.neededDynlibs.forEach((J)=>loadDynamicLibrary(J,flags,localScope)),loadModule()},mergeLibSymbols=(J,Q)=>{for(var[$,Z]of Object.entries(J)){let Y=(K)=>{if(!isSymbolDefined(K))wasmImports[K]=Z};Y($);let G="__main_argc_argv";if($=="main")Y(G);if($==G)Y("main");if($.startsWith("dynCall_")&&!X.hasOwnProperty($))X[$]=Z}},asyncLoad=(J,Q,$,Z)=>{var Y=!Z?getUniqueRunDependency(`al ${J}`):"";if(readAsync(J).then((G)=>{if(Q(new Uint8Array(G)),Y)removeRunDependency(Y)},(G)=>{if($)$();else throw`Loading data file "${J}" failed.`}),Y)addRunDependency(Y)};function loadDynamicLibrary(J,Q={global:!0,nodelete:!0},$,Z){var Y=LDSO.loadedLibsByName[J];if(Y){if(!Q.global){if($)Object.assign($,Y.exports)}else if(!Y.global)Y.global=!0,mergeLibSymbols(Y.exports,J);if(Q.nodelete&&Y.refcount!==1/0)Y.refcount=1/0;if(Y.refcount++,Z)LDSO.loadedLibsByHandle[Z]=Y;return Q.loadAsync?Promise.resolve(!0):!0}Y=newDSO(J,Z,"loading"),Y.refcount=Q.nodelete?1/0:1,Y.global=Q.global;function G(){if(Z){var z=LE_HEAP_LOAD_U32((Z+28>>2)*4),q=LE_HEAP_LOAD_U32((Z+32>>2)*4);if(z&&q){var A=HEAP8.slice(z,z+q);return Q.loadAsync?Promise.resolve(A):A}}var U=locateFile(J);if(Q.loadAsync)return new Promise(function(W,T){asyncLoad(U,W,T)});if(!readBinary)throw Error(`${U}: file not found, and synchronous loading of external files is not available`);return readBinary(U)}function K(){if(Q.loadAsync)return G().then((z)=>loadWebAssemblyModule(z,Q,J,$,Z));return loadWebAssemblyModule(G(),Q,J,$,Z)}function V(z){if(Y.global)mergeLibSymbols(z,J);else if($)Object.assign($,z);Y.exports=z}if(Q.loadAsync)return K().then((z)=>{return V(z),!0});return V(K()),!0}var reportUndefinedSymbols=()=>{for(var[J,Q]of Object.entries(GOT))if(Q.value==0){var $=resolveGlobalSymbol(J,!0).sym;if(!$&&!Q.required)continue;if(typeof $=="function")Q.value=addFunction($,$.sig);else if(typeof $=="number")Q.value=$;else throw Error(`bad export type for '${J}': ${typeof $}`)}},loadDylibs=()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs"),dynamicLibraries.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})},noExitRuntime=X.noExitRuntime||!0;function setValue(J,Q,$="i8"){if($.endsWith("*"))$="*";switch($){case"i1":HEAP8[J]=Q;break;case"i8":HEAP8[J]=Q;break;case"i16":LE_HEAP_STORE_I16((J>>1)*2,Q);break;case"i32":LE_HEAP_STORE_I32((J>>2)*4,Q);break;case"i64":abort("to do setValue(i64) use WASM_BIGINT");case"float":LE_HEAP_STORE_F32((J>>2)*4,Q);break;case"double":LE_HEAP_STORE_F64((J>>3)*8,Q);break;case"*":LE_HEAP_STORE_U32((J>>2)*4,Q);break;default:abort(`invalid type for setValue: ${$}`)}}var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78112),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=()=>{abort("")};__abort_js.sig="v";var nowIsMonotonic=1,__emscripten_get_now_is_monotonic=()=>nowIsMonotonic;__emscripten_get_now_is_monotonic.sig="i";var __emscripten_memcpy_js=(J,Q,$)=>HEAPU8.copyWithin(J,Q,Q+$);__emscripten_memcpy_js.sig="vppp";var _emscripten_date_now=()=>Date.now();_emscripten_date_now.sig="d";var _emscripten_get_now=()=>performance.now();_emscripten_get_now.sig="d";var getHeapMax=()=>2147483648,growMemory=(J)=>{var Q=wasmMemory.buffer,$=(J-Q.byteLength+65535)/65536;try{return wasmMemory.grow($),updateMemoryViews(),1}catch(Z){}},_emscripten_resize_heap=(J)=>{var Q=HEAPU8.length;J>>>=0;var $=getHeapMax();if(J>$)return!1;var Z=(z,q)=>z+(q-z%q)%q;for(var Y=1;Y<=4;Y*=2){var G=Q*(1+0.2/Y);G=Math.min(G,J+100663296);var K=Math.min($,Z(Math.max(J,G),65536)),V=growMemory(K);if(V)return!0}return!1};_emscripten_resize_heap.sig="ip";var _fd_close=(J)=>52;_fd_close.sig="ii";var convertI32PairToI53Checked=(J,Q)=>Q+2097152>>>0<4194305-!!J?(J>>>0)+Q*4294967296:NaN;function _fd_seek(J,Q,$,Z,Y){var G=convertI32PairToI53Checked(Q,$);return 70}_fd_seek.sig="iiiiip";var printCharBuffers=[null,[],[]],printChar=(J,Q)=>{var $=printCharBuffers[J];if(Q===0||Q===10)(J===1?out:err)(UTF8ArrayToString($,0)),$.length=0;else $.push(Q)},_fd_write=(J,Q,$,Z)=>{var Y=0;for(var G=0;G<$;G++){var K=LE_HEAP_LOAD_U32((Q>>2)*4),V=LE_HEAP_LOAD_U32((Q+4>>2)*4);Q+=8;for(var z=0;z<V;z++)printChar(J,HEAPU8[K+z]);Y+=V}return LE_HEAP_STORE_U32((Z>>2)*4,Y),0};_fd_write.sig="iippp";function _tree_sitter_log_callback(J,Q){if(currentLogCallback){let $=UTF8ToString(Q);currentLogCallback($,J!==0)}}function _tree_sitter_parse_callback(J,Q,$,Z,Y){let K=currentParseCallback(Q,{row:$,column:Z});if(typeof K==="string")setValue(Y,K.length,"i32"),stringToUTF16(K,J,10240);else setValue(Y,0,"i32")}var runtimeKeepaliveCounter=0,keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0,_proc_exit=(J)=>{if(EXITSTATUS=J,!keepRuntimeAlive())X.onExit?.(J),ABORT=!0;quit_(J,new ExitStatus(J))};_proc_exit.sig="vi";var exitJS=(J,Q)=>{EXITSTATUS=J,_proc_exit(J)},handleException=(J)=>{if(J instanceof ExitStatus||J=="unwind")return EXITSTATUS;quit_(1,J)},lengthBytesUTF8=(J)=>{var Q=0;for(var $=0;$<J.length;++$){var Z=J.charCodeAt($);if(Z<=127)Q++;else if(Z<=2047)Q+=2;else if(Z>=55296&&Z<=57343)Q+=4,++$;else Q+=3}return Q},stringToUTF8Array=(J,Q,$,Z)=>{if(!(Z>0))return 0;var Y=$,G=$+Z-1;for(var K=0;K<J.length;++K){var V=J.charCodeAt(K);if(V>=55296&&V<=57343){var z=J.charCodeAt(++K);V=65536+((V&1023)<<10)|z&1023}if(V<=127){if($>=G)break;Q[$++]=V}else if(V<=2047){if($+1>=G)break;Q[$++]=192|V>>6,Q[$++]=128|V&63}else if(V<=65535){if($+2>=G)break;Q[$++]=224|V>>12,Q[$++]=128|V>>6&63,Q[$++]=128|V&63}else{if($+3>=G)break;Q[$++]=240|V>>18,Q[$++]=128|V>>12&63,Q[$++]=128|V>>6&63,Q[$++]=128|V&63}}return Q[$]=0,$-Y},stringToUTF8=(J,Q,$)=>stringToUTF8Array(J,HEAPU8,Q,$),stackAlloc=(J)=>__emscripten_stack_alloc(J),stringToUTF8OnStack=(J)=>{var Q=lengthBytesUTF8(J)+1,$=stackAlloc(Q);return stringToUTF8(J,$,Q),$},stringToUTF16=(J,Q,$)=>{if($??=2147483647,$<2)return 0;$-=2;var Z=Q,Y=$<J.length*2?$/2:J.length;for(var G=0;G<Y;++G){var K=J.charCodeAt(G);LE_HEAP_STORE_I16((Q>>1)*2,K),Q+=2}return LE_HEAP_STORE_I16((Q>>1)*2,0),Q-Z},AsciiToString=(J)=>{var Q="";while(!0){var $=HEAPU8[J++];if(!$)return Q;Q+=String.fromCharCode($)}},wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,_emscripten_get_now_is_monotonic:__emscripten_get_now_is_monotonic,_emscripten_memcpy_js:__emscripten_memcpy_js,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,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},wasmExports=createWasm(),___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports.__wasm_call_ctors)(),___wasm_apply_data_relocs=()=>(___wasm_apply_data_relocs=wasmExports.__wasm_apply_data_relocs)(),_malloc=X._malloc=(J)=>(_malloc=X._malloc=wasmExports.malloc)(J),_calloc=X._calloc=(J,Q)=>(_calloc=X._calloc=wasmExports.calloc)(J,Q),_realloc=X._realloc=(J,Q)=>(_realloc=X._realloc=wasmExports.realloc)(J,Q),_free=X._free=(J)=>(_free=X._free=wasmExports.free)(J),_ts_language_symbol_count=X._ts_language_symbol_count=(J)=>(_ts_language_symbol_count=X._ts_language_symbol_count=wasmExports.ts_language_symbol_count)(J),_ts_language_state_count=X._ts_language_state_count=(J)=>(_ts_language_state_count=X._ts_language_state_count=wasmExports.ts_language_state_count)(J),_ts_language_version=X._ts_language_version=(J)=>(_ts_language_version=X._ts_language_version=wasmExports.ts_language_version)(J),_ts_language_field_count=X._ts_language_field_count=(J)=>(_ts_language_field_count=X._ts_language_field_count=wasmExports.ts_language_field_count)(J),_ts_language_next_state=X._ts_language_next_state=(J,Q,$)=>(_ts_language_next_state=X._ts_language_next_state=wasmExports.ts_language_next_state)(J,Q,$),_ts_language_symbol_name=X._ts_language_symbol_name=(J,Q)=>(_ts_language_symbol_name=X._ts_language_symbol_name=wasmExports.ts_language_symbol_name)(J,Q),_ts_language_symbol_for_name=X._ts_language_symbol_for_name=(J,Q,$,Z)=>(_ts_language_symbol_for_name=X._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name)(J,Q,$,Z),_strncmp=X._strncmp=(J,Q,$)=>(_strncmp=X._strncmp=wasmExports.strncmp)(J,Q,$),_ts_language_symbol_type=X._ts_language_symbol_type=(J,Q)=>(_ts_language_symbol_type=X._ts_language_symbol_type=wasmExports.ts_language_symbol_type)(J,Q),_ts_language_field_name_for_id=X._ts_language_field_name_for_id=(J,Q)=>(_ts_language_field_name_for_id=X._ts_language_field_name_for_id=wasmExports.ts_language_field_name_for_id)(J,Q),_ts_lookahead_iterator_new=X._ts_lookahead_iterator_new=(J,Q)=>(_ts_lookahead_iterator_new=X._ts_lookahead_iterator_new=wasmExports.ts_lookahead_iterator_new)(J,Q),_ts_lookahead_iterator_delete=X._ts_lookahead_iterator_delete=(J)=>(_ts_lookahead_iterator_delete=X._ts_lookahead_iterator_delete=wasmExports.ts_lookahead_iterator_delete)(J),_ts_lookahead_iterator_reset_state=X._ts_lookahead_iterator_reset_state=(J,Q)=>(_ts_lookahead_iterator_reset_state=X._ts_lookahead_iterator_reset_state=wasmExports.ts_lookahead_iterator_reset_state)(J,Q),_ts_lookahead_iterator_reset=X._ts_lookahead_iterator_reset=(J,Q,$)=>(_ts_lookahead_iterator_reset=X._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset)(J,Q,$),_ts_lookahead_iterator_next=X._ts_lookahead_iterator_next=(J)=>(_ts_lookahead_iterator_next=X._ts_lookahead_iterator_next=wasmExports.ts_lookahead_iterator_next)(J),_ts_lookahead_iterator_current_symbol=X._ts_lookahead_iterator_current_symbol=(J)=>(_ts_lookahead_iterator_current_symbol=X._ts_lookahead_iterator_current_symbol=wasmExports.ts_lookahead_iterator_current_symbol)(J),_memset=X._memset=(J,Q,$)=>(_memset=X._memset=wasmExports.memset)(J,Q,$),_memcpy=X._memcpy=(J,Q,$)=>(_memcpy=X._memcpy=wasmExports.memcpy)(J,Q,$),_ts_parser_delete=X._ts_parser_delete=(J)=>(_ts_parser_delete=X._ts_parser_delete=wasmExports.ts_parser_delete)(J),_ts_parser_reset=X._ts_parser_reset=(J)=>(_ts_parser_reset=X._ts_parser_reset=wasmExports.ts_parser_reset)(J),_ts_parser_set_language=X._ts_parser_set_language=(J,Q)=>(_ts_parser_set_language=X._ts_parser_set_language=wasmExports.ts_parser_set_language)(J,Q),_ts_parser_timeout_micros=X._ts_parser_timeout_micros=(J)=>(_ts_parser_timeout_micros=X._ts_parser_timeout_micros=wasmExports.ts_parser_timeout_micros)(J),_ts_parser_set_timeout_micros=X._ts_parser_set_timeout_micros=(J,Q,$)=>(_ts_parser_set_timeout_micros=X._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros)(J,Q,$),_ts_parser_set_included_ranges=X._ts_parser_set_included_ranges=(J,Q,$)=>(_ts_parser_set_included_ranges=X._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges)(J,Q,$),_memmove=X._memmove=(J,Q,$)=>(_memmove=X._memmove=wasmExports.memmove)(J,Q,$),_memcmp=X._memcmp=(J,Q,$)=>(_memcmp=X._memcmp=wasmExports.memcmp)(J,Q,$),_ts_query_new=X._ts_query_new=(J,Q,$,Z,Y)=>(_ts_query_new=X._ts_query_new=wasmExports.ts_query_new)(J,Q,$,Z,Y),_ts_query_delete=X._ts_query_delete=(J)=>(_ts_query_delete=X._ts_query_delete=wasmExports.ts_query_delete)(J),_iswspace=X._iswspace=(J)=>(_iswspace=X._iswspace=wasmExports.iswspace)(J),_iswalnum=X._iswalnum=(J)=>(_iswalnum=X._iswalnum=wasmExports.iswalnum)(J),_ts_query_pattern_count=X._ts_query_pattern_count=(J)=>(_ts_query_pattern_count=X._ts_query_pattern_count=wasmExports.ts_query_pattern_count)(J),_ts_query_capture_count=X._ts_query_capture_count=(J)=>(_ts_query_capture_count=X._ts_query_capture_count=wasmExports.ts_query_capture_count)(J),_ts_query_string_count=X._ts_query_string_count=(J)=>(_ts_query_string_count=X._ts_query_string_count=wasmExports.ts_query_string_count)(J),_ts_query_capture_name_for_id=X._ts_query_capture_name_for_id=(J,Q,$)=>(_ts_query_capture_name_for_id=X._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id)(J,Q,$),_ts_query_string_value_for_id=X._ts_query_string_value_for_id=(J,Q,$)=>(_ts_query_string_value_for_id=X._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id)(J,Q,$),_ts_query_predicates_for_pattern=X._ts_query_predicates_for_pattern=(J,Q,$)=>(_ts_query_predicates_for_pattern=X._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern)(J,Q,$),_ts_query_disable_capture=X._ts_query_disable_capture=(J,Q,$)=>(_ts_query_disable_capture=X._ts_query_disable_capture=wasmExports.ts_query_disable_capture)(J,Q,$),_ts_tree_copy=X._ts_tree_copy=(J)=>(_ts_tree_copy=X._ts_tree_copy=wasmExports.ts_tree_copy)(J),_ts_tree_delete=X._ts_tree_delete=(J)=>(_ts_tree_delete=X._ts_tree_delete=wasmExports.ts_tree_delete)(J),_ts_init=X._ts_init=()=>(_ts_init=X._ts_init=wasmExports.ts_init)(),_ts_parser_new_wasm=X._ts_parser_new_wasm=()=>(_ts_parser_new_wasm=X._ts_parser_new_wasm=wasmExports.ts_parser_new_wasm)(),_ts_parser_enable_logger_wasm=X._ts_parser_enable_logger_wasm=(J,Q)=>(_ts_parser_enable_logger_wasm=X._ts_parser_enable_logger_wasm=wasmExports.ts_parser_enable_logger_wasm)(J,Q),_ts_parser_parse_wasm=X._ts_parser_parse_wasm=(J,Q,$,Z,Y)=>(_ts_parser_parse_wasm=X._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm)(J,Q,$,Z,Y),_ts_parser_included_ranges_wasm=X._ts_parser_included_ranges_wasm=(J)=>(_ts_parser_included_ranges_wasm=X._ts_parser_included_ranges_wasm=wasmExports.ts_parser_included_ranges_wasm)(J),_ts_language_type_is_named_wasm=X._ts_language_type_is_named_wasm=(J,Q)=>(_ts_language_type_is_named_wasm=X._ts_language_type_is_named_wasm=wasmExports.ts_language_type_is_named_wasm)(J,Q),_ts_language_type_is_visible_wasm=X._ts_language_type_is_visible_wasm=(J,Q)=>(_ts_language_type_is_visible_wasm=X._ts_language_type_is_visible_wasm=wasmExports.ts_language_type_is_visible_wasm)(J,Q),_ts_tree_root_node_wasm=X._ts_tree_root_node_wasm=(J)=>(_ts_tree_root_node_wasm=X._ts_tree_root_node_wasm=wasmExports.ts_tree_root_node_wasm)(J),_ts_tree_root_node_with_offset_wasm=X._ts_tree_root_node_with_offset_wasm=(J)=>(_ts_tree_root_node_with_offset_wasm=X._ts_tree_root_node_with_offset_wasm=wasmExports.ts_tree_root_node_with_offset_wasm)(J),_ts_tree_edit_wasm=X._ts_tree_edit_wasm=(J)=>(_ts_tree_edit_wasm=X._ts_tree_edit_wasm=wasmExports.ts_tree_edit_wasm)(J),_ts_tree_included_ranges_wasm=X._ts_tree_included_ranges_wasm=(J)=>(_ts_tree_included_ranges_wasm=X._ts_tree_included_ranges_wasm=wasmExports.ts_tree_included_ranges_wasm)(J),_ts_tree_get_changed_ranges_wasm=X._ts_tree_get_changed_ranges_wasm=(J,Q)=>(_ts_tree_get_changed_ranges_wasm=X._ts_tree_get_changed_ranges_wasm=wasmExports.ts_tree_get_changed_ranges_wasm)(J,Q),_ts_tree_cursor_new_wasm=X._ts_tree_cursor_new_wasm=(J)=>(_ts_tree_cursor_new_wasm=X._ts_tree_cursor_new_wasm=wasmExports.ts_tree_cursor_new_wasm)(J),_ts_tree_cursor_delete_wasm=X._ts_tree_cursor_delete_wasm=(J)=>(_ts_tree_cursor_delete_wasm=X._ts_tree_cursor_delete_wasm=wasmExports.ts_tree_cursor_delete_wasm)(J),_ts_tree_cursor_reset_wasm=X._ts_tree_cursor_reset_wasm=(J)=>(_ts_tree_cursor_reset_wasm=X._ts_tree_cursor_reset_wasm=wasmExports.ts_tree_cursor_reset_wasm)(J),_ts_tree_cursor_reset_to_wasm=X._ts_tree_cursor_reset_to_wasm=(J,Q)=>(_ts_tree_cursor_reset_to_wasm=X._ts_tree_cursor_reset_to_wasm=wasmExports.ts_tree_cursor_reset_to_wasm)(J,Q),_ts_tree_cursor_goto_first_child_wasm=X._ts_tree_cursor_goto_first_child_wasm=(J)=>(_ts_tree_cursor_goto_first_child_wasm=X._ts_tree_cursor_goto_first_child_wasm=wasmExports.ts_tree_cursor_goto_first_child_wasm)(J),_ts_tree_cursor_goto_last_child_wasm=X._ts_tree_cursor_goto_last_child_wasm=(J)=>(_ts_tree_cursor_goto_last_child_wasm=X._ts_tree_cursor_goto_last_child_wasm=wasmExports.ts_tree_cursor_goto_last_child_wasm)(J),_ts_tree_cursor_goto_first_child_for_index_wasm=X._ts_tree_cursor_goto_first_child_for_index_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_index_wasm=X._ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm)(J),_ts_tree_cursor_goto_first_child_for_position_wasm=X._ts_tree_cursor_goto_first_child_for_position_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_position_wasm=X._ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm)(J),_ts_tree_cursor_goto_next_sibling_wasm=X._ts_tree_cursor_goto_next_sibling_wasm=(J)=>(_ts_tree_cursor_goto_next_sibling_wasm=X._ts_tree_cursor_goto_next_sibling_wasm=wasmExports.ts_tree_cursor_goto_next_sibling_wasm)(J),_ts_tree_cursor_goto_previous_sibling_wasm=X._ts_tree_cursor_goto_previous_sibling_wasm=(J)=>(_ts_tree_cursor_goto_previous_sibling_wasm=X._ts_tree_cursor_goto_previous_sibling_wasm=wasmExports.ts_tree_cursor_goto_previous_sibling_wasm)(J),_ts_tree_cursor_goto_descendant_wasm=X._ts_tree_cursor_goto_descendant_wasm=(J,Q)=>(_ts_tree_cursor_goto_descendant_wasm=X._ts_tree_cursor_goto_descendant_wasm=wasmExports.ts_tree_cursor_goto_descendant_wasm)(J,Q),_ts_tree_cursor_goto_parent_wasm=X._ts_tree_cursor_goto_parent_wasm=(J)=>(_ts_tree_cursor_goto_parent_wasm=X._ts_tree_cursor_goto_parent_wasm=wasmExports.ts_tree_cursor_goto_parent_wasm)(J),_ts_tree_cursor_current_node_type_id_wasm=X._ts_tree_cursor_current_node_type_id_wasm=(J)=>(_ts_tree_cursor_current_node_type_id_wasm=X._ts_tree_cursor_current_node_type_id_wasm=wasmExports.ts_tree_cursor_current_node_type_id_wasm)(J),_ts_tree_cursor_current_node_state_id_wasm=X._ts_tree_cursor_current_node_state_id_wasm=(J)=>(_ts_tree_cursor_current_node_state_id_wasm=X._ts_tree_cursor_current_node_state_id_wasm=wasmExports.ts_tree_cursor_current_node_state_id_wasm)(J),_ts_tree_cursor_current_node_is_named_wasm=X._ts_tree_cursor_current_node_is_named_wasm=(J)=>(_ts_tree_cursor_current_node_is_named_wasm=X._ts_tree_cursor_current_node_is_named_wasm=wasmExports.ts_tree_cursor_current_node_is_named_wasm)(J),_ts_tree_cursor_current_node_is_missing_wasm=X._ts_tree_cursor_current_node_is_missing_wasm=(J)=>(_ts_tree_cursor_current_node_is_missing_wasm=X._ts_tree_cursor_current_node_is_missing_wasm=wasmExports.ts_tree_cursor_current_node_is_missing_wasm)(J),_ts_tree_cursor_current_node_id_wasm=X._ts_tree_cursor_current_node_id_wasm=(J)=>(_ts_tree_cursor_current_node_id_wasm=X._ts_tree_cursor_current_node_id_wasm=wasmExports.ts_tree_cursor_current_node_id_wasm)(J),_ts_tree_cursor_start_position_wasm=X._ts_tree_cursor_start_position_wasm=(J)=>(_ts_tree_cursor_start_position_wasm=X._ts_tree_cursor_start_position_wasm=wasmExports.ts_tree_cursor_start_position_wasm)(J),_ts_tree_cursor_end_position_wasm=X._ts_tree_cursor_end_position_wasm=(J)=>(_ts_tree_cursor_end_position_wasm=X._ts_tree_cursor_end_position_wasm=wasmExports.ts_tree_cursor_end_position_wasm)(J),_ts_tree_cursor_start_index_wasm=X._ts_tree_cursor_start_index_wasm=(J)=>(_ts_tree_cursor_start_index_wasm=X._ts_tree_cursor_start_index_wasm=wasmExports.ts_tree_cursor_start_index_wasm)(J),_ts_tree_cursor_end_index_wasm=X._ts_tree_cursor_end_index_wasm=(J)=>(_ts_tree_cursor_end_index_wasm=X._ts_tree_cursor_end_index_wasm=wasmExports.ts_tree_cursor_end_index_wasm)(J),_ts_tree_cursor_current_field_id_wasm=X._ts_tree_cursor_current_field_id_wasm=(J)=>(_ts_tree_cursor_current_field_id_wasm=X._ts_tree_cursor_current_field_id_wasm=wasmExports.ts_tree_cursor_current_field_id_wasm)(J),_ts_tree_cursor_current_depth_wasm=X._ts_tree_cursor_current_depth_wasm=(J)=>(_ts_tree_cursor_current_depth_wasm=X._ts_tree_cursor_current_depth_wasm=wasmExports.ts_tree_cursor_current_depth_wasm)(J),_ts_tree_cursor_current_descendant_index_wasm=X._ts_tree_cursor_current_descendant_index_wasm=(J)=>(_ts_tree_cursor_current_descendant_index_wasm=X._ts_tree_cursor_current_descendant_index_wasm=wasmExports.ts_tree_cursor_current_descendant_index_wasm)(J),_ts_tree_cursor_current_node_wasm=X._ts_tree_cursor_current_node_wasm=(J)=>(_ts_tree_cursor_current_node_wasm=X._ts_tree_cursor_current_node_wasm=wasmExports.ts_tree_cursor_current_node_wasm)(J),_ts_node_symbol_wasm=X._ts_node_symbol_wasm=(J)=>(_ts_node_symbol_wasm=X._ts_node_symbol_wasm=wasmExports.ts_node_symbol_wasm)(J),_ts_node_field_name_for_child_wasm=X._ts_node_field_name_for_child_wasm=(J,Q)=>(_ts_node_field_name_for_child_wasm=X._ts_node_field_name_for_child_wasm=wasmExports.ts_node_field_name_for_child_wasm)(J,Q),_ts_node_children_by_field_id_wasm=X._ts_node_children_by_field_id_wasm=(J,Q)=>(_ts_node_children_by_field_id_wasm=X._ts_node_children_by_field_id_wasm=wasmExports.ts_node_children_by_field_id_wasm)(J,Q),_ts_node_first_child_for_byte_wasm=X._ts_node_first_child_for_byte_wasm=(J)=>(_ts_node_first_child_for_byte_wasm=X._ts_node_first_child_for_byte_wasm=wasmExports.ts_node_first_child_for_byte_wasm)(J),_ts_node_first_named_child_for_byte_wasm=X._ts_node_first_named_child_for_byte_wasm=(J)=>(_ts_node_first_named_child_for_byte_wasm=X._ts_node_first_named_child_for_byte_wasm=wasmExports.ts_node_first_named_child_for_byte_wasm)(J),_ts_node_grammar_symbol_wasm=X._ts_node_grammar_symbol_wasm=(J)=>(_ts_node_grammar_symbol_wasm=X._ts_node_grammar_symbol_wasm=wasmExports.ts_node_grammar_symbol_wasm)(J),_ts_node_child_count_wasm=X._ts_node_child_count_wasm=(J)=>(_ts_node_child_count_wasm=X._ts_node_child_count_wasm=wasmExports.ts_node_child_count_wasm)(J),_ts_node_named_child_count_wasm=X._ts_node_named_child_count_wasm=(J)=>(_ts_node_named_child_count_wasm=X._ts_node_named_child_count_wasm=wasmExports.ts_node_named_child_count_wasm)(J),_ts_node_child_wasm=X._ts_node_child_wasm=(J,Q)=>(_ts_node_child_wasm=X._ts_node_child_wasm=wasmExports.ts_node_child_wasm)(J,Q),_ts_node_named_child_wasm=X._ts_node_named_child_wasm=(J,Q)=>(_ts_node_named_child_wasm=X._ts_node_named_child_wasm=wasmExports.ts_node_named_child_wasm)(J,Q),_ts_node_child_by_field_id_wasm=X._ts_node_child_by_field_id_wasm=(J,Q)=>(_ts_node_child_by_field_id_wasm=X._ts_node_child_by_field_id_wasm=wasmExports.ts_node_child_by_field_id_wasm)(J,Q),_ts_node_next_sibling_wasm=X._ts_node_next_sibling_wasm=(J)=>(_ts_node_next_sibling_wasm=X._ts_node_next_sibling_wasm=wasmExports.ts_node_next_sibling_wasm)(J),_ts_node_prev_sibling_wasm=X._ts_node_prev_sibling_wasm=(J)=>(_ts_node_prev_sibling_wasm=X._ts_node_prev_sibling_wasm=wasmExports.ts_node_prev_sibling_wasm)(J),_ts_node_next_named_sibling_wasm=X._ts_node_next_named_sibling_wasm=(J)=>(_ts_node_next_named_sibling_wasm=X._ts_node_next_named_sibling_wasm=wasmExports.ts_node_next_named_sibling_wasm)(J),_ts_node_prev_named_sibling_wasm=X._ts_node_prev_named_sibling_wasm=(J)=>(_ts_node_prev_named_sibling_wasm=X._ts_node_prev_named_sibling_wasm=wasmExports.ts_node_prev_named_sibling_wasm)(J),_ts_node_descendant_count_wasm=X._ts_node_descendant_count_wasm=(J)=>(_ts_node_descendant_count_wasm=X._ts_node_descendant_count_wasm=wasmExports.ts_node_descendant_count_wasm)(J),_ts_node_parent_wasm=X._ts_node_parent_wasm=(J)=>(_ts_node_parent_wasm=X._ts_node_parent_wasm=wasmExports.ts_node_parent_wasm)(J),_ts_node_descendant_for_index_wasm=X._ts_node_descendant_for_index_wasm=(J)=>(_ts_node_descendant_for_index_wasm=X._ts_node_descendant_for_index_wasm=wasmExports.ts_node_descendant_for_index_wasm)(J),_ts_node_named_descendant_for_index_wasm=X._ts_node_named_descendant_for_index_wasm=(J)=>(_ts_node_named_descendant_for_index_wasm=X._ts_node_named_descendant_for_index_wasm=wasmExports.ts_node_named_descendant_for_index_wasm)(J),_ts_node_descendant_for_position_wasm=X._ts_node_descendant_for_position_wasm=(J)=>(_ts_node_descendant_for_position_wasm=X._ts_node_descendant_for_position_wasm=wasmExports.ts_node_descendant_for_position_wasm)(J),_ts_node_named_descendant_for_position_wasm=X._ts_node_named_descendant_for_position_wasm=(J)=>(_ts_node_named_descendant_for_position_wasm=X._ts_node_named_descendant_for_position_wasm=wasmExports.ts_node_named_descendant_for_position_wasm)(J),_ts_node_start_point_wasm=X._ts_node_start_point_wasm=(J)=>(_ts_node_start_point_wasm=X._ts_node_start_point_wasm=wasmExports.ts_node_start_point_wasm)(J),_ts_node_end_point_wasm=X._ts_node_end_point_wasm=(J)=>(_ts_node_end_point_wasm=X._ts_node_end_point_wasm=wasmExports.ts_node_end_point_wasm)(J),_ts_node_start_index_wasm=X._ts_node_start_index_wasm=(J)=>(_ts_node_start_index_wasm=X._ts_node_start_index_wasm=wasmExports.ts_node_start_index_wasm)(J),_ts_node_end_index_wasm=X._ts_node_end_index_wasm=(J)=>(_ts_node_end_index_wasm=X._ts_node_end_index_wasm=wasmExports.ts_node_end_index_wasm)(J),_ts_node_to_string_wasm=X._ts_node_to_string_wasm=(J)=>(_ts_node_to_string_wasm=X._ts_node_to_string_wasm=wasmExports.ts_node_to_string_wasm)(J),_ts_node_children_wasm=X._ts_node_children_wasm=(J)=>(_ts_node_children_wasm=X._ts_node_children_wasm=wasmExports.ts_node_children_wasm)(J),_ts_node_named_children_wasm=X._ts_node_named_children_wasm=(J)=>(_ts_node_named_children_wasm=X._ts_node_named_children_wasm=wasmExports.ts_node_named_children_wasm)(J),_ts_node_descendants_of_type_wasm=X._ts_node_descendants_of_type_wasm=(J,Q,$,Z,Y,G,K)=>(_ts_node_descendants_of_type_wasm=X._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm)(J,Q,$,Z,Y,G,K),_ts_node_is_named_wasm=X._ts_node_is_named_wasm=(J)=>(_ts_node_is_named_wasm=X._ts_node_is_named_wasm=wasmExports.ts_node_is_named_wasm)(J),_ts_node_has_changes_wasm=X._ts_node_has_changes_wasm=(J)=>(_ts_node_has_changes_wasm=X._ts_node_has_changes_wasm=wasmExports.ts_node_has_changes_wasm)(J),_ts_node_has_error_wasm=X._ts_node_has_error_wasm=(J)=>(_ts_node_has_error_wasm=X._ts_node_has_error_wasm=wasmExports.ts_node_has_error_wasm)(J),_ts_node_is_error_wasm=X._ts_node_is_error_wasm=(J)=>(_ts_node_is_error_wasm=X._ts_node_is_error_wasm=wasmExports.ts_node_is_error_wasm)(J),_ts_node_is_missing_wasm=X._ts_node_is_missing_wasm=(J)=>(_ts_node_is_missing_wasm=X._ts_node_is_missing_wasm=wasmExports.ts_node_is_missing_wasm)(J),_ts_node_is_extra_wasm=X._ts_node_is_extra_wasm=(J)=>(_ts_node_is_extra_wasm=X._ts_node_is_extra_wasm=wasmExports.ts_node_is_extra_wasm)(J),_ts_node_parse_state_wasm=X._ts_node_parse_state_wasm=(J)=>(_ts_node_parse_state_wasm=X._ts_node_parse_state_wasm=wasmExports.ts_node_parse_state_wasm)(J),_ts_node_next_parse_state_wasm=X._ts_node_next_parse_state_wasm=(J)=>(_ts_node_next_parse_state_wasm=X._ts_node_next_parse_state_wasm=wasmExports.ts_node_next_parse_state_wasm)(J),_ts_query_matches_wasm=X._ts_query_matches_wasm=(J,Q,$,Z,Y,G,K,V,z,q,A)=>(_ts_query_matches_wasm=X._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm)(J,Q,$,Z,Y,G,K,V,z,q,A),_ts_query_captures_wasm=X._ts_query_captures_wasm=(J,Q,$,Z,Y,G,K,V,z,q,A)=>(_ts_query_captures_wasm=X._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm)(J,Q,$,Z,Y,G,K,V,z,q,A),_iswalpha=X._iswalpha=(J)=>(_iswalpha=X._iswalpha=wasmExports.iswalpha)(J),_iswblank=X._iswblank=(J)=>(_iswblank=X._iswblank=wasmExports.iswblank)(J),_iswdigit=X._iswdigit=(J)=>(_iswdigit=X._iswdigit=wasmExports.iswdigit)(J),_iswlower=X._iswlower=(J)=>(_iswlower=X._iswlower=wasmExports.iswlower)(J),_iswupper=X._iswupper=(J)=>(_iswupper=X._iswupper=wasmExports.iswupper)(J),_iswxdigit=X._iswxdigit=(J)=>(_iswxdigit=X._iswxdigit=wasmExports.iswxdigit)(J),_memchr=X._memchr=(J,Q,$)=>(_memchr=X._memchr=wasmExports.memchr)(J,Q,$),_strlen=X._strlen=(J)=>(_strlen=X._strlen=wasmExports.strlen)(J),_strcmp=X._strcmp=(J,Q)=>(_strcmp=X._strcmp=wasmExports.strcmp)(J,Q),_strncat=X._strncat=(J,Q,$)=>(_strncat=X._strncat=wasmExports.strncat)(J,Q,$),_strncpy=X._strncpy=(J,Q,$)=>(_strncpy=X._strncpy=wasmExports.strncpy)(J,Q,$),_towlower=X._towlower=(J)=>(_towlower=X._towlower=wasmExports.towlower)(J),_towupper=X._towupper=(J)=>(_towupper=X._towupper=wasmExports.towupper)(J),_setThrew=(J,Q)=>(_setThrew=wasmExports.setThrew)(J,Q),__emscripten_stack_restore=(J)=>(__emscripten_stack_restore=wasmExports._emscripten_stack_restore)(J),__emscripten_stack_alloc=(J)=>(__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc)(J),_emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current)(),dynCall_jiji=X.dynCall_jiji=(J,Q,$,Z,Y)=>(dynCall_jiji=X.dynCall_jiji=wasmExports.dynCall_jiji)(J,Q,$,Z,Y),_orig$ts_parser_timeout_micros=X._orig$ts_parser_timeout_micros=(J)=>(_orig$ts_parser_timeout_micros=X._orig$ts_parser_timeout_micros=wasmExports.orig$ts_parser_timeout_micros)(J),_orig$ts_parser_set_timeout_micros=X._orig$ts_parser_set_timeout_micros=(J,Q)=>(_orig$ts_parser_set_timeout_micros=X._orig$ts_parser_set_timeout_micros=wasmExports.orig$ts_parser_set_timeout_micros)(J,Q);X.AsciiToString=AsciiToString,X.stringToUTF16=stringToUTF16;var calledRun;dependenciesFulfilled=function J(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=J};function callMain(J=[]){var Q=resolveGlobalSymbol("main").sym;if(!Q)return;J.unshift(thisProgram);var $=J.length,Z=stackAlloc(($+1)*4),Y=Z;J.forEach((K)=>{LE_HEAP_STORE_U32((Y>>2)*4,stringToUTF8OnStack(K)),Y+=4}),LE_HEAP_STORE_U32((Y>>2)*4,0);try{var G=Q($,Z);return exitJS(G,!0),G}catch(K){return handleException(K)}}function run(J=arguments_){if(runDependencies>0)return;if(preRun(),runDependencies>0)return;function Q(){if(calledRun)return;if(calledRun=!0,X.calledRun=!0,ABORT)return;if(initRuntime(),preMain(),X.onRuntimeInitialized?.(),shouldRunNow)callMain(J);postRun()}if(X.setStatus)X.setStatus("Running..."),setTimeout(function(){setTimeout(function(){X.setStatus("")},1),Q()},1);else Q()}if(X.preInit){if(typeof X.preInit=="function")X.preInit=[X.preInit];while(X.preInit.length>0)X.preInit.pop()()}var shouldRunNow=!0;if(X.noInitialRun)shouldRunNow=!1;run();let C=X,INTERNAL={},SIZE_OF_INT=4,SIZE_OF_CURSOR=4*SIZE_OF_INT,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+/,VERSION,MIN_COMPATIBLE_VERSION,TRANSFER_BUFFER,currentParseCallback,currentLogCallback;class 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(J){let Q;if(!J)Q=0,J=null;else if(J.constructor===Language){Q=J[0];let $=C._ts_language_version(Q);if($<MIN_COMPATIBLE_VERSION||VERSION<$)throw Error(`Incompatible language version ${$}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`)}else throw Error("Argument must be a Language");return this.language=J,C._ts_parser_set_language(this[0],Q),this}getLanguage(){return this.language}parse(J,Q,$){if(typeof J==="string")currentParseCallback=(V,z)=>J.slice(V);else if(typeof J==="function")currentParseCallback=J;else throw Error("Argument must be a string or a function");if(this.logCallback)currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1);else currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0);let Z=0,Y=0;if($?.includedRanges){Z=$.includedRanges.length,Y=C._calloc(Z,SIZE_OF_RANGE);let V=Y;for(let z=0;z<Z;z++)marshalRange(V,$.includedRanges[z]),V+=SIZE_OF_RANGE}let G=C._ts_parser_parse_wasm(this[0],this[1],Q?Q[0]:0,Y,Z);if(!G)throw currentParseCallback=null,currentLogCallback=null,Error("Parsing failed");let K=new Tree(INTERNAL,G,this.language,currentParseCallback);return currentParseCallback=null,currentLogCallback=null,K}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let Y=0;Y<J;Y++)$[Y]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setTimeoutMicros(J){C._ts_parser_set_timeout_micros(this[0],J)}setLogger(J){if(!J)J=null;else if(typeof J!=="function")throw Error("Logger callback must be a function");return this.logCallback=J,this}getLogger(){return this.logCallback}}class Tree{constructor(J,Q,$,Z){assertInternal(J),this[0]=Q,this.language=$,this.textCallback=Z}copy(){let J=C._ts_tree_copy(this[0]);return new Tree(INTERNAL,J,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}edit(J){marshalEdit(J),C._ts_tree_edit_wasm(this[0])}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(J,Q){let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),marshalPoint($+SIZE_OF_INT,Q),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(J){if(J.constructor!==Tree)throw TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],J[0]);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let Y=$;for(let G=0;G<Q;G++)Z[G]=unmarshalRange(Y),Y+=SIZE_OF_RANGE;C._free($)}return Z}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let Y=0;Y<J;Y++)$[Y]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}}class Node{constructor(J,Q){assertInternal(J),this.tree=Q}get typeId(){return marshalNode(this),C._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return marshalNode(this),C._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"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)}get parseState(){return marshalNode(this),C._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return marshalNode(this),C._ts_node_next_parse_state_wasm(this.tree[0])}get isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}get hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}get hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}get isError(){return marshalNode(this),C._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return marshalNode(this),C._ts_node_is_missing_wasm(this.tree[0])===1}get isExtra(){return marshalNode(this),C._ts_node_is_extra_wasm(this.tree[0])===1}equals(J){return this.id===J.id}child(J){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}namedChild(J){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldId(J){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1)return this.childForFieldId(Q);return null}fieldNameForChild(J){marshalNode(this);let Q=C._ts_node_field_name_for_child_wasm(this.tree[0],J);if(!Q)return null;return AsciiToString(Q)}childrenForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1&&Q!==0)return this.childrenForFieldId(Q);return[]}childrenForFieldId(J){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],J);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let Y=$;for(let G=0;G<Q;G++)Z[G]=unmarshalNode(this.tree,Y),Y+=SIZE_OF_NODE;C._free($)}return Z}firstChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_named_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}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 J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._children[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._namedChildren[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._namedChildren}descendantsOfType(J,Q,$){if(!Array.isArray(J))J=[J];if(!Q)Q=ZERO_POINT;if(!$)$=ZERO_POINT;let Z=[],Y=this.tree.language.types;for(let q=0,A=Y.length;q<A;q++)if(J.includes(Y[q]))Z.push(q);let G=C._malloc(SIZE_OF_INT*Z.length);for(let q=0,A=Z.length;q<A;q++)setValue(G+q*SIZE_OF_INT,Z[q],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],G,Z.length,Q.row,Q.column,$.row,$.column);let K=getValue(TRANSFER_BUFFER,"i32"),V=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),z=Array(K);if(K>0){let q=V;for(let A=0;A<K;A++)z[A]=unmarshalNode(this.tree,q),q+=SIZE_OF_NODE}return C._free(V),C._free(G),z}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 descendantCount(){return marshalNode(this),C._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return marshalNode(this),C._ts_node_parent_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),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 J=C._ts_node_to_string_wasm(this.tree[0]),Q=AsciiToString(J);return C._free(J),Q}}class TreeCursor{constructor(J,Q){assertInternal(J),this.tree=Q,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(J){marshalNode(J),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(J){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(J,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],J.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 nodeStateId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_state_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 J=C._ts_tree_cursor_start_index_wasm(this.tree[0]),Q=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,J,Q)}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])}get currentNode(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_wasm(this.tree[0]),unmarshalNode(this.tree)}get currentFieldId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return marshalTreeCursor(this),C._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}gotoFirstChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoLastChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoFirstChildForIndex(J){marshalTreeCursor(this),setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,J,"i32");let Q=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoFirstChildForPosition(J){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,J);let Q=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoNextSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoPreviousSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoDescendant(J){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],J),unmarshalTreeCursor(this)}gotoParent(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}}class Language{constructor(J,Q){assertInternal(J),this[0]=Q,this.types=Array(C._ts_language_symbol_count(this[0]));for(let $=0,Z=this.types.length;$<Z;$++)if(C._ts_language_symbol_type(this[0],$)<2)this.types[$]=UTF8ToString(C._ts_language_symbol_name(this[0],$));this.fields=Array(C._ts_language_field_count(this[0])+1);for(let $=0,Z=this.fields.length;$<Z;$++){let Y=C._ts_language_field_name_for_id(this[0],$);if(Y!==0)this.fields[$]=UTF8ToString(Y);else this.fields[$]=null}}get version(){return C._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(J){let Q=this.fields.indexOf(J);if(Q!==-1)return Q;else return null}fieldNameForId(J){return this.fields[J]||null}idForNodeType(J,Q){let $=lengthBytesUTF8(J),Z=C._malloc($+1);stringToUTF8(J,Z,$+1);let Y=C._ts_language_symbol_for_name(this[0],Z,$,Q);return C._free(Z),Y||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(J){let Q=C._ts_language_symbol_name(this[0],J);return Q?UTF8ToString(Q):null}nodeTypeIsNamed(J){return C._ts_language_type_is_named_wasm(this[0],J)?!0:!1}nodeTypeIsVisible(J){return C._ts_language_type_is_visible_wasm(this[0],J)?!0:!1}nextState(J,Q){return C._ts_language_next_state(this[0],J,Q)}lookaheadIterator(J){let Q=C._ts_lookahead_iterator_new(this[0],J);if(Q)return new LookaheadIterable(INTERNAL,Q,this);return null}query(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1);let Z=C._ts_query_new(this[0],$,Q,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!Z){let F=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),H=getValue(TRANSFER_BUFFER,"i32"),O=UTF8ToString($,H).length,j=J.substr(O,100).split(`
2
+ `)[0],E=j.match(QUERY_WORD_REGEX)[0],I;switch(F){case 2:I=RangeError(`Bad node name '${E}'`);break;case 3:I=RangeError(`Bad field name '${E}'`);break;case 4:I=RangeError(`Bad capture name @${E}`);break;case 5:I=TypeError(`Bad pattern structure at offset ${O}: '${j}'...`),E="";break;default:I=SyntaxError(`Bad syntax at offset ${O}: '${j}'...`),E="";break}throw I.index=O,I.length=E.length,C._free($),I}let Y=C._ts_query_string_count(Z),G=C._ts_query_capture_count(Z),K=C._ts_query_pattern_count(Z),V=Array(G),z=Array(Y);for(let F=0;F<G;F++){let H=C._ts_query_capture_name_for_id(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");V[F]=UTF8ToString(H,O)}for(let F=0;F<Y;F++){let H=C._ts_query_string_value_for_id(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");z[F]=UTF8ToString(H,O)}let q=Array(K),A=Array(K),U=Array(K),W=Array(K),T=Array(K);for(let F=0;F<K;F++){let H=C._ts_query_predicates_for_pattern(Z,F,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");W[F]=[],T[F]=[];let j=[],E=H;for(let I=0;I<O;I++){let B=getValue(E,"i32");E+=SIZE_OF_INT;let R=getValue(E,"i32");if(E+=SIZE_OF_INT,B===PREDICATE_STEP_TYPE_CAPTURE)j.push({type:"capture",name:V[R]});else if(B===PREDICATE_STEP_TYPE_STRING)j.push({type:"string",value:z[R]});else if(j.length>0){if(j[0].type!=="string")throw Error("Predicates must begin with a literal value");let S=j[0].value,L=!0,f=!0,N;switch(S){case"any-not-eq?":case"not-eq?":L=!1;case"any-eq?":case"eq?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 2, got ${j.length-1}`);if(j[1].type!=="capture")throw Error(`First argument of \`#${S}\` predicate must be a capture. Got "${j[1].value}"`);if(f=!S.startsWith("any-"),j[2].type==="capture"){let v=j[1].name,D=j[2].name;T[F].push((_)=>{let w=[],g=[];for(let h of _){if(h.name===v)w.push(h.node);if(h.name===D)g.push(h.node)}let p=(h,c,s)=>s?h.text===c.text:h.text!==c.text;return f?w.every((h)=>g.some((c)=>p(h,c,L))):w.some((h)=>g.some((c)=>p(h,c,L)))})}else{N=j[1].name;let v=j[2].value,D=(w)=>w.text===v,_=(w)=>w.text!==v;T[F].push((w)=>{let g=[];for(let h of w)if(h.name===N)g.push(h.node);let p=L?D:_;return f?g.every(p):g.some(p)})}break;case"any-not-match?":case"not-match?":L=!1;case"any-match?":case"match?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 2, got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${S}\` predicate must be a capture. Got "${j[1].value}".`);if(j[2].type!=="string")throw Error(`Second argument of \`#${S}\` predicate must be a string. Got @${j[2].value}.`);N=j[1].name;let b=new RegExp(j[2].value);f=!S.startsWith("any-"),T[F].push((v)=>{let D=[];for(let w of v)if(w.name===N)D.push(w.node.text);let _=(w,g)=>g?b.test(w):!b.test(w);if(D.length===0)return!L;return f?D.every((w)=>_(w,L)):D.some((w)=>_(w,L))});break;case"set!":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((v)=>v.type!=="string"))throw Error('Arguments to `#set!` predicate must be a strings.".');if(!q[F])q[F]={};q[F][j[1].value]=j[2]?j[2].value:null;break;case"is?":case"is-not?":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#${S}\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((v)=>v.type!=="string"))throw Error(`Arguments to \`#${S}\` predicate must be a strings.".`);let m=S==="is?"?A:U;if(!m[F])m[F]={};m[F][j[1].value]=j[2]?j[2].value:null;break;case"not-any-of?":L=!1;case"any-of?":if(j.length<2)throw Error(`Wrong number of arguments to \`#${S}\` predicate. Expected at least 1. Got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${S}\` predicate must be a capture. Got "${j[1].value}".`);for(let v=2;v<j.length;v++)if(j[v].type!=="string")throw Error(`Arguments to \`#${S}\` predicate must be a strings.".`);N=j[1].name;let r=j.slice(2).map((v)=>v.value);T[F].push((v)=>{let D=[];for(let _ of v)if(_.name===N)D.push(_.node.text);if(D.length===0)return!L;return D.every((_)=>r.includes(_))===L});break;default:W[F].push({operator:S,operands:j.slice(1)})}j.length=0}}Object.freeze(q[F]),Object.freeze(A[F]),Object.freeze(U[F])}return C._free($),new Query(INTERNAL,Z,V,T,W,Object.freeze(q),Object.freeze(A),Object.freeze(U))}static load(J){let Q;if(J instanceof Uint8Array)Q=Promise.resolve(J);else{let $=J;if(typeof process<"u"&&process.versions&&process.versions.node){let Z=vJ("fs");Q=Promise.resolve(Z.readFileSync($))}else Q=fetch($).then((Z)=>Z.arrayBuffer().then((Y)=>{if(Z.ok)return new Uint8Array(Y);else{let G=new TextDecoder("utf-8").decode(Y);throw Error(`Language.load failed with status ${Z.status}.
3
3
 
4
4
  ${G}`)}}))}return Q.then(($)=>loadWebAssemblyModule($,{loadAsync:!0})).then(($)=>{let Z=Object.keys($),Y=Z.find((K)=>LANGUAGE_FUNCTION_REGEX.test(K)&&!K.includes("external_scanner_"));if(!Y)console.log(`Couldn't find language function in WASM file. Symbols:
5
- ${JSON.stringify(Z,null,2)}`);let G=$[Y]();return new Language(INTERNAL,G)})}}class LookaheadIterable{constructor(J,Q,$){assertInternal(J),this[0]=Q,this.language=$}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(J){return C._ts_lookahead_iterator_reset_state(this[0],J)}reset(J,Q){if(C._ts_lookahead_iterator_reset(this[0],J[0],Q))return this.language=J,!0;return!1}[Symbol.iterator](){let J=this;return{next(){if(C._ts_lookahead_iterator_next(J[0]))return{done:!1,value:J.currentType};return{done:!0,value:""}}}}}class Query{constructor(J,Q,$,Z,Y,G,K,V){assertInternal(J),this[0]=Q,this.captureNames=$,this.textPredicates=Z,this.predicates=Y,this.setProperties=G,this.assertedProperties=K,this.refutedProperties=V,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:Y=0,matchLimit:G=4294967295,maxStartDepth:K=4294967295,timeoutMicros:V=0}={}){if(typeof G!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_matches_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,Y,G,K,V);let z=getValue(TRANSFER_BUFFER,"i32"),q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),A=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),U=Array(z);this.exceededMatchLimit=Boolean(A);let W=0,T=q;for(let F=0;F<z;F++){let H=getValue(T,"i32");T+=SIZE_OF_INT;let O=getValue(T,"i32");T+=SIZE_OF_INT;let j=Array(O);if(T=unmarshalCaptures(this,J.tree,T,j),this.textPredicates[H].every((E)=>E(j))){U[W]={pattern:H,captures:j};let E=this.setProperties[H];if(E)U[W].setProperties=E;let I=this.assertedProperties[H];if(I)U[W].assertedProperties=I;let _=this.refutedProperties[H];if(_)U[W].refutedProperties=_;W++}}return U.length=W,C._free(q),U}captures(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:Y=0,matchLimit:G=4294967295,maxStartDepth:K=4294967295,timeoutMicros:V=0}={}){if(typeof G!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_captures_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,Y,G,K,V);let z=getValue(TRANSFER_BUFFER,"i32"),q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),A=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),U=[];this.exceededMatchLimit=Boolean(A);let W=[],T=q;for(let F=0;F<z;F++){let H=getValue(T,"i32");T+=SIZE_OF_INT;let O=getValue(T,"i32");T+=SIZE_OF_INT;let j=getValue(T,"i32");if(T+=SIZE_OF_INT,W.length=O,T=unmarshalCaptures(this,J.tree,T,W),this.textPredicates[H].every((E)=>E(W))){let E=W[j],I=this.setProperties[H];if(I)E.setProperties=I;let _=this.assertedProperties[H];if(_)E.assertedProperties=_;let P=this.refutedProperties[H];if(P)E.refutedProperties=P;U.push(E)}}return C._free(q),U}predicatesForPattern(J){return this.predicates[J]}disableCapture(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1),C._ts_query_disable_capture(this[0],$,Q),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(J,Q,$){let Z=$-Q,Y=J.textCallback(Q,null,$);Q+=Y.length;while(Q<$){let G=J.textCallback(Q,null,$);if(G&&G.length>0)Q+=G.length,Y+=G;else break}if(Q>$)Y=Y.slice(0,Z);return Y}function unmarshalCaptures(J,Q,$,Z){for(let Y=0,G=Z.length;Y<G;Y++){let K=getValue($,"i32");$+=SIZE_OF_INT;let V=unmarshalNode(Q,$);$+=SIZE_OF_NODE,Z[Y]={name:J.captureNames[K],node:V}}return $}function assertInternal(J){if(J!==INTERNAL)throw Error("Illegal constructor")}function isPoint(J){return J&&typeof J.row==="number"&&typeof J.column==="number"}function marshalNode(J){let Q=TRANSFER_BUFFER;setValue(Q,J.id,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.row,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.column,"i32"),Q+=SIZE_OF_INT,setValue(Q,J[0],"i32")}function unmarshalNode(J,Q=TRANSFER_BUFFER){let $=getValue(Q,"i32");if(Q+=SIZE_OF_INT,$===0)return null;let Z=getValue(Q,"i32");Q+=SIZE_OF_INT;let Y=getValue(Q,"i32");Q+=SIZE_OF_INT;let G=getValue(Q,"i32");Q+=SIZE_OF_INT;let K=getValue(Q,"i32"),V=new Node(INTERNAL,J);return V.id=$,V.startIndex=Z,V.startPosition={row:Y,column:G},V[0]=K,V}function marshalTreeCursor(J,Q=TRANSFER_BUFFER){setValue(Q+0*SIZE_OF_INT,J[0],"i32"),setValue(Q+1*SIZE_OF_INT,J[1],"i32"),setValue(Q+2*SIZE_OF_INT,J[2],"i32"),setValue(Q+3*SIZE_OF_INT,J[3],"i32")}function unmarshalTreeCursor(J){J[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),J[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),J[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),J[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(J,Q){setValue(J,Q.row,"i32"),setValue(J+SIZE_OF_INT,Q.column,"i32")}function unmarshalPoint(J){return{row:getValue(J,"i32")>>>0,column:getValue(J+SIZE_OF_INT,"i32")>>>0}}function marshalRange(J,Q){marshalPoint(J,Q.startPosition),J+=SIZE_OF_POINT,marshalPoint(J,Q.endPosition),J+=SIZE_OF_POINT,setValue(J,Q.startIndex,"i32"),J+=SIZE_OF_INT,setValue(J,Q.endIndex,"i32"),J+=SIZE_OF_INT}function unmarshalRange(J){let Q={};return Q.startPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.endPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.startIndex=getValue(J,"i32")>>>0,J+=SIZE_OF_INT,Q.endIndex=getValue(J,"i32")>>>0,Q}function marshalEdit(J){let Q=TRANSFER_BUFFER;marshalPoint(Q,J.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.oldEndPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.newEndPosition),Q+=SIZE_OF_POINT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.oldEndIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.newEndIndex,"i32"),Q+=SIZE_OF_INT}for(let J of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,J,{value:ParserImpl.prototype[J],enumerable:!1,writable:!1});Parser.Language=Language,X.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof CJ==="object")zJ.exports=_$});import{realpath as SQ}from"node:fs/promises";import{delimiter as a$}from"node:path";import{open as uQ}from"node:fs/promises";var GJ=Buffer.from(`
5
+ ${JSON.stringify(Z,null,2)}`);let G=$[Y]();return new Language(INTERNAL,G)})}}class LookaheadIterable{constructor(J,Q,$){assertInternal(J),this[0]=Q,this.language=$}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(J){return C._ts_lookahead_iterator_reset_state(this[0],J)}reset(J,Q){if(C._ts_lookahead_iterator_reset(this[0],J[0],Q))return this.language=J,!0;return!1}[Symbol.iterator](){let J=this;return{next(){if(C._ts_lookahead_iterator_next(J[0]))return{done:!1,value:J.currentType};return{done:!0,value:""}}}}}class Query{constructor(J,Q,$,Z,Y,G,K,V){assertInternal(J),this[0]=Q,this.captureNames=$,this.textPredicates=Z,this.predicates=Y,this.setProperties=G,this.assertedProperties=K,this.refutedProperties=V,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:Y=0,matchLimit:G=4294967295,maxStartDepth:K=4294967295,timeoutMicros:V=0}={}){if(typeof G!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_matches_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,Y,G,K,V);let z=getValue(TRANSFER_BUFFER,"i32"),q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),A=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),U=Array(z);this.exceededMatchLimit=Boolean(A);let W=0,T=q;for(let F=0;F<z;F++){let H=getValue(T,"i32");T+=SIZE_OF_INT;let O=getValue(T,"i32");T+=SIZE_OF_INT;let j=Array(O);if(T=unmarshalCaptures(this,J.tree,T,j),this.textPredicates[H].every((E)=>E(j))){U[W]={pattern:H,captures:j};let E=this.setProperties[H];if(E)U[W].setProperties=E;let I=this.assertedProperties[H];if(I)U[W].assertedProperties=I;let B=this.refutedProperties[H];if(B)U[W].refutedProperties=B;W++}}return U.length=W,C._free(q),U}captures(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:Y=0,matchLimit:G=4294967295,maxStartDepth:K=4294967295,timeoutMicros:V=0}={}){if(typeof G!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_captures_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,Y,G,K,V);let z=getValue(TRANSFER_BUFFER,"i32"),q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),A=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),U=[];this.exceededMatchLimit=Boolean(A);let W=[],T=q;for(let F=0;F<z;F++){let H=getValue(T,"i32");T+=SIZE_OF_INT;let O=getValue(T,"i32");T+=SIZE_OF_INT;let j=getValue(T,"i32");if(T+=SIZE_OF_INT,W.length=O,T=unmarshalCaptures(this,J.tree,T,W),this.textPredicates[H].every((E)=>E(W))){let E=W[j],I=this.setProperties[H];if(I)E.setProperties=I;let B=this.assertedProperties[H];if(B)E.assertedProperties=B;let R=this.refutedProperties[H];if(R)E.refutedProperties=R;U.push(E)}}return C._free(q),U}predicatesForPattern(J){return this.predicates[J]}disableCapture(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1),C._ts_query_disable_capture(this[0],$,Q),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(J,Q,$){let Z=$-Q,Y=J.textCallback(Q,null,$);Q+=Y.length;while(Q<$){let G=J.textCallback(Q,null,$);if(G&&G.length>0)Q+=G.length,Y+=G;else break}if(Q>$)Y=Y.slice(0,Z);return Y}function unmarshalCaptures(J,Q,$,Z){for(let Y=0,G=Z.length;Y<G;Y++){let K=getValue($,"i32");$+=SIZE_OF_INT;let V=unmarshalNode(Q,$);$+=SIZE_OF_NODE,Z[Y]={name:J.captureNames[K],node:V}}return $}function assertInternal(J){if(J!==INTERNAL)throw Error("Illegal constructor")}function isPoint(J){return J&&typeof J.row==="number"&&typeof J.column==="number"}function marshalNode(J){let Q=TRANSFER_BUFFER;setValue(Q,J.id,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.row,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.column,"i32"),Q+=SIZE_OF_INT,setValue(Q,J[0],"i32")}function unmarshalNode(J,Q=TRANSFER_BUFFER){let $=getValue(Q,"i32");if(Q+=SIZE_OF_INT,$===0)return null;let Z=getValue(Q,"i32");Q+=SIZE_OF_INT;let Y=getValue(Q,"i32");Q+=SIZE_OF_INT;let G=getValue(Q,"i32");Q+=SIZE_OF_INT;let K=getValue(Q,"i32"),V=new Node(INTERNAL,J);return V.id=$,V.startIndex=Z,V.startPosition={row:Y,column:G},V[0]=K,V}function marshalTreeCursor(J,Q=TRANSFER_BUFFER){setValue(Q+0*SIZE_OF_INT,J[0],"i32"),setValue(Q+1*SIZE_OF_INT,J[1],"i32"),setValue(Q+2*SIZE_OF_INT,J[2],"i32"),setValue(Q+3*SIZE_OF_INT,J[3],"i32")}function unmarshalTreeCursor(J){J[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),J[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),J[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),J[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(J,Q){setValue(J,Q.row,"i32"),setValue(J+SIZE_OF_INT,Q.column,"i32")}function unmarshalPoint(J){return{row:getValue(J,"i32")>>>0,column:getValue(J+SIZE_OF_INT,"i32")>>>0}}function marshalRange(J,Q){marshalPoint(J,Q.startPosition),J+=SIZE_OF_POINT,marshalPoint(J,Q.endPosition),J+=SIZE_OF_POINT,setValue(J,Q.startIndex,"i32"),J+=SIZE_OF_INT,setValue(J,Q.endIndex,"i32"),J+=SIZE_OF_INT}function unmarshalRange(J){let Q={};return Q.startPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.endPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.startIndex=getValue(J,"i32")>>>0,J+=SIZE_OF_INT,Q.endIndex=getValue(J,"i32")>>>0,Q}function marshalEdit(J){let Q=TRANSFER_BUFFER;marshalPoint(Q,J.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.oldEndPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.newEndPosition),Q+=SIZE_OF_POINT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.oldEndIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.newEndIndex,"i32"),Q+=SIZE_OF_INT}for(let J of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,J,{value:ParserImpl.prototype[J],enumerable:!1,writable:!1});Parser.Language=Language,X.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof CJ==="object")zJ.exports=_$});import{realpath as SQ}from"node:fs/promises";import{delimiter as a$}from"node:path";import{open as uQ}from"node:fs/promises";var GJ=Buffer.from(`
6
6
  `),IJ=Buffer.from(`\r
7
- `),NJ=Buffer.from("\r"),FJ=Buffer.alloc(0),dJ=65536;async function*t(J,Q){let $=Q?.detectBinary??!1,Z=await uQ(J,"r"),Y=Buffer.allocUnsafe(dJ),G=[],K=0,V=0,z=!1;function q(A){if(A&&A.length>0)G.push(A),K+=A.length;if(K===0)return FJ;let U=G.length===1?G[0]:Buffer.concat(G,K);return G=[],K=0,U}try{let A;do{if({bytesRead:A}=await Z.read(Y,0,dJ),A===0)break;let U=Buffer.from(Y.subarray(0,A)),W=0;if(z){z=!1;let T=U.length>0&&U[0]===10?IJ:NJ;if(T===IJ)W=1;yield{lineBytes:q(),eolBytes:T,lineNumber:++V}}for(let T=W;T<A;T++){let F=U[T];if($&&F===0)throw Error("File appears to be binary (contains null bytes)");if(F!==13&&F!==10)continue;let H=U.subarray(W,T),O;if(F===13)if(T+1<A)if(U[T+1]===10)O=IJ,T++;else O=NJ;else{G.push(Buffer.from(H)),K+=H.length,z=!0,W=T+1;continue}else O=GJ;yield{lineBytes:q(H),eolBytes:O,lineNumber:++V},W=T+1}if(W<A){let T=Buffer.from(U.subarray(W,A));G.push(T),K+=T.length}}while(A>0);if(z||K>0)yield{lineBytes:q(),eolBytes:z?NJ:FJ,lineNumber:++V}}finally{await Z.close()}}var e=2166136261;var TJ="0-0:00000000";function nJ(J){let Q=2166136261;for(let $=0;$<J.length;$++){let Z=J.charCodeAt($);if(Z>=55296&&Z<=56319)if($+1<J.length){let Y=J.charCodeAt($+1);if(Y>=56320&&Y<=57343)Z=(Z-55296<<10)+(Y-56320)+65536,$++;else Z=65533}else Z=65533;else if(Z>=56320&&Z<=57343)Z=65533;if(Z<128)Q=Math.imul(Q^Z,16777619)>>>0;else if(Z<2048)Q=Math.imul(Q^(192|Z>>6),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else if(Z<65536)Q=Math.imul(Q^(224|Z>>12),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else Q=Math.imul(Q^(240|Z>>18),16777619)>>>0,Q=Math.imul(Q^(128|Z>>12&63),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0}return Q>>>0}function XJ(J,Q,$){let Z=2166136261;for(let Y=Q;Y<$;Y++)Z=Math.imul(Z^J[Y],16777619)>>>0;return Z}function $J(J,Q){return J=Math.imul(J^Q&255,16777619)>>>0,J=Math.imul(J^Q>>>8&255,16777619)>>>0,J=Math.imul(J^Q>>>16&255,16777619)>>>0,J=Math.imul(J^Q>>>24&255,16777619)>>>0,J}function ZJ(J,Q,$){return`${J}-${Q}:${$.toString(16).padStart(8,"0")}`}var oJ="abcdefghijklmnopqrstuvwxyz",lQ=(()=>{let J=Array(676);for(let Q=0;Q<26;Q++)for(let $=0;$<26;$++)J[Q*26+$]=oJ[Q]+oJ[$];return J})();function KJ(J){return lQ[(J>>>0)%26*26+(J>>>8>>>0)%26]}var AJ=/^\d+$/;function SJ(J){let Q=J.indexOf(".");if(Q===-1){if(!AJ.test(J))throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.12"). `+"Copy the 2-letter prefix and line number from trueline_read/trueline_search output.");if(Number(J)!==0)throw Error(`Invalid hash.line reference "${J}" — bare line number only allowed for 0. `+`Use the hash.line format from trueline_read/trueline_search output (e.g. "ab.${J}").`);return{line:0,hash:""}}let $=J.slice(0,Q),Z=J.slice(Q+1);if(!AJ.test(Z))throw Error(`Invalid line number in "${J}" — must be a non-negative integer`);let Y=Number(Z);if(Y===0)throw Error(`Invalid hash.line reference "${J}" — line 0 must use bare "0" with no hash`);if(!/^[a-z]{2}$/.test($))throw Error(`Invalid hash in "${J}" — must be exactly 2 lowercase letters`);return{line:Y,hash:$}}function iJ(J){let Q=!1,$=J;if($.startsWith("+"))Q=!0,$=$.slice(1);let Z=$.indexOf("-");if(Q&&Z!==-1)throw Error(`Invalid range "${J}" — insert-after (+) cannot be used with a multi-line range`);if(Z===-1){let K=SJ($);return{start:K,end:{...K},insertAfter:Q}}let Y=SJ($.slice(0,Z)),G=SJ($.slice(Z+1));if(Y.line>G.line)throw Error(`Invalid range "${J}" — start line ${Y.line} must be ≤ end line ${G.line}`);return{start:Y,end:G,insertAfter:Q}}function OJ(J){let Q=J.indexOf("-");if(Q===-1)throw Error(`Invalid checksum "${J}" — expected format "startLine-endLine:hex"`);let $=J.indexOf(":",Q);if($===-1)throw Error(`Invalid checksum "${J}" — expected format "startLine-endLine:hex"`);let Z=J.slice(0,Q),Y=J.slice(Q+1,$),G=J.slice($+1);if(!AJ.test(Z))throw Error(`Invalid checksum "${J}" — start line must be a decimal integer`);if(!AJ.test(Y))throw Error(`Invalid checksum "${J}" — end line must be a decimal integer`);if(!/^[0-9a-f]{8}$/.test(G))throw Error(`Invalid checksum "${J}" — hash must be 8 hex chars, got "${G}"`);let K=Number(Z),V=Number(Y);if(K===0&&V!==0)throw Error(`Invalid checksum "${J}" — startLine 0 requires endLine 0`);if(K>V)throw Error(`Invalid checksum "${J}" — start ${K} must be ≤ end ${V}`);if(K===0&&V===0&&G!=="00000000")throw Error(`Invalid checksum "${J}" — empty-file sentinel must have hash 00000000`);return{startLine:K,endLine:V,hash:G}}function rJ(J){if(!J||J.length===0)return[{start:1,end:1/0}];let Q=J.map(($)=>{let Z=$.indexOf("-"),Y,G;if(Z===-1)Y=Number($),G=Y;else if(Z===0)Y=1,G=Number($.slice(1));else if(Z===$.length-1)Y=Number($.slice(0,-1)),G=1/0;else Y=Number($.slice(0,Z)),G=Number($.slice(Z+1));if(!Number.isInteger(Y)||Y<1)throw Error(`Invalid range "${$}": start must be a positive integer`);if(G!==1/0&&(!Number.isInteger(G)||G<1))throw Error(`Invalid range "${$}": end must be a positive integer`);if(Y>G)throw Error(`Invalid range "${$}": start ${Y} must be <= end ${G}`);return{start:Y,end:G}});Q.sort(($,Z)=>$.start-Z.start);for(let $=1;$<Q.length;$++){let Z=Q[$-1],Y=Q[$];if(Z.end===1/0||Y.start<=Z.end+1)Z.end=Math.max(Z.end,Y.end),Q.splice($,1),$--}return Q}import{realpath as MJ,stat as rQ}from"node:fs/promises";import{resolve as sQ,sep as JQ}from"node:path";import{readFile as dQ,stat as oQ}from"node:fs/promises";import{homedir as nQ}from"node:os";import{resolve as LJ}from"node:path";var xJ=new Map,sJ=new Map;function iQ(J){let Q=J.match(/^(\w+)\((.+)\)$/);return Q?{tool:Q[1],glob:Q[2]}:null}function aJ(J,Q=!1){let $=`${J}:${Q}`,Z=sJ.get($);if(Z)return Z;J=J.replace(/(\*\*\/)+/g,"**/");let Y=J.replace(/\*\*\/|\*\*|\*|\?|[^*?]+/g,(K,V)=>{let z=V===0||J[V-1]==="/";switch(K){case"**/":return z?"(.*/)?":"[^/]*/";case"**":return z?".*":"[^/]*";case"*":return"[^/]*";case"?":return"[^/]";default:return K.replace(/[.+^${}()|[\]\\/-]/g,"\\$&")}}),G=new RegExp(`^${Y}$`,Q?"i":"");return sJ.set($,G),G}async function tJ(J,Q,$){let Z=async(K)=>{let V=`${K}:${J}`,z;try{z=(await oQ(K)).mtimeMs}catch{return null}let q=xJ.get(V);if(q&&q.mtime===z)return q.globs;let A;try{A=JSON.parse(await dQ(K,"utf-8"))}catch{return xJ.set(V,{mtime:z,globs:null}),null}let U=typeof A==="object"&&A!==null?A:void 0,T=(typeof U?.permissions==="object"&&U.permissions!==null?U.permissions:void 0)?.deny,F=[];if(Array.isArray(T))for(let H of T){if(typeof H!=="string")continue;let O=iQ(H);if(O?.tool===J)F.push(O.glob)}return xJ.set(V,{mtime:z,globs:F}),F},Y=[];if(Q)Y.push(LJ(Q,".claude","settings.local.json")),Y.push(LJ(Q,".claude","settings.json"));return Y.push($??LJ(nQ(),".claude","settings.json")),(await Promise.all(Y.map(Z))).filter((K)=>K!==null)}function eJ(J,Q,$=process.platform==="win32"){let Z=J.replace(/\\/g,"/"),Y=Z.split("/").pop()??Z,G=(V)=>{let z=aJ(V,$);if(z.test(Z))return!0;if(!V.includes("/"))return z.test(Y);if(!V.startsWith("/")&&!V.startsWith("*"))return aJ(`**/${V}`,$).test(Z);return!1},K=Q.flat().find(G);return K?{denied:!0,matchedPattern:K}:{denied:!1}}function y(J){return{content:[{type:"text",text:J}]}}function L(J){return{content:[{type:"text",text:J}],isError:!0}}async function JJ(J,Q,$,Z=[]){let Y=J.startsWith("/")?J:sQ($??process.cwd(),J),G;try{G=await MJ(Y)}catch{return{ok:!1,error:L(`Error reading file: "${J}" not found`)}}let K=await rQ(G);if(!K.isFile())return{ok:!1,error:L(`"${J}" is not a regular file`)};let V;try{V=await MJ($?$:process.cwd())}catch{return{ok:!1,error:L("Project directory not found or inaccessible")}}let z=await Promise.all(Z.map(async(H)=>{try{return await MJ(H)}catch{return H}})),q=[V,...z];if(!(process.platform==="win32"?q.some((H)=>{let O=G.toLowerCase(),j=H.toLowerCase();return O===j||O.startsWith(j+JQ)}):q.some((H)=>G===H||G.startsWith(H+JQ))))return{ok:!1,error:L(`Access denied: "${J}" is outside the project directory`)};let U=await tJ(Q,$),{denied:W,matchedPattern:T}=eJ(G,U);if(W)return{ok:!1,error:L(`Access denied: "${J}" matched deny pattern "${T}"`)};let F=10485760;if(K.size>F)return{ok:!1,error:L(`"${J}" exceeds the 10 MB size limit (${(K.size/1024/1024).toFixed(1)} MB)`)};return{ok:!0,resolvedPath:G,size:K.size,mtimeMs:K.mtimeMs}}function VJ(J){return J instanceof Error&&J.message.includes("binary")}function UJ(J){return L(`"${J}" appears to be a binary file`)}function QQ(J){let Q=[],$=new Map;for(let K of J){let V=OJ(K.checksum);$.set(K.checksum,V);let z=iJ(K.range);if(z.start.line===0&&!z.insertAfter)return{ok:!1,error:L("range starting at line 0 requires insert-after (use +0: prefix)")};if(z.start.line>0){if(V.startLine>z.start.line||V.endLine<z.end.line)return{ok:!1,error:L(`Checksum range ${V.startLine}-${V.endLine} does not cover edit range ${z.start.line}-${z.end.line}. Re-read with trueline_read to get a checksum covering the target lines.`)}}Q.push({startLine:z.start.line,endLine:z.end.line,content:K.content===""?[]:K.content.split(`
8
- `),insertAfter:z.insertAfter,startHash:z.start.hash,endHash:z.end.hash})}let Z=[...$.values()];Z.sort((K,V)=>K.startLine-V.startLine);let Y=Q.filter((K)=>!K.insertAfter);Y.sort((K,V)=>K.startLine-V.startLine);for(let K=1;K<Y.length;K++)if(Y[K].startLine<=Y[K-1].endLine)return{ok:!1,error:L(`Overlapping ranges: line ${Y[K].startLine} targeted by multiple edits`)};let G=Q.filter((K)=>K.insertAfter);for(let K of G)for(let V of Y)if(K.startLine>=V.startLine&&K.startLine<V.endLine)return{ok:!1,error:L(`Insert-after at line ${K.startLine} conflicts with replace range ${V.startLine}–${V.endLine}. Insert after the last line of the replace instead.`)};return{ok:!0,ops:Q,checksumRefs:Z}}var aQ={"utf-8":"utf-8",utf8:"utf-8",ascii:"ascii",latin1:"latin1"};function DJ(J){if(J===void 0)return"utf-8";let Q=aQ[J.toLowerCase()];if(Q===void 0)throw Error(`Unsupported encoding "${J}". Supported: utf-8, ascii, latin1`);return Q}async function $Q(J){let{file_path:Q,projectDir:$,allowedDirs:Z}=J,Y=await JJ(Q,"Read",$,Z);if(!Y.ok)return Y.error;let G;try{G=DJ(J.encoding)}catch(_){return L(_.message)}let{resolvedPath:K}=Y,V;try{V=rJ(J.ranges)}catch(_){return L(_.message)}let z=2000,q=20971520,A=[],U=0,W=0,T=V[0],F=e,H=0,O=0,j=0,E=0,I=!1;try{for await(let{lineBytes:_,lineNumber:P}of t(K,{detectBinary:!0})){if(j=P,W>=V.length)break;if(T=V[W],P<T.start)continue;if(P>T.end){let N=`
7
+ `),NJ=Buffer.from("\r"),FJ=Buffer.alloc(0),dJ=65536;async function*t(J,Q){let $=Q?.detectBinary??!1,Z=await uQ(J,"r"),Y=Buffer.allocUnsafe(dJ),G=[],K=0,V=0,z=!1;function q(A){if(A&&A.length>0)G.push(A),K+=A.length;if(K===0)return FJ;let U=G.length===1?G[0]:Buffer.concat(G,K);return G=[],K=0,U}try{let A;do{if({bytesRead:A}=await Z.read(Y,0,dJ),A===0)break;let U=Buffer.from(Y.subarray(0,A)),W=0;if(z){z=!1;let T=U.length>0&&U[0]===10?IJ:NJ;if(T===IJ)W=1;yield{lineBytes:q(),eolBytes:T,lineNumber:++V}}for(let T=W;T<A;T++){let F=U[T];if($&&F===0)throw Error("File appears to be binary (contains null bytes)");if(F!==13&&F!==10)continue;let H=U.subarray(W,T),O;if(F===13)if(T+1<A)if(U[T+1]===10)O=IJ,T++;else O=NJ;else{G.push(Buffer.from(H)),K+=H.length,z=!0,W=T+1;continue}else O=GJ;yield{lineBytes:q(H),eolBytes:O,lineNumber:++V},W=T+1}if(W<A){let T=Buffer.from(U.subarray(W,A));G.push(T),K+=T.length}}while(A>0);if(z||K>0)yield{lineBytes:q(),eolBytes:z?NJ:FJ,lineNumber:++V}}finally{await Z.close()}}var e=2166136261;var TJ="0-0:00000000";function nJ(J){let Q=2166136261;for(let $=0;$<J.length;$++){let Z=J.charCodeAt($);if(Z>=55296&&Z<=56319)if($+1<J.length){let Y=J.charCodeAt($+1);if(Y>=56320&&Y<=57343)Z=(Z-55296<<10)+(Y-56320)+65536,$++;else Z=65533}else Z=65533;else if(Z>=56320&&Z<=57343)Z=65533;if(Z<128)Q=Math.imul(Q^Z,16777619)>>>0;else if(Z<2048)Q=Math.imul(Q^(192|Z>>6),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else if(Z<65536)Q=Math.imul(Q^(224|Z>>12),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else Q=Math.imul(Q^(240|Z>>18),16777619)>>>0,Q=Math.imul(Q^(128|Z>>12&63),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0}return Q>>>0}function XJ(J,Q,$){let Z=2166136261;for(let Y=Q;Y<$;Y++)Z=Math.imul(Z^J[Y],16777619)>>>0;return Z}function $J(J,Q){return J=Math.imul(J^Q&255,16777619)>>>0,J=Math.imul(J^Q>>>8&255,16777619)>>>0,J=Math.imul(J^Q>>>16&255,16777619)>>>0,J=Math.imul(J^Q>>>24&255,16777619)>>>0,J}function ZJ(J,Q,$){return`${J}-${Q}:${$.toString(16).padStart(8,"0")}`}var oJ="abcdefghijklmnopqrstuvwxyz",lQ=(()=>{let J=Array(676);for(let Q=0;Q<26;Q++)for(let $=0;$<26;$++)J[Q*26+$]=oJ[Q]+oJ[$];return J})();function KJ(J){return lQ[(J>>>0)%26*26+(J>>>8>>>0)%26]}var AJ=/^\d+$/;function SJ(J){let Q=J.indexOf(".");if(Q===-1){if(!AJ.test(J))throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.12"). `+"Copy the 2-letter prefix and line number from trueline_read/trueline_search output.");if(Number(J)!==0)throw Error(`Invalid hash.line reference "${J}" — bare line number only allowed for 0. `+`Use the hash.line format from trueline_read/trueline_search output (e.g. "ab.${J}").`);return{line:0,hash:""}}let $=J.slice(0,Q),Z=J.slice(Q+1);if(!AJ.test(Z))throw Error(`Invalid line number in "${J}" — must be a non-negative integer`);let Y=Number(Z);if(Y===0)throw Error(`Invalid hash.line reference "${J}" — line 0 must use bare "0" with no hash`);if(!/^[a-z]{2}$/.test($))throw Error(`Invalid hash in "${J}" — must be exactly 2 lowercase letters`);return{line:Y,hash:$}}function iJ(J){let Q=!1,$=J;if($.startsWith("+"))Q=!0,$=$.slice(1);let Z=$.indexOf("-");if(Q&&Z!==-1)throw Error(`Invalid range "${J}" — insert-after (+) cannot be used with a multi-line range`);if(Z===-1){let K=SJ($);return{start:K,end:{...K},insertAfter:Q}}let Y=SJ($.slice(0,Z)),G=SJ($.slice(Z+1));if(Y.line>G.line)throw Error(`Invalid range "${J}" — start line ${Y.line} must be ≤ end line ${G.line}`);return{start:Y,end:G,insertAfter:Q}}function OJ(J){let Q=J.indexOf("-");if(Q===-1)throw Error(`Invalid checksum "${J}" — expected format "startLine-endLine:hex"`);let $=J.indexOf(":",Q);if($===-1)throw Error(`Invalid checksum "${J}" — expected format "startLine-endLine:hex"`);let Z=J.slice(0,Q),Y=J.slice(Q+1,$),G=J.slice($+1);if(!AJ.test(Z))throw Error(`Invalid checksum "${J}" — start line must be a decimal integer`);if(!AJ.test(Y))throw Error(`Invalid checksum "${J}" — end line must be a decimal integer`);if(!/^[0-9a-f]{8}$/.test(G))throw Error(`Invalid checksum "${J}" — hash must be 8 hex chars, got "${G}"`);let K=Number(Z),V=Number(Y);if(K===0&&V!==0)throw Error(`Invalid checksum "${J}" — startLine 0 requires endLine 0`);if(K>V)throw Error(`Invalid checksum "${J}" — start ${K} must be ≤ end ${V}`);if(K===0&&V===0&&G!=="00000000")throw Error(`Invalid checksum "${J}" — empty-file sentinel must have hash 00000000`);return{startLine:K,endLine:V,hash:G}}function rJ(J){if(!J||J.length===0)return[{start:1,end:1/0}];let Q=J.map(($)=>{let Z=$.indexOf("-"),Y,G;if(Z===-1)Y=Number($),G=Y;else if(Z===0)Y=1,G=Number($.slice(1));else if(Z===$.length-1)Y=Number($.slice(0,-1)),G=1/0;else Y=Number($.slice(0,Z)),G=Number($.slice(Z+1));if(!Number.isInteger(Y)||Y<1)throw Error(`Invalid range "${$}": start must be a positive integer`);if(G!==1/0&&(!Number.isInteger(G)||G<1))throw Error(`Invalid range "${$}": end must be a positive integer`);if(Y>G)throw Error(`Invalid range "${$}": start ${Y} must be <= end ${G}`);return{start:Y,end:G}});Q.sort(($,Z)=>$.start-Z.start);for(let $=1;$<Q.length;$++){let Z=Q[$-1],Y=Q[$];if(Z.end===1/0||Y.start<=Z.end+1)Z.end=Math.max(Z.end,Y.end),Q.splice($,1),$--}return Q}import{realpath as MJ,stat as rQ}from"node:fs/promises";import{resolve as sQ,sep as JQ}from"node:path";import{readFile as dQ,stat as oQ}from"node:fs/promises";import{homedir as nQ}from"node:os";import{resolve as LJ}from"node:path";var xJ=new Map,sJ=new Map;function iQ(J){let Q=J.match(/^(\w+)\((.+)\)$/);return Q?{tool:Q[1],glob:Q[2]}:null}function aJ(J,Q=!1){let $=`${J}:${Q}`,Z=sJ.get($);if(Z)return Z;J=J.replace(/(\*\*\/)+/g,"**/");let Y=J.replace(/\*\*\/|\*\*|\*|\?|[^*?]+/g,(K,V)=>{let z=V===0||J[V-1]==="/";switch(K){case"**/":return z?"(.*/)?":"[^/]*/";case"**":return z?".*":"[^/]*";case"*":return"[^/]*";case"?":return"[^/]";default:return K.replace(/[.+^${}()|[\]\\/-]/g,"\\$&")}}),G=new RegExp(`^${Y}$`,Q?"i":"");return sJ.set($,G),G}async function tJ(J,Q,$){let Z=async(K)=>{let V=`${K}:${J}`,z;try{z=(await oQ(K)).mtimeMs}catch{return null}let q=xJ.get(V);if(q&&q.mtime===z)return q.globs;let A;try{A=JSON.parse(await dQ(K,"utf-8"))}catch{return xJ.set(V,{mtime:z,globs:null}),null}let U=typeof A==="object"&&A!==null?A:void 0,T=(typeof U?.permissions==="object"&&U.permissions!==null?U.permissions:void 0)?.deny,F=[];if(Array.isArray(T))for(let H of T){if(typeof H!=="string")continue;let O=iQ(H);if(O?.tool===J)F.push(O.glob)}return xJ.set(V,{mtime:z,globs:F}),F},Y=[];if(Q)Y.push(LJ(Q,".claude","settings.local.json")),Y.push(LJ(Q,".claude","settings.json"));return Y.push($??LJ(nQ(),".claude","settings.json")),(await Promise.all(Y.map(Z))).filter((K)=>K!==null)}function eJ(J,Q,$=process.platform==="win32"){let Z=J.replace(/\\/g,"/"),Y=Z.split("/").pop()??Z,G=(V)=>{let z=aJ(V,$);if(z.test(Z))return!0;if(!V.includes("/"))return z.test(Y);if(!V.startsWith("/")&&!V.startsWith("*"))return aJ(`**/${V}`,$).test(Z);return!1},K=Q.flat().find(G);return K?{denied:!0,matchedPattern:K}:{denied:!1}}function y(J){return{content:[{type:"text",text:J}]}}function x(J){return{content:[{type:"text",text:J}],isError:!0}}async function JJ(J,Q,$,Z=[]){if(J==="*")return{ok:!1,error:x('Wildcard "*" is only supported by trueline_changes. Pass an explicit file path.')};let Y=J.startsWith("/")?J:sQ($??process.cwd(),J),G;try{G=await MJ(Y)}catch{return{ok:!1,error:x(`Error reading file: "${J}" not found`)}}let K=await rQ(G);if(!K.isFile())return{ok:!1,error:x(`"${J}" is not a regular file`)};let V;try{V=await MJ($?$:process.cwd())}catch{return{ok:!1,error:x("Project directory not found or inaccessible")}}let z=await Promise.all(Z.map(async(H)=>{try{return await MJ(H)}catch{return H}})),q=[V,...z];if(!(process.platform==="win32"?q.some((H)=>{let O=G.toLowerCase(),j=H.toLowerCase();return O===j||O.startsWith(j+JQ)}):q.some((H)=>G===H||G.startsWith(H+JQ))))return{ok:!1,error:x(`Access denied: "${J}" is outside the project directory`)};let U=await tJ(Q,$),{denied:W,matchedPattern:T}=eJ(G,U);if(W)return{ok:!1,error:x(`Access denied: "${J}" matched deny pattern "${T}"`)};let F=10485760;if(K.size>F)return{ok:!1,error:x(`"${J}" exceeds the 10 MB size limit (${(K.size/1024/1024).toFixed(1)} MB)`)};return{ok:!0,resolvedPath:G,size:K.size,mtimeMs:K.mtimeMs}}function VJ(J){return J instanceof Error&&J.message.includes("binary")}function UJ(J){return x(`"${J}" appears to be a binary file`)}function QQ(J){let Q=[],$=new Map;for(let K of J){let V=OJ(K.checksum);$.set(K.checksum,V);let z=iJ(K.range);if(z.start.line===0&&!z.insertAfter)return{ok:!1,error:x("range starting at line 0 requires insert-after (use +0: prefix)")};if(z.start.line>0){if(V.startLine>z.start.line||V.endLine<z.end.line)return{ok:!1,error:x(`Checksum range ${V.startLine}-${V.endLine} does not cover edit range ${z.start.line}-${z.end.line}. Re-read with trueline_read to get a checksum covering the target lines.`)}}Q.push({startLine:z.start.line,endLine:z.end.line,content:K.content===""?[]:K.content.split(`
8
+ `),insertAfter:z.insertAfter,startHash:z.start.hash,endHash:z.end.hash})}let Z=[...$.values()];Z.sort((K,V)=>K.startLine-V.startLine);let Y=Q.filter((K)=>!K.insertAfter);Y.sort((K,V)=>K.startLine-V.startLine);for(let K=1;K<Y.length;K++)if(Y[K].startLine<=Y[K-1].endLine)return{ok:!1,error:x(`Overlapping ranges: line ${Y[K].startLine} targeted by multiple edits`)};let G=Q.filter((K)=>K.insertAfter);for(let K of G)for(let V of Y)if(K.startLine>=V.startLine&&K.startLine<V.endLine)return{ok:!1,error:x(`Insert-after at line ${K.startLine} conflicts with replace range ${V.startLine}–${V.endLine}. Insert after the last line of the replace instead.`)};return{ok:!0,ops:Q,checksumRefs:Z}}var aQ={"utf-8":"utf-8",utf8:"utf-8",ascii:"ascii",latin1:"latin1"};function DJ(J){if(J===void 0)return"utf-8";let Q=aQ[J.toLowerCase()];if(Q===void 0)throw Error(`Unsupported encoding "${J}". Supported: utf-8, ascii, latin1`);return Q}async function $Q(J){let{file_path:Q,projectDir:$,allowedDirs:Z}=J,Y=await JJ(Q,"Read",$,Z);if(!Y.ok)return Y.error;let G;try{G=DJ(J.encoding)}catch(R){return x(R.message)}let{resolvedPath:K}=Y,V;try{V=rJ(J.ranges)}catch(R){return x(R.message)}let z=2000,q=20971520,A=[],U=0,W=0,T=V[0],F=e,H=0,O=0,j=0,E=0,I=!1;try{for await(let{lineBytes:R,lineNumber:S}of t(K,{detectBinary:!0})){if(j=S,W>=V.length)break;if(T=V[W],S<T.start)continue;if(S>T.end){let b=`
9
9
  checksum: ${ZJ(H,O,F)}
10
- `,b=Buffer.from(N);if(A.push(b),U+=b.length,W++,F=e,H=0,O=0,W>=V.length)break;if(T=V[W],P<T.start)continue}if(H===0)H=P;let x=XJ(_,0,_.length),S=Buffer.from(`${KJ(x)}.${P} `),f=S.length+_.length+1;if(E++,E>z||U+f>q){I=!0;break}O=P,F=$J(F,x),A.push(S,_,GJ),U+=f}}catch(_){if(VJ(_))return UJ(Q);throw _}if(j===0&&!I)return y(`(empty file)
10
+ `,m=Buffer.from(b);if(A.push(m),U+=m.length,W++,F=e,H=0,O=0,W>=V.length)break;if(T=V[W],S<T.start)continue}if(H===0)H=S;let L=XJ(R,0,R.length),f=Buffer.from(`${KJ(L)}.${S} `),N=f.length+R.length+1;if(E++,E>z||U+N>q){I=!0;break}O=S,F=$J(F,L),A.push(f,R,GJ),U+=N}}catch(R){if(VJ(R))return UJ(Q);throw R}if(j===0&&!I)return y(`(empty file)
11
11
 
12
- checksum: ${TJ}`);if(H===0&&V[0].start>j)return L(`start_line ${V[0].start} out of range (file has ${j} lines)`);if(H>0&&O>0){let _=`
13
- checksum: ${ZJ(H,O,F)}`,P=Buffer.from(_);A.push(P),U+=P.length}if(I){let P=`
12
+ checksum: ${TJ}`);if(H===0&&V[0].start>j)return x(`start_line ${V[0].start} out of range (file has ${j} lines)`);if(H>0&&O>0){let R=`
13
+ checksum: ${ZJ(H,O,F)}`,S=Buffer.from(R);A.push(S),U+=S.length}if(I){let S=`
14
14
 
15
- (truncated at ${E>z?`${z} line`:"20 MB output"} limit — use ranges for specific sections)`,x=Buffer.from(P);A.push(x),U+=x.length}return y(Buffer.concat(A,U).toString(G))}import{unlink as K$}from"node:fs/promises";import{relative as V$}from"node:path";class yJ{entries=[];context(J){this.entries.push({type:"ctx",text:J})}delete(J){this.entries.push({type:"del",text:J})}insert(J){this.entries.push({type:"ins",text:J})}format(J,Q,$=3){let Z=this.entries;if(Z.length===0)return"";let Y=[];for(let q=0;q<Z.length;q++)if(Z[q].type!=="ctx")Y.push(q);if(Y.length===0)return"";let G=[],K=Y[0],V=Y[0];for(let q=1;q<Y.length;q++)if(Y[q]-V-1<=2*$)V=Y[q];else G.push([K,V]),K=Y[q],V=Y[q];G.push([K,V]);let z=[`--- ${J}`,`+++ ${Q}`];for(let[q,A]of G){let U=Math.max(0,q-$),W=Math.min(Z.length-1,A+$),T=1,F=1;for(let _=0;_<U;_++){if(Z[_].type!=="ins")T++;if(Z[_].type!=="del")F++}let H=0,O=0,j=[];for(let _=U;_<=W;_++){let P=Z[_];switch(P.type){case"ctx":j.push(` ${P.text}`),H++,O++;break;case"del":j.push(`-${P.text}`),H++;break;case"ins":j.push(`+${P.text}`),O++;break}}let E=H===1?`${T}`:`${T},${H}`,I=O===1?`${F}`:`${F},${O}`;z.push(`@@ -${E} +${I} @@`),z.push(...j)}return`${z.join(`
15
+ (truncated at ${E>z?`${z} line`:"20 MB output"} limit — use ranges for specific sections)`,L=Buffer.from(S);A.push(L),U+=L.length}let B=Buffer.from(`
16
+
17
+ To edit: trueline_edit (not Edit tool)`);return A.push(B),U+=B.length,y(Buffer.concat(A,U).toString(G))}import{unlink as K$}from"node:fs/promises";import{relative as V$}from"node:path";class yJ{entries=[];context(J){this.entries.push({type:"ctx",text:J})}delete(J){this.entries.push({type:"del",text:J})}insert(J){this.entries.push({type:"ins",text:J})}format(J,Q,$=3){let Z=this.entries;if(Z.length===0)return"";let Y=[];for(let q=0;q<Z.length;q++)if(Z[q].type!=="ctx")Y.push(q);if(Y.length===0)return"";let G=[],K=Y[0],V=Y[0];for(let q=1;q<Y.length;q++)if(Y[q]-V-1<=2*$)V=Y[q];else G.push([K,V]),K=Y[q],V=Y[q];G.push([K,V]);let z=[`--- ${J}`,`+++ ${Q}`];for(let[q,A]of G){let U=Math.max(0,q-$),W=Math.min(Z.length-1,A+$),T=1,F=1;for(let B=0;B<U;B++){if(Z[B].type!=="ins")T++;if(Z[B].type!=="del")F++}let H=0,O=0,j=[];for(let B=U;B<=W;B++){let R=Z[B];switch(R.type){case"ctx":j.push(` ${R.text}`),H++,O++;break;case"del":j.push(`-${R.text}`),H++;break;case"ins":j.push(`+${R.text}`),O++;break}}let E=H===1?`${T}`:`${T},${H}`,I=O===1?`${F}`:`${F},${O}`;z.push(`@@ -${E} +${I} @@`),z.push(...j)}return`${z.join(`
16
18
  `)}
17
- `}}import{randomBytes as tQ}from"node:crypto";import{chmod as eQ,open as J$,rename as Q$,stat as $$,unlink as Z$}from"node:fs/promises";import{dirname as X$,resolve as Y$}from"node:path";function G$(J,Q){if(J.length!==Q.length)return!1;for(let $=0;$<J.length;$++)if(!J[$].equals(Q[$]))return!1;return!0}async function bJ(J,Q,$,Z,Y=!1,G="utf-8",K){let V=Q.map((k,R)=>({op:k,i:R}));V.sort((k,R)=>{if(k.op.startLine!==R.op.startLine)return k.op.startLine-R.op.startLine;if(k.op.insertAfter!==R.op.insertAfter)return k.op.insertAfter?1:-1;return k.i-R.i});let z=V.map((k)=>k.op),q=new Map;for(let k of z){let R=q.get(k.startLine)??[];R.push(k),q.set(k.startLine,R)}let A=$.map((k)=>({ref:k,hash:e,verified:!1})),U=0,W=X$(J),T=`.trueline-tmp-${tQ(6).toString("hex")}`,F=Y$(W,T),H=await J$(F,"w"),O=65536,j=Buffer.allocUnsafe(O),E=0;async function I(){if(E>0)await H.write(j,0,E),E=0}async function _(k){if(E+k.length>O){if(await I(),k.length>O){await H.write(k,0,k.length);return}}k.copy(j,E),E+=k.length}let P=GJ,x=!1,S=!1,f=0,N=null,b=GJ,u=FJ,r=0,v=e,D=null,B=[],w=[];async function g(){if(N!==null)await _(N),await _(b),N=null}async function m(k,R,c){await g(),N=k,b=c??P;let a=R??XJ(k,0,k.length);v=$J(v,a),r++}async function h(k){await m(Buffer.from(k,G))}async function p(){try{await H.close()}catch{}try{await Z$(F)}catch{}}async function s(k){return await p(),{ok:!1,error:`${J}: ${k}`}}async function jJ(k){for(let R of k)await h(R)}async function pJ(k,R,c){if(k.content.length!==R.length){S=!0;for(let M of k.content)await h(M);if(K){for(let M of R)K.delete(M.toString(G));for(let M of k.content)K.insert(M)}return}let a=k.content.map((M)=>Buffer.from(M,G));if(G$(a,R)){for(let M=0;M<R.length;M++){let QJ=c?.[M];await m(R[M],void 0,QJ&&QJ.length>0?QJ:void 0)}if(K)for(let M of R)K.context(M.toString(G))}else{S=!0;for(let M of a)await m(M);if(K){for(let M of R)K.delete(M.toString(G));for(let M of k.content)K.insert(M)}}}function cJ(){return r>0?ZJ(1,r,v):TJ}function PJ(k,R,c){return`hash mismatch at line ${k}: expected ${R}, got ${c}`}let uJ=q.get(0);if(uJ){for(let k of uJ)if(await jJ(k.content),K)for(let R of k.content)K.insert(R);S=!0,q.delete(0)}try{for await(let{lineBytes:k,eolBytes:R,lineNumber:c}of t(J,{detectBinary:!0})){if(f=c,u=R,!x&&R.length>0)P=R,x=!0,b=P;let a=XJ(k,0,k.length),M=KJ(a);while(U<A.length&&A[U].ref.endLine<c)A[U].verified=!0,U++;for(let d=U;d<A.length;d++){let n=A[d];if(c<n.ref.startLine)break;if(c>n.ref.endLine)continue;n.hash=$J(n.hash,a)}if(D&&c<=D.endLine){if(c===D.endLine&&D.endHash!==""){if(M!==D.endHash)return await s(PJ(c,D.endHash,M))}if(B.push(k),w.push(R),c===D.endLine){let d=D;D=null,await pJ(d,B,w),B=[],w=[];let n=q.get(c);if(n){for(let o of n)if(o.insertAfter){if(S=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}}}continue}let QJ=q.get(c);if(QJ){let d=null,n=[];for(let o of QJ)if(o.insertAfter)n.push(o);else d=o;if(d){if(d.startHash!==""&&M!==d.startHash)return await s(PJ(c,d.startHash,M));if(d.startLine===d.endLine){await pJ(d,[k],[R]);for(let o of n)if(S=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}else D=d,B=[k],w=[R]}else{for(let o of n)if(o.startHash!==""&&M!==o.startHash)return await s(PJ(c,o.startHash,M));if(await m(k,a,R.length>0?R:void 0),K)K.context(k.toString(G));for(let o of n)if(S=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}}else if(await m(k,a,R.length>0?R:void 0),K)K.context(k.toString(G))}}catch(k){if(k instanceof Error&&k.message.includes("binary"))return await s(k.message);throw await p(),k}try{if(N!==null){if(await _(N),u.length>0)await _(P)}}catch(k){throw await p(),k}try{await I(),await H.close()}catch(k){throw await p(),k}for(let k of A){let R=k.ref;if(R.startLine===0&&R.endLine===0){if(f!==0)return await s(`Checksum mismatch: expected empty file but file has ${f} lines`);continue}if(R.endLine>f)return await s(`Checksum range ${R.startLine}-${R.endLine} exceeds file length (${f} lines)`);let c=R.hash,a=k.hash.toString(16).padStart(8,"0");if(a!==c){await p();let M=1/0,QJ=-1/0;for(let n of z)if(n.startLine>0)M=Math.min(M,n.startLine),QJ=Math.max(QJ,n.endLine);let d=`${J}: checksum mismatch for lines ${R.startLine}–${R.endLine}: expected ${c}, got ${a}. File changed since last read.`;if(M!==1/0)return{ok:!1,error:d+`
19
+ `}}import{randomBytes as tQ}from"node:crypto";import{chmod as eQ,open as J$,rename as Q$,stat as $$,unlink as Z$}from"node:fs/promises";import{dirname as X$,resolve as Y$}from"node:path";function G$(J,Q){if(J.length!==Q.length)return!1;for(let $=0;$<J.length;$++)if(!J[$].equals(Q[$]))return!1;return!0}async function bJ(J,Q,$,Z,Y=!1,G="utf-8",K){let V=Q.map((k,P)=>({op:k,i:P}));V.sort((k,P)=>{if(k.op.startLine!==P.op.startLine)return k.op.startLine-P.op.startLine;if(k.op.insertAfter!==P.op.insertAfter)return k.op.insertAfter?1:-1;return k.i-P.i});let z=V.map((k)=>k.op),q=new Map;for(let k of z){let P=q.get(k.startLine)??[];P.push(k),q.set(k.startLine,P)}let A=$.map((k)=>({ref:k,hash:e,verified:!1})),U=0,W=X$(J),T=`.trueline-tmp-${tQ(6).toString("hex")}`,F=Y$(W,T),H=await J$(F,"w"),O=65536,j=Buffer.allocUnsafe(O),E=0;async function I(){if(E>0)await H.write(j,0,E),E=0}async function B(k){if(E+k.length>O){if(await I(),k.length>O){await H.write(k,0,k.length);return}}k.copy(j,E),E+=k.length}let R=GJ,S=!1,L=!1,f=0,N=null,b=GJ,m=FJ,r=0,v=e,D=null,_=[],w=[];async function g(){if(N!==null)await B(N),await B(b),N=null}async function p(k,P,u){await g(),N=k,b=u??R;let a=P??XJ(k,0,k.length);v=$J(v,a),r++}async function h(k){await p(Buffer.from(k,G))}async function c(){try{await H.close()}catch{}try{await Z$(F)}catch{}}async function s(k){return await c(),{ok:!1,error:`${J}: ${k}`}}async function jJ(k){for(let P of k)await h(P)}async function pJ(k,P,u){if(k.content.length!==P.length){L=!0;for(let M of k.content)await h(M);if(K){for(let M of P)K.delete(M.toString(G));for(let M of k.content)K.insert(M)}return}let a=k.content.map((M)=>Buffer.from(M,G));if(G$(a,P)){for(let M=0;M<P.length;M++){let QJ=u?.[M];await p(P[M],void 0,QJ&&QJ.length>0?QJ:void 0)}if(K)for(let M of P)K.context(M.toString(G))}else{L=!0;for(let M of a)await p(M);if(K){for(let M of P)K.delete(M.toString(G));for(let M of k.content)K.insert(M)}}}function cJ(){return r>0?ZJ(1,r,v):TJ}function PJ(k,P,u){return`hash mismatch at line ${k}: expected ${P}, got ${u}`}let uJ=q.get(0);if(uJ){for(let k of uJ)if(await jJ(k.content),K)for(let P of k.content)K.insert(P);L=!0,q.delete(0)}try{for await(let{lineBytes:k,eolBytes:P,lineNumber:u}of t(J,{detectBinary:!0})){if(f=u,m=P,!S&&P.length>0)R=P,S=!0,b=R;let a=XJ(k,0,k.length),M=KJ(a);while(U<A.length&&A[U].ref.endLine<u)A[U].verified=!0,U++;for(let d=U;d<A.length;d++){let n=A[d];if(u<n.ref.startLine)break;if(u>n.ref.endLine)continue;n.hash=$J(n.hash,a)}if(D&&u<=D.endLine){if(u===D.endLine&&D.endHash!==""){if(M!==D.endHash)return await s(PJ(u,D.endHash,M))}if(_.push(k),w.push(P),u===D.endLine){let d=D;D=null,await pJ(d,_,w),_=[],w=[];let n=q.get(u);if(n){for(let o of n)if(o.insertAfter){if(L=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}}}continue}let QJ=q.get(u);if(QJ){let d=null,n=[];for(let o of QJ)if(o.insertAfter)n.push(o);else d=o;if(d){if(d.startHash!==""&&M!==d.startHash)return await s(PJ(u,d.startHash,M));if(d.startLine===d.endLine){await pJ(d,[k],[P]);for(let o of n)if(L=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}else D=d,_=[k],w=[P]}else{for(let o of n)if(o.startHash!==""&&M!==o.startHash)return await s(PJ(u,o.startHash,M));if(await p(k,a,P.length>0?P:void 0),K)K.context(k.toString(G));for(let o of n)if(L=!0,await jJ(o.content),K)for(let WJ of o.content)K.insert(WJ)}}else if(await p(k,a,P.length>0?P:void 0),K)K.context(k.toString(G))}}catch(k){if(k instanceof Error&&k.message.includes("binary"))return await s(k.message);throw await c(),k}try{if(N!==null){if(await B(N),m.length>0)await B(R)}}catch(k){throw await c(),k}try{await I(),await H.close()}catch(k){throw await c(),k}for(let k of A){let P=k.ref;if(P.startLine===0&&P.endLine===0){if(f!==0)return await s(`Checksum mismatch: expected empty file but file has ${f} lines`);continue}if(P.endLine>f)return await s(`Checksum range ${P.startLine}-${P.endLine} exceeds file length (${f} lines)`);let u=P.hash,a=k.hash.toString(16).padStart(8,"0");if(a!==u){await c();let M=1/0,QJ=-1/0;for(let n of z)if(n.startLine>0)M=Math.min(M,n.startLine),QJ=Math.max(QJ,n.endLine);let d=`${J}: checksum mismatch for lines ${P.startLine}–${P.endLine}: expected ${u}, got ${a}. File changed since last read.`;if(M!==1/0)return{ok:!1,error:d+`
18
20
 
19
- However, lines ${M}–${QJ} appear unchanged. Re-read with trueline_read(ranges=[{start: ${M}, end: ${QJ}}]) to get a narrow checksum, then retry the edit.`};return{ok:!1,error:d}}}if(!S)return await p(),{ok:!0,newChecksum:cJ(),changed:!1};if(!Y){let k;try{let R=await $$(J);if(k=R.mode,R.mtimeMs!==Z)return await s("File was modified by another process. Re-read with trueline_read.")}catch(R){if(R.code!=="ENOENT")throw await p(),R}try{if(k!==void 0)await eQ(F,k);await Q$(F,J)}catch(R){throw await p(),R}}return{ok:!0,newChecksum:cJ(),changed:!0,...Y?{tmpPath:F}:{}}}async function ZQ(J){let Q=performance.now(),{file_path:$,edits:Z,dry_run:Y,projectDir:G,allowedDirs:K}=J,z=await JJ($,Y?"Read":"Edit",G,K);if(!z.ok)return z.error;let q;try{q=DJ(J.encoding)}catch(H){return L(H.message)}let{resolvedPath:A,mtimeMs:U}=z,W=QQ(Z);if(!W.ok)return W.error;if(Y){let H=new yJ,O=await bJ(A,W.ops,W.checksumRefs,U,!0,q,H);if(!O.ok)return L(O.error);if(!O.changed)return y("(no changes)");let j=$.startsWith("/")?V$(G??process.cwd(),A):$,E=H.format(`a/${j}`,`b/${j}`);if(O.tmpPath)try{await K$(O.tmpPath)}catch{}return y(E)}let T=await bJ(A,W.ops,W.checksumRefs,U,!1,q);if(!T.ok)return L(T.error);let F=U$(W.ops);if(!T.changed)return y(`Edit produced no changes — file not written.
21
+ However, lines ${M}–${QJ} appear unchanged. Re-read with trueline_read(ranges=[{start: ${M}, end: ${QJ}}]) to get a narrow checksum, then retry the edit.`};return{ok:!1,error:d}}}if(!L)return await c(),{ok:!0,newChecksum:cJ(),changed:!1};if(!Y){let k;try{let P=await $$(J);if(k=P.mode,P.mtimeMs!==Z)return await s("File was modified by another process. Re-read with trueline_read.")}catch(P){if(P.code!=="ENOENT")throw await c(),P}try{if(k!==void 0)await eQ(F,k);await Q$(F,J)}catch(P){throw await c(),P}}return{ok:!0,newChecksum:cJ(),changed:!0,...Y?{tmpPath:F}:{}}}async function ZQ(J){let Q=performance.now(),{file_path:$,edits:Z,dry_run:Y,projectDir:G,allowedDirs:K}=J,z=await JJ($,Y?"Read":"Edit",G,K);if(!z.ok)return z.error;let q;try{q=DJ(J.encoding)}catch(H){return x(H.message)}let{resolvedPath:A,mtimeMs:U}=z,W=QQ(Z);if(!W.ok)return W.error;if(Y){let H=new yJ,O=await bJ(A,W.ops,W.checksumRefs,U,!0,q,H);if(!O.ok)return x(O.error);if(!O.changed)return y("(no changes)");let j=$.startsWith("/")?V$(G??process.cwd(),A):$,E=H.format(`a/${j}`,`b/${j}`);if(O.tmpPath)try{await K$(O.tmpPath)}catch{}return y(E)}let T=await bJ(A,W.ops,W.checksumRefs,U,!1,q);if(!T.ok)return x(T.error);let F=U$(W.ops);if(!T.changed)return y(`Edit produced no changes — file not written.
20
22
 
21
23
  ${F}
22
24
  checksum: ${T.newChecksum}`);return y(`Edit applied. (${(performance.now()-Q).toFixed(0)}ms)
@@ -24,7 +26,7 @@ checksum: ${T.newChecksum}`);return y(`Edit applied. (${(performance.now()-Q).to
24
26
  ${F}
25
27
  checksum: ${T.newChecksum}`)}function U$(J){return J.map((Q)=>{let $=Q.content.length;if(Q.insertAfter){let V=Q.startLine===0?"at start of file":`after line ${Q.startLine}`;return`inserted ${$} line${$!==1?"s":""} ${V}`}let Z=Q.endLine-Q.startLine+1,Y=Q.startLine===Q.endLine?`line ${Q.startLine}`:`lines ${Q.startLine}–${Q.endLine}`;if($===0)return`deleted ${Y} (${Z} line${Z!==1?"s":""})`;let G=$-Z,K=G>0?"+":G<0?"":"±";return`replaced ${Y} (${Z}→${$} line${$!==1?"s":""}, ${K}${G})`}).join(`
26
28
  `)}import{execSync as S$}from"node:child_process";import{readFile as L$}from"node:fs/promises";import{extname as x$,relative as CQ,resolve as M$}from"node:path";var qQ={grammar:"typescript",outline:new Set(["function_declaration","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","lexical_declaration","variable_declaration","export_statement","method_definition","public_field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"]),topLevelOnly:new Set(["expression_statement"])},q$={...qQ,grammar:"tsx"},EJ={grammar:"javascript",outline:new Set(["function_declaration","class_declaration","lexical_declaration","variable_declaration","export_statement","expression_statement","method_definition","field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"])},XQ={grammar:"python",outline:new Set(["function_definition","class_definition","decorated_definition","expression_statement"]),skip:new Set(["import_statement","import_from_statement"]),recurse:new Set(["block"]),whitespaceMode:"preserve-indent"},z$={grammar:"go",outline:new Set(["function_declaration","method_declaration","type_declaration","const_declaration","var_declaration"]),skip:new Set(["package_clause","import_declaration"]),recurse:new Set([])},W$={grammar:"rust",outline:new Set(["function_item","struct_item","enum_item","trait_item","impl_item","const_item","static_item","mod_item","type_item","macro_definition"]),skip:new Set(["use_declaration"]),recurse:new Set(["declaration_list"])},H$={grammar:"java",outline:new Set(["class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","field_declaration"]),skip:new Set(["package_declaration","import_declaration"]),recurse:new Set(["class_body"])},j$={grammar:"ruby",outline:new Set(["method","class","module","assignment","call"]),skip:new Set([]),recurse:new Set(["body_statement"])},HJ={grammar:"cpp",outline:new Set(["function_definition","class_specifier","struct_specifier","enum_specifier","namespace_definition","declaration","template_declaration"]),skip:new Set(["preproc_include"]),recurse:new Set(["declaration_list","field_declaration_list"])},YQ={grammar:"c",outline:new Set(["function_definition","struct_specifier","enum_specifier","declaration","type_definition"]),skip:new Set(["preproc_include"]),recurse:new Set([])},F$={grammar:"c_sharp",outline:new Set(["class_declaration","interface_declaration","struct_declaration","enum_declaration","method_declaration","constructor_declaration","property_declaration","namespace_declaration"]),skip:new Set(["using_directive"]),recurse:new Set(["declaration_list"])},GQ={grammar:"kotlin",outline:new Set(["function_declaration","class_declaration","object_declaration","property_declaration"]),skip:new Set(["import_list","package_header"]),recurse:new Set(["class_body"])},T$={grammar:"swift",outline:new Set(["function_declaration","class_declaration","struct_declaration","enum_declaration","protocol_declaration","extension_declaration","property_declaration"]),skip:new Set(["import_declaration"]),recurse:new Set(["class_body"])},A$={grammar:"php",outline:new Set(["function_definition","class_declaration","interface_declaration","trait_declaration","method_declaration","property_declaration"]),skip:new Set(["namespace_use_declaration"]),recurse:new Set(["declaration_list"])},KQ={grammar:"scala",outline:new Set(["function_definition","class_definition","object_definition","trait_definition","val_definition","var_definition","type_definition"]),skip:new Set(["import_declaration"]),recurse:new Set(["template_body"])},VQ={grammar:"elixir",outline:new Set(["call"]),skip:new Set([]),recurse:new Set([])},O$={grammar:"lua",outline:new Set(["function_declaration","local_function","variable_declaration","local_variable_declaration","assignment_statement"]),skip:new Set([]),recurse:new Set([])},D$={grammar:"dart",outline:new Set(["function_signature","class_definition","enum_declaration","mixin_declaration","extension_declaration","type_alias"]),skip:new Set(["import_or_export"]),recurse:new Set(["class_body"])},E$={grammar:"zig",outline:new Set(["TopLevelDecl","VarDecl","FnProto"]),skip:new Set([]),recurse:new Set([])},UQ={grammar:"bash",outline:new Set(["function_definition","variable_assignment"]),skip:new Set([]),recurse:new Set([])},C$={".ts":qQ,".tsx":q$,".js":EJ,".jsx":EJ,".mjs":EJ,".cjs":EJ,".py":XQ,".pyi":XQ,".go":z$,".rs":W$,".java":H$,".c":YQ,".h":YQ,".cpp":HJ,".cc":HJ,".cxx":HJ,".hpp":HJ,".hh":HJ,".cs":F$,".rb":j$,".php":A$,".kt":GQ,".kts":GQ,".swift":T$,".scala":KQ,".sc":KQ,".ex":VQ,".exs":VQ,".lua":O$,".dart":D$,".zig":E$,".sh":UQ,".bash":UQ};function qJ(J){return C$[J]}var kJ=mQ(WQ(),1);import{createRequire as B$}from"node:module";import{resolve as FQ,dirname as TQ}from"node:path";var AQ=B$(import.meta.url),HQ=!1,jQ=new Map;function w$(){let J=AQ.resolve("web-tree-sitter/package.json");return FQ(TQ(J),"tree-sitter.wasm")}async function OQ(){if(HQ)return;let J=new Promise((Q,$)=>setTimeout(()=>$(Error("tree-sitter WASM init timed out after 10 s")),1e4));await Promise.race([kJ.default.init({locateFile:()=>w$()}),J]),HQ=!0}function R$(J){let Q=AQ.resolve("tree-sitter-wasms/package.json");return FQ(TQ(Q),"out",`tree-sitter-${J}.wasm`)}async function P$(J){let Q=jQ.get(J);if(Q)return Q;await OQ();let $=await kJ.default.Language.load(R$(J));return jQ.set(J,$),$}async function DQ(J){await OQ();let Q=new kJ.default,$=await P$(J);return Q.setLanguage($),Q}async function _J(J,Q,$=1/0){let Y=(await DQ(Q.grammar)).parse(J),G=J.split(`
27
- `),K=[];function V(H){let O=H.startPosition.row,j=H.endPosition.row,E=G[O]?.trimEnd()??"";if(O===j||E.includes("{"))return E.length>200?`${E.slice(0,197)}...`:E;let I=[E.trimEnd()];for(let P=O+1;P<=Math.min(j,O+20);P++){let x=(G[P]??"").trimEnd();if(I.push(x.trim()),x.includes("{"))break}let _=I.join(" ").replace(/\s+/g," ").replace(/\(\s+/g,"(").replace(/,\s*\)/g,")").replace(/\s*\{\s*$/,"");if(_.length>200)_=`${_.slice(0,197)}...`;return _}let z=-1,q=-1,A=0,U="";function W(){if(A===0)return;let H=A===1?`1 ${U}`:`${A} ${U}s`;K.push({startLine:z,endLine:q,depth:0,nodeType:"_skipped",text:`(${H})`}),z=-1,q=-1,A=0,U=""}function T(H){let O=H.startPosition.row+1,j=H.endPosition.row+1,E=H.type.replace(/_/g," ").replace(/ statement$/,"").replace(/ declaration$/,"");if(A===0||E===U){if(A===0)z=O,U=E;q=j,A++}else W(),z=O,q=j,A=1,U=E}function F(H,O,j){if(j&&Q.skip.has(H.type)){T(H);return}if(Q.skip.has(H.type))return;let E=Q.outline.has(H.type),I=Q.topLevelOnly?.has(H.type)??!1;if(I&&!j)return;if(E||I&&j){if(j)W();if(K.push({startLine:H.startPosition.row+1,endLine:H.endPosition.row+1,depth:O,nodeType:H.type,text:V(H)}),O+1<=$)for(let _ of H.children){if(!_.isNamed)continue;if(Q.recurse.has(_.type))for(let P of _.children){if(!P.isNamed)continue;F(P,O+1,!1)}}return}}for(let H of Y.rootNode.children)F(H,0,!0);return W(),K}function BJ(J,Q){let $=[];for(let Z of J){let Y=" ".repeat(Z.depth);$.push(`${Y}${Z.startLine}-${Z.endLine}: ${Z.text}`)}return $.push(""),$.push(`(${J.length} symbols, ${Q} source lines)`),$.join(`
29
+ `),K=[];function V(H){let O=H.startPosition.row,j=H.endPosition.row,E=G[O]?.trimEnd()??"";if(O===j||E.includes("{"))return E.length>200?`${E.slice(0,197)}...`:E;let I=[E.trimEnd()];for(let R=O+1;R<=Math.min(j,O+20);R++){let S=(G[R]??"").trimEnd();if(I.push(S.trim()),S.includes("{"))break}let B=I.join(" ").replace(/\s+/g," ").replace(/\(\s+/g,"(").replace(/,\s*\)/g,")").replace(/\s*\{\s*$/,"");if(B.length>200)B=`${B.slice(0,197)}...`;return B}let z=-1,q=-1,A=0,U="";function W(){if(A===0)return;let H=A===1?`1 ${U}`:`${A} ${U}s`;K.push({startLine:z,endLine:q,depth:0,nodeType:"_skipped",text:`(${H})`}),z=-1,q=-1,A=0,U=""}function T(H){let O=H.startPosition.row+1,j=H.endPosition.row+1,E=H.type.replace(/_/g," ").replace(/ statement$/,"").replace(/ declaration$/,"");if(A===0||E===U){if(A===0)z=O,U=E;q=j,A++}else W(),z=O,q=j,A=1,U=E}function F(H,O,j){if(j&&Q.skip.has(H.type)){T(H);return}if(Q.skip.has(H.type))return;let E=Q.outline.has(H.type),I=Q.topLevelOnly?.has(H.type)??!1;if(I&&!j)return;if(E||I&&j){if(j)W();if(K.push({startLine:H.startPosition.row+1,endLine:H.endPosition.row+1,depth:O,nodeType:H.type,text:V(H)}),O+1<=$)for(let B of H.children){if(!B.isNamed)continue;if(Q.recurse.has(B.type))for(let R of B.children){if(!R.isNamed)continue;F(R,O+1,!1)}}return}}for(let H of Y.rootNode.children)F(H,0,!0);return W(),K}function BJ(J,Q){let $=[];for(let Z of J){let Y=" ".repeat(Z.depth);$.push(`${Y}${Z.startLine}-${Z.endLine}: ${Z.text}`)}return $.push(""),$.push(`(${J.length} symbols, ${Q} source lines)`),$.join(`
28
30
  `)}function v$(J,Q="collapse"){let $=J.split(`
29
31
  `);if(Q==="preserve-indent")return $.map((Z)=>Z.replace(/\s+$/,"").replace(/(\S)\s{2,}(\S)/g,"$1 $2")).join(`
30
32
  `);return $.map((Z)=>Z.trim().replace(/\s+/g," ")).join(`
@@ -34,7 +36,7 @@ checksum: ${T.newChecksum}`)}function U$(J){return J.map((Q)=>{let $=Q.content.l
34
36
  `),q=V.length>1?V.slice(1):V,A=v$(q.join(`
35
37
  `),G);return{name:N$(K.text,K.nodeType),signature:K.text,bodyHash:I$(A),nodeType:K.nodeType,bodyText:z}})}function N$(J,Q){let $=J.match(/(?:function|class|interface|type|enum|const|let|var|def|fn|func|fun|pub\s+fn|async\s+function)\s+(\w+)/);if($)return $[1];let Z=J.match(/^\s*(?:(?:public|private|protected|static|async|export|abstract)\s+)*(\w+)\s*[(<]/);if(Z)return Z[1];let Y=J.match(/(\w+)/);return Y?Y[1]:J.slice(0,40)}function EQ(J,Q){let $={added:[],removed:[],renamed:[],signatureChanged:[],logicChanged:[]},Z=new Map(J.map((U)=>[U.name,U])),Y=new Map(Q.map((U)=>[U.name,U])),G=[],K=[],V=[];for(let U of J){let W=Y.get(U.name);if(W)G.push({old:U,new:W});else K.push(U)}for(let U of Q)if(!Z.has(U.name))V.push(U);let z=new Map;for(let U of K){let W=z.get(U.bodyHash)??[];W.push(U),z.set(U.bodyHash,W)}let q=new Set,A=new Set;for(let U of V){let W=z.get(U.bodyHash);if(W&&W.length>0){let T=W.shift();$.renamed.push({oldName:T.name,newName:U.name,signature:U.signature}),q.add(T.name),A.add(U.name)}}for(let U of K)if(!q.has(U.name))$.removed.push(U);for(let U of V)if(!A.has(U.name))$.added.push(U);for(let{old:U,new:W}of G)if(U.signature!==W.signature&&U.bodyHash!==W.bodyHash)$.signatureChanged.push({name:U.name,oldSig:U.signature,newSig:W.signature}),$.logicChanged.push({name:U.name,signature:W.signature,oldBody:U.bodyText,newBody:W.bodyText});else if(U.signature!==W.signature)$.signatureChanged.push({name:U.name,oldSig:U.signature,newSig:W.signature});else if(U.bodyHash!==W.bodyHash)$.logicChanged.push({name:U.name,signature:W.signature,oldBody:U.bodyText,newBody:W.bodyText});return $}async function kQ(J){let{compare_against:Q="HEAD",projectDir:$,allowedDirs:Z}=J,Y=J.file_paths;if(Y.length===1&&Y[0]==="*"){if(Y=g$($??process.cwd(),Q),Y.length===0)return y("No changed files found.")}let G=[];for(let K of Y){let V=await JJ(K,"Read",$,Z);if(!V.ok){G.push(`## ${K}
36
38
 
37
- Access denied.`);continue}let{resolvedPath:z}=V,q=x$(z).replace(/^\./,""),A=K.startsWith("/")?CQ($??process.cwd(),z):K,U;try{let j=await L$(z);if(j.includes(0))return L(`"${K}" appears to be a binary file`);U=j.toString("utf-8")}catch{G.push(`## ${A}
39
+ Access denied.`);continue}let{resolvedPath:z}=V,q=x$(z).replace(/^\./,""),A=K.startsWith("/")?CQ($??process.cwd(),z):K,U;try{let j=await L$(z);if(j.includes(0))return x(`"${K}" appears to be a binary file`);U=j.toString("utf-8")}catch{G.push(`## ${A}
38
40
 
39
41
  File not readable.`);continue}let W=b$(z,Q,$??process.cwd()),[T,F]=await Promise.all([hJ(W,q),hJ(U,q)]);if(!qJ(`.${q}`)){G.push(`## ${A}
40
42
 
@@ -53,16 +55,16 @@ No structural changes.`;let Y=[];if(Y.push(`## ${J} (vs ${$})`),Q.added.length>0
53
55
  ${K}`);else Y.push(`- \`${G.name}\``)}}return Y.join(`
54
56
  `)}function m$(J,Q){if(!J||!Q)return null;let $=J.split(`
55
57
  `),Z=Q.split(`
56
- `),Y=$.length,G=Z.length,K=0;while(K<Y&&K<G&&$[K]===Z[K])K++;let V=0;while(V<Y-K&&V<G-K&&$[Y-1-V]===Z[G-1-V])V++;let z=$.slice(K,Y-V),q=Z.slice(K,G-V),A=z.length,U=q.length,W=1e6;if(A*U>W)return null;let T=Array.from({length:A+1},()=>Array(U+1).fill(0));for(let _=1;_<=A;_++)for(let P=1;P<=U;P++)if(z[_-1]===q[P-1])T[_][P]=T[_-1][P-1]+1;else T[_][P]=Math.max(T[_-1][P],T[_][P-1]);let F=[],H=[],O=A,j=U;while(O>0||j>0)if(O>0&&j>0&&z[O-1]===q[j-1])O--,j--;else if(j>0&&(O===0||T[O][j-1]>=T[O-1][j]))H.push(q[j-1]),j--;else F.push(z[O-1]),O--;let E=F.length+H.length;if(E===0||E>h$)return null;F.reverse(),H.reverse();let I=[];for(let _ of F)I.push(` - ${_.trim()}`);for(let _ of H)I.push(` + ${_.trim()}`);return I.join(`
57
- `)}import{readFileSync as n$}from"node:fs";import{extname as i$}from"node:path";var p$=/^(#{1,6})\s+(.+)$/,c$=/^(`{3,}|~{3,})(\s*(\S+))?/,fJ=/^\|(.+\|)+\s*$/,u$=/^\|[\s:.-]*-+[\s:.-]*(\|[\s:.-]*-+[\s:.-]*)+\|?\s*$/;async function _Q(J){let Q=[],$=0,Z=0,Y=-1,G=-1,K=0,V="",z=0,q=0,A="",U=0,W="",T=0,F=0,H=0,O=0,j="",E=null,I=0;function _(){return Y>=0?Y+1:0}function P(D){if(G>=0)Q[G].endLine=D-1}function x(D,B,w){P(w),Y=D-1,G=Q.length,Q.push({startLine:w,endLine:$,depth:D-1,nodeType:`h${D}`,text:`${"#".repeat(D)} ${B}`})}function S(D){let B=D-K+1;Q.push({startLine:K,endLine:D,depth:0,nodeType:"frontmatter",text:`--- (frontmatter, ${B} lines)`})}function f(D){let B=D-q+1,w=V.repeat(3);Q.push({startLine:q,endLine:D,depth:_(),nodeType:"fenced_code",text:A?`${w}${A} (${B} lines)`:`${w} (${B} lines)`})}function N(D){Q.push({startLine:U,endLine:D,depth:_(),nodeType:"table",text:`${BQ(W,80)} (${F} rows, ${T} cols)`})}function b(D){let B=D-H+1;if(B<3)return;Q.push({startLine:H,endLine:D,depth:_(),nodeType:"html_comment",text:`<!-- ... --> (${B} lines)`})}function u(D){let B=D-O+1;if(B<3)return;let w=/^>\s*\[!(\w+)]/.exec(j),g=w?`> [!${w[1]}]`:`> ${l$(j,60)}`;Q.push({startLine:O,endLine:D,depth:_(),nodeType:"blockquote",text:`${g} (${B} lines)`})}function r(D,B){if(D===2)f(B);else if(D===3)N(B);else if(D===4)b(B);else if(D===5)u(B)}function v(D,B){switch(Z){case 1:{if(D==="---"||D==="...")S(B),Z=0;return!0}case 2:{let w=D.trimEnd();if(w.length>=z){let g=!0;for(let m=0;m<w.length;m++)if(w[m]!==V){g=!1;break}if(g)f(B),Z=0}return!0}case 3:{if(fJ.test(D))return F++,!0;return N(B-1),Z=0,!1}case 4:{if(D.includes("-->"))b(B),Z=0;return!0}case 5:{if(D.startsWith("> ")||D===">")return!0;return u(B-1),Z=0,!1}case 0:{if(B===1&&D==="---")return Z=1,K=1,!0;let w=c$.exec(D);if(w)return Z=2,V=w[1][0],z=w[1].length,q=B,A=w[3]||"",!0;if(D.includes("<!--")&&!D.includes("-->"))return Z=4,H=B,!0;if(D.startsWith("> ")||D===">")return Z=5,O=B,j=D,!0;let g=p$.exec(D);if(g)return x(g[1].length,g[2].trimEnd(),B),!0;return!0}}}for await(let{lineBytes:D,lineNumber:B}of t(J)){$=B;let w=D.toString("utf-8");if(Z!==0){if(E!==null){let h=E,p=I;E=null;let s=v(h,p);while(!s)s=v(h,p)}let m=v(w,B);while(!m)m=v(w,B);continue}if(E!==null){if(fJ.test(E)&&u$.test(w)){Z=3,U=I,W=E.trim(),T=(w.match(/\|/g)||[]).length-1,F=2,E=null;continue}let m=E,h=I;E=null;let p=v(m,h);while(!p)p=v(m,h)}if(Z===0&&fJ.test(w)){E=w,I=B;continue}let g=v(w,B);while(!g)g=v(w,B)}if(E!==null){let D=v(E,I);while(!D)D=v(E,I)}if(r(Z,$),G>=0)Q[G].endLine=$;return{entries:Q,totalLines:$}}function BQ(J,Q){return J.length<=Q?J:`${J.slice(0,Q-1)}…`}function l$(J,Q){let $=J.startsWith("> ")?J.slice(2):J.startsWith(">")?J.slice(1):J;return BQ($.trimEnd(),Q)}var l={Text:0,TagOpen:1,Comment:2,CData:3,PI:4,DocType:5};async function wQ(J,Q=1/0){let $=[],Z=[],Y=0,G=l.Text,K="",V=0;function z(){return Z.length}function q(U,W){if(U.endsWith("/")){let H=U.slice(0,-1).trim(),O=mJ(H),j=z();if(j<=Q)$.push({startLine:V,endLine:W,depth:j,nodeType:"element",text:o$(O,H)});return}if(U.startsWith("/")){let H=mJ(U.slice(1));for(let O=Z.length-1;O>=0;O--)if(Z[O].tagName===H){let j=Z[O];if(Z.length=O,j.depth<=Q)$.push({startLine:j.startLine,endLine:W,depth:j.depth,nodeType:"element",text:j.signature});return}return}let T=mJ(U),F=z();Z.push({tagName:T,depth:F,startLine:V,signature:d$(T,U)})}function A(U,W){if(z()>0)return;let T=U.trim(),F=T.length>200?`${T.slice(0,197)}...`:T;$.push({startLine:V,endLine:W,depth:0,nodeType:"processing_instruction",text:`<?${F}?>`})}for await(let{lineBytes:U,lineNumber:W}of t(J,{detectBinary:!0})){Y=W;let T=U.toString("utf-8");for(let F=0;F<T.length;F++){let H=T[F];switch(G){case l.Text:if(H==="<"){let O=T.slice(F+1);if(O.startsWith("!--"))G=l.Comment,K="",F+=3;else if(O.startsWith("![CDATA["))G=l.CData,K="",F+=8;else if(O.startsWith("!DOCTYPE")||O.startsWith("!doctype"))G=l.DocType,K="",F+=8;else if(O.startsWith("?"))G=l.PI,K="",V=W,F+=1;else G=l.TagOpen,K="",V=W}break;case l.TagOpen:if(H===">")q(K.trim(),W),G=l.Text,K="";else K+=H;break;case l.PI:if(H==="?"&&F+1<T.length&&T[F+1]===">")A(K,W),G=l.Text,K="",F++;else K+=H;break;case l.Comment:if(H==="-"&&T.slice(F,F+3)==="-->")G=l.Text,K="",F+=2;break;case l.CData:if(H==="]"&&T.slice(F,F+3)==="]]>")G=l.Text,K="",F+=2;break;case l.DocType:{if(H===">")G=l.Text,K="";else if(H==="[")K+=H;break}}}if(G===l.TagOpen||G===l.PI)K+=" "}while(Z.length>0){let U=Z.pop();if(U.depth<=Q)$.push({startLine:U.startLine,endLine:Y,depth:U.depth,nodeType:"element",text:U.signature})}return $.sort((U,W)=>U.startLine-W.startLine||U.depth-W.depth),{entries:$,totalLines:Y}}function mJ(J){let Q=J.trim(),$=Q.search(/[\s/]/);return $===-1?Q:Q.slice(0,$)}function d$(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")}>`;return Z.length>200?`<${J} ...>`:Z}function o$(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")} />`;return Z.length>200?`<${J} ... />`:Z}var r$=new Set([".md",".markdown"]),s$=new Set([".xml",".xsl",".xslt",".xhtml",".svg",".pom",".csproj",".props",".targets",".fxml",".xaml"]);async function PQ(J){let{projectDir:Q,allowedDirs:$}=J,Z=J.file_paths;if(Z.length===0)return L("Provide at least one file path in file_paths.");if(Z.length===1)return RQ(Z[0],J.depth,Q,$);let Y=[],G=0,K=0;for(let q of Z){let A=await RQ(q,J.depth,Q,$),U=A.content[0].type==="text"?A.content[0].text:"",W=U.match(/\((\d+) symbols?, (\d+) source lines?\)/);if(W)G+=Number(W[1]),K+=Number(W[2]);let T=Q&&q.startsWith(Q)?q.slice(Q.length+1):q;Y.push(`--- ${T} ---
58
+ `),Y=$.length,G=Z.length,K=0;while(K<Y&&K<G&&$[K]===Z[K])K++;let V=0;while(V<Y-K&&V<G-K&&$[Y-1-V]===Z[G-1-V])V++;let z=$.slice(K,Y-V),q=Z.slice(K,G-V),A=z.length,U=q.length,W=1e6;if(A*U>W)return null;let T=Array.from({length:A+1},()=>Array(U+1).fill(0));for(let B=1;B<=A;B++)for(let R=1;R<=U;R++)if(z[B-1]===q[R-1])T[B][R]=T[B-1][R-1]+1;else T[B][R]=Math.max(T[B-1][R],T[B][R-1]);let F=[],H=[],O=A,j=U;while(O>0||j>0)if(O>0&&j>0&&z[O-1]===q[j-1])O--,j--;else if(j>0&&(O===0||T[O][j-1]>=T[O-1][j]))H.push(q[j-1]),j--;else F.push(z[O-1]),O--;let E=F.length+H.length;if(E===0||E>h$)return null;F.reverse(),H.reverse();let I=[];for(let B of F)I.push(` - ${B.trim()}`);for(let B of H)I.push(` + ${B.trim()}`);return I.join(`
59
+ `)}import{readFileSync as n$}from"node:fs";import{extname as i$}from"node:path";var p$=/^(#{1,6})\s+(.+)$/,c$=/^(`{3,}|~{3,})(\s*(\S+))?/,fJ=/^\|(.+\|)+\s*$/,u$=/^\|[\s:.-]*-+[\s:.-]*(\|[\s:.-]*-+[\s:.-]*)+\|?\s*$/;async function _Q(J){let Q=[],$=0,Z=0,Y=-1,G=-1,K=0,V="",z=0,q=0,A="",U=0,W="",T=0,F=0,H=0,O=0,j="",E=null,I=0;function B(){return Y>=0?Y+1:0}function R(D){if(G>=0)Q[G].endLine=D-1}function S(D,_,w){R(w),Y=D-1,G=Q.length,Q.push({startLine:w,endLine:$,depth:D-1,nodeType:`h${D}`,text:`${"#".repeat(D)} ${_}`})}function L(D){let _=D-K+1;Q.push({startLine:K,endLine:D,depth:0,nodeType:"frontmatter",text:`--- (frontmatter, ${_} lines)`})}function f(D){let _=D-q+1,w=V.repeat(3);Q.push({startLine:q,endLine:D,depth:B(),nodeType:"fenced_code",text:A?`${w}${A} (${_} lines)`:`${w} (${_} lines)`})}function N(D){Q.push({startLine:U,endLine:D,depth:B(),nodeType:"table",text:`${BQ(W,80)} (${F} rows, ${T} cols)`})}function b(D){let _=D-H+1;if(_<3)return;Q.push({startLine:H,endLine:D,depth:B(),nodeType:"html_comment",text:`<!-- ... --> (${_} lines)`})}function m(D){let _=D-O+1;if(_<3)return;let w=/^>\s*\[!(\w+)]/.exec(j),g=w?`> [!${w[1]}]`:`> ${l$(j,60)}`;Q.push({startLine:O,endLine:D,depth:B(),nodeType:"blockquote",text:`${g} (${_} lines)`})}function r(D,_){if(D===2)f(_);else if(D===3)N(_);else if(D===4)b(_);else if(D===5)m(_)}function v(D,_){switch(Z){case 1:{if(D==="---"||D==="...")L(_),Z=0;return!0}case 2:{let w=D.trimEnd();if(w.length>=z){let g=!0;for(let p=0;p<w.length;p++)if(w[p]!==V){g=!1;break}if(g)f(_),Z=0}return!0}case 3:{if(fJ.test(D))return F++,!0;return N(_-1),Z=0,!1}case 4:{if(D.includes("-->"))b(_),Z=0;return!0}case 5:{if(D.startsWith("> ")||D===">")return!0;return m(_-1),Z=0,!1}case 0:{if(_===1&&D==="---")return Z=1,K=1,!0;let w=c$.exec(D);if(w)return Z=2,V=w[1][0],z=w[1].length,q=_,A=w[3]||"",!0;if(D.includes("<!--")&&!D.includes("-->"))return Z=4,H=_,!0;if(D.startsWith("> ")||D===">")return Z=5,O=_,j=D,!0;let g=p$.exec(D);if(g)return S(g[1].length,g[2].trimEnd(),_),!0;return!0}}}for await(let{lineBytes:D,lineNumber:_}of t(J)){$=_;let w=D.toString("utf-8");if(Z!==0){if(E!==null){let h=E,c=I;E=null;let s=v(h,c);while(!s)s=v(h,c)}let p=v(w,_);while(!p)p=v(w,_);continue}if(E!==null){if(fJ.test(E)&&u$.test(w)){Z=3,U=I,W=E.trim(),T=(w.match(/\|/g)||[]).length-1,F=2,E=null;continue}let p=E,h=I;E=null;let c=v(p,h);while(!c)c=v(p,h)}if(Z===0&&fJ.test(w)){E=w,I=_;continue}let g=v(w,_);while(!g)g=v(w,_)}if(E!==null){let D=v(E,I);while(!D)D=v(E,I)}if(r(Z,$),G>=0)Q[G].endLine=$;return{entries:Q,totalLines:$}}function BQ(J,Q){return J.length<=Q?J:`${J.slice(0,Q-1)}…`}function l$(J,Q){let $=J.startsWith("> ")?J.slice(2):J.startsWith(">")?J.slice(1):J;return BQ($.trimEnd(),Q)}var l={Text:0,TagOpen:1,Comment:2,CData:3,PI:4,DocType:5};async function wQ(J,Q=1/0){let $=[],Z=[],Y=0,G=l.Text,K="",V=0;function z(){return Z.length}function q(U,W){if(U.endsWith("/")){let H=U.slice(0,-1).trim(),O=mJ(H),j=z();if(j<=Q)$.push({startLine:V,endLine:W,depth:j,nodeType:"element",text:o$(O,H)});return}if(U.startsWith("/")){let H=mJ(U.slice(1));for(let O=Z.length-1;O>=0;O--)if(Z[O].tagName===H){let j=Z[O];if(Z.length=O,j.depth<=Q)$.push({startLine:j.startLine,endLine:W,depth:j.depth,nodeType:"element",text:j.signature});return}return}let T=mJ(U),F=z();Z.push({tagName:T,depth:F,startLine:V,signature:d$(T,U)})}function A(U,W){if(z()>0)return;let T=U.trim(),F=T.length>200?`${T.slice(0,197)}...`:T;$.push({startLine:V,endLine:W,depth:0,nodeType:"processing_instruction",text:`<?${F}?>`})}for await(let{lineBytes:U,lineNumber:W}of t(J,{detectBinary:!0})){Y=W;let T=U.toString("utf-8");for(let F=0;F<T.length;F++){let H=T[F];switch(G){case l.Text:if(H==="<"){let O=T.slice(F+1);if(O.startsWith("!--"))G=l.Comment,K="",F+=3;else if(O.startsWith("![CDATA["))G=l.CData,K="",F+=8;else if(O.startsWith("!DOCTYPE")||O.startsWith("!doctype"))G=l.DocType,K="",F+=8;else if(O.startsWith("?"))G=l.PI,K="",V=W,F+=1;else G=l.TagOpen,K="",V=W}break;case l.TagOpen:if(H===">")q(K.trim(),W),G=l.Text,K="";else K+=H;break;case l.PI:if(H==="?"&&F+1<T.length&&T[F+1]===">")A(K,W),G=l.Text,K="",F++;else K+=H;break;case l.Comment:if(H==="-"&&T.slice(F,F+3)==="-->")G=l.Text,K="",F+=2;break;case l.CData:if(H==="]"&&T.slice(F,F+3)==="]]>")G=l.Text,K="",F+=2;break;case l.DocType:{if(H===">")G=l.Text,K="";else if(H==="[")K+=H;break}}}if(G===l.TagOpen||G===l.PI)K+=" "}while(Z.length>0){let U=Z.pop();if(U.depth<=Q)$.push({startLine:U.startLine,endLine:Y,depth:U.depth,nodeType:"element",text:U.signature})}return $.sort((U,W)=>U.startLine-W.startLine||U.depth-W.depth),{entries:$,totalLines:Y}}function mJ(J){let Q=J.trim(),$=Q.search(/[\s/]/);return $===-1?Q:Q.slice(0,$)}function d$(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")}>`;return Z.length>200?`<${J} ...>`:Z}function o$(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")} />`;return Z.length>200?`<${J} ... />`:Z}var r$=new Set([".md",".markdown"]),s$=new Set([".xml",".xsl",".xslt",".xhtml",".svg",".pom",".csproj",".props",".targets",".fxml",".xaml"]);async function PQ(J){let{projectDir:Q,allowedDirs:$}=J,Z=J.file_paths;if(Z.length===0)return x("Provide at least one file path in file_paths.");if(Z.length===1)return RQ(Z[0],J.depth,Q,$);let Y=[],G=0,K=0;for(let q of Z){let A=await RQ(q,J.depth,Q,$),U=A.content[0].type==="text"?A.content[0].text:"",W=U.match(/\((\d+) symbols?, (\d+) source lines?\)/);if(W)G+=Number(W[1]),K+=Number(W[2]);let T=Q&&q.startsWith(Q)?q.slice(Q.length+1):q;Y.push(`--- ${T} ---
58
60
  ${U}`)}let V=Y.join(`
59
61
 
60
62
  `),z=`
61
- (${G} symbols, ${K} source lines across ${Z.length} files)`;return y(V+z)}async function RQ(J,Q,$,Z){let Y=await JJ(J,"Read",$,Z);if(!Y.ok)return Y.error;let G=i$(Y.resolvedPath).toLowerCase();if(r$.has(G))try{let{entries:q,totalLines:A}=await _Q(Y.resolvedPath);if(q.length===0)return y(`(no outline entries found in ${A}-line file)`);return y(BJ(q,A))}catch(q){return L(`Markdown outline extraction failed: ${q.message}`)}if(s$.has(G))try{let{entries:q,totalLines:A}=await wQ(Y.resolvedPath,Q);if(q.length===0)return y(`(no outline entries found in ${A}-line file)`);return y(BJ(q,A))}catch(q){return L(`XML outline extraction failed: ${q.message}`)}let K;try{let q=n$(Y.resolvedPath);if(q.includes(0))return L(`"${J}" appears to be a binary file`);K=q.toString("utf-8")}catch(q){return L(`Error reading file: ${q.message}`)}let V=1;for(let q=0;q<K.length;q++)if(K.charCodeAt(q)===10)V++;let z=qJ(G);if(!z)return y(`No outline support for "${G}" files — use trueline_read to read this file directly.`);try{let q=await _J(K,z,Q);if(q.length===0)return y(`(no outline entries found in ${V}-line file)`);return y(BJ(q,V))}catch(q){return L(`Outline extraction failed: ${q.message}`)}}async function vQ(J){let{file_path:Q,pattern:$,projectDir:Z,allowedDirs:Y}=J,G=J.context_lines??2,K=J.max_matches??10,V=1e5;if(G<0||G>1e5||!Number.isFinite(G))return L("context_lines must be between 0 and 100000");let z=await JJ(Q,"Read",Z,Y);if(!z.ok)return z.error;if($.includes(`
62
- `)||$.includes("\r"))return L("Pattern contains newlines. trueline_search matches line-by-line, so multiline patterns cannot match. Search for a single-line substring instead, or use trueline_outline + trueline_read to find multiline blocks.");let q;if(J.regex){let N;try{N=new RegExp($,J.case_insensitive?"i":void 0)}catch{return L(`Invalid regex pattern: "${$}"`)}q=(b)=>N.test(b)}else if(J.case_insensitive){let N=$.toLowerCase();q=(b)=>b.toLowerCase().includes(N)}else q=(N)=>N.includes($);let{resolvedPath:A}=z,U=[],W=0,T=0,F=Array(G>0?G:0),H=0,O=0,j=0,E=null,I=!1,_=1000,P=0,x=!1;try{for await(let{lineBytes:N,lineNumber:b}of t(A,{detectBinary:!0})){if(I){if(P++,P>_){x=!0;break}let B=N.toString("utf-8");if(q(B))W++;continue}let u=XJ(N,0,N.length),r=N.toString("utf-8"),v=q(r),D={lineNumber:b,text:r,hash:u,isMatch:v};if(v)W++;if(v&&T<K){if(T++,E===null){if(E={lines:[]},H>0){let B=Math.min(H,F.length);for(let w=0;w<B;w++)E.lines.push(F[(O+w)%F.length])}}if(E.lines.push(D),j=G,T>=K&&j===0)U.push(E),E=null,I=!0}else if(j>0&&E!==null){if(E.lines.push(D),v&&T<K)j=G;else if(j--,j===0&&T>=K)U.push(E),E=null,I=!0;else if(j===0)U.push(E),E=null,H=0,O=0}else if(G>0)if(H<F.length)F[(O+H)%F.length]=D,H++;else F[O]=D,O=(O+1)%F.length}}catch(N){if(VJ(N))return UJ(Q);throw N}if(E!==null)U.push(E);if(W===0){let N=`No matches for pattern "${$}" in ${Q}`;if(!J.regex&&/[.*+?^${}()|[\]\\]/.test($))N+=`
63
+ (${G} symbols, ${K} source lines across ${Z.length} files)`;return y(V+z)}async function RQ(J,Q,$,Z){let Y=await JJ(J,"Read",$,Z);if(!Y.ok)return Y.error;let G=i$(Y.resolvedPath).toLowerCase();if(r$.has(G))try{let{entries:q,totalLines:A}=await _Q(Y.resolvedPath);if(q.length===0)return y(`(no outline entries found in ${A}-line file)`);return y(BJ(q,A))}catch(q){return x(`Markdown outline extraction failed: ${q.message}`)}if(s$.has(G))try{let{entries:q,totalLines:A}=await wQ(Y.resolvedPath,Q);if(q.length===0)return y(`(no outline entries found in ${A}-line file)`);return y(BJ(q,A))}catch(q){return x(`XML outline extraction failed: ${q.message}`)}let K;try{let q=n$(Y.resolvedPath);if(q.includes(0))return x(`"${J}" appears to be a binary file`);K=q.toString("utf-8")}catch(q){return x(`Error reading file: ${q.message}`)}let V=1;for(let q=0;q<K.length;q++)if(K.charCodeAt(q)===10)V++;let z=qJ(G);if(!z)return y(`No outline support for "${G}" files — use trueline_read to read this file directly.`);try{let q=await _J(K,z,Q);if(q.length===0)return y(`(no outline entries found in ${V}-line file)`);return y(BJ(q,V))}catch(q){return x(`Outline extraction failed: ${q.message}`)}}async function vQ(J){let{file_path:Q,pattern:$,projectDir:Z,allowedDirs:Y}=J,G=J.context_lines??2,K=J.max_matches??10,V=1e5;if(G<0||G>1e5||!Number.isFinite(G))return x("context_lines must be between 0 and 100000");let z=await JJ(Q,"Read",Z,Y);if(!z.ok)return z.error;if($.includes(`
64
+ `)||$.includes("\r"))return x("Pattern contains newlines. trueline_search matches line-by-line, so multiline patterns cannot match. Search for a single-line substring instead, or use trueline_outline + trueline_read to find multiline blocks.");let q;if(J.regex){let N;try{N=new RegExp($,J.case_insensitive?"i":void 0)}catch{return x(`Invalid regex pattern: "${$}"`)}q=(b)=>N.test(b)}else if(J.case_insensitive){let N=$.toLowerCase();q=(b)=>b.toLowerCase().includes(N)}else q=(N)=>N.includes($);let{resolvedPath:A}=z,U=[],W=0,T=0,F=Array(G>0?G:0),H=0,O=0,j=0,E=null,I=!1,B=1000,R=0,S=!1;try{for await(let{lineBytes:N,lineNumber:b}of t(A,{detectBinary:!0})){if(I){if(R++,R>B){S=!0;break}let _=N.toString("utf-8");if(q(_))W++;continue}let m=XJ(N,0,N.length),r=N.toString("utf-8"),v=q(r),D={lineNumber:b,text:r,hash:m,isMatch:v};if(v)W++;if(v&&T<K){if(T++,E===null){if(E={lines:[]},H>0){let _=Math.min(H,F.length);for(let w=0;w<_;w++)E.lines.push(F[(O+w)%F.length])}}if(E.lines.push(D),j=G,T>=K&&j===0)U.push(E),E=null,I=!0}else if(j>0&&E!==null){if(E.lines.push(D),v&&T<K)j=G;else if(j--,j===0&&T>=K)U.push(E),E=null,I=!0;else if(j===0)U.push(E),E=null,H=0,O=0}else if(G>0)if(H<F.length)F[(O+H)%F.length]=D,H++;else F[O]=D,O=(O+1)%F.length}}catch(N){if(VJ(N))return UJ(Q);throw N}if(E!==null)U.push(E);if(W===0){let N=`No matches for pattern "${$}" in ${Q}`;if(!J.regex&&/[.*+?^${}()|[\]\\]/.test($))N+=`
63
65
 
64
- (hint: pattern contains regex metacharacters but was searched literally — add regex=true for regex matching)`;return y(N)}let S=[],f=0;for(let N=0;N<U.length;N++){let b=U[N],u=e,r=0,v=0;if(N>0)S.push("");for(let D of b.lines){if(r===0)r=D.lineNumber;v=D.lineNumber,u=$J(u,D.hash);let B=D.isMatch&&f<K?" ← match":"";if(D.isMatch&&B!=="")f++;S.push(`${KJ(D.hash)}.${D.lineNumber} ${D.text}${B}`)}S.push(""),S.push(`checksum: ${ZJ(r,v,u)}`)}if(W>K){S.push("");let N=x?`${W}+`:`${W}`;S.push(`(showing ${K} of ${N} matches — increase max_matches to see more)`)}return y(S.join(`
65
- `))}async function IQ(J){let{file_path:Q,checksums:$,projectDir:Z,allowedDirs:Y}=J;if(!$||$.length===0)return L("No checksums provided");let G=await JJ(Q,"Read",Z,Y);if(!G.ok)return G.error;let{resolvedPath:K}=G,V=[];for(let U of $){let W;try{W=OJ(U)}catch(T){return L(T.message)}V.push({startLine:W.startLine,endLine:W.endLine,expected:W.hash,hash:e})}V.sort((U,W)=>U.startLine-W.startLine);let z=0;try{let U=0;for await(let{lineBytes:W,lineNumber:T}of t(K,{detectBinary:!0})){z=T;while(U<V.length&&V[U].startLine===0)U++;if(U>=V.length)break;if(T<V[U].startLine)continue;while(U<V.length&&V[U].startLine>0&&T>V[U].endLine)U++;if(U>=V.length)break;if(V[U].startLine>0&&T<V[U].startLine)continue;let F=XJ(W,0,W.length);for(let H=U;H<V.length&&V[H].startLine<=T;H++)if(V[H].startLine>0&&T<=V[H].endLine)V[H].hash=$J(V[H].hash,F)}}catch(U){if(VJ(U))return UJ(Q);throw U}let q=[],A=!0;for(let U of V){if(U.startLine===0&&U.endLine===0){if(z===0&&U.expected==="00000000")q.push("valid: 0-0:00000000");else if(A=!1,z===0)q.push(`stale: 0-0:${U.expected}`);else q.push(`stale: 0-0:${U.expected} (file now has ${z} lines)`);continue}if(U.startLine>z||U.endLine>z){A=!1;let T=U.startLine>z?`range past EOF (file has ${z} lines)`:`actual: ${ZJ(U.startLine,Math.min(U.endLine,z),U.hash)}`;q.push(`stale: ${U.startLine}-${U.endLine}:${U.expected} (${T})`);continue}if(U.hash.toString(16).padStart(8,"0")===U.expected)q.push(`valid: ${ZJ(U.startLine,U.endLine,U.hash)}`);else A=!1,q.push(`stale: ${U.startLine}-${U.endLine}:${U.expected} (actual: ${ZJ(U.startLine,U.endLine,U.hash)})`)}if(A)return y("all checksums valid");return y(q.join(`
66
+ (hint: pattern contains regex metacharacters but was searched literally — add regex=true for regex matching)`;return y(N)}let L=[],f=0;for(let N=0;N<U.length;N++){let b=U[N],m=e,r=0,v=0;if(N>0)L.push("");for(let D of b.lines){if(r===0)r=D.lineNumber;v=D.lineNumber,m=$J(m,D.hash);let _=D.isMatch&&f<K?" ← match":"";if(D.isMatch&&_!=="")f++;L.push(`${KJ(D.hash)}.${D.lineNumber} ${D.text}${_}`)}L.push(""),L.push(`checksum: ${ZJ(r,v,m)}`)}if(W>K){L.push("");let N=S?`${W}+`:`${W}`;L.push(`(showing ${K} of ${N} matches — increase max_matches to see more)`)}return y(L.join(`
67
+ `))}async function IQ(J){let{file_path:Q,checksums:$,projectDir:Z,allowedDirs:Y}=J;if(!$||$.length===0)return x("No checksums provided");let G=await JJ(Q,"Read",Z,Y);if(!G.ok)return G.error;let{resolvedPath:K}=G,V=[];for(let U of $){let W;try{W=OJ(U)}catch(T){return x(T.message)}V.push({startLine:W.startLine,endLine:W.endLine,expected:W.hash,hash:e})}V.sort((U,W)=>U.startLine-W.startLine);let z=0;try{let U=0;for await(let{lineBytes:W,lineNumber:T}of t(K,{detectBinary:!0})){z=T;while(U<V.length&&V[U].startLine===0)U++;if(U>=V.length)break;if(T<V[U].startLine)continue;while(U<V.length&&V[U].startLine>0&&T>V[U].endLine)U++;if(U>=V.length)break;if(V[U].startLine>0&&T<V[U].startLine)continue;let F=XJ(W,0,W.length);for(let H=U;H<V.length&&V[H].startLine<=T;H++)if(V[H].startLine>0&&T<=V[H].endLine)V[H].hash=$J(V[H].hash,F)}}catch(U){if(VJ(U))return UJ(Q);throw U}let q=[],A=!0;for(let U of V){if(U.startLine===0&&U.endLine===0){if(z===0&&U.expected==="00000000")q.push("valid: 0-0:00000000");else if(A=!1,z===0)q.push(`stale: 0-0:${U.expected}`);else q.push(`stale: 0-0:${U.expected} (file now has ${z} lines)`);continue}if(U.startLine>z||U.endLine>z){A=!1;let T=U.startLine>z?`range past EOF (file has ${z} lines)`:`actual: ${ZJ(U.startLine,Math.min(U.endLine,z),U.hash)}`;q.push(`stale: ${U.startLine}-${U.endLine}:${U.expected} (${T})`);continue}if(U.hash.toString(16).padStart(8,"0")===U.expected)q.push(`valid: ${ZJ(U.startLine,U.endLine,U.hash)}`);else A=!1,q.push(`stale: ${U.startLine}-${U.endLine}:${U.expected} (actual: ${ZJ(U.startLine,U.endLine,U.hash)})`)}if(A)return y("all checksums valid");return y(q.join(`
66
68
  `))}var NQ=new Set(["read","edit","outline","search","diff","verify"]);class RJ{text;constructor(J){this.text=J}}var t$=`trueline <command> [options]
67
69
 
68
70
  Hash-verified file operations for AI coding agents.