UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

7 lines • 101 kB
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
import"./chunk-IKOFCODM.js";var __defProp=Object.defineProperty,__name=(target,value)=>__defProp(target,"name",{value,configurable:!0}),Edit=class{static{__name(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex,oldEndIndex,newEndIndex,startPosition,oldEndPosition,newEndPosition}){this.startIndex=startIndex>>>0,this.oldEndIndex=oldEndIndex>>>0,this.newEndIndex=newEndIndex>>>0,this.startPosition=startPosition,this.oldEndPosition=oldEndPosition,this.newEndPosition=newEndPosition}editPoint(point,index){let newIndex=index,newPoint={...point};if(index>=this.oldEndIndex){newIndex=this.newEndIndex+(index-this.oldEndIndex);let originalRow=point.row;newPoint.row=this.newEndPosition.row+(point.row-this.oldEndPosition.row),newPoint.column=originalRow===this.oldEndPosition.row?this.newEndPosition.column+(point.column-this.oldEndPosition.column):point.column}else index>this.startIndex&&(newIndex=this.newEndIndex,newPoint.row=this.newEndPosition.row,newPoint.column=this.newEndPosition.column);return{point:newPoint,index:newIndex}}editRange(range){let newRange={startIndex:range.startIndex,startPosition:{...range.startPosition},endIndex:range.endIndex,endPosition:{...range.endPosition}};return range.endIndex>=this.oldEndIndex?range.endIndex!==Number.MAX_SAFE_INTEGER&&(newRange.endIndex=this.newEndIndex+(range.endIndex-this.oldEndIndex),newRange.endPosition={row:this.newEndPosition.row+(range.endPosition.row-this.oldEndPosition.row),column:range.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(range.endPosition.column-this.oldEndPosition.column):range.endPosition.column},newRange.endIndex<this.newEndIndex&&(newRange.endIndex=Number.MAX_SAFE_INTEGER,newRange.endPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):range.endIndex>this.startIndex&&(newRange.endIndex=this.startIndex,newRange.endPosition={...this.startPosition}),range.startIndex>=this.oldEndIndex?(newRange.startIndex=this.newEndIndex+(range.startIndex-this.oldEndIndex),newRange.startPosition={row:this.newEndPosition.row+(range.startPosition.row-this.oldEndPosition.row),column:range.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(range.startPosition.column-this.oldEndPosition.column):range.startPosition.column},newRange.startIndex<this.newEndIndex&&(newRange.startIndex=Number.MAX_SAFE_INTEGER,newRange.startPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):range.startIndex>this.startIndex&&(newRange.startIndex=this.startIndex,newRange.startPosition={...this.startPosition}),newRange}},SIZE_OF_SHORT=2,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},INTERNAL=Symbol("INTERNAL");function assertInternal(x){if(x!==INTERNAL)throw new Error("Illegal constructor")}__name(assertInternal,"assertInternal");function isPoint(point){return!!point&&typeof point.row=="number"&&typeof point.column=="number"}__name(isPoint,"isPoint");function setModule(module2){C=module2}__name(setModule,"setModule");var C;function newFinalizer(handler){try{return new FinalizationRegistry(handler)}catch(e){console.error("Unsupported FinalizationRegistry:",e);return}}__name(newFinalizer,"newFinalizer");var finalizer=newFinalizer(address=>{C._ts_lookahead_iterator_delete(address)}),LookaheadIterator=class{static{__name(this,"LookaheadIterator")}0=0;language;positioned=!1;constructor(internal,address,language){assertInternal(internal),this[0]=address,this.language=language,finalizer?.register(this,address,this)}get currentTypeId(){return this.positioned?C._ts_lookahead_iterator_current_symbol(this[0]):null}get currentType(){let id=this.currentTypeId;return id===null?null:this.language.types[id]??C.UTF8ToString(C._ts_language_symbol_name(this.language[0],id))}delete(){finalizer?.unregister(this),C._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(language,stateId){return C._ts_lookahead_iterator_reset(this[0],language[0],stateId)?(this.language=language,this.positioned=!1,!0):!1}resetState(stateId){return C._ts_lookahead_iterator_reset_state(this[0],stateId)?(this.positioned=!1,!0):!1}[Symbol.iterator](){return{next:__name(()=>{this.positioned=!!C._ts_lookahead_iterator_next(this[0]);let value=this.currentType;return value===null?{done:!0,value:""}:{done:!1,value}},"next")}}};function getText(tree,startIndex,endIndex,startPosition){let length=endIndex-startIndex,result=tree.textCallback(startIndex,startPosition);if(result){for(startIndex+=result.length;startIndex<endIndex;){let string=tree.textCallback(startIndex,startPosition);if(string&&string.length>0)startIndex+=string.length,result+=string;else break}startIndex>endIndex&&(result=result.slice(0,length))}return result??""}__name(getText,"getText");var finalizer2=newFinalizer(address=>{C._ts_tree_delete(address)}),Tree=class _Tree{static{__name(this,"Tree")}0=0;textCallback;language;constructor(internal,address,language,textCallback){assertInternal(internal),this[0]=address,this.language=language,this.textCallback=textCallback,finalizer2?.register(this,address,this)}copy(){let address=C._ts_tree_copy(this[0]);return new _Tree(INTERNAL,address,this.language,this.textCallback)}delete(){finalizer2?.unregister(this),C._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(offsetBytes,offsetExtent){let address=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(address,offsetBytes,"i32"),marshalPoint(address+SIZE_OF_INT,offsetExtent),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}edit(edit){marshalEdit(edit),C._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(other){if(!(other instanceof _Tree))throw new TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],other[0]);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=unmarshalRange(address),address+=SIZE_OF_RANGE;C._free(buffer)}return result}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=unmarshalRange(address),address+=SIZE_OF_RANGE;C._free(buffer)}return result}},finalizer3=newFinalizer(address=>{C._ts_tree_cursor_delete_wasm(address)}),TreeCursor=class _TreeCursor{static{__name(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(internal,tree){assertInternal(internal),this.tree=tree,unmarshalTreeCursor(this),finalizer3?.register(this,this.tree[0],this)}copy(){let copy=new _TreeCursor(INTERNAL,this.tree);return C._ts_tree_cursor_copy_wasm(this.tree[0]),unmarshalTreeCursor(copy),copy}delete(){finalizer3?.unregister(this),marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=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])}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 startIndex=C._ts_tree_cursor_start_index_wasm(this.tree[0]),endIndex=C._ts_tree_cursor_end_index_wasm(this.tree[0]);C._ts_tree_cursor_start_position_wasm(this.tree[0]);let startPosition=unmarshalPoint(TRANSFER_BUFFER);return getText(this.tree,startIndex,endIndex,startPosition)}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])}gotoFirstChild(){marshalTreeCursor(this);let result=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoLastChild(){marshalTreeCursor(this);let result=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoParent(){marshalTreeCursor(this);let result=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoNextSibling(){marshalTreeCursor(this);let result=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoPreviousSibling(){marshalTreeCursor(this);let result=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoDescendant(goalDescendantIndex){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],goalDescendantIndex),unmarshalTreeCursor(this)}gotoFirstChildForIndex(goalIndex){marshalTreeCursor(this),C.setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,goalIndex,"i32");let result=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}gotoFirstChildForPosition(goalPosition){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,goalPosition);let result=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),result===1}reset(node){marshalNode(node),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(cursor){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(cursor,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],cursor.tree[0]),unmarshalTreeCursor(this)}},Node=class{static{__name(this,"Node")}0=0;_children;_namedChildren;constructor(internal,{id,tree,startIndex,startPosition,other}){assertInternal(internal),this[0]=other,this.id=id,this.tree=tree,this.startIndex=startIndex,this.startPosition=startPosition}id;startIndex;startPosition;tree;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 isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return marshalNode(this),C._ts_node_is_extra_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 hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return marshalNode(this),C._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return marshalNode(this),C._ts_node_end_point_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get text(){return getText(this.tree,this.startIndex,this.endIndex,this.startPosition)}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])}equals(other){return this.tree===other.tree&&this.id===other.id}child(index){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],index),unmarshalNode(this.tree)}namedChild(index){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],index),unmarshalNode(this.tree)}childForFieldId(fieldId){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],fieldId),unmarshalNode(this.tree)}childForFieldName(fieldName){let fieldId=this.tree.language.fields.indexOf(fieldName);return fieldId!==-1?this.childForFieldId(fieldId):null}fieldNameForChild(index){marshalNode(this);let address=C._ts_node_field_name_for_child_wasm(this.tree[0],index);return address?C.AsciiToString(address):null}fieldNameForNamedChild(index){marshalNode(this);let address=C._ts_node_field_name_for_named_child_wasm(this.tree[0],index);return address?C.AsciiToString(address):null}childrenForFieldName(fieldName){let fieldId=this.tree.language.fields.indexOf(fieldName);return fieldId!==-1&&fieldId!==0?this.childrenForFieldId(fieldId):[]}childrenForFieldId(fieldId){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],fieldId);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=unmarshalNode(this.tree,address),address+=SIZE_OF_NODE;C._free(buffer)}return result}firstChildForIndex(index){marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(address,index,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(index){marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(address,index,"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 count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=new Array(count),count>0){let address=buffer;for(let i2=0;i2<count;i2++)this._children[i2]=unmarshalNode(this.tree,address),address+=SIZE_OF_NODE;C._free(buffer)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=new Array(count),count>0){let address=buffer;for(let i2=0;i2<count;i2++)this._namedChildren[i2]=unmarshalNode(this.tree,address),address+=SIZE_OF_NODE;C._free(buffer)}}return this._namedChildren}descendantsOfType(types,startPosition=ZERO_POINT,endPosition=ZERO_POINT){Array.isArray(types)||(types=[types]);let symbols=[],typesBySymbol=this.tree.language.types;for(let node_type of types)node_type=="ERROR"&&symbols.push(65535);for(let i2=0,n=typesBySymbol.length;i2<n;i2++)types.includes(typesBySymbol[i2])&&symbols.push(i2);let symbolsAddress=C._malloc(SIZE_OF_INT*symbols.length);for(let i2=0,n=symbols.length;i2<n;i2++)C.setValue(symbolsAddress+i2*SIZE_OF_INT,symbols[i2],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],symbolsAddress,symbols.length,startPosition.row,startPosition.column,endPosition.row,endPosition.column);let descendantCount=C.getValue(TRANSFER_BUFFER,"i32"),descendantAddress=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(descendantCount);if(descendantCount>0){let address=descendantAddress;for(let i2=0;i2<descendantCount;i2++)result[i2]=unmarshalNode(this.tree,address),address+=SIZE_OF_NODE}return C._free(descendantAddress),C._free(symbolsAddress),result}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)}childWithDescendant(descendant){return marshalNode(this),marshalNode(descendant,1),C._ts_node_child_with_descendant_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(start2,end=start2){if(typeof start2!="number"||typeof end!="number")throw new Error("Arguments must be numbers");marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(address,start2,"i32"),C.setValue(address+SIZE_OF_INT,end,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(start2,end=start2){if(typeof start2!="number"||typeof end!="number")throw new Error("Arguments must be numbers");marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(address,start2,"i32"),C.setValue(address+SIZE_OF_INT,end,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(start2,end=start2){if(!isPoint(start2)||!isPoint(end))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(address,start2),marshalPoint(address+SIZE_OF_POINT,end),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(start2,end=start2){if(!isPoint(start2)||!isPoint(end))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let address=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(address,start2),marshalPoint(address+SIZE_OF_POINT,end),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)}edit(edit){if(this.startIndex>=edit.oldEndIndex){this.startIndex=edit.newEndIndex+(this.startIndex-edit.oldEndIndex);let subbedPointRow,subbedPointColumn;this.startPosition.row>edit.oldEndPosition.row?(subbedPointRow=this.startPosition.row-edit.oldEndPosition.row,subbedPointColumn=this.startPosition.column):(subbedPointRow=0,subbedPointColumn=this.startPosition.column,this.startPosition.column>=edit.oldEndPosition.column&&(subbedPointColumn=this.startPosition.column-edit.oldEndPosition.column)),subbedPointRow>0?(this.startPosition.row+=subbedPointRow,this.startPosition.column=subbedPointColumn):this.startPosition.column+=subbedPointColumn}else this.startIndex>edit.startIndex&&(this.startIndex=edit.newEndIndex,this.startPosition.row=edit.newEndPosition.row,this.startPosition.column=edit.newEndPosition.column)}toString(){marshalNode(this);let address=C._ts_node_to_string_wasm(this.tree[0]),result=C.AsciiToString(address);return C._free(address),result}};function unmarshalCaptures(query,tree,address,patternIndex,result){for(let i2=0,n=result.length;i2<n;i2++){let captureIndex=C.getValue(address,"i32");address+=SIZE_OF_INT;let node=unmarshalNode(tree,address);address+=SIZE_OF_NODE,result[i2]={patternIndex,name:query.captureNames[captureIndex],node}}return address}__name(unmarshalCaptures,"unmarshalCaptures");function marshalNode(node,index=0){let address=TRANSFER_BUFFER+index*SIZE_OF_NODE;C.setValue(address,node.id,"i32"),address+=SIZE_OF_INT,C.setValue(address,node.startIndex,"i32"),address+=SIZE_OF_INT,C.setValue(address,node.startPosition.row,"i32"),address+=SIZE_OF_INT,C.setValue(address,node.startPosition.column,"i32"),address+=SIZE_OF_INT,C.setValue(address,node[0],"i32")}__name(marshalNode,"marshalNode");function unmarshalNode(tree,address=TRANSFER_BUFFER){let id=C.getValue(address,"i32");if(address+=SIZE_OF_INT,id===0)return null;let index=C.getValue(address,"i32");address+=SIZE_OF_INT;let row=C.getValue(address,"i32");address+=SIZE_OF_INT;let column=C.getValue(address,"i32");address+=SIZE_OF_INT;let other=C.getValue(address,"i32");return new Node(INTERNAL,{id,tree,startIndex:index,startPosition:{row,column},other})}__name(unmarshalNode,"unmarshalNode");function marshalTreeCursor(cursor,address=TRANSFER_BUFFER){C.setValue(address+0*SIZE_OF_INT,cursor[0],"i32"),C.setValue(address+1*SIZE_OF_INT,cursor[1],"i32"),C.setValue(address+2*SIZE_OF_INT,cursor[2],"i32"),C.setValue(address+3*SIZE_OF_INT,cursor[3],"i32")}__name(marshalTreeCursor,"marshalTreeCursor");function unmarshalTreeCursor(cursor){cursor[0]=C.getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),cursor[1]=C.getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),cursor[2]=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),cursor[3]=C.getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}__name(unmarshalTreeCursor,"unmarshalTreeCursor");function marshalPoint(address,point){C.setValue(address,point.row,"i32"),C.setValue(address+SIZE_OF_INT,point.column,"i32")}__name(marshalPoint,"marshalPoint");function unmarshalPoint(address){return{row:C.getValue(address,"i32")>>>0,column:C.getValue(address+SIZE_OF_INT,"i32")>>>0}}__name(unmarshalPoint,"unmarshalPoint");function marshalRange(address,range){marshalPoint(address,range.startPosition),address+=SIZE_OF_POINT,marshalPoint(address,range.endPosition),address+=SIZE_OF_POINT,C.setValue(address,range.startIndex,"i32"),address+=SIZE_OF_INT,C.setValue(address,range.endIndex,"i32"),address+=SIZE_OF_INT}__name(marshalRange,"marshalRange");function unmarshalRange(address){let result={};return result.startPosition=unmarshalPoint(address),address+=SIZE_OF_POINT,result.endPosition=unmarshalPoint(address),address+=SIZE_OF_POINT,result.startIndex=C.getValue(address,"i32")>>>0,address+=SIZE_OF_INT,result.endIndex=C.getValue(address,"i32")>>>0,result}__name(unmarshalRange,"unmarshalRange");function marshalEdit(edit,address=TRANSFER_BUFFER){marshalPoint(address,edit.startPosition),address+=SIZE_OF_POINT,marshalPoint(address,edit.oldEndPosition),address+=SIZE_OF_POINT,marshalPoint(address,edit.newEndPosition),address+=SIZE_OF_POINT,C.setValue(address,edit.startIndex,"i32"),address+=SIZE_OF_INT,C.setValue(address,edit.oldEndIndex,"i32"),address+=SIZE_OF_INT,C.setValue(address,edit.newEndIndex,"i32"),address+=SIZE_OF_INT}__name(marshalEdit,"marshalEdit");function unmarshalLanguageMetadata(address){let major_version=C.getValue(address,"i32"),minor_version=C.getValue(address+=SIZE_OF_INT,"i32"),patch_version=C.getValue(address+=SIZE_OF_INT,"i32");return{major_version,minor_version,patch_version}}__name(unmarshalLanguageMetadata,"unmarshalLanguageMetadata");var LANGUAGE_FUNCTION_REGEX=/^tree_sitter_\w+$/,Language=class _Language{static{__name(this,"Language")}0=0;types;fields;constructor(internal,address){assertInternal(internal),this[0]=address,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let i2=0,n=this.types.length;i2<n;i2++)C._ts_language_symbol_type(this[0],i2)<2&&(this.types[i2]=C.UTF8ToString(C._ts_language_symbol_name(this[0],i2)));this.fields=new Array(C._ts_language_field_count(this[0])+1);for(let i2=0,n=this.fields.length;i2<n;i2++){let fieldName=C._ts_language_field_name_for_id(this[0],i2);fieldName!==0?this.fields[i2]=C.UTF8ToString(fieldName):this.fields[i2]=null}}get name(){let ptr=C._ts_language_name(this[0]);return ptr===0?null:C.UTF8ToString(ptr)}get abiVersion(){return C._ts_language_abi_version(this[0])}get metadata(){return C._ts_language_metadata_wasm(this[0]),C.getValue(TRANSFER_BUFFER,"i32")===0?null:unmarshalLanguageMetadata(TRANSFER_BUFFER+SIZE_OF_INT)}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(fieldName){let result=this.fields.indexOf(fieldName);return result!==-1?result:null}fieldNameForId(fieldId){return this.fields[fieldId]??null}idForNodeType(type,named){let typeLength=C.lengthBytesUTF8(type),typeAddress=C._malloc(typeLength+1);C.stringToUTF8(type,typeAddress,typeLength+1);let result=C._ts_language_symbol_for_name(this[0],typeAddress,typeLength,named?1:0);return C._free(typeAddress),result||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(typeId){let name2=C._ts_language_symbol_name(this[0],typeId);return name2?C.UTF8ToString(name2):null}nodeTypeIsNamed(typeId){return!!C._ts_language_type_is_named_wasm(this[0],typeId)}nodeTypeIsVisible(typeId){return!!C._ts_language_type_is_visible_wasm(this[0],typeId)}get supertypes(){C._ts_language_supertypes_wasm(this[0]);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=C.getValue(address,"i16"),address+=SIZE_OF_SHORT}return result}subtypes(supertype){C._ts_language_subtypes_wasm(this[0],supertype);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=C.getValue(address,"i16"),address+=SIZE_OF_SHORT}return result}nextState(stateId,typeId){return C._ts_language_next_state(this[0],stateId,typeId)}lookaheadIterator(stateId){let address=C._ts_lookahead_iterator_new(this[0],stateId);return address?new LookaheadIterator(INTERNAL,address,this):null}static async load(input){let binary2;if(input instanceof Uint8Array)binary2=input;else if(globalThis.process?.versions.node)binary2=await(await import("fs/promises")).readFile(input);else{let response=await fetch(input);if(!response.ok){let body2=await response.text();throw new Error(`Language.load failed with status ${response.status}.

${body2}`)}let retryResp=response.clone();try{binary2=await WebAssembly.compileStreaming(response)}catch(reason){console.error("wasm streaming compile failed:",reason),console.error("falling back to ArrayBuffer instantiation"),binary2=new Uint8Array(await retryResp.arrayBuffer())}}let mod=await C.loadWebAssemblyModule(binary2,{loadAsync:!0});return _Language.loadFromWasmExports(mod,{sync:!1})}static loadFromWasmExports(mod,{sync}){let symbolNames=Object.keys(mod),functionName=symbolNames.find(key=>LANGUAGE_FUNCTION_REGEX.test(key)&&!key.includes("external_scanner_"));if(!functionName)throw console.log(`Couldn't find language function in Wasm file. Symbols:
${JSON.stringify(symbolNames,null,2)}`),new Error(`Language.${sync?"loadSync":"load"} failed: no language function found in Wasm file`);let languageAddress=mod[functionName]();return new _Language(INTERNAL,languageAddress)}static loadSync(wasmModule){let mod=C.loadWebAssemblyModule(wasmModule,{loadAsync:!1});return _Language.loadFromWasmExports(mod,{sync:!0})}};async function Module2(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope<"u",ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){let{createRequire}=await import("module");var require=createRequire(import.meta.url)}Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=__name((status,toThrow)=>{throw toThrow},"quit_"),_scriptName=import.meta.url,scriptDirectory="";function locateFile(path){return Module.locateFile?Module.locateFile(path,scriptDirectory):scriptDirectory+path}__name(locateFile,"locateFile");var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");_scriptName.startsWith("file:")&&(scriptDirectory=require("path").dirname(require("url").fileURLToPath(_scriptName))+"/"),readBinary=__name(filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret},"readBinary"),readAsync=__name(async(filename,binary2=!0)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary2?void 0:"utf8");return ret},"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=__name((status,toThrow)=>{throw process.exitCode=status,toThrow},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=__name(url=>{var xhr=new XMLHttpRequest;return xhr.open("GET",url,!1),xhr.responseType="arraybuffer",xhr.send(null),new Uint8Array(xhr.response)},"readBinary")),readAsync=__name(async url=>{if(isFileURI(url))return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,!0),xhr.responseType="arraybuffer",xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)},xhr.onerror=reject,xhr.send(null)});var response=await fetch(url,{credentials:"same-origin"});if(response.ok)return response.arrayBuffer();throw new Error(response.status+" : "+response.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=__name(filename=>filename.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var b=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(b),Module.HEAP16=HEAP16=new Int16Array(b),Module.HEAPU8=HEAPU8=new Uint8Array(b),Module.HEAPU16=HEAPU16=new Uint16Array(b),Module.HEAP32=HEAP32=new Int32Array(b),Module.HEAPU32=HEAPU32=new Uint32Array(b),Module.HEAPF32=HEAPF32=new Float32Array(b),Module.HEAPF64=HEAPF64=new Float64Array(b),Module.HEAP64=HEAP64=new BigInt64Array(b),Module.HEAPU64=HEAPU64=new BigUint64Array(b),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(b),LE_HEAP_UPDATE()}__name(updateMemoryViews,"updateMemoryViews");function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var INITIAL_MEMORY=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews()}__name(initMemory,"initMemory");var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}__name(preRun,"preRun");function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}__name(initRuntime,"initRuntime");function preMain(){}__name(preMain,"preMain");function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}__name(postRun,"postRun");function abort(what){Module.onAbort?.(what),what="Aborted("+what+")",err(what),ABORT=!0,what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw readyPromiseReject?.(e),e}__name(abort,"abort");var wasmBinaryFile;function findWasmBinary(){return Module.locateFile?locateFile("web-tree-sitter.wasm"):new URL("web-tree-sitter.wasm",import.meta.url).href}__name(findWasmBinary,"findWasmBinary");function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(file);throw"both async and sync fetching of the wasm failed"}__name(getBinarySync,"getBinarySync");async function getWasmBinary(binaryFile){if(!wasmBinary)try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}return getBinarySync(binaryFile)}__name(getWasmBinary,"getWasmBinary");async function instantiateArrayBuffer(binaryFile,imports){try{var binary2=await getWasmBinary(binaryFile),instance2=await WebAssembly.instantiate(binary2,imports);return instance2}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`),abort(reason)}}__name(instantiateArrayBuffer,"instantiateArrayBuffer");async function instantiateAsync(binary2,binaryFile,imports){if(!binary2&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE)try{var response=fetch(binaryFile,{credentials:"same-origin"}),instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(binaryFile,imports)}__name(instantiateAsync,"instantiateAsync");function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}__name(getWasmImports,"getWasmImports");async function createWasm(){function receiveInstance(instance2,module2){wasmExports=instance2.exports,wasmExports=relocateExports(wasmExports,1024);var metadata2=getDylinkMetadata(module2);return metadata2.neededDynlibs&&(dynamicLibraries=metadata2.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}__name(receiveInstance,"receiveInstance");function receiveInstantiationResult(result2){return receiveInstance(result2.instance,result2.module)}__name(receiveInstantiationResult,"receiveInstantiationResult");var info2=getWasmImports();if(Module.instantiateWasm)return new Promise((resolve,reject)=>{Module.instantiateWasm(info2,(mod,inst)=>{resolve(receiveInstance(mod,inst))})});wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info2),exports=receiveInstantiationResult(result);return exports}__name(createWasm,"createWasm");class ExitStatus{static{__name(this,"ExitStatus")}name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`,this.status=status}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(obj,symName){var rtn=GOT[symName];return rtn||(rtn=GOT[symName]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(symName)||(rtn.required=!0),rtn}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=__name(byteOffset=>HEAP_DATA_VIEW.getFloat32(byteOffset,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=__name(byteOffset=>HEAP_DATA_VIEW.getFloat64(byteOffset,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=__name(byteOffset=>HEAP_DATA_VIEW.getInt16(byteOffset,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=__name(byteOffset=>HEAP_DATA_VIEW.getInt32(byteOffset,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=__name(byteOffset=>HEAP_DATA_VIEW.getBigInt64(byteOffset,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=__name(byteOffset=>HEAP_DATA_VIEW.getUint32(byteOffset,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=__name((byteOffset,value)=>HEAP_DATA_VIEW.setFloat32(byteOffset,value,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=__name((byteOffset,value)=>HEAP_DATA_VIEW.setFloat64(byteOffset,value,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=__name((byteOffset,value)=>HEAP_DATA_VIEW.setInt16(byteOffset,value,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=__name((byteOffset,value)=>HEAP_DATA_VIEW.setInt32(byteOffset,value,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=__name((byteOffset,value)=>HEAP_DATA_VIEW.setBigInt64(byteOffset,value,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=__name((byteOffset,value)=>HEAP_DATA_VIEW.setUint32(byteOffset,value,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=__name(callbacks=>{for(;callbacks.length>0;)callbacks.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=__name(cb=>onPostRuns.push(cb),"addOnPostRun"),onPreRuns=[],addOnPreRun=__name(cb=>onPreRuns.push(cb),"addOnPreRun"),UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,findStringEnd=__name((heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;for(;heapOrArray[idx]&&!(idx>=maxIdx);)++idx;return idx},"findStringEnd"),UTF8ArrayToString=__name((heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder)return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));for(var str="";idx<endPtr;){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224?u0=(u0&15)<<12|u1<<6|u2:u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63,u0<65536)str+=String.fromCharCode(u0);else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str},"UTF8ArrayToString"),getDylinkMetadata=__name(binary2=>{var offset=0,end=0;function getU8(){return binary2[offset++]}__name(getU8,"getU8");function getLEB(){for(var ret=0,mul=1;;){var byte=binary2[offset++];if(ret+=(byte&127)*mul,mul*=128,!(byte&128))break}return ret}__name(getLEB,"getLEB");function getString(){var len=getLEB();return offset+=len,UTF8ArrayToString(binary2,offset-len,len)}__name(getString,"getString");function getStringList(){for(var count2=getLEB(),rtn=[];count2--;)rtn.push(getString());return rtn}__name(getStringList,"getStringList");function failIf(condition,message){if(condition)throw new Error(message)}if(__name(failIf,"failIf"),binary2 instanceof WebAssembly.Module){var dylinkSection=WebAssembly.Module.customSections(binary2,"dylink.0");failIf(dylinkSection.length===0,"need dylink section"),binary2=new Uint8Array(dylinkSection[0]),end=binary2.length}else{var int32View=new Uint32Array(new Uint8Array(binary2.subarray(0,24)).buffer),magicNumberFound=int32View[0]==1836278016||int32View[0]==6386541;failIf(!magicNumberFound,"need to see wasm magic number"),failIf(binary2[8]!==0,"need the dylink section to be first"),offset=9;var section_size=getLEB();end=offset+section_size;var name2=getString();failIf(name2!=="dylink.0")}for(var customSection={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]},WASM_DYLINK_MEM_INFO=1,WASM_DYLINK_NEEDED=2,WASM_DYLINK_EXPORT_INFO=3,WASM_DYLINK_IMPORT_INFO=4,WASM_DYLINK_RUNTIME_PATH=5,WASM_SYMBOL_TLS=256,WASM_SYMBOL_BINDING_MASK=3,WASM_SYMBOL_BINDING_WEAK=1;offset<end;){var subsectionType=getU8(),subsectionSize=getLEB();if(subsectionType===WASM_DYLINK_MEM_INFO)customSection.memorySize=getLEB(),customSection.memoryAlign=getLEB(),customSection.tableSize=getLEB(),customSection.tableAlign=getLEB();else if(subsectionType===WASM_DYLINK_NEEDED)customSection.neededDynlibs=getStringList();else if(subsectionType===WASM_DYLINK_EXPORT_INFO)for(var count=getLEB();count--;){var symname=getString(),flags2=getLEB();flags2&WASM_SYMBOL_TLS&&customSection.tlsExports.add(symname)}else if(subsectionType===WASM_DYLINK_IMPORT_INFO)for(var count=getLEB();count--;){var modname=getString(),symname=getString(),flags2=getLEB();(flags2&WASM_SYMBOL_BINDING_MASK)==WASM_SYMBOL_BINDING_WEAK&&customSection.weakImports.add(symname)}else subsectionType===WASM_DYLINK_RUNTIME_PATH?customSection.runtimePaths=getStringList():offset+=subsectionSize}return customSection},"getDylinkMetadata");function getValue(ptr,type="i8"){switch(type.endsWith("*")&&(type="*"),type){case"i1":return HEAP8[ptr];case"i8":return HEAP8[ptr];case"i16":return LE_HEAP_LOAD_I16((ptr>>1)*2);case"i32":return LE_HEAP_LOAD_I32((ptr>>2)*4);case"i64":return LE_HEAP_LOAD_I64((ptr>>3)*8);case"float":return LE_HEAP_LOAD_F32((ptr>>2)*4);case"double":return LE_HEAP_LOAD_F64((ptr>>3)*8);case"*":return LE_HEAP_LOAD_U32((ptr>>2)*4);default:abort(`invalid type for getValue: ${type}`)}}__name(getValue,"getValue");var newDSO=__name((name2,handle2,syms)=>{var dso={refcount:1/0,name:name2,exports:syms,global:!0};return LDSO.loadedLibsByName[name2]=dso,handle2!=null&&(LDSO.loadedLibsByHandle[handle2]=dso),dso},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=82240,alignMemory=__name((size,alignment)=>Math.ceil(size/alignment)*alignment,"alignMemory"),getMemory=__name(size=>{if(runtimeInitialized)return _calloc(size,1);var ret=___heap_base,end=ret+alignMemory(size,16);return ___heap_base=end,GOT.__heap_base.value=end,ret},"getMemory"),isInternalSym=__name(symName=>["__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(symName)||symName.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=__name(arr=>{let n=arr.length;return[n%128|128,n>>7,...arr]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=__name(types=>uleb128EncodeWithLen(Array.from(types,type=>{var code=wasmTypeCodes[type];return code})),"generateTypePack"),convertJsFunctionToWasm=__name((func2,sig)=>{var bytes=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(sig.slice(1)),...generateTypePack(sig[0]==="v"?"":sig[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),module2=new WebAssembly.Module(bytes),instance2=new WebAssembly.Instance(module2,{e:{f:func2}}),wrappedFunc=instance2.exports.f;return wrappedFunc},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=__name(funcPtr=>{var func2=wasmTableMirror[funcPtr];return func2||(wasmTableMirror[funcPtr]=func2=wasmTable.get(funcPtr)),func2},"getWasmTableEntry"),updateTableMap=__name((offset,count)=>{if(functionsInTableMap)for(var i2=offset;i2<offset+count;i2++){var item=getWasmTableEntry(i2);item&&functionsInTableMap.set(item,i2)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=__name(func2=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(func2)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=__name(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=__name((idx,func2)=>{wasmTable.set(idx,func2),wasmTableMirror[idx]=wasmTable.get(idx)},"setWasmTableEntry"),addFunction=__name((func2,sig)=>{var rtn=getFunctionAddress(func2);if(rtn)return rtn;var ret=getEmptyTableSlot();try{setWasmTableEntry(ret,func2)}catch(err2){if(!(err2 instanceof TypeError))throw err2;var wrapped=convertJsFunctionToWasm(func2,sig);setWasmTableEntry(ret,wrapped)}return functionsInTableMap.set(func2,ret),ret},"addFunction"),updateGOT=__name((exports,replace)=>{for(var symName in exports)if(!isInternalSym(symName)){var value=exports[symName];GOT[symName]||=new WebAssembly.Global({value:"i32",mutable:!0}),(replace||GOT[symName].value==0)&&(typeof value=="function"?GOT[symName].value=addFunction(value):typeof value=="number"?GOT[symName].value=value:err(`unhandled export type for '${symName}': ${typeof value}`))}},"updateGOT"),relocateExports=__name((exports,memoryBase2,replace)=>{var relocated={};for(var e in exports){var value=exports[e];typeof value=="object"&&(value=value.value),typeof value=="number"&&(value+=memoryBase2),relocated[e]=value}return updateGOT(relocated,replace),relocated},"relocateExports"),isSymbolDefined=__name(symName=>{var existing=wasmImports[symName];return!(!existing||existing.stub)},"isSymbolDefined"),dynCall=__name((sig,ptr,args2=[],promising=!1)=>{var func2=getWasmTableEntry(ptr),rtn=func2(...args2);function convert(rtn2){return rtn2}return __name(convert,"convert"),rtn},"dynCall"),stackSave=__name(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=__name(val=>__emscripten_stack_restore(val),"stackRestore"),createInvokeFunction=__name(sig=>(ptr,...args2)=>{var sp=stackSave();try{return dynCall(sig,ptr,args2)}catch(e){if(stackRestore(sp),e!==e+0)throw e;if(_setThrew(1,0),sig[0]=="j")return 0n}},"createInvokeFunction"),resolveGlobalSymbol=__name((symName,direct=!1)=>{var sym;return isSymbolDefined(symName)?sym=wasmImports[symName]:symName.startsWith("invoke_")&&(sym=wasmImports[symName]=createInvokeFunction(symName.split("_")[1])),{sym,name:symName}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=__name(cb=>onPostCtors.push(cb),"addOnPostCtor"),UTF8ToString=__name((ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"","UTF8ToString"),loadWebAssemblyModule=__name((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;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)),metadata.tableSize&&wasmTable.grow(metadata.tableSize);var moduleExports;function resolveSymbol(sym){var resolved=resolveGlobalSymbol(sym).sym;return!resolved&&localScope&&(resolved=localScope[sym]),resolved||(resolved=moduleExports[sym]),resolved}__name(resolveSymbol,"resolveSymbol");var proxyHandler={get(stubs,prop){switch(prop){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(prop in wasmImports&&!wasmImports[prop].stub){var res=wasmImports[prop];return res}if(!(prop in stubs)){var resolved;stubs[prop]=(...args2)=>(resolved||=resolveSymbol(prop),resolved(...args2))}return stubs[prop]}},proxy=new Proxy({},proxyHandler);currentModuleWeakSymbols=metadata.weakImports;var info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(__name(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start<stop;){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}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)}__name(addEmJs,"addEmJs");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;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(__name(postInstantiation,"postInstantiation"),flags.loadAsync)return(async()=>{var instance2;return binary instanceof WebAssembly.Module?instance2=new WebAssembly.Instance(binary,info):{module:binary,instance:instance2}=await WebAssembly.instantiate(binary,info),postInstantiation(binary,instance2)})();var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return __name(loadModule,"loadModule"),flags={...flags,rpath:{parentLibPath:libName,paths:metadata.runtimePaths}},flags.loadAsync?metadata.neededDynlibs.reduce((chain,dynNeeded)=>chain.then(()=>loadDynamicLibrary(dynNeeded,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(needed=>loadDynamicLibrary(needed,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=__name((exports,libName2)=>{for(var[sym,exp]of Object.entries(exports)){let setImport=__name(target=>{isSymbolDefined(target)||(wasmImports[target]=exp)},"setImport");setImport(sym);let main_alias="__main_argc_argv";sym=="main"&&setImport(main_alias),sym==main_alias&&setImport("main")}},"mergeLibSymbols"),asyncLoad=__name(async url=>{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)},"asyncLoad");function loadDynamicLibrary(libName2,flags2={global:!0,nodelete:!0},localScope2,handle2){var dso=LDSO.loadedLibsByName[libName2];if(dso)return flags2.global?dso.global||(dso.global=!0,mergeLibSymbols(dso.exports,libName2)):localScope2&&Object.assign(localScope2,dso.exports),flags2.nodelete&&dso.refcount!==1/0&&(dso.refcount=1/0),dso.refcount++,handle2&&(LDSO.loadedLibsByHandle[handle2]=dso),flags2.loadAsync?Promise.resolve(!0):!0;dso=newDSO(libName2,handle2,"loading"),dso.refcount=flags2.nodelete?1/0:1,dso.global=flags2.global;function loadLibData(){if(handle2){var data=LE_HEAP_LOAD_U32((handle2+28>>2)*4),dataSize=LE_HEAP_LOAD_U32((handle2+32>>2)*4);if(data&&dataSize){var libData=HEAP8.slice(data,data+dataSize);return flags2.loadAsync?Promise.resolve(libData):libData}}var libFile=locateFile(libName2);if(flags2.loadAsync)return asyncLoad(libFile);if(!readBinary)throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`);return readBinary(libFile)}__name(loadLibData,"loadLibData");function getExports(){return flags2.loadAsync?loadLibData().then(libData=>loadWebAssemblyModule(libData,flags2,libName2,localScope2,handle2)):loadWebAssemblyModule(loadLibData(),flags2,libName2,localScope2,handle2)}__name(getExports,"getExports");function moduleLoaded(exports){dso.global?mergeLibSymbols(exports,libName2):localScope2&&Object.assign(localScope2,exports),dso.exports=exports}return __name(moduleLoaded,"moduleLoaded"),flags2.loadAsync?getExports().then(exports=>(moduleLoaded(exports),!0)):(moduleLoaded(getExports()),!0)}__name(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=__name(()=>{for(var[symName,entry]of Object.entries(GOT))if(entry.value==0){var value=resolveGlobalSymbol(symName,!0).sym;if(!value&&!entry.required)continue;if(typeof value=="function")entry.value=addFunction(value,value.sig);else if(typeof value=="number")entry.value=value;else throw new Error(`bad export type for '${symName}': ${typeof value}`)}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=__name(id=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null,callback()}},"removeRunDependency"),addRunDependency=__name(id=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=__name(async()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs");for(var lib of dynamicLibraries)await loadDynamicLibrary(lib,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")},"loadDylibs"),noExitRuntime=!0;function setValue(ptr,value,type="i8"){switch(type.endsWith("*")&&(type="*"),type){case"i1":HEAP8[ptr]=value;break;case"i8":HEAP8[ptr]=value;break;case"i16":LE_HEAP_STORE_I16((ptr>>1)*2,value);break;case"i32":LE_HEAP_STORE_I32((ptr>>2)*4,value);break;case"i64":LE_HEAP_STORE_I64((ptr>>3)*8,BigInt(value));break;case"float":LE_HEAP_STORE_F32((ptr>>2)*4,value);break;case"double":LE_HEAP_STORE_F64((ptr>>3)*8,value);break;case"*":LE_HEAP_STORE_U32((ptr>>2)*4,value);break;default:abort(`invalid type for setValue: ${type}`)}}__name(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=82240,___stack_low=16704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},82240),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=__name(()=>abort(""),"__abort_js");__abort_js.sig="v";var getHeapMax=__name(()=>2147483648,"getHeapMax"),growMemory=__name(size=>{var oldHeapSize=wasmMemory.buffer.byteLength,pages=(size-oldHeapSize+65535)/65536|0;try{return wasmMemory.grow(pages),updateMemoryViews(),1}catch{}},"growMemory"),_emscripten_resize_heap=__name(requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize)return!1;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536)),replacement=growMemory(newSize);if(replacement)return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=__name(fd=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=__name(num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num),"bigintToI53Checked");function _fd_seek(fd,offset,whence,newOffset){return offset=bigintToI53Checked(offset),70}__name(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=__name((stream,curr)=>{var buffer=printCharBuffers[stream];curr===0||curr===10?((stream===1?out:err)(UTF8ArrayToString(buffer)),buffer.length=0):buffer.push(curr)},"printChar"),_fd_write=__name((fd,iov,iovcnt,pnum)=>{for(var num=0,i2=0;i2<iovcnt;i2++){var ptr=LE_HEAP_LOAD_U32((iov>>2)*4),len=LE_HEAP_LOAD_U32((iov+4>>2)*4);iov+=8;for(var j=0;j<len;j++)printChar(fd,HEAPU8[ptr+j]);num+=len}return LE_HEAP_STORE_U32((pnum>>2)*4,num),0},"_fd_write");_fd_write.sig="iippp";function _tree_sitter_log_callback(isLexMessage,messageAddress){if(Module.currentLogCallback){let message=UTF8ToString(messageAddress);Module.currentLogCallback(message,isLexMessage!==0)}}__name(_tree_sitter_log_callback,"_tree_sitter_log_callback");function _tree_sitter_parse_callback(inputBufferAddress,index,row,column,lengthAddress){let string=Module.currentParseCallback(index,{row,column});typeof string=="string"?(setValue(lengthAddress,string.length,"i32"),stringToUTF16(string,inputBufferAddress,10240)):setValue(lengthAddress,0,"i32")}__name(_tree_sitter_parse_callback,"_tree_sitter_parse_callback");function _tree_sitter_progress_callback(currentOffset,hasError){return Module.currentProgressCallback?Module.currentProgressCallback({currentOffset,hasError}):!1}__name(_tree_sitter_progress_callback,"_tree_sitter_progress_callback");function _tree_sitter_query_progress_callback(currentOffset){return Module.currentQueryProgressCallback?Module.currentQueryProgressCallback({currentOffset}):!1}__name(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=__name(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=__name(code=>{EXITSTATUS=code,keepRuntimeAlive()||(Module.onExit?.(code),ABORT=!0),quit_(code,new ExitStatus(code))},"_proc_exit");_proc_exit.sig="vi";var exitJS=__name((status,implicit)=>{EXITSTATUS=status,_proc_exit(status)},"exitJS"),handleException=__name(e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=__name(str=>{for(var len=0,i2=0;i2<str.length;++i2){var c=str.charCodeAt(i2);c<=127?len++:c<=2047?len+=2:c>=55296&&c<=57343?(len+=4,++i2):len+=3}return len},"lengthBytesUTF8"),stringToUTF8Array=__name((str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;for(var startIdx=outIdx,endIdx=outIdx+maxBytesToWrite-1,i2=0;i2<str.length;++i2){var u=str.codePointAt(i2);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6,heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12,heap[outIdx++]=128|u>>6&63,heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18,heap[outIdx++]=128|u>>12&63,heap[outIdx++]=128|u>>6&63,heap[outIdx++]=128|u&63,i2++}}return heap[outIdx]=0,outIdx-startIdx},"stringToUTF8Array"),stringToUTF8=__name((str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite),"stringToUTF8"),stackAlloc=__name(sz=>__emscripten_stack_alloc(sz),"stackAlloc"),stringToUTF8OnStack=__name(str=>{var size=lengthBytesUTF8(str)+1,ret=stackAlloc(size);return stringToUTF8(str,ret,size),ret},"stringToUTF8OnStack"),AsciiToString=__name(ptr=>{for(var str="";;){var ch=HEAPU8[ptr++];if(!ch)return str;str+=String.fromCharCode(ch)}},"AsciiToString"),stringToUTF16=__name((str,outPtr,maxBytesToWrite)=>{if(maxBytesToWrite??=2147483647,maxBytesToWrite<2)return 0;maxBytesToWrite-=2;for(var startPtr=outPtr,numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length,i2=0;i2<numCharsToWrite;++i2){var codeUnit=str.charCodeAt(i2);LE_HEAP_STORE_I16((outPtr>>1)*2,codeUnit),outPtr+=2}return LE_HEAP_STORE_I16((outPtr>>1)*2,0),outPtr-startPtr},"stringToUTF16");LE_ATOMICS_NATIVE_BYTE_ORDER=new Int8Array(new Int16Array([1]).buffer)[0]===1?[(x=>x),(x=>x),void 0,(x=>x)]:[(x=>x),(x=>((x&65280)<<8|(x&255)<<24)>>16),void 0,(x=>x>>24&255|x>>8&65280|(x&65280)<<8|(x&255)<<24)];function LE_HEAP_UPDATE(){HEAPU16.unsigned=(x=>x&65535),HEAPU32.unsigned=(x=>x>>>0)}if(__name(LE_HEAP_UPDATE,"LE_HEAP_UPDATE"),initMemory(),Module.noExitRuntime&&(noExitRuntime=Module.noExitRuntime),Module.print&&(out=Module.print),Module.printErr&&(err=Module.printErr),Module.dynamicLibraries&&(dynamicLibraries=Module.dynamicLibraries),Module.wasmBinary&&(wasmBinary=Module.wasmBinary),Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.shift()();Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,Module.LE_HEAP_STORE_I64=LE_HEAP_STORE_I64;var ASM_CONSTS={},_malloc,_calloc,_realloc,_free,_ts_range_edit,_memcmp,_ts_language_symbol_count,_ts_language_state_count,_ts_language_abi_version,_ts_language_name,_ts_language_field_count,_ts_language_next_state,_ts_language_symbol_name,_ts_language_symbol_for_name,_strncmp,_ts_language_symbol_type,_ts_language_field_name_for_id,_ts_lookahead_iterator_new,_ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset,_ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol,_ts_point_edit,_ts_parser_delete,_ts_parser_reset,_ts_parser_set_language,_ts_parser_set_included_ranges,_ts_query_new,_ts_query_delete,_iswspace,_iswalnum,_ts_query_copy,_ts_query_pattern_count,_ts_query_capture_count,_ts_query_string_count,_ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id,_ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture,_ts_query_disable_pattern,_ts_tree_copy,_ts_tree_delete,_ts_init,_ts_parser_new_wasm,_ts_parser_enable_logger_wasm,_ts_parser_parse_wasm,_ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm,_ts_language_metadata_wasm,_ts_language_supertypes_wasm,_ts_language_subtypes_wasm,_ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm,_ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm,_ts_node_named_child_count_wasm,_ts_node_child_wasm,_ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm,_ts_node_parent_wasm,_ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm,_ts_node_end_point_wasm,_ts_node_start_index_wasm,_ts_node_end_index_wasm,_ts_node_to_string_wasm,_ts_node_children_wasm,_ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm,_ts_node_has_changes_wasm,_ts_node_has_error_wasm,_ts_node_is_error_wasm,_ts_node_is_missing_wasm,_ts_node_is_extra_wasm,_ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm,_ts_query_matches_wasm,_ts_query_captures_wasm,_memset,_memcpy,_memmove,_iswalpha,_iswblank,_iswdigit,_iswlower,_iswpunct,_iswupper,_iswxdigit,_memchr,_strlen,_strcmp,_strncat,_strncpy,_towlower,_towupper,_setThrew,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___wasm_apply_data_relocs;function assignWasmExports(wasmExports2){Module._malloc=_malloc=wasmExports2.malloc,Module._calloc=_calloc=wasmExports2.calloc,Module._realloc=_realloc=wasmExports2.realloc,Module._free=_free=wasmExports2.free,Module._ts_range_edit=_ts_range_edit=wasmExports2.ts_range_edit,Module._memcmp=_memcmp=wasmExports2.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=wasmExports2.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=wasmExports2.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=wasmExports2.ts_language_abi_version,Module._ts_language_name=_ts_language_name=wasmExports2.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=wasmExports2.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=wasmExports2.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=wasmExports2.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=wasmExports2.ts_language_symbol_for_name,Module._strncmp=_strncmp=wasmExports2.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=wasmExports2.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=wasmExports2.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=wasmExports2.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=wasmExports2.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=wasmExports2.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=wasmExports2.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=wasmExports2.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=wasmExports2.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=wasmExports2.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=wasmExports2.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=wasmExports2.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=wasmExports2.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=wasmExports2.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=wasmExports2.ts_query_new,Module._ts_query_delete=_ts_query_delete=wasmExports2.ts_query_delete,Module._iswspace=_iswspace=wasmExports2.iswspace,Module._iswalnum=_iswalnum=wasmExports2.iswalnum,Module._ts_query_copy=_ts_query_copy=wasmExports2.ts_query_copy,Module._ts_query_pattern_count=_ts_query_pattern_count=wasmExports2.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=wasmExports2.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=wasmExports2.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=wasmExports2.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=wasmExports2.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=wasmExports2.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=wasmExports2.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=wasmExports2.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=wasmExports2.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=wasmExports2.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=wasmExports2.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=wasmExports2.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=wasmExports2.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=wasmExports2.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=wasmExports2.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=wasmExports2.ts_tree_delete,Module._ts_init=_ts_init=wasmExports2.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=wasmExports2.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=wasmExports2.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=wasmExports2.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=wasmExports2.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=wasmExports2.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=wasmExports2.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=wasmExports2.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=wasmExports2.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=wasmExports2.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=wasmExports2.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=wasmExports2.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=wasmExports2.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=wasmExports2.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=wasmExports2.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=wasmExports2.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=wasmExports2.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=wasmExports2.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=wasmExports2.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=wasmExports2.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=wasmExports2.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=wasmExports2.ts_tree_cursor_goto_last_child_wasm,Module._ts_tree_cursor_goto_first_child_for_index_wasm=_ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports2.ts_tree_cursor_goto_first_child_for_index_wasm,Module._ts_tree_cursor_goto_first_child_for_position_wasm=_ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports2.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=wasmExports2.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=wasmExports2.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=wasmExports2.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=wasmExports2.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=wasmExports2.ts_tree_cursor_current_node_type_id_wasm,Module._ts_tree_cursor_current_node_state_id_wasm=_ts_tree_cursor_current_node_state_id_wasm=wasmExports2.ts_tree_cursor_current_node_state_id_wasm,Module._ts_tree_cursor_current_node_is_named_wasm=_ts_tree_cursor_current_node_is_named_wasm=wasmExports2.ts_tree_cursor_current_node_is_named_wasm,Module._ts_tree_cursor_current_node_is_missing_wasm=_ts_tree_cursor_current_node_is_missing_wasm=wasmExports2.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=wasmExports2.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=wasmExports2.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=wasmExports2.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=wasmExports2.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=wasmExports2.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=wasmExports2.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=wasmExports2.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=wasmExports2.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=wasmExports2.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=wasmExports2.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=wasmExports2.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=wasmExports2.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=wasmExports2.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=wasmExports2.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=wasmExports2.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=wasmExports2.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=wasmExports2.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=wasmExports2.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=wasmExports2.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=wasmExports2.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=wasmExports2.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=wasmExports2.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=wasmExports2.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=wasmExports2.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=wasmExports2.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=wasmExports2.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=wasmExports2.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=wasmExports2.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=wasmExports2.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=wasmExports2.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=wasmExports2.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=wasmExports2.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=wasmExports2.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=wasmExports2.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=wasmExports2.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=wasmExports2.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=wasmExports2.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=wasmExports2.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=wasmExports2.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=wasmExports2.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=wasmExports2.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=wasmExports2.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=wasmExports2.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=wasmExports2.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=wasmExports2.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=wasmExports2.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=wasmExports2.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=wasmExports2.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=wasmExports2.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=wasmExports2.ts_query_captures_wasm,Module._memset=_memset=wasmExports2.memset,Module._memcpy=_memcpy=wasmExports2.memcpy,Module._memmove=_memmove=wasmExports2.memmove,Module._iswalpha=_iswalpha=wasmExports2.iswalpha,Module._iswblank=_iswblank=wasmExports2.iswblank,Module._iswdigit=_iswdigit=wasmExports2.iswdigit,Module._iswlower=_iswlower=wasmExports2.iswlower,Module._iswpunct=_iswpunct=wasmExports2.iswpunct,Module._iswupper=_iswupper=wasmExports2.iswupper,Module._iswxdigit=_iswxdigit=wasmExports2.iswxdigit,Module._memchr=_memchr=wasmExports2.memchr,Module._strlen=_strlen=wasmExports2.strlen,Module._strcmp=_strcmp=wasmExports2.strcmp,Module._strncat=_strncat=wasmExports2.strncat,Module._strncpy=_strncpy=wasmExports2.strncpy,Module._towlower=_towlower=wasmExports2.towlower,Module._towupper=_towupper=wasmExports2.towupper,_setThrew=wasmExports2.setThrew,__emscripten_stack_restore=wasmExports2._emscripten_stack_restore,__emscripten_stack_alloc=wasmExports2._emscripten_stack_alloc,_emscripten_stack_get_current=wasmExports2.emscripten_stack_get_current,___wasm_apply_data_relocs=wasmExports2.__wasm_apply_data_relocs}__name(assignWasmExports,"assignWasmExports");var wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_high:___stack_high,__stack_low:___stack_low,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,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,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback};function callMain(args2=[]){var entryFunction=resolveGlobalSymbol("main").sym;if(entryFunction){args2.unshift(thisProgram);var argc=args2.length,argv=stackAlloc((argc+1)*4),argv_ptr=argv;args2.forEach(arg=>{LE_HEAP_STORE_U32((argv_ptr>>2)*4,stringToUTF8OnStack(arg)),argv_ptr+=4}),LE_HEAP_STORE_U32((argv_ptr>>2)*4,0);try{var ret=entryFunction(argc,argv);return exitJS(ret,!0),ret}catch(e){return handleException(e)}}}__name(callMain,"callMain");function run(args2=arguments_){if(runDependencies>0){dependenciesFulfilled=run;return}if(preRun(),runDependencies>0){dependenciesFulfilled=run;return}function doRun(){if(Module.calledRun=!0,!ABORT){initRuntime(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.();var noInitialRun=Module.noInitialRun||!1;noInitialRun||callMain(args2),postRun()}}__name(doRun,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),doRun()},1)):doRun()}__name(run,"run");var wasmExports;return wasmExports=await createWasm(),run(),runtimeInitialized?moduleRtn=Module:moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve,readyPromiseReject=reject}),moduleRtn}__name(Module2,"Module");var web_tree_sitter_default=Module2,Module3=null;async function initializeBinding(moduleOptions){return Module3??=await web_tree_sitter_default(moduleOptions)}__name(initializeBinding,"initializeBinding");function checkModule(){return!!Module3}__name(checkModule,"checkModule");var TRANSFER_BUFFER,LANGUAGE_VERSION,MIN_COMPATIBLE_VERSION,finalizer4=newFinalizer(addresses=>{C._ts_parser_delete(addresses[0]),C._free(addresses[1])}),Parser=class{static{__name(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(moduleOptions){setModule(await initializeBinding(moduleOptions)),TRANSFER_BUFFER=C._ts_init(),LANGUAGE_VERSION=C.getValue(TRANSFER_BUFFER,"i32"),MIN_COMPATIBLE_VERSION=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}constructor(){this.initialize(),finalizer4?.register(this,[this[0],this[1]],this)}initialize(){if(!checkModule())throw new Error("cannot construct a Parser before calling `init()`");C._ts_parser_new_wasm(),this[0]=C.getValue(TRANSFER_BUFFER,"i32"),this[1]=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}delete(){finalizer4?.unregister(this),C._ts_parser_delete(this[0]),C._free(this[1]),this[0]=0,this[1]=0}setLanguage(language){let address;if(!language)address=0,this.language=null;else if(language.constructor===Language){address=language[0];let version=C._ts_language_abi_version(address);if(version<MIN_COMPATIBLE_VERSION||LANGUAGE_VERSION<version)throw new Error(`Incompatible language version ${version}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`);this.language=language}else throw new Error("Argument must be a Language");return C._ts_parser_set_language(this[0],address),this}parse(callback,oldTree,options){if(typeof callback=="string")C.currentParseCallback=index=>callback.slice(index);else if(typeof callback=="function")C.currentParseCallback=callback;else throw new Error("Argument must be a string or a function");options?.progressCallback?C.currentProgressCallback=options.progressCallback:C.currentProgressCallback=null,this.logCallback?(C.currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1)):(C.currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0));let rangeCount=0,rangeAddress=0;if(options?.includedRanges){rangeCount=options.includedRanges.length,rangeAddress=C._calloc(rangeCount,SIZE_OF_RANGE);let address=rangeAddress;for(let i2=0;i2<rangeCount;i2++)marshalRange(address,options.includedRanges[i2]),address+=SIZE_OF_RANGE}let treeAddress=C._ts_parser_parse_wasm(this[0],this[1],oldTree?oldTree[0]:0,rangeAddress,rangeCount);if(!treeAddress)return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");let result=new Tree(INTERNAL,treeAddress,this.language,C.currentParseCallback);return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,result}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);let count=C.getValue(TRANSFER_BUFFER,"i32"),buffer=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),result=new Array(count);if(count>0){let address=buffer;for(let i2=0;i2<count;i2++)result[i2]=unmarshalRange(address),address+=SIZE_OF_RANGE;C._free(buffer)}return result}setLogger(callback){if(!callback)this.logCallback=null;else{if(typeof callback!="function")throw new Error("Logger callback must be a function");this.logCallback=callback}return this}getLogger(){return this.logCallback}},PREDICATE_STEP_TYPE_CAPTURE=1,PREDICATE_STEP_TYPE_STRING=2,QUERY_WORD_REGEX=/[\w-]+/g,CaptureQuantifier={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},isCaptureStep=__name(step=>step.type==="capture","isCaptureStep"),isStringStep=__name(step=>step.type==="string","isStringStep"),QueryErrorKind={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},QueryError=class _QueryError extends Error{constructor(kind,info2,index,length){super(_QueryError.formatMessage(kind,info2)),this.kind=kind,this.info=info2,this.index=index,this.length=length,this.name="QueryError"}kind;info;index;length;static{__name(this,"QueryError")}static formatMessage(kind,info2){switch(kind){case QueryErrorKind.NodeName:return`Bad node name '${info2.word}'`;case QueryErrorKind.FieldName:return`Bad field name '${info2.word}'`;case QueryErrorKind.CaptureName:return`Bad capture name @${info2.word}`;case QueryErrorKind.PatternStructure:return`Bad pattern structure at offset ${info2.suffix}`;case QueryErrorKind.Syntax:return`Bad syntax at offset ${info2.suffix}`}}};function parseAnyPredicate(steps,index,operator,textPredicates){if(steps.length!==3)throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length-1}`);if(!isCaptureStep(steps[1]))throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}"`);let isPositive=operator==="eq?"||operator==="any-eq?",matchAll=!operator.startsWith("any-");if(isCaptureStep(steps[2])){let captureName1=steps[1].name,captureName2=steps[2].name;textPredicates[index].push(captures=>{let nodes1=[],nodes2=[];for(let c of captures)c.name===captureName1&&nodes1.push(c.node),c.name===captureName2&&nodes2.push(c.node);let compare=__name((n1,n2,positive)=>positive?n1.text===n2.text:n1.text!==n2.text,"compare");return matchAll?nodes1.every(n1=>nodes2.some(n2=>compare(n1,n2,isPositive))):nodes1.some(n1=>nodes2.some(n2=>compare(n1,n2,isPositive)))})}else{let captureName=steps[1].name,stringValue=steps[2].value,matches=__name(n=>n.text===stringValue,"matches"),doesNotMatch=__name(n=>n.text!==stringValue,"doesNotMatch");textPredicates[index].push(captures=>{let nodes=[];for(let c of captures)c.name===captureName&&nodes.push(c.node);let test=isPositive?matches:doesNotMatch;return matchAll?nodes.every(test):nodes.some(test)})}}__name(parseAnyPredicate,"parseAnyPredicate");function parseMatchPredicate(steps,index,operator,textPredicates){if(steps.length!==3)throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length-1}.`);if(steps[1].type!=="capture")throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);if(steps[2].type!=="string")throw new Error(`Second argument of \`#${operator}\` predicate must be a string. Got @${steps[2].name}.`);let isPositive=operator==="match?"||operator==="any-match?",matchAll=!operator.startsWith("any-"),captureName=steps[1].name,regex=new RegExp(steps[2].value);textPredicates[index].push(captures=>{let nodes=[];for(let c of captures)c.name===captureName&&nodes.push(c.node.text);let test=__name((text,positive)=>positive?regex.test(text):!regex.test(text),"test");return nodes.length===0?!isPositive:matchAll?nodes.every(text=>test(text,isPositive)):nodes.some(text=>test(text,isPositive))})}__name(parseMatchPredicate,"parseMatchPredicate");function parseAnyOfPredicate(steps,index,operator,textPredicates){if(steps.length<2)throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected at least 1. Got ${steps.length-1}.`);if(steps[1].type!=="capture")throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);let isPositive=operator==="any-of?",captureName=steps[1].name,stringSteps=steps.slice(2);if(!stringSteps.every(isStringStep))throw new Error(`Arguments to \`#${operator}\` predicate must be strings.".`);let values=stringSteps.map(s=>s.value);textPredicates[index].push(captures=>{let nodes=[];for(let c of captures)c.name===captureName&&nodes.push(c.node.text);return nodes.length===0?!isPositive:nodes.every(text=>values.includes(text))===isPositive})}__name(parseAnyOfPredicate,"parseAnyOfPredicate");function parseIsPredicate(steps,index,operator,assertedProperties,refutedProperties){if(steps.length<2||steps.length>3)throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 1 or 2. Got ${steps.length-1}.`);if(!steps.every(isStringStep))throw new Error(`Arguments to \`#${operator}\` predicate must be strings.".`);let properties=operator==="is?"?assertedProperties:refutedProperties;properties[index]||(properties[index]={}),properties[index][steps[1].value]=steps[2]?.value??null}__name(parseIsPredicate,"parseIsPredicate");function parseSetDirective(steps,index,setProperties){if(steps.length<2||steps.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${steps.length-1}.`);if(!steps.every(isStringStep))throw new Error('Arguments to `#set!` predicate must be strings.".');setProperties[index]||(setProperties[index]={}),setProperties[index][steps[1].value]=steps[2]?.value??null}__name(parseSetDirective,"parseSetDirective");function parsePattern(index,stepType,stepValueId,captureNames,stringValues,steps,textPredicates,predicates,setProperties,assertedProperties,refutedProperties){if(stepType===PREDICATE_STEP_TYPE_CAPTURE){let name2=captureNames[stepValueId];steps.push({type:"capture",name:name2})}else if(stepType===PREDICATE_STEP_TYPE_STRING)steps.push({type:"string",value:stringValues[stepValueId]});else if(steps.length>0){if(steps[0].type!=="string")throw new Error("Predicates must begin with a literal value");let operator=steps[0].value;switch(operator){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":parseAnyPredicate(steps,index,operator,textPredicates);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":parseMatchPredicate(steps,index,operator,textPredicates);break;case"not-any-of?":case"any-of?":parseAnyOfPredicate(steps,index,operator,textPredicates);break;case"is?":case"is-not?":parseIsPredicate(steps,index,operator,assertedProperties,refutedProperties);break;case"set!":parseSetDirective(steps,index,setProperties);break;default:predicates[index].push({operator,operands:steps.slice(1)})}steps.length=0}}__name(parsePattern,"parsePattern");var finalizer5=newFinalizer(address=>{C._ts_query_delete(address)}),Query=class{static{__name(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(language,source){let sourceLength=C.lengthBytesUTF8(source),sourceAddress=C._malloc(sourceLength+1);C.stringToUTF8(source,sourceAddress,sourceLength+1);let address=C._ts_query_new(language[0],sourceAddress,sourceLength,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!address){let errorId=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),errorByte=C.getValue(TRANSFER_BUFFER,"i32"),errorIndex=C.UTF8ToString(sourceAddress,errorByte).length,suffix=source.slice(errorIndex,errorIndex+100).split(`
`)[0],word=suffix.match(QUERY_WORD_REGEX)?.[0]??"";switch(C._free(sourceAddress),errorId){case QueryErrorKind.Syntax:throw new QueryError(QueryErrorKind.Syntax,{suffix:`${errorIndex}: '${suffix}'...`},errorIndex,0);case QueryErrorKind.NodeName:throw new QueryError(errorId,{word},errorIndex,word.length);case QueryErrorKind.FieldName:throw new QueryError(errorId,{word},errorIndex,word.length);case QueryErrorKind.CaptureName:throw new QueryError(errorId,{word},errorIndex,word.length);case QueryErrorKind.PatternStructure:throw new QueryError(errorId,{suffix:`${errorIndex}: '${suffix}'...`},errorIndex,0)}}let stringCount=C._ts_query_string_count(address),captureCount=C._ts_query_capture_count(address),patternCount=C._ts_query_pattern_count(address),captureNames=new Array(captureCount),captureQuantifiers=new Array(patternCount),stringValues=new Array(stringCount);for(let i2=0;i2<captureCount;i2++){let nameAddress=C._ts_query_capture_name_for_id(address,i2,TRANSFER_BUFFER),nameLength=C.getValue(TRANSFER_BUFFER,"i32");captureNames[i2]=C.UTF8ToString(nameAddress,nameLength)}for(let i2=0;i2<patternCount;i2++){let captureQuantifiersArray=new Array(captureCount);for(let j=0;j<captureCount;j++){let quantifier=C._ts_query_capture_quantifier_for_id(address,i2,j);captureQuantifiersArray[j]=quantifier}captureQuantifiers[i2]=captureQuantifiersArray}for(let i2=0;i2<stringCount;i2++){let valueAddress=C._ts_query_string_value_for_id(address,i2,TRANSFER_BUFFER),nameLength=C.getValue(TRANSFER_BUFFER,"i32");stringValues[i2]=C.UTF8ToString(valueAddress,nameLength)}let setProperties=new Array(patternCount),assertedProperties=new Array(patternCount),refutedProperties=new Array(patternCount),predicates=new Array(patternCount),textPredicates=new Array(patternCount);for(let i2=0;i2<patternCount;i2++){let predicatesAddress=C._ts_query_predicates_for_pattern(address,i2,TRANSFER_BUFFER),stepCount=C.getValue(TRANSFER_BUFFER,"i32");predicates[i2]=[],textPredicates[i2]=[];let steps=new Array,stepAddress=predicatesAddress;for(let j=0;j<stepCount;j++){let stepType=C.getValue(stepAddress,"i32");stepAddress+=SIZE_OF_INT;let stepValueId=C.getValue(stepAddress,"i32");stepAddress+=SIZE_OF_INT,parsePattern(i2,stepType,stepValueId,captureNames,stringValues,steps,textPredicates,predicates,setProperties,assertedProperties,refutedProperties)}Object.freeze(textPredicates[i2]),Object.freeze(predicates[i2]),Object.freeze(setProperties[i2]),Object.freeze(assertedProperties[i2]),Object.freeze(refutedProperties[i2])}C._free(sourceAddress),this[0]=address,this.captureNames=captureNames,this.captureQuantifiers=captureQuantifiers,this.textPredicates=textPredicates,this.predicates=predicates,this.setProperties=setProperties,this.assertedProperties=assertedProperties,this.refutedProperties=refutedProperties,this.exceededMatchLimit=!1,finalizer5?.register(this,address,this)}delete(){finalizer5?.unregister(this),C._ts_query_delete(this[0]),this[0]=0}matches(node,options={}){let startPosition=options.startPosition??ZERO_POINT,endPosition=options.endPosition??ZERO_POINT,startIndex=options.startIndex??0,endIndex=options.endIndex??0,startContainingPosition=options.startContainingPosition??ZERO_POINT,endContainingPosition=options.endContainingPosition??ZERO_POINT,startContainingIndex=options.startContainingIndex??0,endContainingIndex=options.endContainingIndex??0,matchLimit=options.matchLimit??4294967295,maxStartDepth=options.maxStartDepth??4294967295,progressCallback=options.progressCallback;if(typeof matchLimit!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=matchLimit,endIndex!==0&&startIndex>endIndex)throw new Error("`startIndex` cannot be greater than `endIndex`");if(endPosition!==ZERO_POINT&&(startPosition.row>endPosition.row||startPosition.row===endPosition.row&&startPosition.column>endPosition.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(endContainingIndex!==0&&startContainingIndex>endContainingIndex)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(endContainingPosition!==ZERO_POINT&&(startContainingPosition.row>endContainingPosition.row||startContainingPosition.row===endContainingPosition.row&&startContainingPosition.column>endContainingPosition.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");progressCallback&&(C.currentQueryProgressCallback=progressCallback),marshalNode(node),C._ts_query_matches_wasm(this[0],node.tree[0],startPosition.row,startPosition.column,endPosition.row,endPosition.column,startIndex,endIndex,startContainingPosition.row,startContainingPosition.column,endContainingPosition.row,endContainingPosition.column,startContainingIndex,endContainingIndex,matchLimit,maxStartDepth);let rawCount=C.getValue(TRANSFER_BUFFER,"i32"),startAddress=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),didExceedMatchLimit=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),result=new Array(rawCount);this.exceededMatchLimit=!!didExceedMatchLimit;let filteredCount=0,address=startAddress;for(let i2=0;i2<rawCount;i2++){let patternIndex=C.getValue(address,"i32");address+=SIZE_OF_INT;let captureCount=C.getValue(address,"i32");address+=SIZE_OF_INT;let captures=new Array(captureCount);if(address=unmarshalCaptures(this,node.tree,address,patternIndex,captures),this.textPredicates[patternIndex].every(p=>p(captures))){result[filteredCount]={patternIndex,captures};let setProperties=this.setProperties[patternIndex];result[filteredCount].setProperties=setProperties;let assertedProperties=this.assertedProperties[patternIndex];result[filteredCount].assertedProperties=assertedProperties;let refutedProperties=this.refutedProperties[patternIndex];result[filteredCount].refutedProperties=refutedProperties,filteredCount++}}return result.length=filteredCount,C._free(startAddress),C.currentQueryProgressCallback=null,result}captures(node,options={}){let startPosition=options.startPosition??ZERO_POINT,endPosition=options.endPosition??ZERO_POINT,startIndex=options.startIndex??0,endIndex=options.endIndex??0,startContainingPosition=options.startContainingPosition??ZERO_POINT,endContainingPosition=options.endContainingPosition??ZERO_POINT,startContainingIndex=options.startContainingIndex??0,endContainingIndex=options.endContainingIndex??0,matchLimit=options.matchLimit??4294967295,maxStartDepth=options.maxStartDepth??4294967295,progressCallback=options.progressCallback;if(typeof matchLimit!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=matchLimit,endIndex!==0&&startIndex>endIndex)throw new Error("`startIndex` cannot be greater than `endIndex`");if(endPosition!==ZERO_POINT&&(startPosition.row>endPosition.row||startPosition.row===endPosition.row&&startPosition.column>endPosition.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(endContainingIndex!==0&&startContainingIndex>endContainingIndex)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(endContainingPosition!==ZERO_POINT&&(startContainingPosition.row>endContainingPosition.row||startContainingPosition.row===endContainingPosition.row&&startContainingPosition.column>endContainingPosition.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");progressCallback&&(C.currentQueryProgressCallback=progressCallback),marshalNode(node),C._ts_query_captures_wasm(this[0],node.tree[0],startPosition.row,startPosition.column,endPosition.row,endPosition.column,startIndex,endIndex,startContainingPosition.row,startContainingPosition.column,endContainingPosition.row,endContainingPosition.column,startContainingIndex,endContainingIndex,matchLimit,maxStartDepth);let count=C.getValue(TRANSFER_BUFFER,"i32"),startAddress=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),didExceedMatchLimit=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),result=new Array;this.exceededMatchLimit=!!didExceedMatchLimit;let captures=new Array,address=startAddress;for(let i2=0;i2<count;i2++){let patternIndex=C.getValue(address,"i32");address+=SIZE_OF_INT;let captureCount=C.getValue(address,"i32");address+=SIZE_OF_INT;let captureIndex=C.getValue(address,"i32");if(address+=SIZE_OF_INT,captures.length=captureCount,address=unmarshalCaptures(this,node.tree,address,patternIndex,captures),this.textPredicates[patternIndex].every(p=>p(captures))){let capture=captures[captureIndex],setProperties=this.setProperties[patternIndex];capture.setProperties=setProperties;let assertedProperties=this.assertedProperties[patternIndex];capture.assertedProperties=assertedProperties;let refutedProperties=this.refutedProperties[patternIndex];capture.refutedProperties=refutedProperties,result.push(capture)}}return C._free(startAddress),C.currentQueryProgressCallback=null,result}predicatesForPattern(patternIndex){return this.predicates[patternIndex]}disableCapture(captureName){let captureNameLength=C.lengthBytesUTF8(captureName),captureNameAddress=C._malloc(captureNameLength+1);C.stringToUTF8(captureName,captureNameAddress,captureNameLength+1),C._ts_query_disable_capture(this[0],captureNameAddress,captureNameLength),C._free(captureNameAddress)}disablePattern(patternIndex){if(patternIndex>=this.predicates.length)throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);C._ts_query_disable_pattern(this[0],patternIndex)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(patternIndex){if(patternIndex>=this.predicates.length)throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);return C._ts_query_start_byte_for_pattern(this[0],patternIndex)}endIndexForPattern(patternIndex){if(patternIndex>=this.predicates.length)throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);return C._ts_query_end_byte_for_pattern(this[0],patternIndex)}patternCount(){return C._ts_query_pattern_count(this[0])}captureIndexForName(captureName){return this.captureNames.indexOf(captureName)}isPatternRooted(patternIndex){return C._ts_query_is_pattern_rooted(this[0],patternIndex)===1}isPatternNonLocal(patternIndex){return C._ts_query_is_pattern_non_local(this[0],patternIndex)===1}isPatternGuaranteedAtStep(byteIndex){return C._ts_query_is_pattern_guaranteed_at_step(this[0],byteIndex)===1}};export{CaptureQuantifier,Edit,LANGUAGE_VERSION,Language,LookaheadIterator,MIN_COMPATIBLE_VERSION,Node,Parser,Query,Tree,TreeCursor};