@github/copilot 0.0.351-14 → 0.0.351-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2447,7 +2447,7 @@ ${e}`:""),isTruncated:!1}}function Ail(t){let e=Math.floor((Date.now()-t.getTime
2447
2447
  `,l+="</function_results>",l}formatMessage(e,l){return!l||!l.trim()?"":`
2448
2448
  ${this.escapeXml(this.secretFilter.filterSecrets(l.trim()))}
2449
2449
  `}escapeXml(e){return e}};function dCe(t){switch(t.kind){case"log":case"session_logging_disabled":case"telemetry":case"title_and_body_content":return!1;case"message":case"response":case"model_call_failure":case"model_call_success":case"tool_execution":case"turn_started":case"turn_ended":case"turn_failed":case"turn_retry":case"history_truncated":case"image_processing":case"images_removed":return!0}}var uCe=class{toolCalls={};trajectoryOutputFile;trajectoryStream;trajectoryFormatter=new cCe;logger;constructor(e,l){this.logger=e,this.trajectoryOutputFile=l,this.initTrajectoryOutputFileIfNeeded()}async progress(e){if(dCe(e)){if(this.trajectoryStream){if(GL(e)){e.message.content&&this.handleAssistantMessageWithContent(e.message.content),e.message.reasoning_text&&this.handleAssistantMessageWithContent(e.message.reasoning_text),T8(e)&&this.handleAssistantToolCalls(e.message.tool_calls);return}else if(_1e(e)){this.handleToolCallId(e.message.tool_call_id,e.message.content);return}}}else return}partialResult(e){return Promise.resolve()}commentReply(e){return Promise.resolve()}async result(e){if(typeof e=="object"&&(e.blockedRequests=e.blockedRequests??await this.getBlockedRequests()),this.trajectoryStream)return await new Promise(l=>{this.trajectoryStream?.end(()=>{this.trajectoryStream=void 0,l()})})}async error(e){if(this.trajectoryStream)return await new Promise(l=>{this.trajectoryStream?.end(()=>{this.trajectoryStream=void 0,l()})})}handleAssistantMessageWithContent(e){this.trajectoryStream&&this.writeTrajectoryAssistantMessage(e)}handleAssistantToolCalls(e){for(let l of e){let n=l.id;this.toolCalls[n]=l,this.trajectoryStream&&this.writeTrajectoryToolCall(l)}}handleToolCallId(e,l){let n=this.toolCalls[e];n&&(delete this.toolCalls[e],kA(n)&&n.function.name&&this.trajectoryStream&&this.writeTrajectoryFunctionResult(l))}initTrajectoryOutputFileIfNeeded(){if(this.trajectoryOutputFile)try{let e=Jil.dirname(this.trajectoryOutputFile);E7.existsSync(e)||E7.mkdirSync(e,{recursive:!0}),this.trajectoryStream=E7.createWriteStream(this.trajectoryOutputFile,{flags:"w"})}catch(e){let l={text:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:"Error",stack:e instanceof Error?e.stack:void 0};this.logger.error(`ERROR: ${JSON.stringify(l,null,2)}`),this.trajectoryStream=void 0}}writeTrajectoryAssistantMessage(e){let l=typeof e=="string"?e:JSON.stringify(e),n=this.trajectoryFormatter.formatMessage("assistant",l);n&&this.writeToTrajectoryFile(n)}writeTrajectoryToolCall(e){let l=this.trajectoryFormatter.formatToolCall(e);this.writeToTrajectoryFile(l)}writeTrajectoryFunctionResult(e){let l=typeof e=="string"?e:JSON.stringify(e),n=this.trajectoryFormatter.formatToolResult(l);this.writeToTrajectoryFile(n)}writeToTrajectoryFile(e){this.trajectoryStream&&this.trajectoryStream.write(e+`
2450
- `)}async getBlockedRequests(){try{return await Lil()}catch(e){return this.logger.error(`Error parsing firewall logs: ${e}`),[]}}};function xil(){let t=[],e=[],l=!1;return{next(n){l||(e.length>0?e.shift()({value:n,done:!1}):t.push(n))},done(){l||(l=!0,e.forEach(n=>n({value:void 0,done:!0})))},async*iterator(){for(;;)if(t.length>0)yield t.shift();else{if(l)return;{let n=await new Promise(r=>{e.push(r)});if(n.done)return;yield n.value}}}}}async function*Sil(t,e="all"){let l=t.map(n=>({iterator:n,next:n.next()}));for(;l.length>0;){let{done:n,value:r,index:a,iterator:I}=await Promise.race(l.map((s,o)=>s.next.then(c=>({index:o,...c,iterator:s.iterator}))));if(n){if(e==="any")return;l.splice(a,1)}else l[a].next=I.next(),yield r}}import{homedir as uPn}from"os";var mPn=10,Bil=["grep","egrep","fgrep","rg"],Til=["awk","gawk","mawk","nawk"];function Ctt(t,e){let l=[],n=["HOME","TMPDIR","TEMP","TMP","PWD","USER","USERNAME","USERPROFILE","APPDATA","LOCALAPPDATA"],r=!1,a=e;switch(t){case"bash":{let I=/\$\{?([A-Z_][A-Z0-9_]*)\}?/gi,s=[...e.matchAll(I)];for(let o=s.length-1;o>=0;o--){let c=s[o],d=c[1];if(n.some(m=>m.toLowerCase()===d.toLowerCase())){let m=process.env[d];m&&c.index!==void 0&&(a=a.slice(0,c.index)+m+a.slice(c.index+c[0].length),r=!0)}}break}case"powershell":{let I=/\$\{?env:([A-Z_][A-Z0-9_]*)\}?/gi,s=[...a.matchAll(I),...a.matchAll(/\$\{?HOME\}?/gi)];s.sort((o,c)=>(o.index??0)-(c.index??0));for(let o=s.length-1;o>=0;o--){let c=s[o],d=c[0].toUpperCase(),m=d==="$HOME"||d==="${HOME}",G=m?"HOME":c[1];if(n.some(p=>p.toLowerCase()===G.toLowerCase())){let p=m?uPn():process.env[G];p&&c.index!==void 0&&(a=a.slice(0,c.index)+p+a.slice(c.index+c[0].length),r=!0)}}break}default:wo(t,`Unknown shell type: ${t}`)}return r&&a!==e&&l.push(a),l.push(e),l}function bPn(t){let e=new Set,l=!1,n=new Set,r=[];for(let a=1;a<t.length;a++){let I=t[a],s=I.text;if(s==="--")break;if(s==="-e"||s==="--regexp"){a+1<t.length&&(e.add(a+1),a++);continue}if(!(s.startsWith("-e")&&s.length>2)&&!s.startsWith("--regexp=")){if(s==="-f"||s==="--file"){l=!0,a+1<t.length&&a++;continue}if(s.startsWith("-f")&&s.length>2){let o=s.slice(2);o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+2}),l=!0;continue}if(s.startsWith("--file=")){let o=s.split("=",2)[1];o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+7}),l=!0;continue}if(s==="--include-dir"){if(a+1<t.length){let o=t[a+1];rQ(o.text)&&r.push({path:o.text,charIndex:o.charIndex}),a++}continue}if(s.startsWith("--include-dir=")){let o=s.split("=",2)[1];o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+14});continue}if(s==="--include"||s==="--exclude"||s==="--exclude-dir"){a+1<t.length&&a++;continue}s.startsWith("--include=")||s.startsWith("--exclude=")||s.startsWith("--exclude-dir=")}}if(l)for(let a of e)n.add(a);else{let a=!1;for(let I=1;I<t.length;I++)if(!t[I].text.startsWith("-")){e.add(I),a=!0;break}if(a)for(let I of e)n.add(I)}return{skipIndexes:n,paths:r}}function GPn(t){let e=new Set,l=[],n=!1;for(let r=1;r<t.length;r++){let a=t[r],I=a.text;if(I==="--")break;if(I==="-f"||I==="--file"){n=!0,r+1<t.length&&r++;continue}if(I.startsWith("-f")&&I.length>2){let s=I.slice(2);s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+2}),n=!0;continue}if(I.startsWith("--file=")){let s=I.split("=",2)[1];s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+7}),n=!0;continue}if(I==="-v"||I==="-F"||I.startsWith("-v")||I.startsWith("-F")){(I==="-v"||I==="-F")&&r+1<t.length&&r++;continue}I.startsWith("--")}if(!n){for(let r=1;r<t.length;r++)if(!t[r].text.startsWith("-")){e.add(r);break}}return{skipIndexes:e,paths:l}}function pPn(t){let e=new Set,l=[];if(t[0].text==="gh"&&t[1].text==="api"){e.add(1);let n=t[2];n&&!n.text.startsWith("-")&&e.add(2)}return{skipIndexes:e,paths:l}}function hPn(t){let e=new Set,l=[],n=!1;for(let r=1;r<t.length;r++){let a=t[r],I=a.text;if(I==="--")break;if(I==="-e"||I==="--expression"){r+1<t.length&&(e.add(r+1),r++);continue}if(!(I.startsWith("-e")&&I.length>2)&&!I.startsWith("--expression=")){if(I==="-f"||I==="--file"){n=!0,r+1<t.length&&r++;continue}if(I.startsWith("-f")&&I.length>2){let s=I.slice(2);s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+2}),n=!0;continue}if(I.startsWith("--file=")){let s=I.split("=",2)[1];s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+7}),n=!0;continue}I==="-i"||I.startsWith("-i")||I.startsWith("--")}}if(!n){for(let r=1;r<t.length;r++)if(!t[r].text.startsWith("-")){e.add(r);break}}return{skipIndexes:e,paths:l}}function APn(t){let e=new Set,l=[],n=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-lname","-ilname","-user","-group","-type","-size","-perm","-mtime","-mmin","-maxdepth","-mindepth"]);for(let r=1;r<t.length;r++){let I=t[r].text;if(I){if(I==="--"){r++;continue}if(n.has(I)){r+1<t.length&&(e.add(r+1),r++);continue}for(let s of n)if(I.startsWith(s+"="))break}}return{skipIndexes:e,paths:l}}function vtt(t,e){let l=[],n=gPn(e);if(n.length===0)return[];let r=n[0].text,a=new Set,I=n.findIndex(d=>/^([;&|<]|\d*>)/.test(d.text)),s=I===-1?n:n.slice(0,I);if(Bil.includes(r)){let{skipIndexes:d,paths:m}=bPn(s);a=new Set([...a,...d]),l.push(...m)}if(Til.includes(r)){let{skipIndexes:d,paths:m}=GPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="sed"){let{skipIndexes:d,paths:m}=hPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="gh"){let{skipIndexes:d,paths:m}=pPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="find"&&process.platform!=="win32"){let{skipIndexes:d,paths:m}=APn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="echo")for(let d=1;d<s.length;d++){let m=s[d];m&&(m.text.startsWith("-")||a.add(d))}for(let d=0;d<n.length;d++){let m=n[d];if(!a.has(d)&&!m.text.startsWith("-")){if(rQ(m.text)){let G=Ctt(t,m.text);l.push(...G.map(p=>({path:p,charIndex:m.charIndex})))}if(m.text.includes(">")||m.text.includes("<")){let G=m.text.match(/[0-9]*[><]+(.+)/);if(G&&G[1]){let p=Ctt(t,G[1]);l.push(...p.map(A=>({path:A,charIndex:m.charIndex+m.text.indexOf(G[1])})))}}if((m.text===">"||m.text===">>"||m.text==="<")&&d+1<n.length){let G=n[d+1];if(rQ(G.text)){let p=Ctt(t,G.text);l.push(...p.map(A=>({path:A,charIndex:G.charIndex})))}}}}let o=new Set,c=[];for(let d of l){let m=`${d.path}|${d.charIndex}`;o.has(m)||(o.add(m),c.push(d))}return c}function gPn(t){let e=[],l=/(\s+|;|&+|\|+|>+|<+)/y,n=null,r=!1,a="";for(let I=0;I<t.length;I++){let s=t[I];if(n&&r)s===a?(r=!1,a="",n&&(e.push(n),n=null)):n.text+=s;else if(s==='"'||s==="'")r=!0,a=s;else{l.lastIndex=I;let o=l.exec(t);if(o){n&&(e.push(n),n=null);let c=o[0];c.trim().length>0&&(e.push({text:c,charIndex:I}),I+=c.length-1)}else n?n.text+=s:n={text:s,charIndex:I}}}return n&&e.push(n),e}function rQ(t){if(t=t.replace(/^['"]|['"]$/g,""),!t)return!1;if(/\$\{?[A-Z_][A-Z0-9_]*\}?/i.test(t)||process.platform==="win32"&&/%[A-Z_][A-Z0-9_]*%/i.test(t)||t.startsWith("/"))return!0;let e=process.platform==="win32";return e&&(t.startsWith("\\")||/^[a-zA-Z]:/.test(t))||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^(\.\.\/)+/.test(t)||e&&(t.startsWith(".\\")||t.startsWith("..\\"))||t.startsWith("~/")||t==="~"||t.includes("/")||new RegExp(`\\.[a-zA-Z0-9]{1,${mPn}}$`).test(t)?!0:t.length>2&&/^[a-zA-Z0-9_.-\s]+$/.test(t)?!["true","false","null","undefined","www","com","org","echo",...Til,...Bil,"sed","find","sort","head","tail","touch","cat","and","or","not","if","then","else","fi","do","done","while","for","case","esac","function","return"].includes(t.toLowerCase()):!1}import scl from"node:path";var ZPn=Object.defineProperty,yt=(t,e)=>ZPn(t,"name",{value:e,configurable:!0}),Oil=2,ur=4,ftt=4*ur,hN=5*ur,aQ=2*ur,Ebe=2*ur+2*aQ,tJ={row:0,column:0},lJ=Symbol("INTERNAL");function R7(t){if(t!==lJ)throw new Error("Illegal constructor")}yt(R7,"assertInternal");function ybe(t){return!!t&&typeof t.row=="number"&&typeof t.column=="number"}yt(ybe,"isPoint");function Mil(t){Ve=t}yt(Mil,"setModule");var Ve,NPn=class{static{yt(this,"LookaheadIterator")}0=0;language;constructor(t,e,l){R7(t),this[0]=e,this.language=l}get currentTypeId(){return Ve._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){Ve._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(t,e){return Ve._ts_lookahead_iterator_reset(this[0],t[0],e)?(this.language=t,!0):!1}resetState(t){return!!Ve._ts_lookahead_iterator_reset_state(this[0],t)}[Symbol.iterator](){return{next:yt(()=>Ve._ts_lookahead_iterator_next(this[0])?{done:!1,value:this.currentType}:{done:!0,value:""},"next")}}};function Jtt(t,e,l,n){let r=l-e,a=t.textCallback(e,n);if(a){for(e+=a.length;e<l;){let I=t.textCallback(e,n);if(I&&I.length>0)e+=I.length,a+=I;else break}e>l&&(a=a.slice(0,r))}return a??""}yt(Jtt,"getText");var WPn=class ktt{static{yt(this,"Tree")}0=0;textCallback;language;constructor(e,l,n,r){R7(e),this[0]=l,this.language=n,this.textCallback=r}copy(){let e=Ve._ts_tree_copy(this[0]);return new ktt(lJ,e,this.language,this.textCallback)}delete(){Ve._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return Ve._ts_tree_root_node_wasm(this[0]),Ad(this)}rootNodeWithOffset(e,l){let n=nr+hN;return Ve.setValue(n,e,"i32"),x0(n+ur,l),Ve._ts_tree_root_node_with_offset_wasm(this[0]),Ad(this)}edit(e){zil(e),Ve._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(e){if(!(e instanceof ktt))throw new TypeError("Argument must be a Tree");Ve._ts_tree_get_changed_ranges_wasm(this[0],e[0]);let l=Ve.getValue(nr,"i32"),n=Ve.getValue(nr+ur,"i32"),r=new Array(l);if(l>0){let a=n;for(let I=0;I<l;I++)r[I]=bCe(a),a+=Ebe;Ve._free(n)}return r}getIncludedRanges(){Ve._ts_tree_included_ranges_wasm(this[0]);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32"),n=new Array(e);if(e>0){let r=l;for(let a=0;a<e;a++)n[a]=bCe(r),r+=Ebe;Ve._free(l)}return n}},yPn=class _il{static{yt(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(e,l){R7(e),this.tree=l,iy(this)}copy(){let e=new _il(lJ,this.tree);return Ve._ts_tree_cursor_copy_wasm(this.tree[0]),iy(e),e}delete(){zi(this),Ve._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return zi(this),Ve._ts_tree_cursor_current_node_wasm(this.tree[0]),Ad(this.tree)}get currentFieldId(){return zi(this),Ve._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return zi(this),Ve._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return zi(this),Ve._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return zi(this),Ve._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return zi(this),Ve._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return zi(this),Ve._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return zi(this),Ve._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return zi(this),Ve._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){zi(this);let e=Ve._ts_tree_cursor_start_index_wasm(this.tree[0]),l=Ve._ts_tree_cursor_end_index_wasm(this.tree[0]);Ve._ts_tree_cursor_start_position_wasm(this.tree[0]);let n=SO(nr);return Jtt(this.tree,e,l,n)}get startPosition(){return zi(this),Ve._ts_tree_cursor_start_position_wasm(this.tree[0]),SO(nr)}get endPosition(){return zi(this),Ve._ts_tree_cursor_end_position_wasm(this.tree[0]),SO(nr)}get startIndex(){return zi(this),Ve._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return zi(this),Ve._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){zi(this);let e=Ve._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return iy(this),e===1}gotoLastChild(){zi(this);let e=Ve._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return iy(this),e===1}gotoParent(){zi(this);let e=Ve._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return iy(this),e===1}gotoNextSibling(){zi(this);let e=Ve._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return iy(this),e===1}gotoPreviousSibling(){zi(this);let e=Ve._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return iy(this),e===1}gotoDescendant(e){zi(this),Ve._ts_tree_cursor_goto_descendant_wasm(this.tree[0],e),iy(this)}gotoFirstChildForIndex(e){zi(this),Ve.setValue(nr+ftt,e,"i32");let l=Ve._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return iy(this),l===1}gotoFirstChildForPosition(e){zi(this),x0(nr+ftt,e);let l=Ve._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return iy(this),l===1}reset(e){za(e),zi(this,nr+hN),Ve._ts_tree_cursor_reset_wasm(this.tree[0]),iy(this)}resetTo(e){zi(this,nr),zi(e,nr+ftt),Ve._ts_tree_cursor_reset_to_wasm(this.tree[0],e.tree[0]),iy(this)}},EPn=class{static{yt(this,"Node")}0=0;_children;_namedChildren;constructor(t,{id:e,tree:l,startIndex:n,startPosition:r,other:a}){R7(t),this[0]=a,this.id=e,this.tree=l,this.startIndex=n,this.startPosition=r}id;startIndex;startPosition;tree;get typeId(){return za(this),Ve._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return za(this),Ve._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 za(this),Ve._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return za(this),Ve._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return za(this),Ve._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return za(this),Ve._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return za(this),Ve._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return za(this),Ve._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return za(this),Ve._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return za(this),Ve._ts_node_end_point_wasm(this.tree[0]),SO(nr)}get text(){return Jtt(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return za(this),Ve._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return za(this),Ve._ts_node_next_parse_state_wasm(this.tree[0])}equals(t){return this.tree===t.tree&&this.id===t.id}child(t){return za(this),Ve._ts_node_child_wasm(this.tree[0],t),Ad(this.tree)}namedChild(t){return za(this),Ve._ts_node_named_child_wasm(this.tree[0],t),Ad(this.tree)}childForFieldId(t){return za(this),Ve._ts_node_child_by_field_id_wasm(this.tree[0],t),Ad(this.tree)}childForFieldName(t){let e=this.tree.language.fields.indexOf(t);return e!==-1?this.childForFieldId(e):null}fieldNameForChild(t){za(this);let e=Ve._ts_node_field_name_for_child_wasm(this.tree[0],t);return e?Ve.AsciiToString(e):null}fieldNameForNamedChild(t){za(this);let e=Ve._ts_node_field_name_for_named_child_wasm(this.tree[0],t);return e?Ve.AsciiToString(e):null}childrenForFieldName(t){let e=this.tree.language.fields.indexOf(t);return e!==-1&&e!==0?this.childrenForFieldId(e):[]}childrenForFieldId(t){za(this),Ve._ts_node_children_by_field_id_wasm(this.tree[0],t);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32"),n=new Array(e);if(e>0){let r=l;for(let a=0;a<e;a++)n[a]=Ad(this.tree,r),r+=hN;Ve._free(l)}return n}firstChildForIndex(t){za(this);let e=nr+hN;return Ve.setValue(e,t,"i32"),Ve._ts_node_first_child_for_byte_wasm(this.tree[0]),Ad(this.tree)}firstNamedChildForIndex(t){za(this);let e=nr+hN;return Ve.setValue(e,t,"i32"),Ve._ts_node_first_named_child_for_byte_wasm(this.tree[0]),Ad(this.tree)}get childCount(){return za(this),Ve._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return za(this),Ve._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){za(this),Ve._ts_node_children_wasm(this.tree[0]);let t=Ve.getValue(nr,"i32"),e=Ve.getValue(nr+ur,"i32");if(this._children=new Array(t),t>0){let l=e;for(let n=0;n<t;n++)this._children[n]=Ad(this.tree,l),l+=hN;Ve._free(e)}}return this._children}get namedChildren(){if(!this._namedChildren){za(this),Ve._ts_node_named_children_wasm(this.tree[0]);let t=Ve.getValue(nr,"i32"),e=Ve.getValue(nr+ur,"i32");if(this._namedChildren=new Array(t),t>0){let l=e;for(let n=0;n<t;n++)this._namedChildren[n]=Ad(this.tree,l),l+=hN;Ve._free(e)}}return this._namedChildren}descendantsOfType(t,e=tJ,l=tJ){Array.isArray(t)||(t=[t]);let n=[],r=this.tree.language.types;for(let c of t)c=="ERROR"&&n.push(65535);for(let c=0,d=r.length;c<d;c++)t.includes(r[c])&&n.push(c);let a=Ve._malloc(ur*n.length);for(let c=0,d=n.length;c<d;c++)Ve.setValue(a+c*ur,n[c],"i32");za(this),Ve._ts_node_descendants_of_type_wasm(this.tree[0],a,n.length,e.row,e.column,l.row,l.column);let I=Ve.getValue(nr,"i32"),s=Ve.getValue(nr+ur,"i32"),o=new Array(I);if(I>0){let c=s;for(let d=0;d<I;d++)o[d]=Ad(this.tree,c),c+=hN}return Ve._free(s),Ve._free(a),o}get nextSibling(){return za(this),Ve._ts_node_next_sibling_wasm(this.tree[0]),Ad(this.tree)}get previousSibling(){return za(this),Ve._ts_node_prev_sibling_wasm(this.tree[0]),Ad(this.tree)}get nextNamedSibling(){return za(this),Ve._ts_node_next_named_sibling_wasm(this.tree[0]),Ad(this.tree)}get previousNamedSibling(){return za(this),Ve._ts_node_prev_named_sibling_wasm(this.tree[0]),Ad(this.tree)}get descendantCount(){return za(this),Ve._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return za(this),Ve._ts_node_parent_wasm(this.tree[0]),Ad(this.tree)}childWithDescendant(t){return za(this),za(t,1),Ve._ts_node_child_with_descendant_wasm(this.tree[0]),Ad(this.tree)}descendantForIndex(t,e=t){if(typeof t!="number"||typeof e!="number")throw new Error("Arguments must be numbers");za(this);let l=nr+hN;return Ve.setValue(l,t,"i32"),Ve.setValue(l+ur,e,"i32"),Ve._ts_node_descendant_for_index_wasm(this.tree[0]),Ad(this.tree)}namedDescendantForIndex(t,e=t){if(typeof t!="number"||typeof e!="number")throw new Error("Arguments must be numbers");za(this);let l=nr+hN;return Ve.setValue(l,t,"i32"),Ve.setValue(l+ur,e,"i32"),Ve._ts_node_named_descendant_for_index_wasm(this.tree[0]),Ad(this.tree)}descendantForPosition(t,e=t){if(!ybe(t)||!ybe(e))throw new Error("Arguments must be {row, column} objects");za(this);let l=nr+hN;return x0(l,t),x0(l+aQ,e),Ve._ts_node_descendant_for_position_wasm(this.tree[0]),Ad(this.tree)}namedDescendantForPosition(t,e=t){if(!ybe(t)||!ybe(e))throw new Error("Arguments must be {row, column} objects");za(this);let l=nr+hN;return x0(l,t),x0(l+aQ,e),Ve._ts_node_named_descendant_for_position_wasm(this.tree[0]),Ad(this.tree)}walk(){return za(this),Ve._ts_tree_cursor_new_wasm(this.tree[0]),new yPn(lJ,this.tree)}edit(t){if(this.startIndex>=t.oldEndIndex){this.startIndex=t.newEndIndex+(this.startIndex-t.oldEndIndex);let e,l;this.startPosition.row>t.oldEndPosition.row?(e=this.startPosition.row-t.oldEndPosition.row,l=this.startPosition.column):(e=0,l=this.startPosition.column,this.startPosition.column>=t.oldEndPosition.column&&(l=this.startPosition.column-t.oldEndPosition.column)),e>0?(this.startPosition.row+=e,this.startPosition.column=l):this.startPosition.column+=l}else this.startIndex>t.startIndex&&(this.startIndex=t.newEndIndex,this.startPosition.row=t.newEndPosition.row,this.startPosition.column=t.newEndPosition.column)}toString(){za(this);let t=Ve._ts_node_to_string_wasm(this.tree[0]),e=Ve.AsciiToString(t);return Ve._free(t),e}};function Ltt(t,e,l,n,r){for(let a=0,I=r.length;a<I;a++){let s=Ve.getValue(l,"i32");l+=ur;let o=Ad(e,l);l+=hN,r[a]={patternIndex:n,name:t.captureNames[s],node:o}}return l}yt(Ltt,"unmarshalCaptures");function za(t,e=0){let l=nr+e*hN;Ve.setValue(l,t.id,"i32"),l+=ur,Ve.setValue(l,t.startIndex,"i32"),l+=ur,Ve.setValue(l,t.startPosition.row,"i32"),l+=ur,Ve.setValue(l,t.startPosition.column,"i32"),l+=ur,Ve.setValue(l,t[0],"i32")}yt(za,"marshalNode");function Ad(t,e=nr){let l=Ve.getValue(e,"i32");if(e+=ur,l===0)return null;let n=Ve.getValue(e,"i32");e+=ur;let r=Ve.getValue(e,"i32");e+=ur;let a=Ve.getValue(e,"i32");e+=ur;let I=Ve.getValue(e,"i32");return new EPn(lJ,{id:l,tree:t,startIndex:n,startPosition:{row:r,column:a},other:I})}yt(Ad,"unmarshalNode");function zi(t,e=nr){Ve.setValue(e+0*ur,t[0],"i32"),Ve.setValue(e+1*ur,t[1],"i32"),Ve.setValue(e+2*ur,t[2],"i32"),Ve.setValue(e+3*ur,t[3],"i32")}yt(zi,"marshalTreeCursor");function iy(t){t[0]=Ve.getValue(nr+0*ur,"i32"),t[1]=Ve.getValue(nr+1*ur,"i32"),t[2]=Ve.getValue(nr+2*ur,"i32"),t[3]=Ve.getValue(nr+3*ur,"i32")}yt(iy,"unmarshalTreeCursor");function x0(t,e){Ve.setValue(t,e.row,"i32"),Ve.setValue(t+ur,e.column,"i32")}yt(x0,"marshalPoint");function SO(t){return{row:Ve.getValue(t,"i32")>>>0,column:Ve.getValue(t+ur,"i32")>>>0}}yt(SO,"unmarshalPoint");function Dil(t,e){x0(t,e.startPosition),t+=aQ,x0(t,e.endPosition),t+=aQ,Ve.setValue(t,e.startIndex,"i32"),t+=ur,Ve.setValue(t,e.endIndex,"i32"),t+=ur}yt(Dil,"marshalRange");function bCe(t){let e={};return e.startPosition=SO(t),t+=aQ,e.endPosition=SO(t),t+=aQ,e.startIndex=Ve.getValue(t,"i32")>>>0,t+=ur,e.endIndex=Ve.getValue(t,"i32")>>>0,e}yt(bCe,"unmarshalRange");function zil(t,e=nr){x0(e,t.startPosition),e+=aQ,x0(e,t.oldEndPosition),e+=aQ,x0(e,t.newEndPosition),e+=aQ,Ve.setValue(e,t.startIndex,"i32"),e+=ur,Ve.setValue(e,t.oldEndIndex,"i32"),e+=ur,Ve.setValue(e,t.newEndIndex,"i32"),e+=ur}yt(zil,"marshalEdit");function Pil(t){let e=Ve.getValue(t,"i32"),l=Ve.getValue(t+=ur,"i32"),n=Ve.getValue(t+=ur,"i32");return{major_version:e,minor_version:l,patch_version:n}}yt(Pil,"unmarshalLanguageMetadata");var RPn=1,YPn=2,VPn=/[\w-]+/g,rbI={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},Uil=yt(t=>t.type==="capture","isCaptureStep"),xtt=yt(t=>t.type==="string","isStringStep"),ZY={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},Wbe=class jil extends Error{constructor(e,l,n,r){super(jil.formatMessage(e,l)),this.kind=e,this.info=l,this.index=n,this.length=r,this.name="QueryError"}static{yt(this,"QueryError")}static formatMessage(e,l){switch(e){case ZY.NodeName:return`Bad node name '${l.word}'`;case ZY.FieldName:return`Bad field name '${l.word}'`;case ZY.CaptureName:return`Bad capture name @${l.word}`;case ZY.PatternStructure:return`Bad pattern structure at offset ${l.suffix}`;case ZY.Syntax:return`Bad syntax at offset ${l.suffix}`}}};function Kil(t,e,l,n){if(t.length!==3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 2, got ${t.length-1}`);if(!Uil(t[1]))throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}"`);let r=l==="eq?"||l==="any-eq?",a=!l.startsWith("any-");if(Uil(t[2])){let I=t[1].name,s=t[2].name;n[e].push(o=>{let c=[],d=[];for(let G of o)G.name===I&&c.push(G.node),G.name===s&&d.push(G.node);let m=yt((G,p,A)=>A?G.text===p.text:G.text!==p.text,"compare");return a?c.every(G=>d.some(p=>m(G,p,r))):c.some(G=>d.some(p=>m(G,p,r)))})}else{let I=t[1].name,s=t[2].value,o=yt(d=>d.text===s,"matches"),c=yt(d=>d.text!==s,"doesNotMatch");n[e].push(d=>{let m=[];for(let p of d)p.name===I&&m.push(p.node);let G=r?o:c;return a?m.every(G):m.some(G)})}}yt(Kil,"parseAnyPredicate");function qil(t,e,l,n){if(t.length!==3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 2, got ${t.length-1}.`);if(t[1].type!=="capture")throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}".`);if(t[2].type!=="string")throw new Error(`Second argument of \`#${l}\` predicate must be a string. Got @${t[2].name}.`);let r=l==="match?"||l==="any-match?",a=!l.startsWith("any-"),I=t[1].name,s=new RegExp(t[2].value);n[e].push(o=>{let c=[];for(let m of o)m.name===I&&c.push(m.node.text);let d=yt((m,G)=>G?s.test(m):!s.test(m),"test");return c.length===0?!r:a?c.every(m=>d(m,r)):c.some(m=>d(m,r))})}yt(qil,"parseMatchPredicate");function $il(t,e,l,n){if(t.length<2)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected at least 1. Got ${t.length-1}.`);if(t[1].type!=="capture")throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}".`);let r=l==="any-of?",a=t[1].name,I=t.slice(2);if(!I.every(xtt))throw new Error(`Arguments to \`#${l}\` predicate must be strings.".`);let s=I.map(o=>o.value);n[e].push(o=>{let c=[];for(let d of o)d.name===a&&c.push(d.node.text);return c.length===0?!r:c.every(d=>s.includes(d))===r})}yt($il,"parseAnyOfPredicate");function ecl(t,e,l,n,r){if(t.length<2||t.length>3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 1 or 2. Got ${t.length-1}.`);if(!t.every(xtt))throw new Error(`Arguments to \`#${l}\` predicate must be strings.".`);let a=l==="is?"?n:r;a[e]||(a[e]={}),a[e][t[1].value]=t[2]?.value??null}yt(ecl,"parseIsPredicate");function tcl(t,e,l){if(t.length<2||t.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${t.length-1}.`);if(!t.every(xtt))throw new Error('Arguments to `#set!` predicate must be strings.".');l[e]||(l[e]={}),l[e][t[1].value]=t[2]?.value??null}yt(tcl,"parseSetDirective");function lcl(t,e,l,n,r,a,I,s,o,c,d){if(e===RPn){let m=n[l];a.push({type:"capture",name:m})}else if(e===YPn)a.push({type:"string",value:r[l]});else if(a.length>0){if(a[0].type!=="string")throw new Error("Predicates must begin with a literal value");let m=a[0].value;switch(m){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":Kil(a,t,m,I);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":qil(a,t,m,I);break;case"not-any-of?":case"any-of?":$il(a,t,m,I);break;case"is?":case"is-not?":ecl(a,t,m,c,d);break;case"set!":tcl(a,t,o);break;default:s[t].push({operator:m,operands:a.slice(1)})}a.length=0}}yt(lcl,"parsePattern");var wPn=class{static{yt(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(t,e){let l=Ve.lengthBytesUTF8(e),n=Ve._malloc(l+1);Ve.stringToUTF8(e,n,l+1);let r=Ve._ts_query_new(t[0],n,l,nr,nr+ur);if(!r){let W=Ve.getValue(nr+ur,"i32"),R=Ve.getValue(nr,"i32"),V=Ve.UTF8ToString(n,R).length,v=e.slice(V,V+100).split(`
2450
+ `)}async getBlockedRequests(){try{return await Lil()}catch(e){return this.logger.error(`Error parsing firewall logs: ${e}`),[]}}};function xil(){let t=[],e=[],l=!1;return{next(n){l||(e.length>0?e.shift()({value:n,done:!1}):t.push(n))},done(){l||(l=!0,e.forEach(n=>n({value:void 0,done:!0})))},async*iterator(){for(;;)if(t.length>0)yield t.shift();else{if(l)return;{let n=await new Promise(r=>{e.push(r)});if(n.done)return;yield n.value}}}}}async function*Sil(t,e="all"){let l=t.map(n=>({iterator:n,next:n.next()}));for(;l.length>0;){let{done:n,value:r,index:a,iterator:I}=await Promise.race(l.map((s,o)=>s.next.then(c=>({index:o,...c,iterator:s.iterator}))));if(n){if(e==="any")return;l.splice(a,1)}else l[a].next=I.next(),yield r}}import{homedir as uPn}from"os";var mPn=10,Bil=["grep","egrep","fgrep","rg"],Til=["awk","gawk","mawk","nawk"];function Ctt(t,e){let l=[],n=["HOME","TMPDIR","TEMP","TMP","PWD","USER","USERNAME","USERPROFILE","APPDATA","LOCALAPPDATA"],r=!1,a=e;switch(t){case"bash":{let I=/\$\{?([A-Z_][A-Z0-9_]*)\}?/gi,s=[...e.matchAll(I)];for(let o=s.length-1;o>=0;o--){let c=s[o],d=c[1];if(n.some(m=>m.toLowerCase()===d.toLowerCase())){let m=process.env[d];m&&c.index!==void 0&&(a=a.slice(0,c.index)+m+a.slice(c.index+c[0].length),r=!0)}}break}case"powershell":{let I=/\$\{?env:([A-Z_][A-Z0-9_]*)\}?/gi,s=[...a.matchAll(I),...a.matchAll(/\$\{?HOME\}?/gi)];s.sort((o,c)=>(o.index??0)-(c.index??0));for(let o=s.length-1;o>=0;o--){let c=s[o],d=c[0].toUpperCase(),m=d==="$HOME"||d==="${HOME}",G=m?"HOME":c[1];if(n.some(p=>p.toLowerCase()===G.toLowerCase())){let p=m?uPn():process.env[G];p&&c.index!==void 0&&(a=a.slice(0,c.index)+p+a.slice(c.index+c[0].length),r=!0)}}break}default:wo(t,`Unknown shell type: ${t}`)}return r&&a!==e&&l.push(a),l.push(e),l}function bPn(t){let e=new Set,l=!1,n=new Set,r=[];for(let a=1;a<t.length;a++){let I=t[a],s=I.text;if(s==="--")break;if(s==="-e"||s==="--regexp"){a+1<t.length&&(e.add(a+1),a++);continue}if(!(s.startsWith("-e")&&s.length>2)&&!s.startsWith("--regexp=")){if(s==="-f"||s==="--file"){l=!0,a+1<t.length&&a++;continue}if(s.startsWith("-f")&&s.length>2){let o=s.slice(2);o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+2}),l=!0;continue}if(s.startsWith("--file=")){let o=s.split("=",2)[1];o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+7}),l=!0;continue}if(s==="--include-dir"){if(a+1<t.length){let o=t[a+1];rQ(o.text)&&r.push({path:o.text,charIndex:o.charIndex}),a++}continue}if(s.startsWith("--include-dir=")){let o=s.split("=",2)[1];o&&rQ(o)&&r.push({path:o,charIndex:I.charIndex+14});continue}if(s==="--include"||s==="--exclude"||s==="--exclude-dir"){a+1<t.length&&a++;continue}s.startsWith("--include=")||s.startsWith("--exclude=")||s.startsWith("--exclude-dir=")}}if(l)for(let a of e)n.add(a);else{let a=!1;for(let I=1;I<t.length;I++)if(!t[I].text.startsWith("-")){e.add(I),a=!0;break}if(a)for(let I of e)n.add(I)}return{skipIndexes:n,paths:r}}function GPn(t){let e=new Set,l=[],n=!1;for(let r=1;r<t.length;r++){let a=t[r],I=a.text;if(I==="--")break;if(I==="-f"||I==="--file"){n=!0,r+1<t.length&&r++;continue}if(I.startsWith("-f")&&I.length>2){let s=I.slice(2);s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+2}),n=!0;continue}if(I.startsWith("--file=")){let s=I.split("=",2)[1];s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+7}),n=!0;continue}if(I==="-v"||I==="-F"||I.startsWith("-v")||I.startsWith("-F")){(I==="-v"||I==="-F")&&r+1<t.length&&r++;continue}I.startsWith("--")}if(!n){for(let r=1;r<t.length;r++)if(!t[r].text.startsWith("-")){e.add(r);break}}return{skipIndexes:e,paths:l}}function pPn(t){let e=new Set,l=[];if(t[0].text==="gh"&&t[1].text==="api"){e.add(1);let n=t[2];n&&!n.text.startsWith("-")&&e.add(2)}return{skipIndexes:e,paths:l}}function hPn(t){let e=new Set,l=[],n=!1;for(let r=1;r<t.length;r++){let a=t[r],I=a.text;if(I==="--")break;if(I==="-e"||I==="--expression"){r+1<t.length&&(e.add(r+1),r++);continue}if(!(I.startsWith("-e")&&I.length>2)&&!I.startsWith("--expression=")){if(I==="-f"||I==="--file"){n=!0,r+1<t.length&&r++;continue}if(I.startsWith("-f")&&I.length>2){let s=I.slice(2);s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+2}),n=!0;continue}if(I.startsWith("--file=")){let s=I.split("=",2)[1];s&&rQ(s)&&l.push({path:s,charIndex:a.charIndex+7}),n=!0;continue}I==="-i"||I.startsWith("-i")||I.startsWith("--")}}if(!n){for(let r=1;r<t.length;r++)if(!t[r].text.startsWith("-")){e.add(r);break}}return{skipIndexes:e,paths:l}}function APn(t){let e=new Set,l=[],n=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-lname","-ilname","-user","-group","-type","-size","-perm","-mtime","-mmin","-maxdepth","-mindepth"]);for(let r=1;r<t.length;r++){let I=t[r].text;if(I){if(I==="--"){r++;continue}if(n.has(I)){r+1<t.length&&(e.add(r+1),r++);continue}for(let s of n)if(I.startsWith(s+"="))break}}return{skipIndexes:e,paths:l}}function vtt(t,e){let l=[],n=gPn(e);if(n.length===0)return[];let r=n[0].text,a=new Set,I=n.findIndex(d=>/^([;&|<]|\d*>)/.test(d.text)),s=I===-1?n:n.slice(0,I);if(Bil.includes(r)){let{skipIndexes:d,paths:m}=bPn(s);a=new Set([...a,...d]),l.push(...m)}if(Til.includes(r)){let{skipIndexes:d,paths:m}=GPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="sed"){let{skipIndexes:d,paths:m}=hPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="gh"){let{skipIndexes:d,paths:m}=pPn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="find"&&process.platform!=="win32"){let{skipIndexes:d,paths:m}=APn(s);a=new Set([...a,...d]),l.push(...m)}if(r==="echo")for(let d=1;d<s.length;d++){let m=s[d];m&&(m.text.startsWith("-")||a.add(d))}for(let d=0;d<n.length;d++){let m=n[d];if(!a.has(d)&&!m.text.startsWith("-")){if(rQ(m.text)){let G=Ctt(t,m.text);l.push(...G.map(p=>({path:p,charIndex:m.charIndex})))}if(m.text.includes(">")||m.text.includes("<")){let G=m.text.match(/[0-9]*[><]+(.+)/);if(G&&G[1]){let p=Ctt(t,G[1]);l.push(...p.map(A=>({path:A,charIndex:m.charIndex+m.text.indexOf(G[1])})))}}if((m.text===">"||m.text===">>"||m.text==="<")&&d+1<n.length){let G=n[d+1];if(rQ(G.text)){let p=Ctt(t,G.text);l.push(...p.map(A=>({path:A,charIndex:G.charIndex})))}}}}let o=new Set,c=[];for(let d of l){let m=`${d.path}|${d.charIndex}`;o.has(m)||(o.add(m),c.push(d))}return c}function gPn(t){let e=[],l=/(\s+|;|&+|\|+|>+|<+)/y,n=null,r=!1,a="";for(let I=0;I<t.length;I++){let s=t[I];if(n&&r)s===a?(r=!1,a="",n&&(e.push(n),n=null)):n.text+=s;else if(s==='"'||s==="'")r=!0,a=s;else{l.lastIndex=I;let o=l.exec(t);if(o){n&&(e.push(n),n=null);let c=o[0];c.trim().length>0&&(e.push({text:c,charIndex:I}),I+=c.length-1)}else n?n.text+=s:n={text:s,charIndex:I}}}return n&&e.push(n),e}function rQ(t){if(t=t.replace(/^['"]|['"]$/g,""),!t)return!1;if(t.startsWith("/*")||t.endsWith("*/")){let l=t.split("/"),n=!1,r=!1,a=!1;for(let I=0;I<l.length;I++){let s=l[I];if(s!==""){if(s==="*"||s==="**"){r=!0;continue}if(/^[-*]+$/.test(s)){a=!0;continue}/[a-zA-Z0-9._]/.test(s)&&(n=!0)}}return!!(n||r&&!a)}if(/\$\{?[A-Z_][A-Z0-9_]*\}?/i.test(t)||process.platform==="win32"&&/%[A-Z_][A-Z0-9_]*%/i.test(t)||t.startsWith("/"))return!0;let e=process.platform==="win32";return e&&(t.startsWith("\\")||/^[a-zA-Z]:/.test(t))||t.startsWith("./")||t.startsWith("../")||t==="."||t===".."||/^(\.\.\/)+/.test(t)||e&&(t.startsWith(".\\")||t.startsWith("..\\"))||t.startsWith("~/")||t==="~"||t.includes("/")||new RegExp(`\\.[a-zA-Z0-9]{1,${mPn}}$`).test(t)?!0:t.length>2&&/^[a-zA-Z0-9_.-\s]+$/.test(t)?!["true","false","null","undefined","www","com","org","echo",...Til,...Bil,"sed","find","sort","head","tail","touch","cat","and","or","not","if","then","else","fi","do","done","while","for","case","esac","function","return"].includes(t.toLowerCase()):!1}import scl from"node:path";var ZPn=Object.defineProperty,yt=(t,e)=>ZPn(t,"name",{value:e,configurable:!0}),Oil=2,ur=4,ftt=4*ur,hN=5*ur,aQ=2*ur,Ebe=2*ur+2*aQ,tJ={row:0,column:0},lJ=Symbol("INTERNAL");function R7(t){if(t!==lJ)throw new Error("Illegal constructor")}yt(R7,"assertInternal");function ybe(t){return!!t&&typeof t.row=="number"&&typeof t.column=="number"}yt(ybe,"isPoint");function Mil(t){Ve=t}yt(Mil,"setModule");var Ve,NPn=class{static{yt(this,"LookaheadIterator")}0=0;language;constructor(t,e,l){R7(t),this[0]=e,this.language=l}get currentTypeId(){return Ve._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){Ve._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(t,e){return Ve._ts_lookahead_iterator_reset(this[0],t[0],e)?(this.language=t,!0):!1}resetState(t){return!!Ve._ts_lookahead_iterator_reset_state(this[0],t)}[Symbol.iterator](){return{next:yt(()=>Ve._ts_lookahead_iterator_next(this[0])?{done:!1,value:this.currentType}:{done:!0,value:""},"next")}}};function Jtt(t,e,l,n){let r=l-e,a=t.textCallback(e,n);if(a){for(e+=a.length;e<l;){let I=t.textCallback(e,n);if(I&&I.length>0)e+=I.length,a+=I;else break}e>l&&(a=a.slice(0,r))}return a??""}yt(Jtt,"getText");var WPn=class ktt{static{yt(this,"Tree")}0=0;textCallback;language;constructor(e,l,n,r){R7(e),this[0]=l,this.language=n,this.textCallback=r}copy(){let e=Ve._ts_tree_copy(this[0]);return new ktt(lJ,e,this.language,this.textCallback)}delete(){Ve._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return Ve._ts_tree_root_node_wasm(this[0]),Ad(this)}rootNodeWithOffset(e,l){let n=nr+hN;return Ve.setValue(n,e,"i32"),x0(n+ur,l),Ve._ts_tree_root_node_with_offset_wasm(this[0]),Ad(this)}edit(e){zil(e),Ve._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(e){if(!(e instanceof ktt))throw new TypeError("Argument must be a Tree");Ve._ts_tree_get_changed_ranges_wasm(this[0],e[0]);let l=Ve.getValue(nr,"i32"),n=Ve.getValue(nr+ur,"i32"),r=new Array(l);if(l>0){let a=n;for(let I=0;I<l;I++)r[I]=bCe(a),a+=Ebe;Ve._free(n)}return r}getIncludedRanges(){Ve._ts_tree_included_ranges_wasm(this[0]);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32"),n=new Array(e);if(e>0){let r=l;for(let a=0;a<e;a++)n[a]=bCe(r),r+=Ebe;Ve._free(l)}return n}},yPn=class _il{static{yt(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(e,l){R7(e),this.tree=l,iy(this)}copy(){let e=new _il(lJ,this.tree);return Ve._ts_tree_cursor_copy_wasm(this.tree[0]),iy(e),e}delete(){zi(this),Ve._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}get currentNode(){return zi(this),Ve._ts_tree_cursor_current_node_wasm(this.tree[0]),Ad(this.tree)}get currentFieldId(){return zi(this),Ve._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return zi(this),Ve._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return zi(this),Ve._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return zi(this),Ve._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return zi(this),Ve._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return zi(this),Ve._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return zi(this),Ve._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return zi(this),Ve._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){zi(this);let e=Ve._ts_tree_cursor_start_index_wasm(this.tree[0]),l=Ve._ts_tree_cursor_end_index_wasm(this.tree[0]);Ve._ts_tree_cursor_start_position_wasm(this.tree[0]);let n=SO(nr);return Jtt(this.tree,e,l,n)}get startPosition(){return zi(this),Ve._ts_tree_cursor_start_position_wasm(this.tree[0]),SO(nr)}get endPosition(){return zi(this),Ve._ts_tree_cursor_end_position_wasm(this.tree[0]),SO(nr)}get startIndex(){return zi(this),Ve._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return zi(this),Ve._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){zi(this);let e=Ve._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return iy(this),e===1}gotoLastChild(){zi(this);let e=Ve._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return iy(this),e===1}gotoParent(){zi(this);let e=Ve._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return iy(this),e===1}gotoNextSibling(){zi(this);let e=Ve._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return iy(this),e===1}gotoPreviousSibling(){zi(this);let e=Ve._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return iy(this),e===1}gotoDescendant(e){zi(this),Ve._ts_tree_cursor_goto_descendant_wasm(this.tree[0],e),iy(this)}gotoFirstChildForIndex(e){zi(this),Ve.setValue(nr+ftt,e,"i32");let l=Ve._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return iy(this),l===1}gotoFirstChildForPosition(e){zi(this),x0(nr+ftt,e);let l=Ve._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return iy(this),l===1}reset(e){za(e),zi(this,nr+hN),Ve._ts_tree_cursor_reset_wasm(this.tree[0]),iy(this)}resetTo(e){zi(this,nr),zi(e,nr+ftt),Ve._ts_tree_cursor_reset_to_wasm(this.tree[0],e.tree[0]),iy(this)}},EPn=class{static{yt(this,"Node")}0=0;_children;_namedChildren;constructor(t,{id:e,tree:l,startIndex:n,startPosition:r,other:a}){R7(t),this[0]=a,this.id=e,this.tree=l,this.startIndex=n,this.startPosition=r}id;startIndex;startPosition;tree;get typeId(){return za(this),Ve._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return za(this),Ve._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 za(this),Ve._ts_node_is_named_wasm(this.tree[0])===1}get isExtra(){return za(this),Ve._ts_node_is_extra_wasm(this.tree[0])===1}get isError(){return za(this),Ve._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return za(this),Ve._ts_node_is_missing_wasm(this.tree[0])===1}get hasChanges(){return za(this),Ve._ts_node_has_changes_wasm(this.tree[0])===1}get hasError(){return za(this),Ve._ts_node_has_error_wasm(this.tree[0])===1}get endIndex(){return za(this),Ve._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return za(this),Ve._ts_node_end_point_wasm(this.tree[0]),SO(nr)}get text(){return Jtt(this.tree,this.startIndex,this.endIndex,this.startPosition)}get parseState(){return za(this),Ve._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return za(this),Ve._ts_node_next_parse_state_wasm(this.tree[0])}equals(t){return this.tree===t.tree&&this.id===t.id}child(t){return za(this),Ve._ts_node_child_wasm(this.tree[0],t),Ad(this.tree)}namedChild(t){return za(this),Ve._ts_node_named_child_wasm(this.tree[0],t),Ad(this.tree)}childForFieldId(t){return za(this),Ve._ts_node_child_by_field_id_wasm(this.tree[0],t),Ad(this.tree)}childForFieldName(t){let e=this.tree.language.fields.indexOf(t);return e!==-1?this.childForFieldId(e):null}fieldNameForChild(t){za(this);let e=Ve._ts_node_field_name_for_child_wasm(this.tree[0],t);return e?Ve.AsciiToString(e):null}fieldNameForNamedChild(t){za(this);let e=Ve._ts_node_field_name_for_named_child_wasm(this.tree[0],t);return e?Ve.AsciiToString(e):null}childrenForFieldName(t){let e=this.tree.language.fields.indexOf(t);return e!==-1&&e!==0?this.childrenForFieldId(e):[]}childrenForFieldId(t){za(this),Ve._ts_node_children_by_field_id_wasm(this.tree[0],t);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32"),n=new Array(e);if(e>0){let r=l;for(let a=0;a<e;a++)n[a]=Ad(this.tree,r),r+=hN;Ve._free(l)}return n}firstChildForIndex(t){za(this);let e=nr+hN;return Ve.setValue(e,t,"i32"),Ve._ts_node_first_child_for_byte_wasm(this.tree[0]),Ad(this.tree)}firstNamedChildForIndex(t){za(this);let e=nr+hN;return Ve.setValue(e,t,"i32"),Ve._ts_node_first_named_child_for_byte_wasm(this.tree[0]),Ad(this.tree)}get childCount(){return za(this),Ve._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return za(this),Ve._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){za(this),Ve._ts_node_children_wasm(this.tree[0]);let t=Ve.getValue(nr,"i32"),e=Ve.getValue(nr+ur,"i32");if(this._children=new Array(t),t>0){let l=e;for(let n=0;n<t;n++)this._children[n]=Ad(this.tree,l),l+=hN;Ve._free(e)}}return this._children}get namedChildren(){if(!this._namedChildren){za(this),Ve._ts_node_named_children_wasm(this.tree[0]);let t=Ve.getValue(nr,"i32"),e=Ve.getValue(nr+ur,"i32");if(this._namedChildren=new Array(t),t>0){let l=e;for(let n=0;n<t;n++)this._namedChildren[n]=Ad(this.tree,l),l+=hN;Ve._free(e)}}return this._namedChildren}descendantsOfType(t,e=tJ,l=tJ){Array.isArray(t)||(t=[t]);let n=[],r=this.tree.language.types;for(let c of t)c=="ERROR"&&n.push(65535);for(let c=0,d=r.length;c<d;c++)t.includes(r[c])&&n.push(c);let a=Ve._malloc(ur*n.length);for(let c=0,d=n.length;c<d;c++)Ve.setValue(a+c*ur,n[c],"i32");za(this),Ve._ts_node_descendants_of_type_wasm(this.tree[0],a,n.length,e.row,e.column,l.row,l.column);let I=Ve.getValue(nr,"i32"),s=Ve.getValue(nr+ur,"i32"),o=new Array(I);if(I>0){let c=s;for(let d=0;d<I;d++)o[d]=Ad(this.tree,c),c+=hN}return Ve._free(s),Ve._free(a),o}get nextSibling(){return za(this),Ve._ts_node_next_sibling_wasm(this.tree[0]),Ad(this.tree)}get previousSibling(){return za(this),Ve._ts_node_prev_sibling_wasm(this.tree[0]),Ad(this.tree)}get nextNamedSibling(){return za(this),Ve._ts_node_next_named_sibling_wasm(this.tree[0]),Ad(this.tree)}get previousNamedSibling(){return za(this),Ve._ts_node_prev_named_sibling_wasm(this.tree[0]),Ad(this.tree)}get descendantCount(){return za(this),Ve._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return za(this),Ve._ts_node_parent_wasm(this.tree[0]),Ad(this.tree)}childWithDescendant(t){return za(this),za(t,1),Ve._ts_node_child_with_descendant_wasm(this.tree[0]),Ad(this.tree)}descendantForIndex(t,e=t){if(typeof t!="number"||typeof e!="number")throw new Error("Arguments must be numbers");za(this);let l=nr+hN;return Ve.setValue(l,t,"i32"),Ve.setValue(l+ur,e,"i32"),Ve._ts_node_descendant_for_index_wasm(this.tree[0]),Ad(this.tree)}namedDescendantForIndex(t,e=t){if(typeof t!="number"||typeof e!="number")throw new Error("Arguments must be numbers");za(this);let l=nr+hN;return Ve.setValue(l,t,"i32"),Ve.setValue(l+ur,e,"i32"),Ve._ts_node_named_descendant_for_index_wasm(this.tree[0]),Ad(this.tree)}descendantForPosition(t,e=t){if(!ybe(t)||!ybe(e))throw new Error("Arguments must be {row, column} objects");za(this);let l=nr+hN;return x0(l,t),x0(l+aQ,e),Ve._ts_node_descendant_for_position_wasm(this.tree[0]),Ad(this.tree)}namedDescendantForPosition(t,e=t){if(!ybe(t)||!ybe(e))throw new Error("Arguments must be {row, column} objects");za(this);let l=nr+hN;return x0(l,t),x0(l+aQ,e),Ve._ts_node_named_descendant_for_position_wasm(this.tree[0]),Ad(this.tree)}walk(){return za(this),Ve._ts_tree_cursor_new_wasm(this.tree[0]),new yPn(lJ,this.tree)}edit(t){if(this.startIndex>=t.oldEndIndex){this.startIndex=t.newEndIndex+(this.startIndex-t.oldEndIndex);let e,l;this.startPosition.row>t.oldEndPosition.row?(e=this.startPosition.row-t.oldEndPosition.row,l=this.startPosition.column):(e=0,l=this.startPosition.column,this.startPosition.column>=t.oldEndPosition.column&&(l=this.startPosition.column-t.oldEndPosition.column)),e>0?(this.startPosition.row+=e,this.startPosition.column=l):this.startPosition.column+=l}else this.startIndex>t.startIndex&&(this.startIndex=t.newEndIndex,this.startPosition.row=t.newEndPosition.row,this.startPosition.column=t.newEndPosition.column)}toString(){za(this);let t=Ve._ts_node_to_string_wasm(this.tree[0]),e=Ve.AsciiToString(t);return Ve._free(t),e}};function Ltt(t,e,l,n,r){for(let a=0,I=r.length;a<I;a++){let s=Ve.getValue(l,"i32");l+=ur;let o=Ad(e,l);l+=hN,r[a]={patternIndex:n,name:t.captureNames[s],node:o}}return l}yt(Ltt,"unmarshalCaptures");function za(t,e=0){let l=nr+e*hN;Ve.setValue(l,t.id,"i32"),l+=ur,Ve.setValue(l,t.startIndex,"i32"),l+=ur,Ve.setValue(l,t.startPosition.row,"i32"),l+=ur,Ve.setValue(l,t.startPosition.column,"i32"),l+=ur,Ve.setValue(l,t[0],"i32")}yt(za,"marshalNode");function Ad(t,e=nr){let l=Ve.getValue(e,"i32");if(e+=ur,l===0)return null;let n=Ve.getValue(e,"i32");e+=ur;let r=Ve.getValue(e,"i32");e+=ur;let a=Ve.getValue(e,"i32");e+=ur;let I=Ve.getValue(e,"i32");return new EPn(lJ,{id:l,tree:t,startIndex:n,startPosition:{row:r,column:a},other:I})}yt(Ad,"unmarshalNode");function zi(t,e=nr){Ve.setValue(e+0*ur,t[0],"i32"),Ve.setValue(e+1*ur,t[1],"i32"),Ve.setValue(e+2*ur,t[2],"i32"),Ve.setValue(e+3*ur,t[3],"i32")}yt(zi,"marshalTreeCursor");function iy(t){t[0]=Ve.getValue(nr+0*ur,"i32"),t[1]=Ve.getValue(nr+1*ur,"i32"),t[2]=Ve.getValue(nr+2*ur,"i32"),t[3]=Ve.getValue(nr+3*ur,"i32")}yt(iy,"unmarshalTreeCursor");function x0(t,e){Ve.setValue(t,e.row,"i32"),Ve.setValue(t+ur,e.column,"i32")}yt(x0,"marshalPoint");function SO(t){return{row:Ve.getValue(t,"i32")>>>0,column:Ve.getValue(t+ur,"i32")>>>0}}yt(SO,"unmarshalPoint");function Dil(t,e){x0(t,e.startPosition),t+=aQ,x0(t,e.endPosition),t+=aQ,Ve.setValue(t,e.startIndex,"i32"),t+=ur,Ve.setValue(t,e.endIndex,"i32"),t+=ur}yt(Dil,"marshalRange");function bCe(t){let e={};return e.startPosition=SO(t),t+=aQ,e.endPosition=SO(t),t+=aQ,e.startIndex=Ve.getValue(t,"i32")>>>0,t+=ur,e.endIndex=Ve.getValue(t,"i32")>>>0,e}yt(bCe,"unmarshalRange");function zil(t,e=nr){x0(e,t.startPosition),e+=aQ,x0(e,t.oldEndPosition),e+=aQ,x0(e,t.newEndPosition),e+=aQ,Ve.setValue(e,t.startIndex,"i32"),e+=ur,Ve.setValue(e,t.oldEndIndex,"i32"),e+=ur,Ve.setValue(e,t.newEndIndex,"i32"),e+=ur}yt(zil,"marshalEdit");function Pil(t){let e=Ve.getValue(t,"i32"),l=Ve.getValue(t+=ur,"i32"),n=Ve.getValue(t+=ur,"i32");return{major_version:e,minor_version:l,patch_version:n}}yt(Pil,"unmarshalLanguageMetadata");var RPn=1,YPn=2,VPn=/[\w-]+/g,rbI={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},Uil=yt(t=>t.type==="capture","isCaptureStep"),xtt=yt(t=>t.type==="string","isStringStep"),ZY={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},Wbe=class jil extends Error{constructor(e,l,n,r){super(jil.formatMessage(e,l)),this.kind=e,this.info=l,this.index=n,this.length=r,this.name="QueryError"}static{yt(this,"QueryError")}static formatMessage(e,l){switch(e){case ZY.NodeName:return`Bad node name '${l.word}'`;case ZY.FieldName:return`Bad field name '${l.word}'`;case ZY.CaptureName:return`Bad capture name @${l.word}`;case ZY.PatternStructure:return`Bad pattern structure at offset ${l.suffix}`;case ZY.Syntax:return`Bad syntax at offset ${l.suffix}`}}};function Kil(t,e,l,n){if(t.length!==3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 2, got ${t.length-1}`);if(!Uil(t[1]))throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}"`);let r=l==="eq?"||l==="any-eq?",a=!l.startsWith("any-");if(Uil(t[2])){let I=t[1].name,s=t[2].name;n[e].push(o=>{let c=[],d=[];for(let G of o)G.name===I&&c.push(G.node),G.name===s&&d.push(G.node);let m=yt((G,p,A)=>A?G.text===p.text:G.text!==p.text,"compare");return a?c.every(G=>d.some(p=>m(G,p,r))):c.some(G=>d.some(p=>m(G,p,r)))})}else{let I=t[1].name,s=t[2].value,o=yt(d=>d.text===s,"matches"),c=yt(d=>d.text!==s,"doesNotMatch");n[e].push(d=>{let m=[];for(let p of d)p.name===I&&m.push(p.node);let G=r?o:c;return a?m.every(G):m.some(G)})}}yt(Kil,"parseAnyPredicate");function qil(t,e,l,n){if(t.length!==3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 2, got ${t.length-1}.`);if(t[1].type!=="capture")throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}".`);if(t[2].type!=="string")throw new Error(`Second argument of \`#${l}\` predicate must be a string. Got @${t[2].name}.`);let r=l==="match?"||l==="any-match?",a=!l.startsWith("any-"),I=t[1].name,s=new RegExp(t[2].value);n[e].push(o=>{let c=[];for(let m of o)m.name===I&&c.push(m.node.text);let d=yt((m,G)=>G?s.test(m):!s.test(m),"test");return c.length===0?!r:a?c.every(m=>d(m,r)):c.some(m=>d(m,r))})}yt(qil,"parseMatchPredicate");function $il(t,e,l,n){if(t.length<2)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected at least 1. Got ${t.length-1}.`);if(t[1].type!=="capture")throw new Error(`First argument of \`#${l}\` predicate must be a capture. Got "${t[1].value}".`);let r=l==="any-of?",a=t[1].name,I=t.slice(2);if(!I.every(xtt))throw new Error(`Arguments to \`#${l}\` predicate must be strings.".`);let s=I.map(o=>o.value);n[e].push(o=>{let c=[];for(let d of o)d.name===a&&c.push(d.node.text);return c.length===0?!r:c.every(d=>s.includes(d))===r})}yt($il,"parseAnyOfPredicate");function ecl(t,e,l,n,r){if(t.length<2||t.length>3)throw new Error(`Wrong number of arguments to \`#${l}\` predicate. Expected 1 or 2. Got ${t.length-1}.`);if(!t.every(xtt))throw new Error(`Arguments to \`#${l}\` predicate must be strings.".`);let a=l==="is?"?n:r;a[e]||(a[e]={}),a[e][t[1].value]=t[2]?.value??null}yt(ecl,"parseIsPredicate");function tcl(t,e,l){if(t.length<2||t.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${t.length-1}.`);if(!t.every(xtt))throw new Error('Arguments to `#set!` predicate must be strings.".');l[e]||(l[e]={}),l[e][t[1].value]=t[2]?.value??null}yt(tcl,"parseSetDirective");function lcl(t,e,l,n,r,a,I,s,o,c,d){if(e===RPn){let m=n[l];a.push({type:"capture",name:m})}else if(e===YPn)a.push({type:"string",value:r[l]});else if(a.length>0){if(a[0].type!=="string")throw new Error("Predicates must begin with a literal value");let m=a[0].value;switch(m){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":Kil(a,t,m,I);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":qil(a,t,m,I);break;case"not-any-of?":case"any-of?":$il(a,t,m,I);break;case"is?":case"is-not?":ecl(a,t,m,c,d);break;case"set!":tcl(a,t,o);break;default:s[t].push({operator:m,operands:a.slice(1)})}a.length=0}}yt(lcl,"parsePattern");var wPn=class{static{yt(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(t,e){let l=Ve.lengthBytesUTF8(e),n=Ve._malloc(l+1);Ve.stringToUTF8(e,n,l+1);let r=Ve._ts_query_new(t[0],n,l,nr,nr+ur);if(!r){let W=Ve.getValue(nr+ur,"i32"),R=Ve.getValue(nr,"i32"),V=Ve.UTF8ToString(n,R).length,v=e.slice(V,V+100).split(`
2451
2451
  `)[0],X=v.match(VPn)?.[0]??"";switch(Ve._free(n),W){case ZY.Syntax:throw new Wbe(ZY.Syntax,{suffix:`${V}: '${v}'...`},V,0);case ZY.NodeName:throw new Wbe(W,{word:X},V,X.length);case ZY.FieldName:throw new Wbe(W,{word:X},V,X.length);case ZY.CaptureName:throw new Wbe(W,{word:X},V,X.length);case ZY.PatternStructure:throw new Wbe(W,{suffix:`${V}: '${v}'...`},V,0)}}let a=Ve._ts_query_string_count(r),I=Ve._ts_query_capture_count(r),s=Ve._ts_query_pattern_count(r),o=new Array(I),c=new Array(s),d=new Array(a);for(let W=0;W<I;W++){let R=Ve._ts_query_capture_name_for_id(r,W,nr),V=Ve.getValue(nr,"i32");o[W]=Ve.UTF8ToString(R,V)}for(let W=0;W<s;W++){let R=new Array(I);for(let V=0;V<I;V++){let v=Ve._ts_query_capture_quantifier_for_id(r,W,V);R[V]=v}c[W]=R}for(let W=0;W<a;W++){let R=Ve._ts_query_string_value_for_id(r,W,nr),V=Ve.getValue(nr,"i32");d[W]=Ve.UTF8ToString(R,V)}let m=new Array(s),G=new Array(s),p=new Array(s),A=new Array(s),Z=new Array(s);for(let W=0;W<s;W++){let R=Ve._ts_query_predicates_for_pattern(r,W,nr),V=Ve.getValue(nr,"i32");A[W]=[],Z[W]=[];let v=new Array,X=R;for(let S=0;S<V;S++){let O=Ve.getValue(X,"i32");X+=ur;let T=Ve.getValue(X,"i32");X+=ur,lcl(W,O,T,o,d,v,Z,A,m,G,p)}Object.freeze(Z[W]),Object.freeze(A[W]),Object.freeze(m[W]),Object.freeze(G[W]),Object.freeze(p[W])}Ve._free(n),this[0]=r,this.captureNames=o,this.captureQuantifiers=c,this.textPredicates=Z,this.predicates=A,this.setProperties=m,this.assertedProperties=G,this.refutedProperties=p,this.exceededMatchLimit=!1}delete(){Ve._ts_query_delete(this[0]),this[0]=0}matches(t,e={}){let l=e.startPosition??tJ,n=e.endPosition??tJ,r=e.startIndex??0,a=e.endIndex??0,I=e.matchLimit??4294967295,s=e.maxStartDepth??4294967295,o=e.timeoutMicros??0,c=e.progressCallback;if(typeof I!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=I,a!==0&&r>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==tJ&&(l.row>n.row||l.row===n.row&&l.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");c&&(Ve.currentQueryProgressCallback=c),za(t),Ve._ts_query_matches_wasm(this[0],t.tree[0],l.row,l.column,n.row,n.column,r,a,I,s,o);let d=Ve.getValue(nr,"i32"),m=Ve.getValue(nr+ur,"i32"),G=Ve.getValue(nr+2*ur,"i32"),p=new Array(d);this.exceededMatchLimit=!!G;let A=0,Z=m;for(let W=0;W<d;W++){let R=Ve.getValue(Z,"i32");Z+=ur;let V=Ve.getValue(Z,"i32");Z+=ur;let v=new Array(V);if(Z=Ltt(this,t.tree,Z,R,v),this.textPredicates[R].every(X=>X(v))){p[A]={pattern:R,patternIndex:R,captures:v};let X=this.setProperties[R];p[A].setProperties=X;let S=this.assertedProperties[R];p[A].assertedProperties=S;let O=this.refutedProperties[R];p[A].refutedProperties=O,A++}}return p.length=A,Ve._free(m),Ve.currentQueryProgressCallback=null,p}captures(t,e={}){let l=e.startPosition??tJ,n=e.endPosition??tJ,r=e.startIndex??0,a=e.endIndex??0,I=e.matchLimit??4294967295,s=e.maxStartDepth??4294967295,o=e.timeoutMicros??0,c=e.progressCallback;if(typeof I!="number")throw new Error("Arguments must be numbers");if(this.matchLimit=I,a!==0&&r>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==tJ&&(l.row>n.row||l.row===n.row&&l.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");c&&(Ve.currentQueryProgressCallback=c),za(t),Ve._ts_query_captures_wasm(this[0],t.tree[0],l.row,l.column,n.row,n.column,r,a,I,s,o);let d=Ve.getValue(nr,"i32"),m=Ve.getValue(nr+ur,"i32"),G=Ve.getValue(nr+2*ur,"i32"),p=new Array;this.exceededMatchLimit=!!G;let A=new Array,Z=m;for(let W=0;W<d;W++){let R=Ve.getValue(Z,"i32");Z+=ur;let V=Ve.getValue(Z,"i32");Z+=ur;let v=Ve.getValue(Z,"i32");if(Z+=ur,A.length=V,Z=Ltt(this,t.tree,Z,R,A),this.textPredicates[R].every(X=>X(A))){let X=A[v],S=this.setProperties[R];X.setProperties=S;let O=this.assertedProperties[R];X.assertedProperties=O;let T=this.refutedProperties[R];X.refutedProperties=T,p.push(X)}}return Ve._free(m),Ve.currentQueryProgressCallback=null,p}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){let e=Ve.lengthBytesUTF8(t),l=Ve._malloc(e+1);Ve.stringToUTF8(t,l,e+1),Ve._ts_query_disable_capture(this[0],l,e),Ve._free(l)}disablePattern(t){if(t>=this.predicates.length)throw new Error(`Pattern index is ${t} but the pattern count is ${this.predicates.length}`);Ve._ts_query_disable_pattern(this[0],t)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(t){if(t>=this.predicates.length)throw new Error(`Pattern index is ${t} but the pattern count is ${this.predicates.length}`);return Ve._ts_query_start_byte_for_pattern(this[0],t)}endIndexForPattern(t){if(t>=this.predicates.length)throw new Error(`Pattern index is ${t} but the pattern count is ${this.predicates.length}`);return Ve._ts_query_end_byte_for_pattern(this[0],t)}patternCount(){return Ve._ts_query_pattern_count(this[0])}captureIndexForName(t){return this.captureNames.indexOf(t)}isPatternRooted(t){return Ve._ts_query_is_pattern_rooted(this[0],t)===1}isPatternNonLocal(t){return Ve._ts_query_is_pattern_non_local(this[0],t)===1}isPatternGuaranteedAtStep(t){return Ve._ts_query_is_pattern_guaranteed_at_step(this[0],t)===1}},QPn=/^tree_sitter_\w+$/,Stt=class ncl{static{yt(this,"Language")}0=0;types;fields;constructor(e,l){R7(e),this[0]=l,this.types=new Array(Ve._ts_language_symbol_count(this[0]));for(let n=0,r=this.types.length;n<r;n++)Ve._ts_language_symbol_type(this[0],n)<2&&(this.types[n]=Ve.UTF8ToString(Ve._ts_language_symbol_name(this[0],n)));this.fields=new Array(Ve._ts_language_field_count(this[0])+1);for(let n=0,r=this.fields.length;n<r;n++){let a=Ve._ts_language_field_name_for_id(this[0],n);a!==0?this.fields[n]=Ve.UTF8ToString(a):this.fields[n]=null}}get name(){let e=Ve._ts_language_name(this[0]);return e===0?null:Ve.UTF8ToString(e)}get version(){return Ve._ts_language_version(this[0])}get abiVersion(){return Ve._ts_language_abi_version(this[0])}get metadata(){Ve._ts_language_metadata(this[0]);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32");return e===0?null:Pil(l)}get fieldCount(){return this.fields.length-1}get stateCount(){return Ve._ts_language_state_count(this[0])}fieldIdForName(e){let l=this.fields.indexOf(e);return l!==-1?l:null}fieldNameForId(e){return this.fields[e]??null}idForNodeType(e,l){let n=Ve.lengthBytesUTF8(e),r=Ve._malloc(n+1);Ve.stringToUTF8(e,r,n+1);let a=Ve._ts_language_symbol_for_name(this[0],r,n,l?1:0);return Ve._free(r),a||null}get nodeTypeCount(){return Ve._ts_language_symbol_count(this[0])}nodeTypeForId(e){let l=Ve._ts_language_symbol_name(this[0],e);return l?Ve.UTF8ToString(l):null}nodeTypeIsNamed(e){return!!Ve._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!Ve._ts_language_type_is_visible_wasm(this[0],e)}get supertypes(){Ve._ts_language_supertypes_wasm(this[0]);let e=Ve.getValue(nr,"i32"),l=Ve.getValue(nr+ur,"i32"),n=new Array(e);if(e>0){let r=l;for(let a=0;a<e;a++)n[a]=Ve.getValue(r,"i16"),r+=Oil}return n}subtypes(e){Ve._ts_language_subtypes_wasm(this[0],e);let l=Ve.getValue(nr,"i32"),n=Ve.getValue(nr+ur,"i32"),r=new Array(l);if(l>0){let a=n;for(let I=0;I<l;I++)r[I]=Ve.getValue(a,"i16"),a+=Oil}return r}nextState(e,l){return Ve._ts_language_next_state(this[0],e,l)}lookaheadIterator(e){let l=Ve._ts_lookahead_iterator_new(this[0],e);return l?new NPn(lJ,l,this):null}query(e){return console.warn("Language.query is deprecated. Use new Query(language, source) instead."),new wPn(this,e)}static async load(e){let l;e instanceof Uint8Array?l=Promise.resolve(e):globalThis.process?.versions.node?l=(await import("fs/promises")).readFile(e):l=fetch(e).then(s=>s.arrayBuffer().then(o=>{if(s.ok)return new Uint8Array(o);{let c=new TextDecoder("utf-8").decode(o);throw new Error(`Language.load failed with status ${s.status}.
2452
2452
 
2453
2453
  ${c}`)}}));let n=await Ve.loadWebAssemblyModule(await l,{loadAsync:!0}),r=Object.keys(n),a=r.find(s=>QPn.test(s)&&!s.includes("external_scanner_"));if(!a)throw console.log(`Couldn't find language function in WASM file. Symbols:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@github/copilot",
3
3
  "description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.",
4
- "version": "0.0.351-14",
4
+ "version": "0.0.351-15",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
7
  "repository": {
@@ -37,6 +37,6 @@
37
37
  "worker/**/*"
38
38
  ],
39
39
  "buildMetadata": {
40
- "gitCommit": "6416a65"
40
+ "gitCommit": "ef9b0b1"
41
41
  }
42
42
  }