energy-state-analyzer 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- (()=>{"use strict";var __webpack_modules__={186(e,t,r){var n,s=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),_=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),a=0;a<r.length;a++)"default"!==r[a]&&s(t,e,r[a]);return _(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const o=a(r(896)),i=a(r(928)),{Parser:l,Language:d}=r(43),u=r(958),c=r(212),m=r(106),p=r(58),h=r(912),g=r(613);function f(){console.error("Usage: energy-state-cli <file.py|.fs|.fsx|.ts> [--medium-nesting N] [--high-nesting N] [--medium-cyclomatic N] [--high-cyclomatic N] [--medium-cognitive N] [--high-cognitive N]")}function y(e,t){if(void 0!==e.mediumThreshold||void 0!==e.highThreshold)return{...t,mediumThreshold:e.mediumThreshold??t.mediumThreshold,highThreshold:e.highThreshold??t.highThreshold}}(async function(){const e=function(e){const t=t=>{const r=e.indexOf(`--${t}`);return-1!==r?Number(e[r+1]):void 0};return{filePath:e.find(e=>!e.startsWith("--")),nesting:{mediumThreshold:t("medium-nesting"),highThreshold:t("high-nesting")},cyclomatic:{mediumThreshold:t("medium-cyclomatic"),highThreshold:t("high-cyclomatic")},cognitive:{mediumThreshold:t("medium-cognitive"),highThreshold:t("high-cognitive")}}}(process.argv.slice(2)),{filePath:t}=e;t||(f(),process.exit(2));const r=(0,h.resolveLanguageForFile)(t);r||(console.error(`Unsupported file type: ${t}`),f(),process.exit(2));const n=o.readFileSync(t,"utf8"),s=(await async function(e){await l.init();const t=new l,r=i.join(__dirname,"..",e.grammarPath),n=await d.load(r);return t.setLanguage(n),t}(r)).parse(n),_=(0,u.analyzeSource)(n,s,r,t,function(e){return{nesting:y(e.nesting,c.DEFAULT_NESTING_THRESHOLDS),cyclomatic:y(e.cyclomatic,m.DEFAULT_CYCLOMATIC_THRESHOLDS),cognitive:y(e.cognitive,p.DEFAULT_COGNITIVE_THRESHOLDS)}}(e));console.log(JSON.stringify(_,null,2));const a=_.some(e=>e.severity===g.SEVERITY.HIGH||e.severity===g.SEVERITY.MEDIUM);process.exit(a?1:0)})().catch(e=>{console.error("energy-state-cli failed:",e),process.exit(1)})},958(e,t,r){t.analyzeSource=function(e,t,r,g,f={}){const y=(0,n.createPositionLookup)(e),E=[];return E.push(...(0,s.analyzeNesting)(t,y,r,f.nesting??s.DEFAULT_NESTING_THRESHOLDS)),E.push(...(0,_.analyzeFunctionComplexity)(t,y,r,f.cyclomatic??_.DEFAULT_CYCLOMATIC_THRESHOLDS)),E.push(...(0,a.analyzeCognitiveComplexity)(t,y,r,f.cognitive??a.DEFAULT_COGNITIVE_THRESHOLDS)),E.push(...(0,o.analyzeFileCoherence)(t,g,r,f.coherence??o.DEFAULT_COHERENCE_THRESHOLDS)),E.push(...(0,i.analyzeMagicNumbers)(t,y,r,f.magicNumber??i.DEFAULT_MAGIC_NUMBER_OPTIONS)),E.push(...(0,l.analyzeMagicStrings)(t,y,r,f.magicString??l.DEFAULT_MAGIC_STRING_OPTIONS)),E.push(...(0,d.analyzeParameterCount)(t,y,r)),E.push(...(0,u.analyzeInversionOpportunities)(t,y,r)),E.push(...(0,c.analyzePrimitiveObsession)(t,y,r)),E.push(...(0,m.analyzeMatchOpportunities)(t,y,r,f.matchOpportunity??m.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS)),E.push(...(0,p.analyzeLogicalControlFlow)(t,y,r)),E.push(...(0,h.analyzeOpaqueBooleanLiteral)(t,y,r)),E};const n=r(599),s=r(212),_=r(106),a=r(58),o=r(764),i=r(268),l=r(668),d=r(622),u=r(907),c=r(164),m=r(774),p=r(632),h=r(487)},58(e,t,r){t.DEFAULT_COGNITIVE_THRESHOLDS=void 0,t.analyzeCognitiveComplexity=function(e,r,a,o=t.DEFAULT_COGNITIVE_THRESHOLDS){const i=[];return function e(t){if(a.isFunctionDefinition(t)){const e=s(t,a);if(e>o.mediumThreshold){const s=r.toPosition(t.startIndex);i.push({line:s.line,column:s.column,type:n.VIOLATION_TYPE.COGNITIVE,severity:e>o.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`High cognitive complexity: ${e}. This function is hard to read; consider flattening nesting or extracting functions.`,hotspots:_(t,r,a)})}}for(const r of t.children)e(r)}(e.rootNode),i};const n=r(613);function s(e,t,r){let n=0;const{nodeTypes:s}=t;function _(e,t){n+=t,r?.(e,t)}function a(e,r){for(const n of e.children)o(n,t.entersNestedScope(n)?r+1:r)}function o(e,r){const n=t.getBooleanOperator(e);if(n){t.getBooleanOperator(e.parent)!==n&&_(e,1);for(const t of e.children)o(t,r)}else{if(t.cognitiveNestedDecisionTypes.includes(e.type))return _(e,1+r),void a(e,r);if(e.type===s.elseClause)return _(e,1),void a(e,r);if(e.type!==s.conditionalExpression)if(t.isFunctionDefinition(e))_(e,1+r);else{if(e.type===s.lambda)return _(e,1+r),void a(e,r);for(const t of e.children||[])o(t,r)}else{_(e,1+r);for(const t of e.children)o(t,r+1)}}}for(const t of e.children)o(t,0);return n}function _(e,t,r){const n=[];return s(e,r,(e,r)=>{n.push({line:t.toPosition(e.startIndex).line,weight:r})}),n}t.DEFAULT_COGNITIVE_THRESHOLDS={mediumThreshold:15,highThreshold:25}},764(e,t,r){t.DEFAULT_COHERENCE_THRESHOLDS=void 0,t.analyzeFileCoherence=function(e,r,n,s=t.DEFAULT_COHERENCE_THRESHOLDS){const{functions:i,imports:l}=function(e,t){const r=[],n=[],{nodeTypes:s}=t;return function e(_){t.isFunctionDefinition(_)?r.push(_):_.type!==s.importStatement&&_.type!==s.importFromStatement||n.push(_.text||"");for(const t of _.children)e(t)}(e.rootNode),{functions:r,imports:n}}(e,n);return[_(i,r,s),a(i,s),o(l)].filter(e=>null!==e)};const n=r(613);function s(e){const t=e.children?.find(e=>"identifier"===e.type);if(!t?.text)return null;const r=/^[a-z]+/.exec(t.text);return r?r[0]:t.text.toLowerCase()}function _(e,t,r){if(e.length<=8)return null;const _=t.split("/").pop()||"",a=_.includes("util")||_.includes("helper")||_.includes("common"),o=!a&&function(e,t){const r=e.map(s).filter(e=>null!==e);if(0===r.length)return!1;const n=new Map;for(const e of r)n.set(e,(n.get(e)??0)+1);return Math.max(...n.values())/r.length>=t}(e,r.singleDomainNameShare);return!a&&(e.length<=12||o)?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:e.length>15?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`File coherence warning: ${e.length} functions in one file. Consider splitting by domain.`}}function a(e,t){const r=e.filter(e=>{return(r=e).endPosition.row-r.startPosition.row+1>t.largeFunctionLines;var r});return r.length<=t.maxLargeFunctions?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:r.length>1.5*t.maxLargeFunctions?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`${r.length} functions exceed ${t.largeFunctionLines} lines. Large functions carry more complexity than function count alone suggests.`}}function o(e){return e.length<=10?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:e.length>15?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Import sprawl: ${e.length} imports suggest this file does too much.`}}t.DEFAULT_COHERENCE_THRESHOLDS={largeFunctionLines:20,maxLargeFunctions:5,singleDomainNameShare:.7}},106(e,t,r){t.DEFAULT_CYCLOMATIC_THRESHOLDS=void 0,t.analyzeFunctionComplexity=function(e,r,_,a=t.DEFAULT_CYCLOMATIC_THRESHOLDS){const o=[];return function e(t){if(_.isFunctionDefinition(t)){const e=function(e,t){let r=1;return function e(n,s){if((t.decisionNodeTypes.includes(n.type)||null!==t.getBooleanOperator(n)||t.isTryElseClause(n))&&r++,s||!t.isFunctionDefinition(n))for(const t of n.children)e(t,!1)}(e,!0),r}(t,_);if(e>a.mediumThreshold){const i=r.toPosition(t.startIndex);o.push({line:i.line,column:i.column,type:n.VIOLATION_TYPE.COMPLEXITY,severity:e>a.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`High cyclomatic complexity: ${e}. Consider breaking down this function.`,hotspots:s(t,r,_)})}}for(const r of t.children)e(r)}(e.rootNode),o};const n=r(613);function s(e,t,r){const n=[];return function e(s,_,a){let o=_;if(r.decisionNodeTypes.includes(s.type)||null!==r.getBooleanOperator(s)||r.isTryElseClause(s)){const e=t.toPosition(s.startIndex).line;n.push({line:e,weight:1+_}),o=_+1}if(a||!r.isFunctionDefinition(s))for(const t of s.children)e(t,o,!1)}(e,0,!0),n}t.DEFAULT_CYCLOMATIC_THRESHOLDS={mediumThreshold:10,highThreshold:15}},907(e,t,r){t.analyzeInversionOpportunities=function(e,t,r){const s=[],{nodeTypes:_}=r;return function e(a){r.isFunctionDefinition(a)&&function(e){const a=e.children.find(e=>e.type===_.block);if(!a)return;const o=a.children.filter(e=>e.isNamed&&e.type!==_.comment&&e.text?.trim());if(o.length>=1){const r=o[0];if(r.type===_.ifStatement){const a=r.children.find(e=>e.type===_.block);if(a&&a.children.length>2){const _=e.endIndex-e.startIndex;if((a.endIndex-a.startIndex)/_>.5){const e=t.toPosition(r.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:"Consider inverting this condition and using early return for cleaner flow."})}}}}!function(e){let a=e,o=0;const i=[];for(;a&&o<4;){const e=a.children?.filter(e=>r.nestingControlTypes.includes(e.type))||[];if(1!==e.length||e[0].type!==_.ifStatement)break;{const t=e[0];if(i.push(t),t.children.some(e=>e.type===_.elseClause))break;a=t.children.find(e=>e.type===_.block),o++}}if(i.length>=2){const e=i[0],r=t.toPosition(e.startIndex);s.push({line:r.line,column:r.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:`Found ${i.length} nested validation checks. Consider using guard clauses with early returns.`})}}(a),function(e){let a=0,o=null;if(function e(t,n=0){if(!r.isFunctionDefinition(t)){t.type===_.ifStatement&&(n>a&&(a=n,o=t),n++);for(const r of t.children||[])e(r,n)}}(e),a>=3&&o){const e=t.toPosition(o.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:`Deep if-nesting (${a} levels). Consider inverting conditions or extracting functions.`})}}(a)}(a);for(const t of a.children)e(t)}(e.rootNode),s};const n=r(613)},632(e,t,r){t.analyzeLogicalControlFlow=function(e,t,r){const s=[],{nodeTypes:_}=r;return function e(a){const o=r.getBooleanOperator(a);if(null!==o&&a.parent?.type===_.expressionStatement){const e=t.toPosition(a.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.LOGICAL_CONTROL_FLOW,severity:n.SEVERITY.LOW,message:"and"===o?"If-statement disguised as '&&'. Consider an explicit if-statement instead.":"If-statement disguised as '||'. Consider an explicit if-statement instead."})}for(const t of a.children)e(t)}(e.rootNode),s};const n=r(613)},268(e,t,r){t.DEFAULT_MAGIC_NUMBER_OPTIONS=void 0,t.analyzeMagicNumbers=function(e,r,s,_=t.DEFAULT_MAGIC_NUMBER_OPTIONS){const a=[];if(!_.enabled)return a;const{nodeTypes:o}=s;function i(e){let t=e.parent;for(;t;){if(s.isFunctionDefinition(t))return!0;t=t.parent}return!1}return function e(t){if(t.type===o.integerLiteral||t.type===o.floatLiteral){const e=parseFloat(t.text);if(!Number.isNaN(e)){const l=function(e,t){const r=e.parent;return 2===r?.children?.length&&"-"===r.children[0]?.text?-t:t}(t,e);if(!(_.allowlist.includes(l)||function(e){let t=e.parent;for(;t;){if(t.type===o.assignment){if(s.isFunctionDefinition(t))return!1;let e=t.parent;if(e?.type===o.expressionStatement&&(e=e.parent),e?.type===o.module)return!i(t);if(o.exportStatement&&e?.type===o.exportStatement&&e.parent?.type===o.module)return!0}t=t.parent}return!1}(t)||function(e){return!!e.parent&&s.subscriptNodeTypes.includes(e.parent.type)}(t)||s.isDefaultParameterValue(t))){const e=r.toPosition(t.startIndex);a.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.MAGIC,severity:n.SEVERITY.LOW,message:`Magic number: ${t.text}. Consider extracting to a named constant.`})}}return}for(const r of t.children)e(r)}(e.rootNode),a};const n=r(613);t.DEFAULT_MAGIC_NUMBER_OPTIONS={enabled:!0,allowlist:[0,1,-1,2]}},668(e,t,r){t.DEFAULT_MAGIC_STRING_OPTIONS=void 0,t.analyzeMagicStrings=function(e,r,s,_=t.DEFAULT_MAGIC_STRING_OPTIONS){const a=[];if(!_.enabled)return a;const{nodeTypes:o}=s;const i=[];!function e(t){if(t.type===o.stringLiteral){const e=(r=t.text).length>=2?r.slice(1,-1):r;(function(e,t){return function(e){return[e.parent,e.parent?.parent].filter(Boolean).some(t=>s.getEqualityComparisons(t).some(({left:t,right:r})=>t.id===e.id||r.id===e.id))}(e)||function(e,t){const r=e.parent?.parent;return!!r&&s.getMembershipComparisons(r).some(({values:e})=>e.includes(t))}(e,t)||function(e){return!!e.parent&&s.subscriptNodeTypes.includes(e.parent.type)}(e)})(t,e)&&!function(e,t){return function(e){return e.parent?.type===o.expressionStatement}(e)||s.isFormattedOrInterpolatedString(e)||_.allowlist.includes(t)||t.length<=1}(t,e)&&i.push({node:t,content:e})}var r;for(const r of t.children)e(r)}(e.rootNode);const l=new Map;for(const e of i){const t=l.get(e.content)??[];t.push(e),l.set(e.content,t)}for(const[e,t]of l){if(t.length<_.minDuplicates)continue;const s=t[0].node,o=r.toPosition(s.startIndex);a.push({line:o.line,column:o.column,type:n.VIOLATION_TYPE.MAGIC,severity:n.SEVERITY.LOW,message:`Magic string: "${e}" is compared/keyed against directly ${t.length} time(s). Consider extracting to a named constant or enum.`})}return a};const n=r(613);t.DEFAULT_MAGIC_STRING_OPTIONS={enabled:!0,minDuplicates:2,allowlist:["","utf-8","__main__"]}},774(e,t,r){t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS=void 0,t.analyzeMatchOpportunities=function(e,r,s,_=t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS){const a=[],{nodeTypes:o}=s,i=new Set;return function e(t){t.type!==o.ifStatement||i.has(t)||function(e){const t=function(e,t){const r=[e],n=t.getElseIfBranches(e);if(n.length>0)return r.push(...n),r;let s=e;for(;;){const e=s.children?.find(e=>e.type===t.nodeTypes.elseClause);if(!e)break;const n=e.children?.find(e=>e.type===t.nodeTypes.ifStatement);if(!n)break;r.push(n),s=n}return r}(e,s);if(t.slice(1).forEach(e=>i.add(e)),t.length<_.minBranches)return;const o=t.map(e=>function(e,t,r){const{nodeTypes:n}=r,s=[];function _(e){return r.variableReferenceNodeTypes.includes(e.type)}function a(e){return e.type===n.stringLiteral||e.type===n.integerLiteral||e.type===n.floatLiteral}function o(e){return e.type===n.stringLiteral?e.text.slice(1,-1):e.text}return function e(i){if(!t.has(i)&&i.type!==n.block&&i.type!==n.elseClause){for(const{left:e,right:t}of r.getEqualityComparisons(i))_(e)&&a(t)?s.push({variable:e.text,value:o(t)}):_(t)&&a(e)&&s.push({variable:t.text,value:o(e)});for(const{left:e,values:t}of r.getMembershipComparisons(i))_(e)&&t.forEach(t=>s.push({variable:e.text,value:t}));for(const t of i.children||[])e(t)}}(e),s}(e,new Set(t.filter(t=>t!==e)),s));if(o.some(e=>0===e.length))return;const l=o[0].map(e=>e.variable).find(e=>o.every(t=>t.some(t=>t.variable===e)));if(!l)return;const d=r.toPosition(e.startIndex);a.push({line:d.line,column:d.column,type:n.VIOLATION_TYPE.MATCH_OPPORTUNITY,severity:n.SEVERITY.LOW,message:`This ${t.length}-way if/elif chain all branch on '${l}'. Consider a match/switch statement for clearer, exhaustiveness-checked dispatch.`})}(t);for(const r of t.children||[])e(r)}(e.rootNode),a};const n=r(613);t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS={minBranches:3}},212(e,t,r){t.DEFAULT_NESTING_THRESHOLDS=void 0,t.analyzeNesting=function(e,r,s,_=t.DEFAULT_NESTING_THRESHOLDS){const a=[];return function e(t,o=0){if(s.nestingControlTypes.includes(t.type)){if(o>_.mediumThreshold){const e=r.toPosition(t.startIndex);a.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.NESTING,severity:o>_.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Excessive nesting depth: ${o}. Consider extracting.`})}o++}for(const r of t.children)e(r,o)}(e.rootNode),a};const n=r(613);t.DEFAULT_NESTING_THRESHOLDS={mediumThreshold:3,highThreshold:5}},487(e,t,r){t.analyzeOpaqueBooleanLiteral=function(e,t,r){const s=[];return function e(_){r.isBooleanLiteral(_)&&r.isPositionalCallArgument(_)&&s.push(function(e,t){const r=t.toPosition(e.startIndex);return{line:r.line,column:r.column,type:n.VIOLATION_TYPE.OPAQUE_BOOLEAN,severity:n.SEVERITY.LOW,message:`Opaque boolean literal: a bare '${e.text}' passed positionally tells the reader nothing without checking the callee's signature. Name it at the call site (a keyword argument, an object-literal field, or F#'s named-argument syntax) — or better, split into two clearly named functions (e.g. enableX()/disableX()) or use an enum.`}}(_,t));for(const t of _.children)e(t)}(e.rootNode),s};const n=r(613)},622(e,t,r){t.findParametersNode=s,t.analyzeParameterCount=function(e,t,r){const _=[];return function e(a){if(r.isFunctionDefinition(a)){const e=s(a,r.nodeTypes.parameters);if(e){const s=e.children.filter(e=>r.parameterChildTypes.includes(e.type)).length;if(s>5){const e=t.toPosition(a.startIndex);_.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.PARAMETERS,severity:s>8?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Parameter explosion: ${s} parameters. Consider using objects or builder pattern.`})}}}for(const t of a.children)e(t)}(e.rootNode),_};const n=r(613);function s(e,t){for(const r of e.children)if(r.type===t)return r;for(const r of e.children){const e=s(r,t);if(e)return e}}},164(e,t,r){t.analyzePrimitiveObsession=function(e,t,r){const a=[];return function e(o){if(r.isFunctionDefinition(o)){const e=(0,s.findParametersNode)(o,r.nodeTypes.parameters);e&&a.push(...function(e,t,r){const s=[];let _=!1;const a=[];for(const t of e.children){if(r.keywordOnlyBoundaryTypes.includes(t.type)){_=!0;continue}const e=r.extractTypedParameter(t);e&&a.push({...e,node:t,keywordOnly:_})}for(let e=0;e<a.length-1;e++){const _=a[e],o=a[e+1];if(_.type!==o.type||!r.primitiveTypeNames.has(_.type))continue;if(_.keywordOnly&&o.keywordOnly)continue;const i=t.toPosition(_.node.startIndex);s.push({line:i.line,column:i.column,type:n.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:n.SEVERITY.MEDIUM,message:`Primitive obsession: consecutive parameters '${_.name}: ${_.type}' and '${o.name}: ${o.type}' share the same primitive type — a caller can swap them and nothing will complain. Consider ${r.distinctTypeAdvice} so the type checker catches it.`})}return s}(e,t,r)),a.push(...function(e,t,r){const{nodeTypes:s}=r,a=new Map,o=new Map;function i(e){return r.variableReferenceNodeTypes.includes(e.type)}function l(e,t){const r=e.text;a.has(r)||(a.set(r,new Set),o.set(r,e));const n=a.get(r);t.forEach(e=>n.add(e))}!function e(t){for(const{left:e,right:n}of r.getEqualityComparisons(t))i(e)&&n.type===s.stringLiteral?l(e,[_(n.text)]):i(n)&&e.type===s.stringLiteral&&l(n,[_(e.text)]);for(const{left:e,values:n}of r.getMembershipComparisons(t))i(e)&&n.length>0&&l(e,n);for(const r of t.children)e(r)}(e);const d=[];for(const[e,r]of a)if(r.size>=3){const s=o.get(e),_=t.toPosition(s.startIndex),a=Array.from(r).slice(0,4);d.push({line:_.line,column:_.column,type:n.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:n.SEVERITY.LOW,message:`Stringly-typed control flow: '${e}' is compared against ${r.size} distinct string literals (${a.join(", ")}${r.size>a.length?", …":""}). Consider an Enum or Literal type to catch typos and get exhaustiveness checking.`})}return d}(o,t,r))}for(const t of o.children)e(t)}(e.rootNode),a};const n=r(613),s=r(622);function _(e){return e.slice(1,-1)}},599(e,t){t.createPositionLookup=function(e){const t=[0];for(let r=0;r<e.length;r++)"\n"===e[r]&&t.push(r+1);return{toPosition(e){let r=0,n=t.length-1;for(;r<n;){const s=Math.ceil((r+n)/2);t[s]<=e?r=s:n=s-1}return{line:r,column:e-t[r]}}}}},964(e,t){t.FSHARP=void 0,t.FSHARP={id:"fsharp",grammarPath:"grammars/tree-sitter-fsharp.wasm",nodeTypes:{block:null,parameters:"argument_patterns",ifStatement:"if_expression",elseClause:null,forStatement:"for_expression",whileStatement:"while_expression",conditionalExpression:null,lambda:"fun_expression",importStatement:"import_decl",importFromStatement:null,expressionStatement:null,assignment:"function_or_value_defn",module:"declaration_expression",exportStatement:null,comment:"line_comment",integerLiteral:"int",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_or_value_defn"===e?.type&&e.children?.some(e=>"function_declaration_left"===e.type),parameterChildTypes:["long_identifier","typed_pattern"],decisionNodeTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],cognitiveNestedDecisionTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],nestingControlTypes:["if_expression","elif_expression","for_expression","while_expression","match_expression"],getBooleanOperator(e){if(!e||"infix_expression"!==e.type)return null;const t=e.children?.find(e=>"infix_op"===e.type);return"&&"===t?.text?"and":"||"===t?.text?"or":null},entersNestedScope:()=>!0,isTryElseClause:()=>!1,variableReferenceNodeTypes:["long_identifier_or_op"],extractTypedParameter(e){if("typed_pattern"!==e?.type)return null;const t=e.children.find(e=>"identifier_pattern"===e.type),r=e.children.find(e=>"simple_type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["string","int","float","bool"]),keywordOnlyBoundaryTypes:[],distinctTypeAdvice:"a single-case union type",getEqualityComparisons(e){if("infix_expression"!==e?.type)return[];const t=e.children.find(e=>"infix_op"===e.type);if(!t||"="!==t.text)return[];const r=e.children.filter(e=>"infix_op"!==e.type);if(2!==r.length)return[];const[n,s]=r;return[{left:n,right:"const"===s.type&&1===s.children?.length?s.children[0]:s}]},getMembershipComparisons:()=>[],getElseIfBranches:e=>e?.children?.filter(e=>"elif_expression"===e.type)??[],subscriptNodeTypes:[],isFormattedOrInterpolatedString:()=>!1,isDefaultParameterValue:()=>!1,isBooleanLiteral:e=>"const"===e?.type&&1===e.children?.length&&"bool"===e.children[0]?.type,isPositionalCallArgument(e){const t=e?.parent;return"application_expression"===t?.type?t.children?.[0]?.id!==e.id:"tuple_expression"===t?.type&&"application_expression"===t.parent?.type}}},912(e,t,r){t.Y=void 0,t.resolveLanguageForFile=function(e){const r=e.lastIndexOf(".");if(-1===r)return;const n=e.slice(r).toLowerCase(),s=a[n];return s?t.Y[s]:void 0};const n=r(996),s=r(964),_=r(501);t.Y={python:n.PYTHON,fsharp:s.FSHARP,typescript:_.TYPESCRIPT};const a={".py":"python",".fs":"fsharp",".fsx":"fsharp",".fsi":"fsharp",".ts":"typescript"}},996(e,t){t.PYTHON=void 0,t.PYTHON={id:"python",grammarPath:"grammars/tree-sitter-python.wasm",nodeTypes:{block:"block",parameters:"parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"conditional_expression",lambda:"lambda",importStatement:"import_statement",importFromStatement:"import_from_statement",expressionStatement:"expression_statement",assignment:"assignment",module:"module",exportStatement:null,comment:"comment",integerLiteral:"integer",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_definition"===e?.type,parameterChildTypes:["identifier","default_parameter"],decisionNodeTypes:["if_statement","elif_clause","while_statement","for_statement","except_clause","conditional_expression","match_statement"],cognitiveNestedDecisionTypes:["if_statement","elif_clause","for_statement","while_statement","except_clause","match_statement"],nestingControlTypes:["if_statement","for_statement","while_statement","with_statement","match_statement"],getBooleanOperator(e){if(!e||"boolean_operator"!==e.type)return null;const t=e.children?.find(e=>"and"===e.type||"or"===e.type);return t?t.type:null},entersNestedScope:e=>"block"===e?.type,isTryElseClause:e=>"else_clause"===e?.type&&"try_statement"===e?.parent?.type,variableReferenceNodeTypes:["identifier","attribute"],extractTypedParameter(e){if("typed_parameter"!==e?.type&&"typed_default_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["str","int","float","bool","bytes"]),keywordOnlyBoundaryTypes:["keyword_separator","list_splat_pattern"],distinctTypeAdvice:"NewType or a dataclass",getEqualityComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++)"=="===r[e].type&&t.push({left:r[e-1],right:r[e+1]});return t},getMembershipComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++){if("in"!==r[e].type)continue;const n=r[e-1],s=r[e+1];if("tuple"!==s.type&&"list"!==s.type&&"set"!==s.type)continue;const _=[];let a=!0;for(const e of s.children)if(e.isNamed){if("string"!==e.type){a=!1;break}_.push(e.text.slice(1,-1))}a&&_.length>0&&t.push({left:n,values:_})}return t},getElseIfBranches:e=>e?.children?.filter(e=>"elif_clause"===e.type)??[],subscriptNodeTypes:["subscript"],isFormattedOrInterpolatedString(e){if(e?.children?.some(e=>"interpolation"===e.type))return!0;const t=e?.parent;if("binary_operator"===t?.type&&t.children?.[0]?.id===e.id&&t.children?.some(e=>"%"===e.type))return!0;if("attribute"===t?.type&&t.children?.[0]?.id===e.id){const e=t.children?.find(e=>"identifier"===e.type);if("format"===e?.text&&"call"===t.parent?.type)return!0}return!1},isDefaultParameterValue(e){const t=e?.parent;return("default_parameter"===t?.type||"typed_default_parameter"===t?.type)&&t.children?.[t.children.length-1]?.id===e.id},isBooleanLiteral:e=>"true"===e?.type||"false"===e?.type,isPositionalCallArgument:e=>"argument_list"===e?.parent?.type&&"call"===e.parent.parent?.type}},501(e,t){t.TYPESCRIPT=void 0,t.TYPESCRIPT={id:"typescript",grammarPath:"grammars/tree-sitter-typescript.wasm",nodeTypes:{block:"statement_block",parameters:"formal_parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"ternary_expression",lambda:"arrow_function",importStatement:"import_statement",importFromStatement:null,expressionStatement:"expression_statement",assignment:"lexical_declaration",module:"program",exportStatement:"export_statement",comment:"comment",integerLiteral:"number",floatLiteral:null,stringLiteral:"string"},isFunctionDefinition:e=>"function_declaration"===e?.type||"method_definition"===e?.type,parameterChildTypes:["required_parameter","optional_parameter"],decisionNodeTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause","ternary_expression"],cognitiveNestedDecisionTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause"],nestingControlTypes:["if_statement","for_statement","for_in_statement","while_statement"],getBooleanOperator(e){if(!e||"binary_expression"!==e.type)return null;const t=e.children?.find(e=>"&&"===e.type||"||"===e.type);return t?"&&"===t.type?"and":"or":null},entersNestedScope:e=>"statement_block"===e?.type,isTryElseClause:()=>!1,variableReferenceNodeTypes:["identifier","member_expression"],extractTypedParameter(e){if("required_parameter"!==e?.type&&"optional_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type_annotation"===e.type);if(!t||!r)return null;const n=r.children.find(e=>":"!==e.type);return n?{name:t.text,type:n.text}:null},primitiveTypeNames:new Set(["string","number","boolean"]),keywordOnlyBoundaryTypes:[],distinctTypeAdvice:"a branded/nominal type (e.g. a tagged type alias)",getEqualityComparisons(e){if("binary_expression"!==e?.type)return[];const t=e.children.find(e=>"==="===e.type||"=="===e.type);if(!t)return[];const r=e.children.filter(e=>e!==t);return 2!==r.length?[]:[{left:r[0],right:r[1]}]},getMembershipComparisons:()=>[],getElseIfBranches:()=>[],subscriptNodeTypes:["subscript_expression"],isFormattedOrInterpolatedString:()=>!1,isDefaultParameterValue(e){const t=e?.parent;return("required_parameter"===t?.type||"optional_parameter"===t?.type)&&t.children?.some(e=>"="===e.type)&&t.children?.[t.children.length-1]?.id===e.id},isBooleanLiteral:e=>"true"===e?.type||"false"===e?.type,isPositionalCallArgument:e=>"arguments"===e?.parent?.type&&"call_expression"===e.parent.parent?.type}},613(e,t){t.VIOLATION_TYPE=t.SEVERITY=void 0,t.SEVERITY={LOW:"low",MEDIUM:"medium",HIGH:"high"},t.VIOLATION_TYPE={NESTING:"nesting",COMPLEXITY:"complexity",COGNITIVE:"cognitive",NAMING:"naming",COHERENCE:"coherence",MAGIC:"magic",PARAMETERS:"parameters",INVERSION:"inversion",PRIMITIVE_OBSESSION:"primitive-obsession",MATCH_OPPORTUNITY:"match-opportunity",LOGICAL_CONTROL_FLOW:"logical-control-flow",OPAQUE_BOOLEAN:"opaque-boolean"}},896(e){e.exports=require("fs")},943(e){e.exports=require("fs/promises")},928(e){e.exports=require("path")},43(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===r||__defProp(e,s,{get:()=>t[s],enumerable:!(n=__getOwnPropDesc(t,s))||n.enumerable});return e},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?r:__defProp(r,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),require_web_tree_sitter=__commonJS({"lib/web-tree-sitter.cjs"(exports,module){var Module=(()=>{var _scriptName="undefined"!=typeof document?document.currentScript?.src:void 0;return async function(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="undefined"!=typeof WorkerGlobalScope,ENVIRONMENT_IS_NODE="object"==typeof process&&process.versions?.node&&"renderer"!=process.type;Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=__name((e,t)=>{throw t},"quit_");_scriptName=__filename;var scriptDirectory="",readAsync,readBinary;function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}if(__name(locateFile,"locateFile"),ENVIRONMENT_IS_NODE){var fs=__webpack_require__(896);scriptDirectory=__dirname+"/",readBinary=__name(e=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e)),"readBinary"),readAsync=__name(async(e,t=!0)=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e,t?void 0:"utf8")),"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=__name((e,t)=>{throw process.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=__name(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=__name(async e=>{if(isFileURI(e))return new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=__name(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}__name(updateMemoryViews,"updateMemoryViews"),__name(initMemory,"initMemory");var __RELOC_FUNCS__=[],wasmBinaryFile;function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}function preMain(){}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}function abort(e){Module.onAbort?.(e),err(e="Aborted("+e+")"),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}function findWasmBinary(){return locateFile("web-tree-sitter.wasm")}function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}async function instantiateArrayBuffer(e,t){try{var r=await getWasmBinary(e);return await WebAssembly.instantiate(r,t)}catch(e){err(`failed to asynchronously prepare wasm: ${e}`),abort(e)}}async function instantiateAsync(e,t,r){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(e){err(`wasm streaming compile failed: ${e}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,r)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}async function createWasm(){function e(e,t){wasmExports=e.exports,wasmExports=relocateExports(wasmExports,1024);var r=getDylinkMetadata(t);return r.neededDynlibs&&(dynamicLibraries=r.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}function t(t){return e(t.instance,t.module)}__name(e,"receiveInstance"),__name(t,"receiveInstantiationResult");var r=getWasmImports();return Module.instantiateWasm?new Promise((t,n)=>{Module.instantiateWasm(r,(r,n)=>{t(e(r,n))})}):(wasmBinaryFile??=findWasmBinary(),t(await instantiateAsync(wasmBinary,wasmBinaryFile,r)))}__name(preRun,"preRun"),__name(initRuntime,"initRuntime"),__name(preMain,"preMain"),__name(postRun,"postRun"),__name(abort,"abort"),__name(findWasmBinary,"findWasmBinary"),__name(getBinarySync,"getBinarySync"),__name(getWasmBinary,"getWasmBinary"),__name(instantiateArrayBuffer,"instantiateArrayBuffer"),__name(instantiateAsync,"instantiateAsync"),__name(getWasmImports,"getWasmImports"),__name(createWasm,"createWasm");class ExitStatus{static{__name(this,"ExitStatus")}name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var r=GOT[t];return r||(r=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(r.required=!0),r}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=__name(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=__name(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=__name(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=__name(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=__name(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=__name(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=__name((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=__name((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=__name((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=__name((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=__name((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=__name((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=__name(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=__name(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=__name(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder:void 0,findStringEnd=__name((e,t,r,n)=>{var s=t+r;if(n)return s;for(;e[t]&&!(t>=s);)++t;return t},"findStringEnd"),UTF8ArrayToString=__name((e,t=0,r,n)=>{var s=findStringEnd(e,t,r,n);if(s-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,s));for(var _="";t<s;){var a=e[t++];if(128&a){var o=63&e[t++];if(192!=(224&a)){var i=63&e[t++];if((a=224==(240&a)?(15&a)<<12|o<<6|i:(7&a)<<18|o<<12|i<<6|63&e[t++])<65536)_+=String.fromCharCode(a);else{var l=a-65536;_+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else _+=String.fromCharCode((31&a)<<6|o)}else _+=String.fromCharCode(a)}return _},"UTF8ArrayToString"),getDylinkMetadata=__name(e=>{var t=0,r=0;function n(){return e[t++]}function s(){for(var r=0,n=1;;){var s=e[t++];if(r+=(127&s)*n,n*=128,!(128&s))break}return r}function _(){var r=s();return UTF8ArrayToString(e,(t+=r)-r,r)}function a(){for(var e=s(),t=[];e--;)t.push(_());return t}function o(e,t){if(e)throw new Error(t)}if(__name(n,"getU8"),__name(s,"getLEB"),__name(_,"getString"),__name(a,"getStringList"),__name(o,"failIf"),e instanceof WebAssembly.Module){var i=WebAssembly.Module.customSections(e,"dylink.0");o(0===i.length,"need dylink section"),r=(e=new Uint8Array(i[0])).length}else{var l=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer);o(!(1836278016==l[0]||6386541==l[0]),"need to see wasm magic number"),o(0!==e[8],"need the dylink section to be first"),t=9;var d=s();r=t+d,o("dylink.0"!==_())}for(var u={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]};t<r;){var c=n(),m=s();if(1===c)u.memorySize=s(),u.memoryAlign=s(),u.tableSize=s(),u.tableAlign=s();else if(2===c)u.neededDynlibs=a();else if(3===c)for(var p=s();p--;){var h=_();256&s()&&u.tlsExports.add(h)}else if(4===c)for(p=s();p--;)_(),h=_(),1==(3&s())&&u.weakImports.add(h);else 5===c?u.runtimePaths=a():t+=m}return u},"getDylinkMetadata");function getValue(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return HEAP8[e];case"i16":return LE_HEAP_LOAD_I16(2*(e>>1));case"i32":return LE_HEAP_LOAD_I32(4*(e>>2));case"i64":return LE_HEAP_LOAD_I64(8*(e>>3));case"float":return LE_HEAP_LOAD_F32(4*(e>>2));case"double":return LE_HEAP_LOAD_F64(8*(e>>3));case"*":return LE_HEAP_LOAD_U32(4*(e>>2));default:abort(`invalid type for getValue: ${t}`)}}__name(getValue,"getValue");var newDSO=__name((e,t,r)=>{var n={refcount:1/0,name:e,exports:r,global:!0};return LDSO.loadedLibsByName[e]=n,null!=t&&(LDSO.loadedLibsByHandle[t]=n),n},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78240,alignMemory=__name((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=__name(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,r=t+alignMemory(e,16);return ___heap_base=r,GOT.__heap_base.value=r,t},"getMemory"),isInternalSym=__name(e=>["__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(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=__name(e=>{const t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=__name(e=>uleb128EncodeWithLen(Array.from(e,e=>wasmTypeCodes[e])),"generateTypePack"),convertJsFunctionToWasm=__name((e,t)=>{var r=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack("v"===t[0]?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),n=new WebAssembly.Module(r);return new WebAssembly.Instance(n,{e:{f:e}}).exports.f},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=__name(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=__name((e,t)=>{if(functionsInTableMap)for(var r=e;r<e+t;r++){var n=getWasmTableEntry(r);n&&functionsInTableMap.set(n,r)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=__name(e=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=__name(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=__name((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=__name((e,t)=>{var r=getFunctionAddress(e);if(r)return r;var n=getEmptyTableSlot();try{setWasmTableEntry(n,e)}catch(r){if(!(r instanceof TypeError))throw r;var s=convertJsFunctionToWasm(e,t);setWasmTableEntry(n,s)}return functionsInTableMap.set(e,n),n},"addFunction"),updateGOT=__name((e,t)=>{for(var r in e)if(!isInternalSym(r)){var n=e[r];GOT[r]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||0==GOT[r].value)&&("function"==typeof n?GOT[r].value=addFunction(n):"number"==typeof n?GOT[r].value=n:err(`unhandled export type for '${r}': ${typeof n}`))}},"updateGOT"),relocateExports=__name((e,t,r)=>{var n={};for(var s in e){var _=e[s];"object"==typeof _&&(_=_.value),"number"==typeof _&&(_+=t),n[s]=_}return updateGOT(n,r),n},"relocateExports"),isSymbolDefined=__name(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=__name((e,t,r=[],n=!1)=>{var s=getWasmTableEntry(t)(...r);return __name(function(e){return e},"convert"),s},"dynCall"),stackSave=__name(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=__name(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=__name(e=>(t,...r)=>{var n=stackSave();try{return dynCall(e,t,r)}catch(t){if(stackRestore(n),t!==t+0)throw t;if(_setThrew(1,0),"j"==e[0])return 0n}},"createInvokeFunction"),resolveGlobalSymbol=__name((e,t=!1)=>{var r;return isSymbolDefined(e)?r=wasmImports[e]:e.startsWith("invoke_")&&(r=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:r,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=__name(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=__name((e,t,r)=>e?UTF8ArrayToString(HEAPU8,e,t,r):"","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,moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32(4*(handle+12>>2),memoryBase),LE_HEAP_STORE_I32(4*(handle+16>>2),metadata.memorySize),LE_HEAP_STORE_U32(4*(handle+20>>2),tableBase),LE_HEAP_STORE_I32(4*(handle+24>>2),metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize),__name(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}var r;return t in wasmImports&&!wasmImports[t].stub?wasmImports[t]:(t in e||(e[t]=(...e)=>(r||=resolveSymbol(t),r(...e))),e[t])}},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){function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&-1!=body.indexOf("$"+arity);arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols(),__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),"void"!=cSig)for(var i in cSig=cSig.split(","),cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}for(var name in __name(addEmJs,"addEmJs"),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 e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):({module:binary,instance:e}=await WebAssembly.instantiate(binary,info)),postInstantiation(binary,e)})();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((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=__name((e,t)=>{for(var[r,n]of Object.entries(e)){const e=__name(e=>{isSymbolDefined(e)||(wasmImports[e]=n)},"setImport");e(r);const t="__main_argc_argv";"main"==r&&e(t),r==t&&e("main")}},"mergeLibSymbols"),asyncLoad=__name(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},r,n){var s=LDSO.loadedLibsByName[e];if(s)return t.global?s.global||(s.global=!0,mergeLibSymbols(s.exports,e)):r&&Object.assign(r,s.exports),t.nodelete&&s.refcount!==1/0&&(s.refcount=1/0),s.refcount++,n&&(LDSO.loadedLibsByHandle[n]=s),!t.loadAsync||Promise.resolve(!0);function _(){if(n){var r=LE_HEAP_LOAD_U32(4*(n+28>>2)),s=LE_HEAP_LOAD_U32(4*(n+32>>2));if(r&&s){var _=HEAP8.slice(r,r+s);return t.loadAsync?Promise.resolve(_):_}}var a=locateFile(e);if(t.loadAsync)return asyncLoad(a);if(!readBinary)throw new Error(`${a}: file not found, and synchronous loading of external files is not available`);return readBinary(a)}function a(){return t.loadAsync?_().then(s=>loadWebAssemblyModule(s,t,e,r,n)):loadWebAssemblyModule(_(),t,e,r,n)}function o(t){s.global?mergeLibSymbols(t,e):r&&Object.assign(r,t),s.exports=t}return(s=newDSO(e,n,"loading")).refcount=t.nodelete?1/0:1,s.global=t.global,__name(_,"loadLibData"),__name(a,"getExports"),__name(o,"moduleLoaded"),t.loadAsync?a().then(e=>(o(e),!0)):(o(a()),!0)}__name(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=__name(()=>{for(var[e,t]of Object.entries(GOT))if(0==t.value){var r=resolveGlobalSymbol(e,!0).sym;if(!r&&!t.required)continue;if("function"==typeof r)t.value=addFunction(r,r.sig);else{if("number"!=typeof r)throw new Error(`bad export type for '${e}': ${typeof r}`);t.value=r}}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=__name(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),0==runDependencies&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=__name(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=__name(async()=>{if(dynamicLibraries.length){for(var e of(addRunDependency("loadDylibs"),dynamicLibraries))await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")}else reportUndefinedSymbols()},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16(2*(e>>1),t);break;case"i32":LE_HEAP_STORE_I32(4*(e>>2),t);break;case"i64":LE_HEAP_STORE_I64(8*(e>>3),BigInt(t));break;case"float":LE_HEAP_STORE_F32(4*(e>>2),t);break;case"double":LE_HEAP_STORE_F64(8*(e>>3),t);break;case"*":LE_HEAP_STORE_U32(4*(e>>2),t);break;default:abort(`invalid type for setValue: ${r}`)}}__name(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=78240,___stack_low=12704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78240),___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(e=>{var t=(e-wasmMemory.buffer.byteLength+65535)/65536|0;try{return wasmMemory.grow(t),updateMemoryViews(),1}catch(e){}},"growMemory"),_emscripten_resize_heap=__name(e=>{var t=HEAPU8.length;e>>>=0;var r=getHeapMax();if(e>r)return!1;for(var n=1;n<=4;n*=2){var s=t*(1+.2/n);s=Math.min(s,e+100663296);var _=Math.min(r,alignMemory(Math.max(e,s),65536));if(growMemory(_))return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=__name(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=__name(e=>e<INT53_MIN||e>INT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,r,n){return t=bigintToI53Checked(t),70}__name(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=__name((e,t)=>{var r=printCharBuffers[e];0===t||10===t?((1===e?out:err)(UTF8ArrayToString(r)),r.length=0):r.push(t)},"printChar"),_fd_write=__name((e,t,r,n)=>{for(var s=0,_=0;_<r;_++){var a=LE_HEAP_LOAD_U32(4*(t>>2)),o=LE_HEAP_LOAD_U32(4*(t+4>>2));t+=8;for(var i=0;i<o;i++)printChar(e,HEAPU8[a+i]);s+=o}return LE_HEAP_STORE_U32(4*(n>>2),s),0},"_fd_write");function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){const r=UTF8ToString(t);Module.currentLogCallback(r,0!==e)}}function _tree_sitter_parse_callback(e,t,r,n,s){const _=Module.currentParseCallback(t,{row:r,column:n});"string"==typeof _?(setValue(s,_.length,"i32"),stringToUTF16(_,e,10240)):setValue(s,0,"i32")}function _tree_sitter_progress_callback(e,t){return!!Module.currentProgressCallback&&Module.currentProgressCallback({currentOffset:e,hasError:t})}function _tree_sitter_query_progress_callback(e){return!!Module.currentQueryProgressCallback&&Module.currentQueryProgressCallback({currentOffset:e})}_fd_write.sig="iippp",__name(_tree_sitter_log_callback,"_tree_sitter_log_callback"),__name(_tree_sitter_parse_callback,"_tree_sitter_parse_callback"),__name(_tree_sitter_progress_callback,"_tree_sitter_progress_callback"),__name(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=__name(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=__name(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=__name((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=__name(e=>{if(e instanceof ExitStatus||"unwind"==e)return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=__name(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=__name((e,t,r,n)=>{if(!(n>0))return 0;for(var s=r,_=r+n-1,a=0;a<e.length;++a){var o=e.codePointAt(a);if(o<=127){if(r>=_)break;t[r++]=o}else if(o<=2047){if(r+1>=_)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=_)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=_)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o,a++}}return t[r]=0,r-s},"stringToUTF8Array"),stringToUTF8=__name((e,t,r)=>stringToUTF8Array(e,HEAPU8,t,r),"stringToUTF8"),stackAlloc=__name(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=__name(e=>{var t=lengthBytesUTF8(e)+1,r=stackAlloc(t);return stringToUTF8(e,r,t),r},"stringToUTF8OnStack"),AsciiToString=__name(e=>{for(var t="";;){var r=HEAPU8[e++];if(!r)return t;t+=String.fromCharCode(r)}},"AsciiToString"),stringToUTF16=__name((e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,s=(r-=2)<2*e.length?r/2:e.length,_=0;_<s;++_){var a=e.charCodeAt(_);LE_HEAP_STORE_I16(2*(t>>1),a),t+=2}return LE_HEAP_STORE_I16(2*(t>>1),0),t-n},"stringToUTF16");function LE_HEAP_UPDATE(){HEAPU16.unsigned=e=>65535&e,HEAPU32.unsigned=e=>e>>>0}if(LE_ATOMICS_NATIVE_BYTE_ORDER=1===new Int8Array(new Int16Array([1]).buffer)[0]?[e=>e,e=>e,void 0,e=>e]:[e=>e,e=>((65280&e)<<8|(255&e)<<24)>>16,void 0,e=>e>>24&255|e>>8&65280|(65280&e)<<8|(255&e)<<24],__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("function"==typeof Module.preInit&&(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_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,_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(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.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=e.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=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.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=e.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=e.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=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__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},wasmExports;function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var r=e.length,n=stackAlloc(4*(r+1)),s=n;e.forEach(e=>{LE_HEAP_STORE_U32(4*(s>>2),stringToUTF8OnStack(e)),s+=4}),LE_HEAP_STORE_U32(4*(s>>2),0);try{var _=t(r,n);return exitJS(_,!0),_}catch(e){return handleException(e)}}}function run(e=arguments_){function t(){Module.calledRun=!0,ABORT||(initRuntime(),preMain(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.(),Module.noInitialRun||callMain(e),postRun())}runDependencies>0?dependenciesFulfilled=run:(preRun(),runDependencies>0?dependenciesFulfilled=run:(__name(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()))}return __name(callMain,"callMain"),__name(run,"run"),wasmExports=await createWasm(),run(),moduleRtn=runtimeInitialized?Module:new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}})();"object"==typeof exports&&"object"==typeof module?(module.exports=Module,module.exports.default=Module):(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=(()=>Module).apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}}),index_exports={};__export(index_exports,{CaptureQuantifier:()=>CaptureQuantifier,Edit:()=>Edit,LANGUAGE_VERSION:()=>LANGUAGE_VERSION,Language:()=>Language,LookaheadIterator:()=>LookaheadIterator,MIN_COMPATIBLE_VERSION:()=>MIN_COMPATIBLE_VERSION,Node:()=>Node,Parser:()=>Parser,Query:()=>Query,Tree:()=>Tree,TreeCursor:()=>TreeCursor}),module.exports=__toCommonJS(index_exports);var Edit=class{static{__name(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:r,startPosition:n,oldEndPosition:s,newEndPosition:_}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=r>>>0,this.startPosition=n,this.oldEndPosition=s,this.newEndPosition=_}editPoint(e,t){let r=t;const n={...e};if(t>=this.oldEndIndex){r=this.newEndIndex+(t-this.oldEndIndex);const s=e.row;n.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),n.column=s===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(r=this.newEndIndex,n.row=this.newEndPosition.row,n.column=this.newEndPosition.column);return{point:n,index:r}}editRange(e){const t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndex<this.newEndIndex&&(t.endIndex=Number.MAX_SAFE_INTEGER,t.endPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.endIndex>this.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndex<this.newEndIndex&&(t.startIndex=Number.MAX_SAFE_INTEGER,t.startPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.startIndex>this.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},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"),C;function assertInternal(e){if(e!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(e){return!!e&&"number"==typeof e.row&&"number"==typeof e.column}function setModule(e){C=e}__name(assertInternal,"assertInternal"),__name(isPoint,"isPoint"),__name(setModule,"setModule");var LookaheadIterator=class{static{__name(this,"LookaheadIterator")}0=0;language;constructor(e,t,r){assertInternal(e),this[0]=t,this.language=r}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return!!C._ts_lookahead_iterator_reset(this[0],e[0],t)&&(this.language=e,!0)}resetState(e){return Boolean(C._ts_lookahead_iterator_reset_state(this[0],e))}[Symbol.iterator](){return{next:__name(()=>C._ts_lookahead_iterator_next(this[0])?{done:!1,value:this.currentType}:{done:!0,value:""},"next")}}};function getText(e,t,r,n){const s=r-t;let _=e.textCallback(t,n);if(_){for(t+=_.length;t<r;){const r=e.textCallback(t,n);if(!(r&&r.length>0))break;t+=r.length,_+=r}t>r&&(_=_.slice(0,s))}return _??""}__name(getText,"getText");var Tree=class e{static{__name(this,"Tree")}0=0;textCallback;language;constructor(e,t,r,n){assertInternal(e),this[0]=t,this.language=r,this.textCallback=n}copy(){const t=C._ts_tree_copy(this[0]);return new e(INTERNAL,t,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(e,t){const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),marshalPoint(r+SIZE_OF_INT,t),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}edit(e){marshalEdit(e),C._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof e))throw new TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],t[0]);const r=C.getValue(TRANSFER_BUFFER,"i32"),n=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),s=new Array(r);if(r>0){let e=n;for(let t=0;t<r;t++)s[t]=unmarshalRange(e),e+=SIZE_OF_RANGE;C._free(n)}return s}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(n),n+=SIZE_OF_RANGE;C._free(t)}return r}},TreeCursor=class e{static{__name(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(e,t){assertInternal(e),this.tree=t,unmarshalTreeCursor(this)}copy(){const t=new e(INTERNAL,this.tree);return C._ts_tree_cursor_copy_wasm(this.tree[0]),unmarshalTreeCursor(t),t}delete(){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),1===C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])}get nodeIsMissing(){return marshalTreeCursor(this),1===C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])}get nodeText(){marshalTreeCursor(this);const e=C._ts_tree_cursor_start_index_wasm(this.tree[0]),t=C._ts_tree_cursor_end_index_wasm(this.tree[0]);C._ts_tree_cursor_start_position_wasm(this.tree[0]);const r=unmarshalPoint(TRANSFER_BUFFER);return getText(this.tree,e,t,r)}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);const e=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoLastChild(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoParent(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoNextSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoPreviousSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoDescendant(e){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],e),unmarshalTreeCursor(this)}gotoFirstChildForIndex(e){marshalTreeCursor(this),C.setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,e,"i32");const t=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}gotoFirstChildForPosition(e){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,e);const t=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}reset(e){marshalNode(e),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(e){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(e,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],e.tree[0]),unmarshalTreeCursor(this)}},Node=class{static{__name(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:r,startIndex:n,startPosition:s,other:_}){assertInternal(e),this[0]=_,this.id=t,this.tree=r,this.startIndex=n,this.startPosition=s}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),1===C._ts_node_is_named_wasm(this.tree[0])}get isExtra(){return marshalNode(this),1===C._ts_node_is_extra_wasm(this.tree[0])}get isError(){return marshalNode(this),1===C._ts_node_is_error_wasm(this.tree[0])}get isMissing(){return marshalNode(this),1===C._ts_node_is_missing_wasm(this.tree[0])}get hasChanges(){return marshalNode(this),1===C._ts_node_has_changes_wasm(this.tree[0])}get hasError(){return marshalNode(this),1===C._ts_node_has_error_wasm(this.tree[0])}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(e){return this.tree===e.tree&&this.id===e.id}child(e){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}namedChild(e){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldId(e){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t?this.childForFieldId(t):null}fieldNameForChild(e){marshalNode(this);const t=C._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}fieldNameForNamedChild(e){marshalNode(this);const t=C._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}childrenForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t&&0!==t?this.childrenForFieldId(t):[]}childrenForFieldId(e){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),n=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)n[r]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE;C._free(r)}return n}firstChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"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]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._children[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._namedChildren[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._namedChildren}descendantsOfType(e,t=ZERO_POINT,r=ZERO_POINT){Array.isArray(e)||(e=[e]);const n=[],s=this.tree.language.types;for(const t of e)"ERROR"==t&&n.push(65535);for(let t=0,r=s.length;t<r;t++)e.includes(s[t])&&n.push(t);const _=C._malloc(SIZE_OF_INT*n.length);for(let e=0,t=n.length;e<t;e++)C.setValue(_+e*SIZE_OF_INT,n[e],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],_,n.length,t.row,t.column,r.row,r.column);const a=C.getValue(TRANSFER_BUFFER,"i32"),o=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),i=new Array(a);if(a>0){let e=o;for(let t=0;t<a;t++)i[t]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE}return C._free(o),C._free(_),i}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(e){return marshalNode(this),marshalNode(e,1),C._ts_node_child_with_descendant_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_named_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}walk(){return marshalNode(this),C._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(INTERNAL,this.tree)}edit(e){if(this.startIndex>=e.oldEndIndex){let t,r;this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex),this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,r=this.startPosition.column):(t=0,r=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(r=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=r):this.startPosition.column+=r}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){marshalNode(this);const e=C._ts_node_to_string_wasm(this.tree[0]),t=C.AsciiToString(e);return C._free(e),t}};function unmarshalCaptures(e,t,r,n,s){for(let _=0,a=s.length;_<a;_++){const a=C.getValue(r,"i32"),o=unmarshalNode(t,r+=SIZE_OF_INT);r+=SIZE_OF_NODE,s[_]={patternIndex:n,name:e.captureNames[a],node:o}}return r}function marshalNode(e,t=0){let r=TRANSFER_BUFFER+t*SIZE_OF_NODE;C.setValue(r,e.id,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startIndex,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.row,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.column,"i32"),r+=SIZE_OF_INT,C.setValue(r,e[0],"i32")}function unmarshalNode(e,t=TRANSFER_BUFFER){const r=C.getValue(t,"i32");if(t+=SIZE_OF_INT,0===r)return null;const n=C.getValue(t,"i32");t+=SIZE_OF_INT;const s=C.getValue(t,"i32");t+=SIZE_OF_INT;const _=C.getValue(t,"i32");t+=SIZE_OF_INT;const a=C.getValue(t,"i32");return new Node(INTERNAL,{id:r,tree:e,startIndex:n,startPosition:{row:s,column:_},other:a})}function marshalTreeCursor(e,t=TRANSFER_BUFFER){C.setValue(t+0*SIZE_OF_INT,e[0],"i32"),C.setValue(t+1*SIZE_OF_INT,e[1],"i32"),C.setValue(t+2*SIZE_OF_INT,e[2],"i32"),C.setValue(t+3*SIZE_OF_INT,e[3],"i32")}function unmarshalTreeCursor(e){e[0]=C.getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),e[1]=C.getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),e[2]=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),e[3]=C.getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(e,t){C.setValue(e,t.row,"i32"),C.setValue(e+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(e){return{row:C.getValue(e,"i32")>>>0,column:C.getValue(e+SIZE_OF_INT,"i32")>>>0}}function marshalRange(e,t){marshalPoint(e,t.startPosition),marshalPoint(e+=SIZE_OF_POINT,t.endPosition),e+=SIZE_OF_POINT,C.setValue(e,t.startIndex,"i32"),e+=SIZE_OF_INT,C.setValue(e,t.endIndex,"i32"),e+=SIZE_OF_INT}function unmarshalRange(e){const t={};return t.startPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.startIndex=C.getValue(e,"i32")>>>0,e+=SIZE_OF_INT,t.endIndex=C.getValue(e,"i32")>>>0,t}function marshalEdit(e,t=TRANSFER_BUFFER){marshalPoint(t,e.startPosition),marshalPoint(t+=SIZE_OF_POINT,e.oldEndPosition),marshalPoint(t+=SIZE_OF_POINT,e.newEndPosition),t+=SIZE_OF_POINT,C.setValue(t,e.startIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.oldEndIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.newEndIndex,"i32"),t+=SIZE_OF_INT}function unmarshalLanguageMetadata(e){return{major_version:C.getValue(e,"i32"),minor_version:C.getValue(e+=SIZE_OF_INT,"i32"),patch_version:C.getValue(e+=SIZE_OF_INT,"i32")}}__name(unmarshalCaptures,"unmarshalCaptures"),__name(marshalNode,"marshalNode"),__name(unmarshalNode,"unmarshalNode"),__name(marshalTreeCursor,"marshalTreeCursor"),__name(unmarshalTreeCursor,"unmarshalTreeCursor"),__name(marshalPoint,"marshalPoint"),__name(unmarshalPoint,"unmarshalPoint"),__name(marshalRange,"marshalRange"),__name(unmarshalRange,"unmarshalRange"),__name(marshalEdit,"marshalEdit"),__name(unmarshalLanguageMetadata,"unmarshalLanguageMetadata");var LANGUAGE_FUNCTION_REGEX=/^tree_sitter_\w+$/,Language=class e{static{__name(this,"Language")}0=0;types;fields;constructor(e,t){assertInternal(e),this[0]=t,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let e=0,t=this.types.length;e<t;e++)C._ts_language_symbol_type(this[0],e)<2&&(this.types[e]=C.UTF8ToString(C._ts_language_symbol_name(this[0],e)));this.fields=new Array(C._ts_language_field_count(this[0])+1);for(let e=0,t=this.fields.length;e<t;e++){const t=C._ts_language_field_name_for_id(this[0],e);this.fields[e]=0!==t?C.UTF8ToString(t):null}}get name(){const e=C._ts_language_name(this[0]);return 0===e?null:C.UTF8ToString(e)}get abiVersion(){return C._ts_language_abi_version(this[0])}get metadata(){return C._ts_language_metadata_wasm(this[0]),0===C.getValue(TRANSFER_BUFFER,"i32")?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(e){const t=this.fields.indexOf(e);return-1!==t?t:null}fieldNameForId(e){return this.fields[e]??null}idForNodeType(e,t){const r=C.lengthBytesUTF8(e),n=C._malloc(r+1);C.stringToUTF8(e,n,r+1);const s=C._ts_language_symbol_for_name(this[0],n,r,t?1:0);return C._free(n),s||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(e){const t=C._ts_language_symbol_name(this[0],e);return t?C.UTF8ToString(t):null}nodeTypeIsNamed(e){return!!C._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!C._ts_language_type_is_visible_wasm(this[0],e)}get supertypes(){C._ts_language_supertypes_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=C.getValue(n,"i16"),n+=SIZE_OF_SHORT}return r}subtypes(e){C._ts_language_subtypes_wasm(this[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),n=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)n[r]=C.getValue(e,"i16"),e+=SIZE_OF_SHORT}return n}nextState(e,t){return C._ts_language_next_state(this[0],e,t)}lookaheadIterator(e){const t=C._ts_lookahead_iterator_new(this[0],e);return t?new LookaheadIterator(INTERNAL,t,this):null}static async load(t){let r;if(t instanceof Uint8Array)r=t;else if(globalThis.process?.versions.node){const e=await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__,943,23));r=await e.readFile(t)}else{const e=await fetch(t);if(!e.ok){const t=await e.text();throw new Error(`Language.load failed with status ${e.status}.\n\n${t}`)}const n=e.clone();try{r=await WebAssembly.compileStreaming(e)}catch(e){console.error("wasm streaming compile failed:",e),console.error("falling back to ArrayBuffer instantiation"),r=new Uint8Array(await n.arrayBuffer())}}const n=await C.loadWebAssemblyModule(r,{loadAsync:!0}),s=Object.keys(n),_=s.find(e=>LANGUAGE_FUNCTION_REGEX.test(e)&&!e.includes("external_scanner_"));if(!_)throw console.log(`Couldn't find language function in Wasm file. Symbols:\n${JSON.stringify(s,null,2)}`),new Error("Language.load failed: no language function found in Wasm file");const a=n[_]();return new e(INTERNAL,a)}},import_web_tree_sitter=__toESM(require_web_tree_sitter(),1),Module2=null,TRANSFER_BUFFER,LANGUAGE_VERSION,MIN_COMPATIBLE_VERSION;async function initializeBinding(e){return Module2??=await(0,import_web_tree_sitter.default)(e)}function checkModule(){return!!Module2}__name(initializeBinding,"initializeBinding"),__name(checkModule,"checkModule");var Parser=class{static{__name(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){setModule(await initializeBinding(e)),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()}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(){C._ts_parser_delete(this[0]),C._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(e){if(e.constructor!==Language)throw new Error("Argument must be a Language");{t=e[0];const r=C._ts_language_abi_version(t);if(r<MIN_COMPATIBLE_VERSION||LANGUAGE_VERSION<r)throw new Error(`Incompatible language version ${r}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`);this.language=e}}else t=0,this.language=null;return C._ts_parser_set_language(this[0],t),this}parse(e,t,r){if("string"==typeof e)C.currentParseCallback=t=>e.slice(t);else{if("function"!=typeof e)throw new Error("Argument must be a string or a function");C.currentParseCallback=e}C.currentProgressCallback=r?.progressCallback?r.progressCallback: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 n=0,s=0;if(r?.includedRanges){n=r.includedRanges.length,s=C._calloc(n,SIZE_OF_RANGE);let e=s;for(let t=0;t<n;t++)marshalRange(e,r.includedRanges[t]),e+=SIZE_OF_RANGE}const _=C._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,s,n);if(!_)return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");const a=new Tree(INTERNAL,_,this.language,C.currentParseCallback);return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,a}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(n),n+=SIZE_OF_RANGE;C._free(t)}return r}setLogger(e){if(e){if("function"!=typeof e)throw new Error("Logger callback must be a function");this.logCallback=e}else this.logCallback=null;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(e=>"capture"===e.type,"isCaptureStep"),isStringStep=__name(e=>"string"===e.type,"isStringStep"),QueryErrorKind={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},QueryError=class e extends Error{constructor(t,r,n,s){super(e.formatMessage(t,r)),this.kind=t,this.info=r,this.index=n,this.length=s,this.name="QueryError"}static{__name(this,"QueryError")}static formatMessage(e,t){switch(e){case QueryErrorKind.NodeName:return`Bad node name '${t.word}'`;case QueryErrorKind.FieldName:return`Bad field name '${t.word}'`;case QueryErrorKind.CaptureName:return`Bad capture name @${t.word}`;case QueryErrorKind.PatternStructure:return`Bad pattern structure at offset ${t.suffix}`;case QueryErrorKind.Syntax:return`Bad syntax at offset ${t.suffix}`}}};function parseAnyPredicate(e,t,r,n){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}`);if(!isCaptureStep(e[1]))throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}"`);const s="eq?"===r||"any-eq?"===r,_=!r.startsWith("any-");if(isCaptureStep(e[2])){const r=e[1].name,a=e[2].name;n[t].push(e=>{const t=[],n=[];for(const s of e)s.name===r&&t.push(s.node),s.name===a&&n.push(s.node);const o=__name((e,t,r)=>r?e.text===t.text:e.text!==t.text,"compare");return _?t.every(e=>n.some(t=>o(e,t,s))):t.some(e=>n.some(t=>o(e,t,s)))})}else{const r=e[1].name,a=e[2].value,o=__name(e=>e.text===a,"matches"),i=__name(e=>e.text!==a,"doesNotMatch");n[t].push(e=>{const t=[];for(const n of e)n.name===r&&t.push(n.node);const n=s?o:i;return _?t.every(n):t.some(n)})}}function parseMatchPredicate(e,t,r,n){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);if("string"!==e[2].type)throw new Error(`Second argument of \`#${r}\` predicate must be a string. Got @${e[2].name}.`);const s="match?"===r||"any-match?"===r,_=!r.startsWith("any-"),a=e[1].name,o=new RegExp(e[2].value);n[t].push(e=>{const t=[];for(const r of e)r.name===a&&t.push(r.node.text);const r=__name((e,t)=>t?o.test(e):!o.test(e),"test");return 0===t.length?!s:_?t.every(e=>r(e,s)):t.some(e=>r(e,s))})}function parseAnyOfPredicate(e,t,r,n){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected at least 1. Got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);const s="any-of?"===r,_=e[1].name,a=e.slice(2);if(!a.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const o=a.map(e=>e.value);n[t].push(e=>{const t=[];for(const r of e)r.name===_&&t.push(r.node.text);return 0===t.length?!s:t.every(e=>o.includes(e))===s})}function parseIsPredicate(e,t,r,n,s){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const _="is?"===r?n:s;_[t]||(_[t]={}),_[t][e[1].value]=e[2]?.value??null}function parseSetDirective(e,t,r){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error('Arguments to `#set!` predicate must be strings.".');r[t]||(r[t]={}),r[t][e[1].value]=e[2]?.value??null}function parsePattern(e,t,r,n,s,_,a,o,i,l,d){if(t===PREDICATE_STEP_TYPE_CAPTURE){const e=n[r];_.push({type:"capture",name:e})}else if(t===PREDICATE_STEP_TYPE_STRING)_.push({type:"string",value:s[r]});else if(_.length>0){if("string"!==_[0].type)throw new Error("Predicates must begin with a literal value");const t=_[0].value;switch(t){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":parseAnyPredicate(_,e,t,a);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":parseMatchPredicate(_,e,t,a);break;case"not-any-of?":case"any-of?":parseAnyOfPredicate(_,e,t,a);break;case"is?":case"is-not?":parseIsPredicate(_,e,t,l,d);break;case"set!":parseSetDirective(_,e,i);break;default:o[e].push({operator:t,operands:_.slice(1)})}_.length=0}}__name(parseAnyPredicate,"parseAnyPredicate"),__name(parseMatchPredicate,"parseMatchPredicate"),__name(parseAnyOfPredicate,"parseAnyOfPredicate"),__name(parseIsPredicate,"parseIsPredicate"),__name(parseSetDirective,"parseSetDirective"),__name(parsePattern,"parsePattern");var Query=class{static{__name(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){const r=C.lengthBytesUTF8(t),n=C._malloc(r+1);C.stringToUTF8(t,n,r+1);const s=C._ts_query_new(e[0],n,r,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!s){const e=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=C.getValue(TRANSFER_BUFFER,"i32"),s=C.UTF8ToString(n,r).length,_=t.slice(s,s+100).split("\n")[0],a=_.match(QUERY_WORD_REGEX)?.[0]??"";switch(C._free(n),e){case QueryErrorKind.Syntax:throw new QueryError(QueryErrorKind.Syntax,{suffix:`${s}: '${_}'...`},s,0);case QueryErrorKind.NodeName:case QueryErrorKind.FieldName:case QueryErrorKind.CaptureName:throw new QueryError(e,{word:a},s,a.length);case QueryErrorKind.PatternStructure:throw new QueryError(e,{suffix:`${s}: '${_}'...`},s,0)}}const _=C._ts_query_string_count(s),a=C._ts_query_capture_count(s),o=C._ts_query_pattern_count(s),i=new Array(a),l=new Array(o),d=new Array(_);for(let e=0;e<a;e++){const t=C._ts_query_capture_name_for_id(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");i[e]=C.UTF8ToString(t,r)}for(let e=0;e<o;e++){const t=new Array(a);for(let r=0;r<a;r++){const n=C._ts_query_capture_quantifier_for_id(s,e,r);t[r]=n}l[e]=t}for(let e=0;e<_;e++){const t=C._ts_query_string_value_for_id(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");d[e]=C.UTF8ToString(t,r)}const u=new Array(o),c=new Array(o),m=new Array(o),p=new Array(o),h=new Array(o);for(let e=0;e<o;e++){const t=C._ts_query_predicates_for_pattern(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");p[e]=[],h[e]=[];const n=new Array;let _=t;for(let t=0;t<r;t++){const t=C.getValue(_,"i32");_+=SIZE_OF_INT;const r=C.getValue(_,"i32");_+=SIZE_OF_INT,parsePattern(e,t,r,i,d,n,h,p,u,c,m)}Object.freeze(h[e]),Object.freeze(p[e]),Object.freeze(u[e]),Object.freeze(c[e]),Object.freeze(m[e])}C._free(n),this[0]=s,this.captureNames=i,this.captureQuantifiers=l,this.textPredicates=h,this.predicates=p,this.setProperties=u,this.assertedProperties=c,this.refutedProperties=m,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(e,t={}){const r=t.startPosition??ZERO_POINT,n=t.endPosition??ZERO_POINT,s=t.startIndex??0,_=t.endIndex??0,a=t.startContainingPosition??ZERO_POINT,o=t.endContainingPosition??ZERO_POINT,i=t.startContainingIndex??0,l=t.endContainingIndex??0,d=t.matchLimit??4294967295,u=t.maxStartDepth??4294967295,c=t.progressCallback;if("number"!=typeof d)throw new Error("Arguments must be numbers");if(this.matchLimit=d,0!==_&&s>_)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==ZERO_POINT&&(r.row>n.row||r.row===n.row&&r.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(0!==l&&i>l)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(o!==ZERO_POINT&&(a.row>o.row||a.row===o.row&&a.column>o.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");c&&(C.currentQueryProgressCallback=c),marshalNode(e),C._ts_query_matches_wasm(this[0],e.tree[0],r.row,r.column,n.row,n.column,s,_,a.row,a.column,o.row,o.column,i,l,d,u);const m=C.getValue(TRANSFER_BUFFER,"i32"),p=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),h=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),g=new Array(m);this.exceededMatchLimit=Boolean(h);let f=0,y=p;for(let t=0;t<m;t++){const t=C.getValue(y,"i32");y+=SIZE_OF_INT;const r=C.getValue(y,"i32");y+=SIZE_OF_INT;const n=new Array(r);if(y=unmarshalCaptures(this,e.tree,y,t,n),this.textPredicates[t].every(e=>e(n))){g[f]={patternIndex:t,captures:n};const e=this.setProperties[t];g[f].setProperties=e;const r=this.assertedProperties[t];g[f].assertedProperties=r;const s=this.refutedProperties[t];g[f].refutedProperties=s,f++}}return g.length=f,C._free(p),C.currentQueryProgressCallback=null,g}captures(e,t={}){const r=t.startPosition??ZERO_POINT,n=t.endPosition??ZERO_POINT,s=t.startIndex??0,_=t.endIndex??0,a=t.startContainingPosition??ZERO_POINT,o=t.endContainingPosition??ZERO_POINT,i=t.startContainingIndex??0,l=t.endContainingIndex??0,d=t.matchLimit??4294967295,u=t.maxStartDepth??4294967295,c=t.progressCallback;if("number"!=typeof d)throw new Error("Arguments must be numbers");if(this.matchLimit=d,0!==_&&s>_)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==ZERO_POINT&&(r.row>n.row||r.row===n.row&&r.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(0!==l&&i>l)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(o!==ZERO_POINT&&(a.row>o.row||a.row===o.row&&a.column>o.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");c&&(C.currentQueryProgressCallback=c),marshalNode(e),C._ts_query_captures_wasm(this[0],e.tree[0],r.row,r.column,n.row,n.column,s,_,a.row,a.column,o.row,o.column,i,l,d,u);const m=C.getValue(TRANSFER_BUFFER,"i32"),p=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),h=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),g=new Array;this.exceededMatchLimit=Boolean(h);const f=new Array;let y=p;for(let t=0;t<m;t++){const t=C.getValue(y,"i32");y+=SIZE_OF_INT;const r=C.getValue(y,"i32");y+=SIZE_OF_INT;const n=C.getValue(y,"i32");if(y+=SIZE_OF_INT,f.length=r,y=unmarshalCaptures(this,e.tree,y,t,f),this.textPredicates[t].every(e=>e(f))){const e=f[n],r=this.setProperties[t];e.setProperties=r;const s=this.assertedProperties[t];e.assertedProperties=s;const _=this.refutedProperties[t];e.refutedProperties=_,g.push(e)}}return C._free(p),C.currentQueryProgressCallback=null,g}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){const t=C.lengthBytesUTF8(e),r=C._malloc(t+1);C.stringToUTF8(e,r,t+1),C._ts_query_disable_capture(this[0],r,t),C._free(r)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);C._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return C._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return 1===C._ts_query_is_pattern_rooted(this[0],e)}isPatternNonLocal(e){return 1===C._ts_query_is_pattern_non_local(this[0],e)}isPatternGuaranteedAtStep(e){return 1===C._ts_query_is_pattern_guaranteed_at_step(this[0],e)}};module.exports.default=module.exports}};const __webpack_module_cache__={};function __webpack_require__(e){const t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;const r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;__webpack_require__.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}const s=Object.create(null);__webpack_require__.r(s);const _={};t=t||[null,e({}),e([]),e(e)];for(var a=2&n&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>_[e]=()=>r[e]);return _.default=()=>r,__webpack_require__.d(s,_),s}})(),__webpack_require__.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var n=t[r++],s=t[r++];__webpack_require__.o(e,n)?0===s&&r++:0===s?Object.defineProperty(e,n,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,n,{enumerable:!0,get:s})}else for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let __webpack_exports__=__webpack_require__(186);module.exports=__webpack_exports__})();
2
+ (()=>{"use strict";var __webpack_modules__={186(e,t,r){var n,s=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),_=0;_<r.length;_++)"default"!==r[_]&&s(t,e,r[_]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0});const o=_(r(896)),i=r(212),l=r(106),u=r(58),d=r(380),c=["base-ref","report","medium-nesting","high-nesting","medium-cyclomatic","high-cyclomatic","medium-cognitive","high-cognitive"];function m(e,t){if(void 0!==e.mediumThreshold||void 0!==e.highThreshold)return{...t,mediumThreshold:e.mediumThreshold??t.mediumThreshold,highThreshold:e.highThreshold??t.highThreshold}}(async function(){const e=function(e){const t=[],r=new Map;for(let n=0;n<e.length;n++){const s=e[n];if(s.startsWith("--")){const t=s.slice(2);c.includes(t)&&(r.set(t,e[n+1]),n++)}else t.push(s)}const n=e=>r.get(e),s=e=>{const t=n(e);return void 0!==t?Number(t):void 0};return{paths:t,baseRef:n("base-ref"),report:n("report"),nesting:{mediumThreshold:s("medium-nesting"),highThreshold:s("high-nesting")},cyclomatic:{mediumThreshold:s("medium-cyclomatic"),highThreshold:s("high-cyclomatic")},cognitive:{mediumThreshold:s("medium-cognitive"),highThreshold:s("high-cognitive")}}}(process.argv.slice(2)),t=function(e){return{nesting:m(e.nesting,i.DEFAULT_NESTING_THRESHOLDS),cyclomatic:m(e.cyclomatic,l.DEFAULT_CYCLOMATIC_THRESHOLDS),cognitive:m(e.cognitive,u.DEFAULT_COGNITIVE_THRESHOLDS)}}(e),r=e.report??(e.baseRef||1!==e.paths.length?"md":"json");e.baseRef?await(0,d.runDiff)(e.baseRef,e.paths,t,r):(0===e.paths.length&&((0,d.printUsage)(),process.exit(2)),1===e.paths.length&&o.existsSync(e.paths[0])&&o.statSync(e.paths[0]).isFile()&&!e.report?await(0,d.runLegacySingleFile)(e.paths[0],t):await(0,d.runScan)(e.paths,t,r))})().catch(e=>{console.error("energy-state-cli failed:",e),process.exit(1)})},380(e,t,r){var n,s=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),_=0;_<r.length;_++)"default"!==r[_]&&s(t,e,r[_]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.printUsage=g,t.runLegacySingleFile=async function(e,t){(0,m.resolveLanguageForFile)(e)||(console.error(`Unsupported file type: ${e}`),g(),process.exit(2));const r=o.readFileSync(e,"utf8"),n=await E(e,r,t);console.log(JSON.stringify(n,null,2));const s=n.some(e=>e.severity===f.SEVERITY.HIGH||e.severity===f.SEVERITY.MEDIUM);process.exit(s?1:0)},t.runScan=async function(e,t,r){const n=(0,p.resolveSupportedFiles)(e),s=[];for(const e of n){const r=o.readFileSync(e,"utf8"),n=await E(e,r,t);s.push({filePath:i.relative(process.cwd(),e),violations:n})}const a=(0,h.summarize)(s);var _;"human"===r?console.log((0,h.renderHumanReport)(s)):"md"===r?console.log((0,h.renderMarkdownReport)(a)):console.log(JSON.stringify(a,null,2)),_=a.totalCounts,process.exit((0,h.hasBlockingViolations)(_)?1:0)},t.runDiff=async function(e,t,r,n){const s=(t.length>0?t:function(e){return(0,l.execFileSync)("git",["diff","--name-only","--diff-filter=d",`${e}...HEAD`],{encoding:"utf8"}).split("\n").map(e=>e.trim()).filter(Boolean)}(e)).filter(e=>(0,m.resolveLanguageForFile)(e)&&o.existsSync(e)),a=[],_=[];for(const t of s){const n=o.readFileSync(t,"utf8"),s=await E(t,n,r);a.push((0,h.summarizeFile)({filePath:t,violations:s}));const i=w(e,t);if(null!==i){const e=await E(t,i,r);_.push((0,h.summarizeFile)({filePath:t,violations:e}))}}const i=(0,h.diffSummaries)(_,a);console.log("md"===n?(0,h.renderDiffMarkdown)(i,e):JSON.stringify(i,null,2)),process.exit(i.some(e=>"worsened"===e.status)?1:0)};const o=_(r(896)),i=_(r(928)),l=r(317),{Parser:u,Language:d}=r(43),c=r(958),m=r(912),p=r(53),h=r(254),f=r(613);function g(){console.error("Usage: energy-state-cli <file.py|.fs|.fsx|.ts> [thresholds...]"),console.error(" energy-state-cli <path...> [--report json|md|human] [thresholds...] (scan a directory/subtree)"),console.error(" energy-state-cli --base-ref <ref> [<path...>] [--report json|md] [thresholds...] (diff PR head against a base ref)"),console.error("Thresholds: --medium-nesting N --high-nesting N --medium-cyclomatic N --high-cyclomatic N --medium-cognitive N --high-cognitive N")}const y=new Map;async function E(e,t,r){const n=(0,m.resolveLanguageForFile)(e);if(!n)return[];const s=await async function(e){const t=y.get(e);if(t)return t;await u.init();const r=new u,n=i.join(__dirname,"..",e.grammarPath),s=await d.load(n);return r.setLanguage(s),y.set(e,r),r}(n),a=s.parse(t);return(0,c.analyzeSource)(t,a,n,e,r)}function w(e,t){try{return(0,l.execFileSync)("git",["show",`${e}:${t}`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch(r){return console.error(`energy-state-cli: could not read ${t} at ${e} (new file or rename) — treating as new`),null}}},958(e,t,r){t.analyzeSource=function(e,t,r,f,g={}){const y=(0,n.createPositionLookup)(e),E=[];return E.push(...(0,s.analyzeNesting)(t,y,r,g.nesting??s.DEFAULT_NESTING_THRESHOLDS)),E.push(...(0,a.analyzeFunctionComplexity)(t,y,r,g.cyclomatic??a.DEFAULT_CYCLOMATIC_THRESHOLDS)),E.push(...(0,_.analyzeCognitiveComplexity)(t,y,r,g.cognitive??_.DEFAULT_COGNITIVE_THRESHOLDS)),E.push(...(0,o.analyzeFileCoherence)(t,f,r,g.coherence??o.DEFAULT_COHERENCE_THRESHOLDS)),E.push(...(0,i.analyzeMagicNumbers)(t,y,r,g.magicNumber??i.DEFAULT_MAGIC_NUMBER_OPTIONS)),E.push(...(0,l.analyzeMagicStrings)(t,y,r,g.magicString??l.DEFAULT_MAGIC_STRING_OPTIONS)),E.push(...(0,u.analyzeParameterCount)(t,y,r)),E.push(...(0,d.analyzeInversionOpportunities)(t,y,r)),E.push(...(0,c.analyzePrimitiveObsession)(t,y,r)),E.push(...(0,m.analyzeMatchOpportunities)(t,y,r,g.matchOpportunity??m.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS)),E.push(...(0,p.analyzeLogicalControlFlow)(t,y,r)),E.push(...(0,h.analyzeOpaqueBooleanLiteral)(t,y,r)),E};const n=r(599),s=r(212),a=r(106),_=r(58),o=r(764),i=r(268),l=r(668),u=r(622),d=r(907),c=r(164),m=r(774),p=r(632),h=r(487)},58(e,t,r){t.DEFAULT_COGNITIVE_THRESHOLDS=void 0,t.analyzeCognitiveComplexity=function(e,r,_,o=t.DEFAULT_COGNITIVE_THRESHOLDS){const i=[];return function e(t){if(_.isFunctionDefinition(t)){const e=s(t,_);if(e>o.mediumThreshold){const s=r.toPosition(t.startIndex);i.push({line:s.line,column:s.column,type:n.VIOLATION_TYPE.COGNITIVE,severity:e>o.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`High cognitive complexity: ${e}. This function is hard to read; consider flattening nesting or extracting functions.`,hotspots:a(t,r,_)})}}for(const r of t.children)e(r)}(e.rootNode),i};const n=r(613);function s(e,t,r){let n=0;const{nodeTypes:s}=t;function a(e,t){n+=t,r?.(e,t)}function _(e,r){for(const n of e.children)o(n,t.entersNestedScope(n)?r+1:r)}function o(e,r){const n=t.getBooleanOperator(e);if(n){t.getBooleanOperator(e.parent)!==n&&a(e,1);for(const t of e.children)o(t,r)}else{if(t.cognitiveNestedDecisionTypes.includes(e.type))return a(e,1+r),void _(e,r);if(e.type===s.elseClause)return a(e,1),void _(e,r);if(e.type!==s.conditionalExpression)if(t.isFunctionDefinition(e))a(e,1+r);else{if(e.type===s.lambda)return a(e,1+r),void _(e,r);for(const t of e.children||[])o(t,r)}else{a(e,1+r);for(const t of e.children)o(t,r+1)}}}for(const t of e.children)o(t,0);return n}function a(e,t,r){const n=[];return s(e,r,(e,r)=>{n.push({line:t.toPosition(e.startIndex).line,weight:r})}),n}t.DEFAULT_COGNITIVE_THRESHOLDS={mediumThreshold:15,highThreshold:25}},764(e,t,r){t.DEFAULT_COHERENCE_THRESHOLDS=void 0,t.analyzeFileCoherence=function(e,r,n,s=t.DEFAULT_COHERENCE_THRESHOLDS){const{functions:i,imports:l}=function(e,t){const r=[],n=[],{nodeTypes:s}=t;return function e(a){t.isFunctionDefinition(a)?r.push(a):!a.isNamed||a.type!==s.importStatement&&a.type!==s.importFromStatement||n.push(a.text||"");for(const t of a.children)e(t)}(e.rootNode),{functions:r,imports:n}}(e,n);return[a(i,r,s),_(i,s),o(l)].filter(e=>null!==e)};const n=r(613);function s(e){const t=e.children?.find(e=>"identifier"===e.type);if(!t?.text)return null;const r=/^[a-z]+/.exec(t.text);return r?r[0]:t.text.toLowerCase()}function a(e,t,r){if(e.length<=8)return null;const a=t.split("/").pop()||"",_=a.includes("util")||a.includes("helper")||a.includes("common"),o=!_&&function(e,t){const r=e.map(s).filter(e=>null!==e);if(0===r.length)return!1;const n=new Map;for(const e of r)n.set(e,(n.get(e)??0)+1);return Math.max(...n.values())/r.length>=t}(e,r.singleDomainNameShare);return!_&&(e.length<=12||o)?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:e.length>15?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`File coherence warning: ${e.length} functions in one file. Consider splitting by domain.`}}function _(e,t){const r=e.filter(e=>{return(r=e).endPosition.row-r.startPosition.row+1>t.largeFunctionLines;var r});return r.length<=t.maxLargeFunctions?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:r.length>1.5*t.maxLargeFunctions?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`${r.length} functions exceed ${t.largeFunctionLines} lines. Large functions carry more complexity than function count alone suggests.`}}function o(e){return e.length<=10?null:{line:0,column:0,type:n.VIOLATION_TYPE.COHERENCE,severity:e.length>15?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Import sprawl: ${e.length} imports suggest this file does too much.`}}t.DEFAULT_COHERENCE_THRESHOLDS={largeFunctionLines:20,maxLargeFunctions:5,singleDomainNameShare:.7}},106(e,t,r){t.DEFAULT_CYCLOMATIC_THRESHOLDS=void 0,t.analyzeFunctionComplexity=function(e,r,a,_=t.DEFAULT_CYCLOMATIC_THRESHOLDS){const o=[];return function e(t){if(a.isFunctionDefinition(t)){const e=function(e,t){let r=1;return function e(n,s){if((t.decisionNodeTypes.includes(n.type)||null!==t.getBooleanOperator(n)||t.isTryElseClause(n))&&r++,s||!t.isFunctionDefinition(n))for(const t of n.children)e(t,!1)}(e,!0),r}(t,a);if(e>_.mediumThreshold){const i=r.toPosition(t.startIndex);o.push({line:i.line,column:i.column,type:n.VIOLATION_TYPE.COMPLEXITY,severity:e>_.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`High cyclomatic complexity: ${e}. Consider breaking down this function.`,hotspots:s(t,r,a)})}}for(const r of t.children)e(r)}(e.rootNode),o};const n=r(613);function s(e,t,r){const n=[];return function e(s,a,_){let o=a;if(r.decisionNodeTypes.includes(s.type)||null!==r.getBooleanOperator(s)||r.isTryElseClause(s)){const e=t.toPosition(s.startIndex).line;n.push({line:e,weight:1+a}),o=a+1}if(_||!r.isFunctionDefinition(s))for(const t of s.children)e(t,o,!1)}(e,0,!0),n}t.DEFAULT_CYCLOMATIC_THRESHOLDS={mediumThreshold:10,highThreshold:15}},907(e,t,r){t.analyzeInversionOpportunities=function(e,t,r){const s=[],{nodeTypes:a}=r;return function e(_){r.isFunctionDefinition(_)&&function(e){const _=e.children.find(e=>e.type===a.block)??e.children.flatMap(e=>e.children??[]).find(e=>e.type===a.block);if(!_)return;const o=_.children.filter(e=>e.isNamed&&e.type!==a.comment&&e.text?.trim());if(o.length>=1){const r=o[0];if(r.type===a.ifStatement){const _=r.children.find(e=>e.type===a.block);if(_&&_.children.length>2){const a=e.endIndex-e.startIndex;if((_.endIndex-_.startIndex)/a>.5){const e=t.toPosition(r.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:"Consider inverting this condition and using early return for cleaner flow."})}}}}!function(e){let _=e,o=0;const i=[];for(;_&&o<4;){const e=_.children?.filter(e=>r.nestingControlTypes.includes(e.type))||[];if(1!==e.length||e[0].type!==a.ifStatement)break;{const t=e[0];if(i.push(t),a.elseClause?t.children.some(e=>e.type===a.elseClause):t.children.filter(e=>e.type===a.block).length>1||t.children.some(e=>e.type===a.ifStatement))break;_=t.children.find(e=>e.type===a.block),o++}}if(i.length>=2){const e=i[0],r=t.toPosition(e.startIndex);s.push({line:r.line,column:r.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:`Found ${i.length} nested validation checks. Consider using guard clauses with early returns.`})}}(_),function(e){let _=0,o=null;if(function e(t,n=0){if(!r.isFunctionDefinition(t)){t.type===a.ifStatement&&(n>_&&(_=n,o=t),n++);for(const r of t.children||[])e(r,n)}}(e),_>=3&&o){const e=t.toPosition(o.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.INVERSION,severity:n.SEVERITY.MEDIUM,message:`Deep if-nesting (${_} levels). Consider inverting conditions or extracting functions.`})}}(_)}(_);for(const t of _.children)e(t)}(e.rootNode),s};const n=r(613)},632(e,t,r){t.analyzeLogicalControlFlow=function(e,t,r){const s=[],{nodeTypes:a}=r;return function e(_){const o=r.getBooleanOperator(_);if(null!==o&&_.parent?.type===a.expressionStatement){const e=t.toPosition(_.startIndex);s.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.LOGICAL_CONTROL_FLOW,severity:n.SEVERITY.LOW,message:"and"===o?"If-statement disguised as '&&'. Consider an explicit if-statement instead.":"If-statement disguised as '||'. Consider an explicit if-statement instead."})}for(const t of _.children)e(t)}(e.rootNode),s};const n=r(613)},268(e,t,r){t.DEFAULT_MAGIC_NUMBER_OPTIONS=void 0,t.analyzeMagicNumbers=function(e,r,s,a=t.DEFAULT_MAGIC_NUMBER_OPTIONS){const _=[];if(!a.enabled)return _;const{nodeTypes:o}=s;function i(e){let t=e.parent;for(;t;){if(s.isFunctionDefinition(t))return!0;t=t.parent}return!1}return function e(t){if(t.type===o.integerLiteral||t.type===o.floatLiteral){const e=parseFloat(t.text);if(!Number.isNaN(e)){const l=function(e,t){const r=e.parent;return 2===r?.children?.length&&"-"===r.children[0]?.text?-t:t}(t,e);if(!(a.allowlist.includes(l)||function(e){let t=e.parent;for(;t;){if(t.type===o.assignment){if(s.isFunctionDefinition(t))return!1;if(s.isExplicitConstant(t))return!0;let e=t.parent;if(e?.type===o.expressionStatement&&(e=e.parent),e?.type===o.module)return!i(t);if(o.exportStatement&&e?.type===o.exportStatement&&e.parent?.type===o.module)return!0}t=t.parent}return!1}(t)||function(e){return!!e.parent&&s.subscriptNodeTypes.includes(e.parent.type)}(t)||s.isDefaultParameterValue(t))){const e=r.toPosition(t.startIndex);_.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.MAGIC,severity:n.SEVERITY.LOW,message:`Magic number: ${t.text}. Consider extracting to a named constant.`})}}return}for(const r of t.children)e(r)}(e.rootNode),_};const n=r(613);t.DEFAULT_MAGIC_NUMBER_OPTIONS={enabled:!0,allowlist:[0,1,-1,2]}},668(e,t,r){t.DEFAULT_MAGIC_STRING_OPTIONS=void 0,t.analyzeMagicStrings=function(e,r,s,a=t.DEFAULT_MAGIC_STRING_OPTIONS){const _=[];if(!a.enabled)return _;const{nodeTypes:o}=s;const i=[];!function e(t){if(t.type===o.stringLiteral){const e=(r=t.text).length>=2?r.slice(1,-1):r;(function(e,t){return function(e){return[e.parent,e.parent?.parent].filter(Boolean).some(t=>s.getEqualityComparisons(t).some(({left:t,right:r})=>t.id===e.id||r.id===e.id))}(e)||function(e,t){const r=e.parent?.parent;return!!r&&s.getMembershipComparisons(r).some(({values:e})=>e.includes(t))}(e,t)||function(e){return!!e.parent&&s.subscriptNodeTypes.includes(e.parent.type)}(e)})(t,e)&&!function(e,t){return function(e){return e.parent?.type===o.expressionStatement}(e)||s.isFormattedOrInterpolatedString(e)||a.allowlist.includes(t)||t.length<=1}(t,e)&&i.push({node:t,content:e})}var r;for(const r of t.children)e(r)}(e.rootNode);const l=new Map;for(const e of i){const t=l.get(e.content)??[];t.push(e),l.set(e.content,t)}for(const[e,t]of l){if(t.length<a.minDuplicates)continue;const s=t[0].node,o=r.toPosition(s.startIndex);_.push({line:o.line,column:o.column,type:n.VIOLATION_TYPE.MAGIC,severity:n.SEVERITY.LOW,message:`Magic string: "${e}" is compared/keyed against directly ${t.length} time(s). Consider extracting to a named constant or enum.`})}return _};const n=r(613);t.DEFAULT_MAGIC_STRING_OPTIONS={enabled:!0,minDuplicates:2,allowlist:["","utf-8","__main__"]}},774(e,t,r){t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS=void 0,t.analyzeMatchOpportunities=function(e,r,s,a=t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS){const _=[],{nodeTypes:o}=s,i=new Set;return function e(t){t.type!==o.ifStatement||i.has(t)||function(e){const t=function(e,t){const r=[e],n=t.getElseIfBranches(e);if(n.length>0)return r.push(...n),r;let s=e;for(;;){const e=t.nodeTypes.elseClause?s.children?.find(e=>e.type===t.nodeTypes.elseClause)?.children?.find(e=>e.type===t.nodeTypes.ifStatement):s.children?.find(e=>e.type===t.nodeTypes.ifStatement);if(!e)break;r.push(e),s=e}return r}(e,s);if(t.slice(1).forEach(e=>i.add(e)),t.length<a.minBranches)return;const o=t.map(e=>function(e,t,r){const{nodeTypes:n}=r,s=[];function a(e){return r.variableReferenceNodeTypes.includes(e.type)}function _(e){return e.type===n.stringLiteral||e.type===n.integerLiteral||e.type===n.floatLiteral}function o(e){return e.type===n.stringLiteral?e.text.slice(1,-1):e.text}return function e(i){if(!t.has(i)&&i.type!==n.block&&i.type!==n.elseClause){for(const{left:e,right:t}of r.getEqualityComparisons(i))a(e)&&_(t)?s.push({variable:e.text,value:o(t)}):a(t)&&_(e)&&s.push({variable:t.text,value:o(e)});for(const{left:e,values:t}of r.getMembershipComparisons(i))a(e)&&t.forEach(t=>s.push({variable:e.text,value:t}));for(const t of i.children||[])e(t)}}(e),s}(e,new Set(t.filter(t=>t!==e)),s));if(o.some(e=>0===e.length))return;const l=o[0].map(e=>e.variable).find(e=>o.every(t=>t.some(t=>t.variable===e)));if(!l)return;const u=r.toPosition(e.startIndex);_.push({line:u.line,column:u.column,type:n.VIOLATION_TYPE.MATCH_OPPORTUNITY,severity:n.SEVERITY.LOW,message:`This ${t.length}-way if/elif chain all branch on '${l}'. Consider a match/switch statement for clearer, exhaustiveness-checked dispatch.`})}(t);for(const r of t.children||[])e(r)}(e.rootNode),_};const n=r(613);t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS={minBranches:3}},212(e,t,r){t.DEFAULT_NESTING_THRESHOLDS=void 0,t.analyzeNesting=function(e,r,s,a=t.DEFAULT_NESTING_THRESHOLDS){const _=[];return function e(t,o=0){if(s.nestingControlTypes.includes(t.type)){if(o>a.mediumThreshold){const e=r.toPosition(t.startIndex);_.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.NESTING,severity:o>a.highThreshold?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Excessive nesting depth: ${o}. Consider extracting.`})}o++}for(const r of t.children)e(r,o)}(e.rootNode),_};const n=r(613);t.DEFAULT_NESTING_THRESHOLDS={mediumThreshold:3,highThreshold:5}},487(e,t,r){t.analyzeOpaqueBooleanLiteral=function(e,t,r){const s=[];return function e(a){r.isBooleanLiteral(a)&&r.isPositionalCallArgument(a)&&s.push(function(e,t){const r=t.toPosition(e.startIndex);return{line:r.line,column:r.column,type:n.VIOLATION_TYPE.OPAQUE_BOOLEAN,severity:n.SEVERITY.LOW,message:`Opaque boolean literal: a bare '${e.text}' passed positionally tells the reader nothing without checking the callee's signature. Name it at the call site (a keyword argument, an object-literal field, or F#'s named-argument syntax) — or better, split into two clearly named functions (e.g. enableX()/disableX()) or use an enum.`}}(a,t));for(const t of a.children)e(t)}(e.rootNode),s};const n=r(613)},622(e,t,r){t.findParametersNode=s,t.analyzeParameterCount=function(e,t,r){const a=[];return function e(_){if(r.isFunctionDefinition(_)){const e=s(_,r.nodeTypes.parameters);if(e){const s=e.children.filter(e=>r.parameterChildTypes.includes(e.type)).length;if(s>5){const e=t.toPosition(_.startIndex);a.push({line:e.line,column:e.column,type:n.VIOLATION_TYPE.PARAMETERS,severity:s>8?n.SEVERITY.HIGH:n.SEVERITY.MEDIUM,message:`Parameter explosion: ${s} parameters. Consider using objects or builder pattern.`})}}}for(const t of _.children)e(t)}(e.rootNode),a};const n=r(613);function s(e,t){for(const r of e.children)if(r.type===t)return r;for(const r of e.children){const e=s(r,t);if(e)return e}}},164(e,t,r){t.analyzePrimitiveObsession=function(e,t,r){const _=[];return function e(o){if(r.isFunctionDefinition(o)){const e=(0,s.findParametersNode)(o,r.nodeTypes.parameters);e&&_.push(...function(e,t,r){const s=[];let a=!1;const _=[];for(const t of e.children){if(r.keywordOnlyBoundaryTypes.includes(t.type)){a=!0;continue}const e=r.extractTypedParameter(t);e&&_.push({...e,node:t,keywordOnly:a})}for(let e=0;e<_.length-1;e++){const a=_[e],o=_[e+1];if(a.type!==o.type||!r.primitiveTypeNames.has(a.type))continue;if(a.keywordOnly&&o.keywordOnly)continue;const i=t.toPosition(a.node.startIndex);s.push({line:i.line,column:i.column,type:n.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:n.SEVERITY.MEDIUM,message:`Primitive obsession: consecutive parameters '${a.name}: ${a.type}' and '${o.name}: ${o.type}' share the same primitive type — a caller can swap them and nothing will complain. Consider ${r.distinctTypeAdvice} so the type checker catches it.`})}return s}(e,t,r)),_.push(...function(e,t,r){const{nodeTypes:s}=r,_=new Map,o=new Map;function i(e){return r.variableReferenceNodeTypes.includes(e.type)}function l(e,t){const r=e.text;_.has(r)||(_.set(r,new Set),o.set(r,e));const n=_.get(r);t.forEach(e=>n.add(e))}!function e(t){for(const{left:e,right:n}of r.getEqualityComparisons(t))i(e)&&n.type===s.stringLiteral?l(e,[a(n.text)]):i(n)&&e.type===s.stringLiteral&&l(n,[a(e.text)]);for(const{left:e,values:n}of r.getMembershipComparisons(t))i(e)&&n.length>0&&l(e,n);for(const r of t.children)e(r)}(e);const u=[];for(const[e,r]of _)if(r.size>=3){const s=o.get(e),a=t.toPosition(s.startIndex),_=Array.from(r).slice(0,4);u.push({line:a.line,column:a.column,type:n.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:n.SEVERITY.LOW,message:`Stringly-typed control flow: '${e}' is compared against ${r.size} distinct string literals (${_.join(", ")}${r.size>_.length?", …":""}). Consider an Enum or Literal type to catch typos and get exhaustiveness checking.`})}return u}(o,t,r))}for(const t of o.children)e(t)}(e.rootNode),_};const n=r(613),s=r(622);function a(e){return e.slice(1,-1)}},599(e,t){t.createPositionLookup=function(e){const t=[0];for(let r=0;r<e.length;r++)"\n"===e[r]&&t.push(r+1);return{toPosition(e){let r=0,n=t.length-1;for(;r<n;){const s=Math.ceil((r+n)/2);t[s]<=e?r=s:n=s-1}return{line:r,column:e-t[r]}}}}},254(e,t,r){t.summarizeFile=s,t.summarize=function(e){const t=e.map(s),r={low:0,medium:0,high:0};let n=0;for(const e of t)n+=e.score,r.low+=e.counts.low,r.medium+=e.counts.medium,r.high+=e.counts.high;return{files:t,totalScore:n,totalCounts:r}},t.hasBlockingViolations=function(e){return e.medium>0||e.high>0},t.renderMarkdownReport=function(e){const t=e.files.filter(e=>0===e.score).length,r=[];r.push("# Energy State Report"),r.push(""),r.push(`**${e.files.length} file${1===e.files.length?"":"s"} scanned** — ${t} clean, ${e.files.length-t} with violations`),r.push(""),r.push("| File | Score | High | Medium | Low |"),r.push("| --- | --- | --- | --- | --- |");for(const t of e.files)r.push(`| ${t.filePath} | ${t.score} | ${t.counts.high} | ${t.counts.medium} | ${t.counts.low} |`);return r.push(""),r.push(`**Total score: ${e.totalScore}** (${e.totalCounts.high} high, ${e.totalCounts.medium} medium, ${e.totalCounts.low} low)`),r.join("\n")},t.diffSummaries=function(e,t){const r=new Map(e.map(e=>[e.filePath,e.score]));return t.map(e=>{const t=r.get(e.filePath)??null,n=null===t?e.score:e.score-t,s=null===t?"new":n<0?"improved":n>0?"worsened":"unchanged";return{filePath:e.filePath,baseScore:t,headScore:e.score,delta:n,status:s}})},t.renderDiffMarkdown=function(e,t){const r=[];r.push(`# Energy State Diff vs \`${t}\``),r.push(""),r.push("| File | Base | Head | Δ | Status |"),r.push("| --- | --- | --- | --- | --- |");for(const t of e){const e=null===t.baseScore?"—":String(t.baseScore),n=null===t.baseScore?"—":t.delta>0?`+${t.delta}`:String(t.delta);r.push(`| ${t.filePath} | ${e} | ${t.headScore} | ${n} | ${a[t.status]} ${t.status} |`)}const n=e.filter(e=>"worsened"===e.status).length,s=e.filter(e=>"improved"===e.status).length,_=e.filter(e=>"new"===e.status).length;return r.push(""),r.push(`_${e.length} file${1===e.length?"":"s"} changed, ${n} worsened, ${s} improved, ${_} new._`),r.join("\n")},t.renderHumanReport=function(e){const t=e.filter(e=>e.violations.length>0).sort((e,t)=>f(t.violations)-f(e.violations)),r=e.length-t.length,n=[];n.push("# Energy State Report"),n.push(""),n.push(y),n.push(""),n.push(`**${e.length} file${1===e.length?"":"s"} scanned** — ${r} clean, ${t.length} flagged`),n.push("");for(const e of t)n.push(g(e)),n.push("");n.push("## Total evaluation"),n.push("");const s=e.map(e=>({filePath:e.filePath,score:f(e.violations)})),a=s.reduce((e,t)=>t.score>e.score?t:e,{filePath:"",score:0}),_=i(a.score);a.score>0?n.push(`**Repo score: ${a.score.toFixed(1)} (${l[_]})** — driven by the worst file in the scan, \`${a.filePath}\` (${u[_]}).`):n.push("**Repo score: 0.0 (None)** — no violations were found anywhere in the scan."),n.push(""),n.push("This is the _maximum_ file score, not an average across files — see the note at the top of this report for why an average would hide the file most worth fixing."),n.push("");const o={none:0,low:0,medium:0,high:0,critical:0};for(const{score:e}of s)o[i(e)]+=1;n.push("| Risk | Files |"),n.push("| --- | --- |"),n.push(`| None | ${o.none} |`),n.push(`| Low | ${o.low} |`),n.push(`| Medium | ${o.medium} |`),n.push(`| High | ${o.high} |`),n.push(`| Critical | ${o.critical} |`),n.push("");const d={low:0,medium:0,high:0};for(const t of e)for(const e of t.violations)d[e.severity]+=1;const c=d.low+d.medium+d.high;return n.push(`**${c} total finding${1===c?"":"s"}** (${d.high} high, ${d.medium} medium, ${d.low} low) — breadth of issues across the scan, independent of peak severity.`),n.join("\n")};const n=r(613);function s(e){const t={low:0,medium:0,high:0},r={};for(const n of e.violations)t[n.severity]+=1,r[n.type]=(r[n.type]??0)+1;const n=1*t.low+4*t.medium+9*t.high;return{filePath:e.filePath,score:n,counts:t,byType:r}}const a={new:"🆕",improved:"🟢",worsened:"🔴",unchanged:"⚪"},_=[{value:0,score:0},{value:10,score:3.9},{value:20,score:6.9},{value:50,score:8.9},{value:100,score:10}];function o(e){if(e<=0)return 0;if(e>=100)return 10;for(let t=1;t<_.length;t++){const r=_[t-1],n=_[t];if(e<=n.value){const t=(e-r.value)/(n.value-r.value);return Math.round(10*(r.score+t*(n.score-r.score)))/10}}return 10}function i(e){return e<=0?"none":e<4?"low":e<7?"medium":e<9?"high":"critical"}const l={none:"None",low:"Low",medium:"Medium",high:"High",critical:"Critical"},u={none:"no violations found",low:"simple, easy to test exhaustively",medium:"getting harder to cover with tests",high:"complex, testing all paths is impractical",critical:"effectively untestable"},d={[n.VIOLATION_TYPE.NESTING]:"Nesting depth",[n.VIOLATION_TYPE.COMPLEXITY]:"Cyclomatic complexity",[n.VIOLATION_TYPE.COGNITIVE]:"Cognitive complexity",[n.VIOLATION_TYPE.NAMING]:"Naming",[n.VIOLATION_TYPE.COHERENCE]:"File coherence",[n.VIOLATION_TYPE.MAGIC]:"Magic values",[n.VIOLATION_TYPE.PARAMETERS]:"Parameter count",[n.VIOLATION_TYPE.INVERSION]:"Inversion opportunities",[n.VIOLATION_TYPE.PRIMITIVE_OBSESSION]:"Primitive obsession",[n.VIOLATION_TYPE.MATCH_OPPORTUNITY]:"Match opportunities",[n.VIOLATION_TYPE.LOGICAL_CONTROL_FLOW]:"Logical operator as control flow",[n.VIOLATION_TYPE.OPAQUE_BOOLEAN]:"Opaque boolean literals"},c={[n.VIOLATION_TYPE.NESTING]:"control-flow blocks nested deep enough that a reader has to hold several levels of context in mind at once",[n.VIOLATION_TYPE.NAMING]:"naming that obscures intent",[n.VIOLATION_TYPE.COHERENCE]:"the file mixes too many responsibilities (too many functions/imports, or too many large functions) to read as one coherent unit",[n.VIOLATION_TYPE.MAGIC]:"unnamed literals standing in for a value that deserves a name",[n.VIOLATION_TYPE.PARAMETERS]:"a function with enough parameters that call sites are easy to get wrong",[n.VIOLATION_TYPE.INVERSION]:"validation/guard logic that would read more clearly as early returns",[n.VIOLATION_TYPE.PRIMITIVE_OBSESSION]:"adjacent same-typed values a caller could silently swap without the compiler noticing",[n.VIOLATION_TYPE.MATCH_OPPORTUNITY]:"an if/elif chain on one variable that would read more clearly as a match/switch",[n.VIOLATION_TYPE.LOGICAL_CONTROL_FLOW]:"&&/|| used to hide an if statement",[n.VIOLATION_TYPE.OPAQUE_BOOLEAN]:"a bare true/false at a call site that only makes sense by reading the callee"},m=/complexity: (\d+)/i;function p(e){if(e.type!==n.VIOLATION_TYPE.COMPLEXITY&&e.type!==n.VIOLATION_TYPE.COGNITIVE)return;const t=e.message.match(m);return t?Number(t[1]):void 0}function h(e,t){const r=d[e]??e;if(e===n.VIOLATION_TYPE.COMPLEXITY||e===n.VIOLATION_TYPE.COGNITIVE)return function(e,t){const r=t.map(p).filter(e=>void 0!==e).sort((e,t)=>t-e);if(0===r.length)return"";const n=r[0],s=o(n),a=i(s);return`- **${e}**: ${1===r.length?`1 function scores ${n}`:`${r.length} functions score ${r.join(", ")} (worst: ${n})`} — score ${s.toFixed(1)} (${l[a]}): ${u[a]}.`}(r,t);const s={low:0,medium:0,high:0};for(const e of t)s[e.severity]+=1;const a=["high","medium","low"].filter(e=>s[e]>0).map(e=>`${s[e]} ${e}`).join(", "),_=c[e];return`- **${r}**: ${t.length} finding${1===t.length?"":"s"} (${a})${_?` — ${_}`:""}.`}function f(e){const t=e.map(p).filter(e=>void 0!==e);return t.length>0?o(Math.max(...t)):e.some(e=>e.severity===n.SEVERITY.HIGH)?7.5:e.some(e=>e.severity===n.SEVERITY.MEDIUM)?5:e.length>0?2:0}function g(e){const t=[],r=f(e.violations),n=i(r);t.push(`## ${e.filePath} — ${l[n]} (score ${r.toFixed(1)})`),t.push("");const s=new Map;for(const t of e.violations){const e=s.get(t.type)??[];e.push(t),s.set(t.type,e)}for(const[e,r]of s){const n=h(e,r);n&&t.push(n)}return t.join("\n")}const y=["## Score legend","","_Risk is reported on a 0.0–10.0 complexity score, sorted into the same None/Low/Medium/High/Critical levels already used elsewhere in this tool._","","| Score | Risk | Roughly | Cyclomatic/cognitive complexity |","| --- | --- | --- | --- |","| 0.0 | None | No violations found | — |","| 0.1–3.9 | Low | Simple, easy to test exhaustively | 1–10 |","| 4.0–6.9 | Medium | Getting harder to cover with tests | 11–20 |","| 7.0–8.9 | High | Complex, testing all paths is impractical | 21–50 |","| 9.0–10.0 | Critical | Effectively untestable | 50+ |","","_Cyclomatic and cognitive complexity numbers are converted to the score using the ranges above. Other detectors flag a pattern rather than a path count, so a file with no complexity violations of its own instead gets a fixed score from its worst other finding (Low 2.0 / Medium 5.0 / High 7.5)._"].join("\n")},53(e,t,r){var n,s=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),_=0;_<r.length;_++)"default"!==r[_]&&s(t,e,r[_]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSupportedFiles=function(e){const t=[];for(const r of e){if(r.includes("*")){t.push(...c(r));continue}if(!o.existsSync(r))continue;const e=o.statSync(r);e.isDirectory()?d(r,t):e.isFile()&&(0,l.resolveLanguageForFile)(r)&&t.push(r)}const r=t.map(e=>i.resolve(e));return Array.from(new Set(r)).sort()};const o=_(r(896)),i=_(r(928)),l=r(912),u=new Set(["node_modules",".git","dist","out","build",".next","coverage",".vscode-test"]);function d(e,t){for(const r of o.readdirSync(e,{withFileTypes:!0})){const n=i.join(e,r.name);r.isDirectory()?u.has(r.name)||d(n,t):r.isFile()&&(0,l.resolveLanguageForFile)(r.name)&&t.push(n)}}function c(e){const t=e.indexOf("*"),r=e.lastIndexOf(i.sep,t),n=-1===r?".":e.slice(0,r),s=e.slice(e.lastIndexOf(".")),a=s.startsWith(".")&&!s.includes("*")?s:void 0;if(!o.existsSync(n)||!o.statSync(n).isDirectory())return[];const _=[];return d(n,_),a?_.filter(e=>e.toLowerCase().endsWith(a.toLowerCase())):_}},964(e,t){t.FSHARP=void 0,t.FSHARP={id:"fsharp",grammarPath:"grammars/tree-sitter-fsharp.wasm",nodeTypes:{block:null,parameters:"argument_patterns",ifStatement:"if_expression",elseClause:null,forStatement:"for_expression",whileStatement:"while_expression",conditionalExpression:null,lambda:"fun_expression",importStatement:"import_decl",importFromStatement:null,expressionStatement:null,assignment:"function_or_value_defn",module:"declaration_expression",exportStatement:null,comment:"line_comment",integerLiteral:"int",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_or_value_defn"===e?.type&&e.children?.some(e=>"function_declaration_left"===e.type),parameterChildTypes:["long_identifier","typed_pattern"],decisionNodeTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],cognitiveNestedDecisionTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],nestingControlTypes:["if_expression","elif_expression","for_expression","while_expression","match_expression"],getBooleanOperator(e){if(!e||"infix_expression"!==e.type)return null;const t=e.children?.find(e=>"infix_op"===e.type);return"&&"===t?.text?"and":"||"===t?.text?"or":null},entersNestedScope:()=>!0,isTryElseClause:()=>!1,variableReferenceNodeTypes:["long_identifier_or_op"],extractTypedParameter(e){if("typed_pattern"!==e?.type)return null;const t=e.children.find(e=>"identifier_pattern"===e.type),r=e.children.find(e=>"simple_type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["string","int","float","bool"]),keywordOnlyBoundaryTypes:[],distinctTypeAdvice:"a single-case union type",getEqualityComparisons(e){if("infix_expression"!==e?.type)return[];const t=e.children.find(e=>"infix_op"===e.type);if(!t||"="!==t.text)return[];const r=e.children.filter(e=>"infix_op"!==e.type);if(2!==r.length)return[];const[n,s]=r;return[{left:n,right:"const"===s.type&&1===s.children?.length?s.children[0]:s}]},getMembershipComparisons:()=>[],getElseIfBranches:e=>e?.children?.filter(e=>"elif_expression"===e.type)??[],subscriptNodeTypes:[],isFormattedOrInterpolatedString:()=>!1,isDefaultParameterValue:()=>!1,isBooleanLiteral:e=>"const"===e?.type&&1===e.children?.length&&"bool"===e.children[0]?.type,isPositionalCallArgument(e){const t=e?.parent;return"application_expression"===t?.type?t.children?.[0]?.id!==e.id:"tuple_expression"===t?.type&&"application_expression"===t.parent?.type},isExplicitConstant:()=>!1}},912(e,t,r){t.Y=void 0,t.resolveLanguageForFile=function(e){const r=e.lastIndexOf(".");if(-1===r)return;const n=e.slice(r).toLowerCase(),s=o[n];return s?t.Y[s]:void 0};const n=r(996),s=r(964),a=r(501),_=r(135);t.Y={python:n.PYTHON,fsharp:s.FSHARP,typescript:a.TYPESCRIPT,kotlin:_.KOTLIN};const o={".py":"python",".fs":"fsharp",".fsx":"fsharp",".fsi":"fsharp",".ts":"typescript",".kt":"kotlin",".kts":"kotlin"}},135(e,t){t.KOTLIN=void 0,t.KOTLIN={id:"kotlin",grammarPath:"grammars/tree-sitter-kotlin.wasm",nodeTypes:{block:"block",parameters:"function_value_parameters",ifStatement:"if_expression",elseClause:null,forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:null,lambda:"lambda_literal",importStatement:"import",importFromStatement:null,expressionStatement:null,assignment:"property_declaration",module:"source_file",exportStatement:null,comment:"line_comment",integerLiteral:"number_literal",floatLiteral:"float_literal",stringLiteral:"string_literal"},isFunctionDefinition:e=>"function_declaration"===e?.type,parameterChildTypes:["parameter"],decisionNodeTypes:["if_expression","for_statement","while_statement","when_expression","catch_block"],cognitiveNestedDecisionTypes:["if_expression","for_statement","while_statement","when_expression","catch_block"],nestingControlTypes:["if_expression","for_statement","while_statement"],getBooleanOperator(e){if(!e||"binary_expression"!==e.type)return null;const t=e.children?.find(e=>"&&"===e.type||"||"===e.type);return t?"&&"===t.type?"and":"or":null},entersNestedScope:e=>"block"===e?.type,isTryElseClause:()=>!1,variableReferenceNodeTypes:["identifier","navigation_expression"],extractTypedParameter(e){if("parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"user_type"===e.type);if(!t||!r)return null;const n=r.children?.find(e=>"identifier"===e.type);return n?{name:t.text,type:n.text}:null},primitiveTypeNames:new Set(["Int","Long","Short","Byte","Double","Float","Boolean","String","Char"]),keywordOnlyBoundaryTypes:[],distinctTypeAdvice:"a value class (@JvmInline value class)",getEqualityComparisons(e){if("binary_expression"!==e?.type)return[];const t=e.children.find(e=>"=="===e.type||"==="===e.type);if(!t)return[];const r=e.children.filter(e=>e!==t);return 2!==r.length?[]:[{left:r[0],right:r[1]}]},getMembershipComparisons:()=>[],getElseIfBranches:()=>[],subscriptNodeTypes:["index_expression"],isFormattedOrInterpolatedString:e=>e?.children?.some(e=>"interpolation"===e.type)??!1,isDefaultParameterValue(e){const t=e?.parent;if("function_value_parameters"!==t?.type)return!1;const r=t.children??[],n=r.findIndex(t=>t.id===e.id);return n>=2&&"="===r[n-1]?.type&&"parameter"===r[n-2]?.type},isBooleanLiteral:e=>"identifier"===e?.type&&("true"===e.text||"false"===e.text),isPositionalCallArgument(e){const t=e?.parent;return"value_argument"===t?.type&&"value_arguments"===t.parent?.type&&"call_expression"===t.parent.parent?.type&&t.children?.[0]?.id===e.id},isExplicitConstant(e){if("property_declaration"!==e?.type)return!1;const t=e.children?.find(e=>"modifiers"===e.type);return t?.children?.some(e=>"property_modifier"===e.type&&e.children?.some(e=>"const"===e.type))??!1}}},996(e,t){t.PYTHON=void 0,t.PYTHON={id:"python",grammarPath:"grammars/tree-sitter-python.wasm",nodeTypes:{block:"block",parameters:"parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"conditional_expression",lambda:"lambda",importStatement:"import_statement",importFromStatement:"import_from_statement",expressionStatement:"expression_statement",assignment:"assignment",module:"module",exportStatement:null,comment:"comment",integerLiteral:"integer",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_definition"===e?.type,parameterChildTypes:["identifier","default_parameter"],decisionNodeTypes:["if_statement","elif_clause","while_statement","for_statement","except_clause","conditional_expression","match_statement"],cognitiveNestedDecisionTypes:["if_statement","elif_clause","for_statement","while_statement","except_clause","match_statement"],nestingControlTypes:["if_statement","for_statement","while_statement","with_statement","match_statement"],getBooleanOperator(e){if(!e||"boolean_operator"!==e.type)return null;const t=e.children?.find(e=>"and"===e.type||"or"===e.type);return t?t.type:null},entersNestedScope:e=>"block"===e?.type,isTryElseClause:e=>"else_clause"===e?.type&&"try_statement"===e?.parent?.type,variableReferenceNodeTypes:["identifier","attribute"],extractTypedParameter(e){if("typed_parameter"!==e?.type&&"typed_default_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["str","int","float","bool","bytes"]),keywordOnlyBoundaryTypes:["keyword_separator","list_splat_pattern"],distinctTypeAdvice:"NewType or a dataclass",getEqualityComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++)"=="===r[e].type&&t.push({left:r[e-1],right:r[e+1]});return t},getMembershipComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++){if("in"!==r[e].type)continue;const n=r[e-1],s=r[e+1];if("tuple"!==s.type&&"list"!==s.type&&"set"!==s.type)continue;const a=[];let _=!0;for(const e of s.children)if(e.isNamed){if("string"!==e.type){_=!1;break}a.push(e.text.slice(1,-1))}_&&a.length>0&&t.push({left:n,values:a})}return t},getElseIfBranches:e=>e?.children?.filter(e=>"elif_clause"===e.type)??[],subscriptNodeTypes:["subscript"],isFormattedOrInterpolatedString(e){if(e?.children?.some(e=>"interpolation"===e.type))return!0;const t=e?.parent;if("binary_operator"===t?.type&&t.children?.[0]?.id===e.id&&t.children?.some(e=>"%"===e.type))return!0;if("attribute"===t?.type&&t.children?.[0]?.id===e.id){const e=t.children?.find(e=>"identifier"===e.type);if("format"===e?.text&&"call"===t.parent?.type)return!0}return!1},isDefaultParameterValue(e){const t=e?.parent;return("default_parameter"===t?.type||"typed_default_parameter"===t?.type)&&t.children?.[t.children.length-1]?.id===e.id},isBooleanLiteral:e=>"true"===e?.type||"false"===e?.type,isPositionalCallArgument:e=>"argument_list"===e?.parent?.type&&"call"===e.parent.parent?.type,isExplicitConstant:()=>!1}},501(e,t){t.TYPESCRIPT=void 0,t.TYPESCRIPT={id:"typescript",grammarPath:"grammars/tree-sitter-typescript.wasm",nodeTypes:{block:"statement_block",parameters:"formal_parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"ternary_expression",lambda:"arrow_function",importStatement:"import_statement",importFromStatement:null,expressionStatement:"expression_statement",assignment:"lexical_declaration",module:"program",exportStatement:"export_statement",comment:"comment",integerLiteral:"number",floatLiteral:null,stringLiteral:"string"},isFunctionDefinition:e=>"function_declaration"===e?.type||"method_definition"===e?.type,parameterChildTypes:["required_parameter","optional_parameter"],decisionNodeTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause","ternary_expression"],cognitiveNestedDecisionTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause"],nestingControlTypes:["if_statement","for_statement","for_in_statement","while_statement"],getBooleanOperator(e){if(!e||"binary_expression"!==e.type)return null;const t=e.children?.find(e=>"&&"===e.type||"||"===e.type);return t?"&&"===t.type?"and":"or":null},entersNestedScope:e=>"statement_block"===e?.type,isTryElseClause:()=>!1,variableReferenceNodeTypes:["identifier","member_expression"],extractTypedParameter(e){if("required_parameter"!==e?.type&&"optional_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type_annotation"===e.type);if(!t||!r)return null;const n=r.children.find(e=>":"!==e.type);return n?{name:t.text,type:n.text}:null},primitiveTypeNames:new Set(["string","number","boolean"]),keywordOnlyBoundaryTypes:[],distinctTypeAdvice:"a branded/nominal type (e.g. a tagged type alias)",getEqualityComparisons(e){if("binary_expression"!==e?.type)return[];const t=e.children.find(e=>"==="===e.type||"=="===e.type);if(!t)return[];const r=e.children.filter(e=>e!==t);return 2!==r.length?[]:[{left:r[0],right:r[1]}]},getMembershipComparisons:()=>[],getElseIfBranches:()=>[],subscriptNodeTypes:["subscript_expression"],isFormattedOrInterpolatedString:()=>!1,isDefaultParameterValue(e){const t=e?.parent;return("required_parameter"===t?.type||"optional_parameter"===t?.type)&&t.children?.some(e=>"="===e.type)&&t.children?.[t.children.length-1]?.id===e.id},isBooleanLiteral:e=>"true"===e?.type||"false"===e?.type,isPositionalCallArgument:e=>"arguments"===e?.parent?.type&&"call_expression"===e.parent.parent?.type,isExplicitConstant:()=>!1}},613(e,t){t.VIOLATION_TYPE=t.SEVERITY=void 0,t.SEVERITY={LOW:"low",MEDIUM:"medium",HIGH:"high"},t.VIOLATION_TYPE={NESTING:"nesting",COMPLEXITY:"complexity",COGNITIVE:"cognitive",NAMING:"naming",COHERENCE:"coherence",MAGIC:"magic",PARAMETERS:"parameters",INVERSION:"inversion",PRIMITIVE_OBSESSION:"primitive-obsession",MATCH_OPPORTUNITY:"match-opportunity",LOGICAL_CONTROL_FLOW:"logical-control-flow",OPAQUE_BOOLEAN:"opaque-boolean"}},317(e){e.exports=require("child_process")},896(e){e.exports=require("fs")},943(e){e.exports=require("fs/promises")},928(e){e.exports=require("path")},43(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===r||__defProp(e,s,{get:()=>t[s],enumerable:!(n=__getOwnPropDesc(t,s))||n.enumerable});return e},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?r:__defProp(r,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),require_web_tree_sitter=__commonJS({"lib/web-tree-sitter.cjs"(exports,module){var Module=(()=>{var _scriptName="undefined"!=typeof document?document.currentScript?.src:void 0;return async function(moduleArg={}){var moduleRtn,Module=moduleArg,ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="undefined"!=typeof WorkerGlobalScope,ENVIRONMENT_IS_NODE="object"==typeof process&&process.versions?.node&&"renderer"!=process.type;Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var arguments_=[],thisProgram="./this.program",quit_=__name((e,t)=>{throw t},"quit_");_scriptName=__filename;var scriptDirectory="",readAsync,readBinary;function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}if(__name(locateFile,"locateFile"),ENVIRONMENT_IS_NODE){var fs=__webpack_require__(896);scriptDirectory=__dirname+"/",readBinary=__name(e=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e)),"readBinary"),readAsync=__name(async(e,t=!0)=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e,t?void 0:"utf8")),"readAsync"),process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=__name((e,t)=>{throw process.exitCode=e,t},"quit_")}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}ENVIRONMENT_IS_WORKER&&(readBinary=__name(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=__name(async e=>{if(isFileURI(e))return new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync")}var out=console.log.bind(console),err=console.error.bind(console),dynamicLibraries=[],wasmBinary,ABORT=!1,EXITSTATUS,isFileURI=__name(e=>e.startsWith("file://"),"isFileURI"),readyPromiseResolve,readyPromiseReject,wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP64,HEAPU64,HEAP_DATA_VIEW,runtimeInitialized=!1;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e),Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),LE_HEAP_UPDATE()}function initMemory(){if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var e=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:e/65536,maximum:32768})}updateMemoryViews()}__name(updateMemoryViews,"updateMemoryViews"),__name(initMemory,"initMemory");var __RELOC_FUNCS__=[],wasmBinaryFile;function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}function preMain(){}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}function abort(e){Module.onAbort?.(e),err(e="Aborted("+e+")"),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject?.(t),t}function findWasmBinary(){return locateFile("web-tree-sitter.wasm")}function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}async function instantiateArrayBuffer(e,t){try{var r=await getWasmBinary(e);return await WebAssembly.instantiate(r,t)}catch(e){err(`failed to asynchronously prepare wasm: ${e}`),abort(e)}}async function instantiateAsync(e,t,r){if(!e&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(e){err(`wasm streaming compile failed: ${e}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,r)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}async function createWasm(){function e(e,t){wasmExports=e.exports,wasmExports=relocateExports(wasmExports,1024);var r=getDylinkMetadata(t);return r.neededDynlibs&&(dynamicLibraries=r.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),assignWasmExports(wasmExports),wasmExports}function t(t){return e(t.instance,t.module)}__name(e,"receiveInstance"),__name(t,"receiveInstantiationResult");var r=getWasmImports();return Module.instantiateWasm?new Promise((t,n)=>{Module.instantiateWasm(r,(r,n)=>{t(e(r,n))})}):(wasmBinaryFile??=findWasmBinary(),t(await instantiateAsync(wasmBinary,wasmBinaryFile,r)))}__name(preRun,"preRun"),__name(initRuntime,"initRuntime"),__name(preMain,"preMain"),__name(postRun,"postRun"),__name(abort,"abort"),__name(findWasmBinary,"findWasmBinary"),__name(getBinarySync,"getBinarySync"),__name(getWasmBinary,"getWasmBinary"),__name(instantiateArrayBuffer,"instantiateArrayBuffer"),__name(instantiateAsync,"instantiateAsync"),__name(getWasmImports,"getWasmImports"),__name(createWasm,"createWasm");class ExitStatus{static{__name(this,"ExitStatus")}name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var r=GOT[t];return r||(r=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(r.required=!0),r}},LE_ATOMICS_NATIVE_BYTE_ORDER=[],LE_HEAP_LOAD_F32=__name(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=__name(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=__name(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=__name(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_I64=__name(e=>HEAP_DATA_VIEW.getBigInt64(e,!0),"LE_HEAP_LOAD_I64"),LE_HEAP_LOAD_U32=__name(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=__name((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=__name((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=__name((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=__name((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_I64=__name((e,t)=>HEAP_DATA_VIEW.setBigInt64(e,t,!0),"LE_HEAP_STORE_I64"),LE_HEAP_STORE_U32=__name((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=__name(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=__name(e=>onPostRuns.push(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=__name(e=>onPreRuns.push(e),"addOnPreRun"),UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder:void 0,findStringEnd=__name((e,t,r,n)=>{var s=t+r;if(n)return s;for(;e[t]&&!(t>=s);)++t;return t},"findStringEnd"),UTF8ArrayToString=__name((e,t=0,r,n)=>{var s=findStringEnd(e,t,r,n);if(s-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,s));for(var a="";t<s;){var _=e[t++];if(128&_){var o=63&e[t++];if(192!=(224&_)){var i=63&e[t++];if((_=224==(240&_)?(15&_)<<12|o<<6|i:(7&_)<<18|o<<12|i<<6|63&e[t++])<65536)a+=String.fromCharCode(_);else{var l=_-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&_)<<6|o)}else a+=String.fromCharCode(_)}return a},"UTF8ArrayToString"),getDylinkMetadata=__name(e=>{var t=0,r=0;function n(){return e[t++]}function s(){for(var r=0,n=1;;){var s=e[t++];if(r+=(127&s)*n,n*=128,!(128&s))break}return r}function a(){var r=s();return UTF8ArrayToString(e,(t+=r)-r,r)}function _(){for(var e=s(),t=[];e--;)t.push(a());return t}function o(e,t){if(e)throw new Error(t)}if(__name(n,"getU8"),__name(s,"getLEB"),__name(a,"getString"),__name(_,"getStringList"),__name(o,"failIf"),e instanceof WebAssembly.Module){var i=WebAssembly.Module.customSections(e,"dylink.0");o(0===i.length,"need dylink section"),r=(e=new Uint8Array(i[0])).length}else{var l=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer);o(!(1836278016==l[0]||6386541==l[0]),"need to see wasm magic number"),o(0!==e[8],"need the dylink section to be first"),t=9;var u=s();r=t+u,o("dylink.0"!==a())}for(var d={neededDynlibs:[],tlsExports:new Set,weakImports:new Set,runtimePaths:[]};t<r;){var c=n(),m=s();if(1===c)d.memorySize=s(),d.memoryAlign=s(),d.tableSize=s(),d.tableAlign=s();else if(2===c)d.neededDynlibs=_();else if(3===c)for(var p=s();p--;){var h=a();256&s()&&d.tlsExports.add(h)}else if(4===c)for(p=s();p--;)a(),h=a(),1==(3&s())&&d.weakImports.add(h);else 5===c?d.runtimePaths=_():t+=m}return d},"getDylinkMetadata");function getValue(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return HEAP8[e];case"i16":return LE_HEAP_LOAD_I16(2*(e>>1));case"i32":return LE_HEAP_LOAD_I32(4*(e>>2));case"i64":return LE_HEAP_LOAD_I64(8*(e>>3));case"float":return LE_HEAP_LOAD_F32(4*(e>>2));case"double":return LE_HEAP_LOAD_F64(8*(e>>3));case"*":return LE_HEAP_LOAD_U32(4*(e>>2));default:abort(`invalid type for getValue: ${t}`)}}__name(getValue,"getValue");var newDSO=__name((e,t,r)=>{var n={refcount:1/0,name:e,exports:r,global:!0};return LDSO.loadedLibsByName[e]=n,null!=t&&(LDSO.loadedLibsByHandle[t]=n),n},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78240,alignMemory=__name((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=__name(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,r=t+alignMemory(e,16);return ___heap_base=r,GOT.__heap_base.value=r,t},"getMemory"),isInternalSym=__name(e=>["__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(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128EncodeWithLen=__name(e=>{const t=e.length;return[t%128|128,t>>7,...e]},"uleb128EncodeWithLen"),wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111},generateTypePack=__name(e=>uleb128EncodeWithLen(Array.from(e,e=>wasmTypeCodes[e])),"generateTypePack"),convertJsFunctionToWasm=__name((e,t)=>{var r=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(t.slice(1)),...generateTypePack("v"===t[0]?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),n=new WebAssembly.Module(r);return new WebAssembly.Instance(n,{e:{f:e}}).exports.f},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=__name(e=>{var t=wasmTableMirror[e];return t||(wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=__name((e,t)=>{if(functionsInTableMap)for(var r=e;r<e+t;r++){var n=getWasmTableEntry(r);n&&functionsInTableMap.set(n,r)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=__name(e=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=__name(()=>freeTableIndexes.length?freeTableIndexes.pop():wasmTable.grow(1),"getEmptyTableSlot"),setWasmTableEntry=__name((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=__name((e,t)=>{var r=getFunctionAddress(e);if(r)return r;var n=getEmptyTableSlot();try{setWasmTableEntry(n,e)}catch(r){if(!(r instanceof TypeError))throw r;var s=convertJsFunctionToWasm(e,t);setWasmTableEntry(n,s)}return functionsInTableMap.set(e,n),n},"addFunction"),updateGOT=__name((e,t)=>{for(var r in e)if(!isInternalSym(r)){var n=e[r];GOT[r]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||0==GOT[r].value)&&("function"==typeof n?GOT[r].value=addFunction(n):"number"==typeof n?GOT[r].value=n:err(`unhandled export type for '${r}': ${typeof n}`))}},"updateGOT"),relocateExports=__name((e,t,r)=>{var n={};for(var s in e){var a=e[s];"object"==typeof a&&(a=a.value),"number"==typeof a&&(a+=t),n[s]=a}return updateGOT(n,r),n},"relocateExports"),isSymbolDefined=__name(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=__name((e,t,r=[],n=!1)=>{var s=getWasmTableEntry(t)(...r);return __name(function(e){return e},"convert"),s},"dynCall"),stackSave=__name(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=__name(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=__name(e=>(t,...r)=>{var n=stackSave();try{return dynCall(e,t,r)}catch(t){if(stackRestore(n),t!==t+0)throw t;if(_setThrew(1,0),"j"==e[0])return 0n}},"createInvokeFunction"),resolveGlobalSymbol=__name((e,t=!1)=>{var r;return isSymbolDefined(e)?r=wasmImports[e]:e.startsWith("invoke_")&&(r=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:r,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=__name(e=>onPostCtors.push(e),"addOnPostCtor"),UTF8ToString=__name((e,t,r)=>e?UTF8ArrayToString(HEAPU8,e,t,r):"","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,moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32(4*(handle+12>>2),memoryBase),LE_HEAP_STORE_I32(4*(handle+16>>2),metadata.memorySize),LE_HEAP_STORE_U32(4*(handle+20>>2),tableBase),LE_HEAP_STORE_I32(4*(handle+24>>2),metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize),__name(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}var r;return t in wasmImports&&!wasmImports[t].stub?wasmImports[t]:(t in e||(e[t]=(...e)=>(r||=resolveSymbol(t),r(...e))),e[t])}},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){function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&-1!=body.indexOf("$"+arity);arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols(),__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),"void"!=cSig)for(var i in cSig=cSig.split(","),cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}for(var name in __name(addEmJs,"addEmJs"),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 e;return binary instanceof WebAssembly.Module?e=new WebAssembly.Instance(binary,info):({module:binary,instance:e}=await WebAssembly.instantiate(binary,info)),postInstantiation(binary,e)})();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((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=__name((e,t)=>{for(var[r,n]of Object.entries(e)){const e=__name(e=>{isSymbolDefined(e)||(wasmImports[e]=n)},"setImport");e(r);const t="__main_argc_argv";"main"==r&&e(t),r==t&&e("main")}},"mergeLibSymbols"),asyncLoad=__name(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},r,n){var s=LDSO.loadedLibsByName[e];if(s)return t.global?s.global||(s.global=!0,mergeLibSymbols(s.exports,e)):r&&Object.assign(r,s.exports),t.nodelete&&s.refcount!==1/0&&(s.refcount=1/0),s.refcount++,n&&(LDSO.loadedLibsByHandle[n]=s),!t.loadAsync||Promise.resolve(!0);function a(){if(n){var r=LE_HEAP_LOAD_U32(4*(n+28>>2)),s=LE_HEAP_LOAD_U32(4*(n+32>>2));if(r&&s){var a=HEAP8.slice(r,r+s);return t.loadAsync?Promise.resolve(a):a}}var _=locateFile(e);if(t.loadAsync)return asyncLoad(_);if(!readBinary)throw new Error(`${_}: file not found, and synchronous loading of external files is not available`);return readBinary(_)}function _(){return t.loadAsync?a().then(s=>loadWebAssemblyModule(s,t,e,r,n)):loadWebAssemblyModule(a(),t,e,r,n)}function o(t){s.global?mergeLibSymbols(t,e):r&&Object.assign(r,t),s.exports=t}return(s=newDSO(e,n,"loading")).refcount=t.nodelete?1/0:1,s.global=t.global,__name(a,"loadLibData"),__name(_,"getExports"),__name(o,"moduleLoaded"),t.loadAsync?_().then(e=>(o(e),!0)):(o(_()),!0)}__name(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=__name(()=>{for(var[e,t]of Object.entries(GOT))if(0==t.value){var r=resolveGlobalSymbol(e,!0).sym;if(!r&&!t.required)continue;if("function"==typeof r)t.value=addFunction(r,r.sig);else{if("number"!=typeof r)throw new Error(`bad export type for '${e}': ${typeof r}`);t.value=r}}},"reportUndefinedSymbols"),runDependencies=0,dependenciesFulfilled=null,removeRunDependency=__name(e=>{if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),0==runDependencies&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}},"removeRunDependency"),addRunDependency=__name(e=>{runDependencies++,Module.monitorRunDependencies?.(runDependencies)},"addRunDependency"),loadDylibs=__name(async()=>{if(dynamicLibraries.length){for(var e of(addRunDependency("loadDylibs"),dynamicLibraries))await loadDynamicLibrary(e,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0});reportUndefinedSymbols(),removeRunDependency("loadDylibs")}else reportUndefinedSymbols()},"loadDylibs"),noExitRuntime=!0;function setValue(e,t,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16(2*(e>>1),t);break;case"i32":LE_HEAP_STORE_I32(4*(e>>2),t);break;case"i64":LE_HEAP_STORE_I64(8*(e>>3),BigInt(t));break;case"float":LE_HEAP_STORE_F32(4*(e>>2),t);break;case"double":LE_HEAP_STORE_F64(8*(e>>3),t);break;case"*":LE_HEAP_STORE_U32(4*(e>>2),t);break;default:abort(`invalid type for setValue: ${r}`)}}__name(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_high=78240,___stack_low=12704,___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78240),___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(e=>{var t=(e-wasmMemory.buffer.byteLength+65535)/65536|0;try{return wasmMemory.grow(t),updateMemoryViews(),1}catch(e){}},"growMemory"),_emscripten_resize_heap=__name(e=>{var t=HEAPU8.length;e>>>=0;var r=getHeapMax();if(e>r)return!1;for(var n=1;n<=4;n*=2){var s=t*(1+.2/n);s=Math.min(s,e+100663296);var a=Math.min(r,alignMemory(Math.max(e,s),65536));if(growMemory(a))return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=__name(e=>52,"_fd_close");_fd_close.sig="ii";var INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=__name(e=>e<INT53_MIN||e>INT53_MAX?NaN:Number(e),"bigintToI53Checked");function _fd_seek(e,t,r,n){return t=bigintToI53Checked(t),70}__name(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=__name((e,t)=>{var r=printCharBuffers[e];0===t||10===t?((1===e?out:err)(UTF8ArrayToString(r)),r.length=0):r.push(t)},"printChar"),_fd_write=__name((e,t,r,n)=>{for(var s=0,a=0;a<r;a++){var _=LE_HEAP_LOAD_U32(4*(t>>2)),o=LE_HEAP_LOAD_U32(4*(t+4>>2));t+=8;for(var i=0;i<o;i++)printChar(e,HEAPU8[_+i]);s+=o}return LE_HEAP_STORE_U32(4*(n>>2),s),0},"_fd_write");function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){const r=UTF8ToString(t);Module.currentLogCallback(r,0!==e)}}function _tree_sitter_parse_callback(e,t,r,n,s){const a=Module.currentParseCallback(t,{row:r,column:n});"string"==typeof a?(setValue(s,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(s,0,"i32")}function _tree_sitter_progress_callback(e,t){return!!Module.currentProgressCallback&&Module.currentProgressCallback({currentOffset:e,hasError:t})}function _tree_sitter_query_progress_callback(e){return!!Module.currentQueryProgressCallback&&Module.currentQueryProgressCallback({currentOffset:e})}_fd_write.sig="iippp",__name(_tree_sitter_log_callback,"_tree_sitter_log_callback"),__name(_tree_sitter_parse_callback,"_tree_sitter_parse_callback"),__name(_tree_sitter_progress_callback,"_tree_sitter_progress_callback"),__name(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=__name(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=__name(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=__name((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=__name(e=>{if(e instanceof ExitStatus||"unwind"==e)return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=__name(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=__name((e,t,r,n)=>{if(!(n>0))return 0;for(var s=r,a=r+n-1,_=0;_<e.length;++_){var o=e.codePointAt(_);if(o<=127){if(r>=a)break;t[r++]=o}else if(o<=2047){if(r+1>=a)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=a)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=a)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o,_++}}return t[r]=0,r-s},"stringToUTF8Array"),stringToUTF8=__name((e,t,r)=>stringToUTF8Array(e,HEAPU8,t,r),"stringToUTF8"),stackAlloc=__name(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=__name(e=>{var t=lengthBytesUTF8(e)+1,r=stackAlloc(t);return stringToUTF8(e,r,t),r},"stringToUTF8OnStack"),AsciiToString=__name(e=>{for(var t="";;){var r=HEAPU8[e++];if(!r)return t;t+=String.fromCharCode(r)}},"AsciiToString"),stringToUTF16=__name((e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,s=(r-=2)<2*e.length?r/2:e.length,a=0;a<s;++a){var _=e.charCodeAt(a);LE_HEAP_STORE_I16(2*(t>>1),_),t+=2}return LE_HEAP_STORE_I16(2*(t>>1),0),t-n},"stringToUTF16");function LE_HEAP_UPDATE(){HEAPU16.unsigned=e=>65535&e,HEAPU32.unsigned=e=>e>>>0}if(LE_ATOMICS_NATIVE_BYTE_ORDER=1===new Int8Array(new Int16Array([1]).buffer)[0]?[e=>e,e=>e,void 0,e=>e]:[e=>e,e=>((65280&e)<<8|(255&e)<<24)>>16,void 0,e=>e>>24&255|e>>8&65280|(65280&e)<<8|(255&e)<<24],__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("function"==typeof Module.preInit&&(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_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,_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(e){Module._malloc=_malloc=e.malloc,Module._calloc=_calloc=e.calloc,Module._realloc=_realloc=e.realloc,Module._free=_free=e.free,Module._ts_range_edit=_ts_range_edit=e.ts_range_edit,Module._memcmp=_memcmp=e.memcmp,Module._ts_language_symbol_count=_ts_language_symbol_count=e.ts_language_symbol_count,Module._ts_language_state_count=_ts_language_state_count=e.ts_language_state_count,Module._ts_language_abi_version=_ts_language_abi_version=e.ts_language_abi_version,Module._ts_language_name=_ts_language_name=e.ts_language_name,Module._ts_language_field_count=_ts_language_field_count=e.ts_language_field_count,Module._ts_language_next_state=_ts_language_next_state=e.ts_language_next_state,Module._ts_language_symbol_name=_ts_language_symbol_name=e.ts_language_symbol_name,Module._ts_language_symbol_for_name=_ts_language_symbol_for_name=e.ts_language_symbol_for_name,Module._strncmp=_strncmp=e.strncmp,Module._ts_language_symbol_type=_ts_language_symbol_type=e.ts_language_symbol_type,Module._ts_language_field_name_for_id=_ts_language_field_name_for_id=e.ts_language_field_name_for_id,Module._ts_lookahead_iterator_new=_ts_lookahead_iterator_new=e.ts_lookahead_iterator_new,Module._ts_lookahead_iterator_delete=_ts_lookahead_iterator_delete=e.ts_lookahead_iterator_delete,Module._ts_lookahead_iterator_reset_state=_ts_lookahead_iterator_reset_state=e.ts_lookahead_iterator_reset_state,Module._ts_lookahead_iterator_reset=_ts_lookahead_iterator_reset=e.ts_lookahead_iterator_reset,Module._ts_lookahead_iterator_next=_ts_lookahead_iterator_next=e.ts_lookahead_iterator_next,Module._ts_lookahead_iterator_current_symbol=_ts_lookahead_iterator_current_symbol=e.ts_lookahead_iterator_current_symbol,Module._ts_point_edit=_ts_point_edit=e.ts_point_edit,Module._ts_parser_delete=_ts_parser_delete=e.ts_parser_delete,Module._ts_parser_reset=_ts_parser_reset=e.ts_parser_reset,Module._ts_parser_set_language=_ts_parser_set_language=e.ts_parser_set_language,Module._ts_parser_set_included_ranges=_ts_parser_set_included_ranges=e.ts_parser_set_included_ranges,Module._ts_query_new=_ts_query_new=e.ts_query_new,Module._ts_query_delete=_ts_query_delete=e.ts_query_delete,Module._iswspace=_iswspace=e.iswspace,Module._iswalnum=_iswalnum=e.iswalnum,Module._ts_query_pattern_count=_ts_query_pattern_count=e.ts_query_pattern_count,Module._ts_query_capture_count=_ts_query_capture_count=e.ts_query_capture_count,Module._ts_query_string_count=_ts_query_string_count=e.ts_query_string_count,Module._ts_query_capture_name_for_id=_ts_query_capture_name_for_id=e.ts_query_capture_name_for_id,Module._ts_query_capture_quantifier_for_id=_ts_query_capture_quantifier_for_id=e.ts_query_capture_quantifier_for_id,Module._ts_query_string_value_for_id=_ts_query_string_value_for_id=e.ts_query_string_value_for_id,Module._ts_query_predicates_for_pattern=_ts_query_predicates_for_pattern=e.ts_query_predicates_for_pattern,Module._ts_query_start_byte_for_pattern=_ts_query_start_byte_for_pattern=e.ts_query_start_byte_for_pattern,Module._ts_query_end_byte_for_pattern=_ts_query_end_byte_for_pattern=e.ts_query_end_byte_for_pattern,Module._ts_query_is_pattern_rooted=_ts_query_is_pattern_rooted=e.ts_query_is_pattern_rooted,Module._ts_query_is_pattern_non_local=_ts_query_is_pattern_non_local=e.ts_query_is_pattern_non_local,Module._ts_query_is_pattern_guaranteed_at_step=_ts_query_is_pattern_guaranteed_at_step=e.ts_query_is_pattern_guaranteed_at_step,Module._ts_query_disable_capture=_ts_query_disable_capture=e.ts_query_disable_capture,Module._ts_query_disable_pattern=_ts_query_disable_pattern=e.ts_query_disable_pattern,Module._ts_tree_copy=_ts_tree_copy=e.ts_tree_copy,Module._ts_tree_delete=_ts_tree_delete=e.ts_tree_delete,Module._ts_init=_ts_init=e.ts_init,Module._ts_parser_new_wasm=_ts_parser_new_wasm=e.ts_parser_new_wasm,Module._ts_parser_enable_logger_wasm=_ts_parser_enable_logger_wasm=e.ts_parser_enable_logger_wasm,Module._ts_parser_parse_wasm=_ts_parser_parse_wasm=e.ts_parser_parse_wasm,Module._ts_parser_included_ranges_wasm=_ts_parser_included_ranges_wasm=e.ts_parser_included_ranges_wasm,Module._ts_language_type_is_named_wasm=_ts_language_type_is_named_wasm=e.ts_language_type_is_named_wasm,Module._ts_language_type_is_visible_wasm=_ts_language_type_is_visible_wasm=e.ts_language_type_is_visible_wasm,Module._ts_language_metadata_wasm=_ts_language_metadata_wasm=e.ts_language_metadata_wasm,Module._ts_language_supertypes_wasm=_ts_language_supertypes_wasm=e.ts_language_supertypes_wasm,Module._ts_language_subtypes_wasm=_ts_language_subtypes_wasm=e.ts_language_subtypes_wasm,Module._ts_tree_root_node_wasm=_ts_tree_root_node_wasm=e.ts_tree_root_node_wasm,Module._ts_tree_root_node_with_offset_wasm=_ts_tree_root_node_with_offset_wasm=e.ts_tree_root_node_with_offset_wasm,Module._ts_tree_edit_wasm=_ts_tree_edit_wasm=e.ts_tree_edit_wasm,Module._ts_tree_included_ranges_wasm=_ts_tree_included_ranges_wasm=e.ts_tree_included_ranges_wasm,Module._ts_tree_get_changed_ranges_wasm=_ts_tree_get_changed_ranges_wasm=e.ts_tree_get_changed_ranges_wasm,Module._ts_tree_cursor_new_wasm=_ts_tree_cursor_new_wasm=e.ts_tree_cursor_new_wasm,Module._ts_tree_cursor_copy_wasm=_ts_tree_cursor_copy_wasm=e.ts_tree_cursor_copy_wasm,Module._ts_tree_cursor_delete_wasm=_ts_tree_cursor_delete_wasm=e.ts_tree_cursor_delete_wasm,Module._ts_tree_cursor_reset_wasm=_ts_tree_cursor_reset_wasm=e.ts_tree_cursor_reset_wasm,Module._ts_tree_cursor_reset_to_wasm=_ts_tree_cursor_reset_to_wasm=e.ts_tree_cursor_reset_to_wasm,Module._ts_tree_cursor_goto_first_child_wasm=_ts_tree_cursor_goto_first_child_wasm=e.ts_tree_cursor_goto_first_child_wasm,Module._ts_tree_cursor_goto_last_child_wasm=_ts_tree_cursor_goto_last_child_wasm=e.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=e.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=e.ts_tree_cursor_goto_first_child_for_position_wasm,Module._ts_tree_cursor_goto_next_sibling_wasm=_ts_tree_cursor_goto_next_sibling_wasm=e.ts_tree_cursor_goto_next_sibling_wasm,Module._ts_tree_cursor_goto_previous_sibling_wasm=_ts_tree_cursor_goto_previous_sibling_wasm=e.ts_tree_cursor_goto_previous_sibling_wasm,Module._ts_tree_cursor_goto_descendant_wasm=_ts_tree_cursor_goto_descendant_wasm=e.ts_tree_cursor_goto_descendant_wasm,Module._ts_tree_cursor_goto_parent_wasm=_ts_tree_cursor_goto_parent_wasm=e.ts_tree_cursor_goto_parent_wasm,Module._ts_tree_cursor_current_node_type_id_wasm=_ts_tree_cursor_current_node_type_id_wasm=e.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=e.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=e.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=e.ts_tree_cursor_current_node_is_missing_wasm,Module._ts_tree_cursor_current_node_id_wasm=_ts_tree_cursor_current_node_id_wasm=e.ts_tree_cursor_current_node_id_wasm,Module._ts_tree_cursor_start_position_wasm=_ts_tree_cursor_start_position_wasm=e.ts_tree_cursor_start_position_wasm,Module._ts_tree_cursor_end_position_wasm=_ts_tree_cursor_end_position_wasm=e.ts_tree_cursor_end_position_wasm,Module._ts_tree_cursor_start_index_wasm=_ts_tree_cursor_start_index_wasm=e.ts_tree_cursor_start_index_wasm,Module._ts_tree_cursor_end_index_wasm=_ts_tree_cursor_end_index_wasm=e.ts_tree_cursor_end_index_wasm,Module._ts_tree_cursor_current_field_id_wasm=_ts_tree_cursor_current_field_id_wasm=e.ts_tree_cursor_current_field_id_wasm,Module._ts_tree_cursor_current_depth_wasm=_ts_tree_cursor_current_depth_wasm=e.ts_tree_cursor_current_depth_wasm,Module._ts_tree_cursor_current_descendant_index_wasm=_ts_tree_cursor_current_descendant_index_wasm=e.ts_tree_cursor_current_descendant_index_wasm,Module._ts_tree_cursor_current_node_wasm=_ts_tree_cursor_current_node_wasm=e.ts_tree_cursor_current_node_wasm,Module._ts_node_symbol_wasm=_ts_node_symbol_wasm=e.ts_node_symbol_wasm,Module._ts_node_field_name_for_child_wasm=_ts_node_field_name_for_child_wasm=e.ts_node_field_name_for_child_wasm,Module._ts_node_field_name_for_named_child_wasm=_ts_node_field_name_for_named_child_wasm=e.ts_node_field_name_for_named_child_wasm,Module._ts_node_children_by_field_id_wasm=_ts_node_children_by_field_id_wasm=e.ts_node_children_by_field_id_wasm,Module._ts_node_first_child_for_byte_wasm=_ts_node_first_child_for_byte_wasm=e.ts_node_first_child_for_byte_wasm,Module._ts_node_first_named_child_for_byte_wasm=_ts_node_first_named_child_for_byte_wasm=e.ts_node_first_named_child_for_byte_wasm,Module._ts_node_grammar_symbol_wasm=_ts_node_grammar_symbol_wasm=e.ts_node_grammar_symbol_wasm,Module._ts_node_child_count_wasm=_ts_node_child_count_wasm=e.ts_node_child_count_wasm,Module._ts_node_named_child_count_wasm=_ts_node_named_child_count_wasm=e.ts_node_named_child_count_wasm,Module._ts_node_child_wasm=_ts_node_child_wasm=e.ts_node_child_wasm,Module._ts_node_named_child_wasm=_ts_node_named_child_wasm=e.ts_node_named_child_wasm,Module._ts_node_child_by_field_id_wasm=_ts_node_child_by_field_id_wasm=e.ts_node_child_by_field_id_wasm,Module._ts_node_next_sibling_wasm=_ts_node_next_sibling_wasm=e.ts_node_next_sibling_wasm,Module._ts_node_prev_sibling_wasm=_ts_node_prev_sibling_wasm=e.ts_node_prev_sibling_wasm,Module._ts_node_next_named_sibling_wasm=_ts_node_next_named_sibling_wasm=e.ts_node_next_named_sibling_wasm,Module._ts_node_prev_named_sibling_wasm=_ts_node_prev_named_sibling_wasm=e.ts_node_prev_named_sibling_wasm,Module._ts_node_descendant_count_wasm=_ts_node_descendant_count_wasm=e.ts_node_descendant_count_wasm,Module._ts_node_parent_wasm=_ts_node_parent_wasm=e.ts_node_parent_wasm,Module._ts_node_child_with_descendant_wasm=_ts_node_child_with_descendant_wasm=e.ts_node_child_with_descendant_wasm,Module._ts_node_descendant_for_index_wasm=_ts_node_descendant_for_index_wasm=e.ts_node_descendant_for_index_wasm,Module._ts_node_named_descendant_for_index_wasm=_ts_node_named_descendant_for_index_wasm=e.ts_node_named_descendant_for_index_wasm,Module._ts_node_descendant_for_position_wasm=_ts_node_descendant_for_position_wasm=e.ts_node_descendant_for_position_wasm,Module._ts_node_named_descendant_for_position_wasm=_ts_node_named_descendant_for_position_wasm=e.ts_node_named_descendant_for_position_wasm,Module._ts_node_start_point_wasm=_ts_node_start_point_wasm=e.ts_node_start_point_wasm,Module._ts_node_end_point_wasm=_ts_node_end_point_wasm=e.ts_node_end_point_wasm,Module._ts_node_start_index_wasm=_ts_node_start_index_wasm=e.ts_node_start_index_wasm,Module._ts_node_end_index_wasm=_ts_node_end_index_wasm=e.ts_node_end_index_wasm,Module._ts_node_to_string_wasm=_ts_node_to_string_wasm=e.ts_node_to_string_wasm,Module._ts_node_children_wasm=_ts_node_children_wasm=e.ts_node_children_wasm,Module._ts_node_named_children_wasm=_ts_node_named_children_wasm=e.ts_node_named_children_wasm,Module._ts_node_descendants_of_type_wasm=_ts_node_descendants_of_type_wasm=e.ts_node_descendants_of_type_wasm,Module._ts_node_is_named_wasm=_ts_node_is_named_wasm=e.ts_node_is_named_wasm,Module._ts_node_has_changes_wasm=_ts_node_has_changes_wasm=e.ts_node_has_changes_wasm,Module._ts_node_has_error_wasm=_ts_node_has_error_wasm=e.ts_node_has_error_wasm,Module._ts_node_is_error_wasm=_ts_node_is_error_wasm=e.ts_node_is_error_wasm,Module._ts_node_is_missing_wasm=_ts_node_is_missing_wasm=e.ts_node_is_missing_wasm,Module._ts_node_is_extra_wasm=_ts_node_is_extra_wasm=e.ts_node_is_extra_wasm,Module._ts_node_parse_state_wasm=_ts_node_parse_state_wasm=e.ts_node_parse_state_wasm,Module._ts_node_next_parse_state_wasm=_ts_node_next_parse_state_wasm=e.ts_node_next_parse_state_wasm,Module._ts_query_matches_wasm=_ts_query_matches_wasm=e.ts_query_matches_wasm,Module._ts_query_captures_wasm=_ts_query_captures_wasm=e.ts_query_captures_wasm,Module._memset=_memset=e.memset,Module._memcpy=_memcpy=e.memcpy,Module._memmove=_memmove=e.memmove,Module._iswalpha=_iswalpha=e.iswalpha,Module._iswblank=_iswblank=e.iswblank,Module._iswdigit=_iswdigit=e.iswdigit,Module._iswlower=_iswlower=e.iswlower,Module._iswupper=_iswupper=e.iswupper,Module._iswxdigit=_iswxdigit=e.iswxdigit,Module._memchr=_memchr=e.memchr,Module._strlen=_strlen=e.strlen,Module._strcmp=_strcmp=e.strcmp,Module._strncat=_strncat=e.strncat,Module._strncpy=_strncpy=e.strncpy,Module._towlower=_towlower=e.towlower,Module._towupper=_towupper=e.towupper,_setThrew=e.setThrew,__emscripten_stack_restore=e._emscripten_stack_restore,__emscripten_stack_alloc=e._emscripten_stack_alloc,_emscripten_stack_get_current=e.emscripten_stack_get_current,___wasm_apply_data_relocs=e.__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},wasmExports;function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var r=e.length,n=stackAlloc(4*(r+1)),s=n;e.forEach(e=>{LE_HEAP_STORE_U32(4*(s>>2),stringToUTF8OnStack(e)),s+=4}),LE_HEAP_STORE_U32(4*(s>>2),0);try{var a=t(r,n);return exitJS(a,!0),a}catch(e){return handleException(e)}}}function run(e=arguments_){function t(){Module.calledRun=!0,ABORT||(initRuntime(),preMain(),readyPromiseResolve?.(Module),Module.onRuntimeInitialized?.(),Module.noInitialRun||callMain(e),postRun())}runDependencies>0?dependenciesFulfilled=run:(preRun(),runDependencies>0?dependenciesFulfilled=run:(__name(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()))}return __name(callMain,"callMain"),__name(run,"run"),wasmExports=await createWasm(),run(),moduleRtn=runtimeInitialized?Module:new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),moduleRtn}})();"object"==typeof exports&&"object"==typeof module?(module.exports=Module,module.exports.default=Module):(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=(()=>Module).apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}}),index_exports={};__export(index_exports,{CaptureQuantifier:()=>CaptureQuantifier,Edit:()=>Edit,LANGUAGE_VERSION:()=>LANGUAGE_VERSION,Language:()=>Language,LookaheadIterator:()=>LookaheadIterator,MIN_COMPATIBLE_VERSION:()=>MIN_COMPATIBLE_VERSION,Node:()=>Node,Parser:()=>Parser,Query:()=>Query,Tree:()=>Tree,TreeCursor:()=>TreeCursor}),module.exports=__toCommonJS(index_exports);var Edit=class{static{__name(this,"Edit")}startPosition;oldEndPosition;newEndPosition;startIndex;oldEndIndex;newEndIndex;constructor({startIndex:e,oldEndIndex:t,newEndIndex:r,startPosition:n,oldEndPosition:s,newEndPosition:a}){this.startIndex=e>>>0,this.oldEndIndex=t>>>0,this.newEndIndex=r>>>0,this.startPosition=n,this.oldEndPosition=s,this.newEndPosition=a}editPoint(e,t){let r=t;const n={...e};if(t>=this.oldEndIndex){r=this.newEndIndex+(t-this.oldEndIndex);const s=e.row;n.row=this.newEndPosition.row+(e.row-this.oldEndPosition.row),n.column=s===this.oldEndPosition.row?this.newEndPosition.column+(e.column-this.oldEndPosition.column):e.column}else t>this.startIndex&&(r=this.newEndIndex,n.row=this.newEndPosition.row,n.column=this.newEndPosition.column);return{point:n,index:r}}editRange(e){const t={startIndex:e.startIndex,startPosition:{...e.startPosition},endIndex:e.endIndex,endPosition:{...e.endPosition}};return e.endIndex>=this.oldEndIndex?e.endIndex!==Number.MAX_SAFE_INTEGER&&(t.endIndex=this.newEndIndex+(e.endIndex-this.oldEndIndex),t.endPosition={row:this.newEndPosition.row+(e.endPosition.row-this.oldEndPosition.row),column:e.endPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.endPosition.column-this.oldEndPosition.column):e.endPosition.column},t.endIndex<this.newEndIndex&&(t.endIndex=Number.MAX_SAFE_INTEGER,t.endPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.endIndex>this.startIndex&&(t.endIndex=this.startIndex,t.endPosition={...this.startPosition}),e.startIndex>=this.oldEndIndex?(t.startIndex=this.newEndIndex+(e.startIndex-this.oldEndIndex),t.startPosition={row:this.newEndPosition.row+(e.startPosition.row-this.oldEndPosition.row),column:e.startPosition.row===this.oldEndPosition.row?this.newEndPosition.column+(e.startPosition.column-this.oldEndPosition.column):e.startPosition.column},t.startIndex<this.newEndIndex&&(t.startIndex=Number.MAX_SAFE_INTEGER,t.startPosition={row:Number.MAX_SAFE_INTEGER,column:Number.MAX_SAFE_INTEGER})):e.startIndex>this.startIndex&&(t.startIndex=this.startIndex,t.startPosition={...this.startPosition}),t}},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"),C;function assertInternal(e){if(e!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(e){return!!e&&"number"==typeof e.row&&"number"==typeof e.column}function setModule(e){C=e}__name(assertInternal,"assertInternal"),__name(isPoint,"isPoint"),__name(setModule,"setModule");var LookaheadIterator=class{static{__name(this,"LookaheadIterator")}0=0;language;constructor(e,t,r){assertInternal(e),this[0]=t,this.language=r}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}reset(e,t){return!!C._ts_lookahead_iterator_reset(this[0],e[0],t)&&(this.language=e,!0)}resetState(e){return Boolean(C._ts_lookahead_iterator_reset_state(this[0],e))}[Symbol.iterator](){return{next:__name(()=>C._ts_lookahead_iterator_next(this[0])?{done:!1,value:this.currentType}:{done:!0,value:""},"next")}}};function getText(e,t,r,n){const s=r-t;let a=e.textCallback(t,n);if(a){for(t+=a.length;t<r;){const r=e.textCallback(t,n);if(!(r&&r.length>0))break;t+=r.length,a+=r}t>r&&(a=a.slice(0,s))}return a??""}__name(getText,"getText");var Tree=class e{static{__name(this,"Tree")}0=0;textCallback;language;constructor(e,t,r,n){assertInternal(e),this[0]=t,this.language=r,this.textCallback=n}copy(){const t=C._ts_tree_copy(this[0]);return new e(INTERNAL,t,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(e,t){const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),marshalPoint(r+SIZE_OF_INT,t),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}edit(e){marshalEdit(e),C._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof e))throw new TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],t[0]);const r=C.getValue(TRANSFER_BUFFER,"i32"),n=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),s=new Array(r);if(r>0){let e=n;for(let t=0;t<r;t++)s[t]=unmarshalRange(e),e+=SIZE_OF_RANGE;C._free(n)}return s}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(n),n+=SIZE_OF_RANGE;C._free(t)}return r}},TreeCursor=class e{static{__name(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(e,t){assertInternal(e),this.tree=t,unmarshalTreeCursor(this)}copy(){const t=new e(INTERNAL,this.tree);return C._ts_tree_cursor_copy_wasm(this.tree[0]),unmarshalTreeCursor(t),t}delete(){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),1===C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])}get nodeIsMissing(){return marshalTreeCursor(this),1===C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])}get nodeText(){marshalTreeCursor(this);const e=C._ts_tree_cursor_start_index_wasm(this.tree[0]),t=C._ts_tree_cursor_end_index_wasm(this.tree[0]);C._ts_tree_cursor_start_position_wasm(this.tree[0]);const r=unmarshalPoint(TRANSFER_BUFFER);return getText(this.tree,e,t,r)}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);const e=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoLastChild(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoParent(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoNextSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoPreviousSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoDescendant(e){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],e),unmarshalTreeCursor(this)}gotoFirstChildForIndex(e){marshalTreeCursor(this),C.setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,e,"i32");const t=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}gotoFirstChildForPosition(e){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,e);const t=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}reset(e){marshalNode(e),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(e){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(e,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],e.tree[0]),unmarshalTreeCursor(this)}},Node=class{static{__name(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:r,startIndex:n,startPosition:s,other:a}){assertInternal(e),this[0]=a,this.id=t,this.tree=r,this.startIndex=n,this.startPosition=s}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),1===C._ts_node_is_named_wasm(this.tree[0])}get isExtra(){return marshalNode(this),1===C._ts_node_is_extra_wasm(this.tree[0])}get isError(){return marshalNode(this),1===C._ts_node_is_error_wasm(this.tree[0])}get isMissing(){return marshalNode(this),1===C._ts_node_is_missing_wasm(this.tree[0])}get hasChanges(){return marshalNode(this),1===C._ts_node_has_changes_wasm(this.tree[0])}get hasError(){return marshalNode(this),1===C._ts_node_has_error_wasm(this.tree[0])}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(e){return this.tree===e.tree&&this.id===e.id}child(e){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}namedChild(e){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldId(e){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t?this.childForFieldId(t):null}fieldNameForChild(e){marshalNode(this);const t=C._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}fieldNameForNamedChild(e){marshalNode(this);const t=C._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}childrenForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t&&0!==t?this.childrenForFieldId(t):[]}childrenForFieldId(e){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),n=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)n[r]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE;C._free(r)}return n}firstChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"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]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._children[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._namedChildren[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._namedChildren}descendantsOfType(e,t=ZERO_POINT,r=ZERO_POINT){Array.isArray(e)||(e=[e]);const n=[],s=this.tree.language.types;for(const t of e)"ERROR"==t&&n.push(65535);for(let t=0,r=s.length;t<r;t++)e.includes(s[t])&&n.push(t);const a=C._malloc(SIZE_OF_INT*n.length);for(let e=0,t=n.length;e<t;e++)C.setValue(a+e*SIZE_OF_INT,n[e],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],a,n.length,t.row,t.column,r.row,r.column);const _=C.getValue(TRANSFER_BUFFER,"i32"),o=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),i=new Array(_);if(_>0){let e=o;for(let t=0;t<_;t++)i[t]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE}return C._free(o),C._free(a),i}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(e){return marshalNode(this),marshalNode(e,1),C._ts_node_child_with_descendant_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_named_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}walk(){return marshalNode(this),C._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(INTERNAL,this.tree)}edit(e){if(this.startIndex>=e.oldEndIndex){let t,r;this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex),this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,r=this.startPosition.column):(t=0,r=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(r=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=r):this.startPosition.column+=r}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){marshalNode(this);const e=C._ts_node_to_string_wasm(this.tree[0]),t=C.AsciiToString(e);return C._free(e),t}};function unmarshalCaptures(e,t,r,n,s){for(let a=0,_=s.length;a<_;a++){const _=C.getValue(r,"i32"),o=unmarshalNode(t,r+=SIZE_OF_INT);r+=SIZE_OF_NODE,s[a]={patternIndex:n,name:e.captureNames[_],node:o}}return r}function marshalNode(e,t=0){let r=TRANSFER_BUFFER+t*SIZE_OF_NODE;C.setValue(r,e.id,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startIndex,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.row,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.column,"i32"),r+=SIZE_OF_INT,C.setValue(r,e[0],"i32")}function unmarshalNode(e,t=TRANSFER_BUFFER){const r=C.getValue(t,"i32");if(t+=SIZE_OF_INT,0===r)return null;const n=C.getValue(t,"i32");t+=SIZE_OF_INT;const s=C.getValue(t,"i32");t+=SIZE_OF_INT;const a=C.getValue(t,"i32");t+=SIZE_OF_INT;const _=C.getValue(t,"i32");return new Node(INTERNAL,{id:r,tree:e,startIndex:n,startPosition:{row:s,column:a},other:_})}function marshalTreeCursor(e,t=TRANSFER_BUFFER){C.setValue(t+0*SIZE_OF_INT,e[0],"i32"),C.setValue(t+1*SIZE_OF_INT,e[1],"i32"),C.setValue(t+2*SIZE_OF_INT,e[2],"i32"),C.setValue(t+3*SIZE_OF_INT,e[3],"i32")}function unmarshalTreeCursor(e){e[0]=C.getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),e[1]=C.getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),e[2]=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),e[3]=C.getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(e,t){C.setValue(e,t.row,"i32"),C.setValue(e+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(e){return{row:C.getValue(e,"i32")>>>0,column:C.getValue(e+SIZE_OF_INT,"i32")>>>0}}function marshalRange(e,t){marshalPoint(e,t.startPosition),marshalPoint(e+=SIZE_OF_POINT,t.endPosition),e+=SIZE_OF_POINT,C.setValue(e,t.startIndex,"i32"),e+=SIZE_OF_INT,C.setValue(e,t.endIndex,"i32"),e+=SIZE_OF_INT}function unmarshalRange(e){const t={};return t.startPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.startIndex=C.getValue(e,"i32")>>>0,e+=SIZE_OF_INT,t.endIndex=C.getValue(e,"i32")>>>0,t}function marshalEdit(e,t=TRANSFER_BUFFER){marshalPoint(t,e.startPosition),marshalPoint(t+=SIZE_OF_POINT,e.oldEndPosition),marshalPoint(t+=SIZE_OF_POINT,e.newEndPosition),t+=SIZE_OF_POINT,C.setValue(t,e.startIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.oldEndIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.newEndIndex,"i32"),t+=SIZE_OF_INT}function unmarshalLanguageMetadata(e){return{major_version:C.getValue(e,"i32"),minor_version:C.getValue(e+=SIZE_OF_INT,"i32"),patch_version:C.getValue(e+=SIZE_OF_INT,"i32")}}__name(unmarshalCaptures,"unmarshalCaptures"),__name(marshalNode,"marshalNode"),__name(unmarshalNode,"unmarshalNode"),__name(marshalTreeCursor,"marshalTreeCursor"),__name(unmarshalTreeCursor,"unmarshalTreeCursor"),__name(marshalPoint,"marshalPoint"),__name(unmarshalPoint,"unmarshalPoint"),__name(marshalRange,"marshalRange"),__name(unmarshalRange,"unmarshalRange"),__name(marshalEdit,"marshalEdit"),__name(unmarshalLanguageMetadata,"unmarshalLanguageMetadata");var LANGUAGE_FUNCTION_REGEX=/^tree_sitter_\w+$/,Language=class e{static{__name(this,"Language")}0=0;types;fields;constructor(e,t){assertInternal(e),this[0]=t,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let e=0,t=this.types.length;e<t;e++)C._ts_language_symbol_type(this[0],e)<2&&(this.types[e]=C.UTF8ToString(C._ts_language_symbol_name(this[0],e)));this.fields=new Array(C._ts_language_field_count(this[0])+1);for(let e=0,t=this.fields.length;e<t;e++){const t=C._ts_language_field_name_for_id(this[0],e);this.fields[e]=0!==t?C.UTF8ToString(t):null}}get name(){const e=C._ts_language_name(this[0]);return 0===e?null:C.UTF8ToString(e)}get abiVersion(){return C._ts_language_abi_version(this[0])}get metadata(){return C._ts_language_metadata_wasm(this[0]),0===C.getValue(TRANSFER_BUFFER,"i32")?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(e){const t=this.fields.indexOf(e);return-1!==t?t:null}fieldNameForId(e){return this.fields[e]??null}idForNodeType(e,t){const r=C.lengthBytesUTF8(e),n=C._malloc(r+1);C.stringToUTF8(e,n,r+1);const s=C._ts_language_symbol_for_name(this[0],n,r,t?1:0);return C._free(n),s||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(e){const t=C._ts_language_symbol_name(this[0],e);return t?C.UTF8ToString(t):null}nodeTypeIsNamed(e){return!!C._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!C._ts_language_type_is_visible_wasm(this[0],e)}get supertypes(){C._ts_language_supertypes_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=C.getValue(n,"i16"),n+=SIZE_OF_SHORT}return r}subtypes(e){C._ts_language_subtypes_wasm(this[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),n=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)n[r]=C.getValue(e,"i16"),e+=SIZE_OF_SHORT}return n}nextState(e,t){return C._ts_language_next_state(this[0],e,t)}lookaheadIterator(e){const t=C._ts_lookahead_iterator_new(this[0],e);return t?new LookaheadIterator(INTERNAL,t,this):null}static async load(t){let r;if(t instanceof Uint8Array)r=t;else if(globalThis.process?.versions.node){const e=await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__,943,23));r=await e.readFile(t)}else{const e=await fetch(t);if(!e.ok){const t=await e.text();throw new Error(`Language.load failed with status ${e.status}.\n\n${t}`)}const n=e.clone();try{r=await WebAssembly.compileStreaming(e)}catch(e){console.error("wasm streaming compile failed:",e),console.error("falling back to ArrayBuffer instantiation"),r=new Uint8Array(await n.arrayBuffer())}}const n=await C.loadWebAssemblyModule(r,{loadAsync:!0}),s=Object.keys(n),a=s.find(e=>LANGUAGE_FUNCTION_REGEX.test(e)&&!e.includes("external_scanner_"));if(!a)throw console.log(`Couldn't find language function in Wasm file. Symbols:\n${JSON.stringify(s,null,2)}`),new Error("Language.load failed: no language function found in Wasm file");const _=n[a]();return new e(INTERNAL,_)}},import_web_tree_sitter=__toESM(require_web_tree_sitter(),1),Module2=null,TRANSFER_BUFFER,LANGUAGE_VERSION,MIN_COMPATIBLE_VERSION;async function initializeBinding(e){return Module2??=await(0,import_web_tree_sitter.default)(e)}function checkModule(){return!!Module2}__name(initializeBinding,"initializeBinding"),__name(checkModule,"checkModule");var Parser=class{static{__name(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){setModule(await initializeBinding(e)),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()}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(){C._ts_parser_delete(this[0]),C._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(e){if(e.constructor!==Language)throw new Error("Argument must be a Language");{t=e[0];const r=C._ts_language_abi_version(t);if(r<MIN_COMPATIBLE_VERSION||LANGUAGE_VERSION<r)throw new Error(`Incompatible language version ${r}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`);this.language=e}}else t=0,this.language=null;return C._ts_parser_set_language(this[0],t),this}parse(e,t,r){if("string"==typeof e)C.currentParseCallback=t=>e.slice(t);else{if("function"!=typeof e)throw new Error("Argument must be a string or a function");C.currentParseCallback=e}C.currentProgressCallback=r?.progressCallback?r.progressCallback: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 n=0,s=0;if(r?.includedRanges){n=r.includedRanges.length,s=C._calloc(n,SIZE_OF_RANGE);let e=s;for(let t=0;t<n;t++)marshalRange(e,r.includedRanges[t]),e+=SIZE_OF_RANGE}const a=C._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,s,n);if(!a)return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");const _=new Tree(INTERNAL,a,this.language,C.currentParseCallback);return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,_}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let n=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(n),n+=SIZE_OF_RANGE;C._free(t)}return r}setLogger(e){if(e){if("function"!=typeof e)throw new Error("Logger callback must be a function");this.logCallback=e}else this.logCallback=null;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(e=>"capture"===e.type,"isCaptureStep"),isStringStep=__name(e=>"string"===e.type,"isStringStep"),QueryErrorKind={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},QueryError=class e extends Error{constructor(t,r,n,s){super(e.formatMessage(t,r)),this.kind=t,this.info=r,this.index=n,this.length=s,this.name="QueryError"}static{__name(this,"QueryError")}static formatMessage(e,t){switch(e){case QueryErrorKind.NodeName:return`Bad node name '${t.word}'`;case QueryErrorKind.FieldName:return`Bad field name '${t.word}'`;case QueryErrorKind.CaptureName:return`Bad capture name @${t.word}`;case QueryErrorKind.PatternStructure:return`Bad pattern structure at offset ${t.suffix}`;case QueryErrorKind.Syntax:return`Bad syntax at offset ${t.suffix}`}}};function parseAnyPredicate(e,t,r,n){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}`);if(!isCaptureStep(e[1]))throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}"`);const s="eq?"===r||"any-eq?"===r,a=!r.startsWith("any-");if(isCaptureStep(e[2])){const r=e[1].name,_=e[2].name;n[t].push(e=>{const t=[],n=[];for(const s of e)s.name===r&&t.push(s.node),s.name===_&&n.push(s.node);const o=__name((e,t,r)=>r?e.text===t.text:e.text!==t.text,"compare");return a?t.every(e=>n.some(t=>o(e,t,s))):t.some(e=>n.some(t=>o(e,t,s)))})}else{const r=e[1].name,_=e[2].value,o=__name(e=>e.text===_,"matches"),i=__name(e=>e.text!==_,"doesNotMatch");n[t].push(e=>{const t=[];for(const n of e)n.name===r&&t.push(n.node);const n=s?o:i;return a?t.every(n):t.some(n)})}}function parseMatchPredicate(e,t,r,n){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);if("string"!==e[2].type)throw new Error(`Second argument of \`#${r}\` predicate must be a string. Got @${e[2].name}.`);const s="match?"===r||"any-match?"===r,a=!r.startsWith("any-"),_=e[1].name,o=new RegExp(e[2].value);n[t].push(e=>{const t=[];for(const r of e)r.name===_&&t.push(r.node.text);const r=__name((e,t)=>t?o.test(e):!o.test(e),"test");return 0===t.length?!s:a?t.every(e=>r(e,s)):t.some(e=>r(e,s))})}function parseAnyOfPredicate(e,t,r,n){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected at least 1. Got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);const s="any-of?"===r,a=e[1].name,_=e.slice(2);if(!_.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const o=_.map(e=>e.value);n[t].push(e=>{const t=[];for(const r of e)r.name===a&&t.push(r.node.text);return 0===t.length?!s:t.every(e=>o.includes(e))===s})}function parseIsPredicate(e,t,r,n,s){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const a="is?"===r?n:s;a[t]||(a[t]={}),a[t][e[1].value]=e[2]?.value??null}function parseSetDirective(e,t,r){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error('Arguments to `#set!` predicate must be strings.".');r[t]||(r[t]={}),r[t][e[1].value]=e[2]?.value??null}function parsePattern(e,t,r,n,s,a,_,o,i,l,u){if(t===PREDICATE_STEP_TYPE_CAPTURE){const e=n[r];a.push({type:"capture",name:e})}else if(t===PREDICATE_STEP_TYPE_STRING)a.push({type:"string",value:s[r]});else if(a.length>0){if("string"!==a[0].type)throw new Error("Predicates must begin with a literal value");const t=a[0].value;switch(t){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":parseAnyPredicate(a,e,t,_);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":parseMatchPredicate(a,e,t,_);break;case"not-any-of?":case"any-of?":parseAnyOfPredicate(a,e,t,_);break;case"is?":case"is-not?":parseIsPredicate(a,e,t,l,u);break;case"set!":parseSetDirective(a,e,i);break;default:o[e].push({operator:t,operands:a.slice(1)})}a.length=0}}__name(parseAnyPredicate,"parseAnyPredicate"),__name(parseMatchPredicate,"parseMatchPredicate"),__name(parseAnyOfPredicate,"parseAnyOfPredicate"),__name(parseIsPredicate,"parseIsPredicate"),__name(parseSetDirective,"parseSetDirective"),__name(parsePattern,"parsePattern");var Query=class{static{__name(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){const r=C.lengthBytesUTF8(t),n=C._malloc(r+1);C.stringToUTF8(t,n,r+1);const s=C._ts_query_new(e[0],n,r,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!s){const e=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=C.getValue(TRANSFER_BUFFER,"i32"),s=C.UTF8ToString(n,r).length,a=t.slice(s,s+100).split("\n")[0],_=a.match(QUERY_WORD_REGEX)?.[0]??"";switch(C._free(n),e){case QueryErrorKind.Syntax:throw new QueryError(QueryErrorKind.Syntax,{suffix:`${s}: '${a}'...`},s,0);case QueryErrorKind.NodeName:case QueryErrorKind.FieldName:case QueryErrorKind.CaptureName:throw new QueryError(e,{word:_},s,_.length);case QueryErrorKind.PatternStructure:throw new QueryError(e,{suffix:`${s}: '${a}'...`},s,0)}}const a=C._ts_query_string_count(s),_=C._ts_query_capture_count(s),o=C._ts_query_pattern_count(s),i=new Array(_),l=new Array(o),u=new Array(a);for(let e=0;e<_;e++){const t=C._ts_query_capture_name_for_id(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");i[e]=C.UTF8ToString(t,r)}for(let e=0;e<o;e++){const t=new Array(_);for(let r=0;r<_;r++){const n=C._ts_query_capture_quantifier_for_id(s,e,r);t[r]=n}l[e]=t}for(let e=0;e<a;e++){const t=C._ts_query_string_value_for_id(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");u[e]=C.UTF8ToString(t,r)}const d=new Array(o),c=new Array(o),m=new Array(o),p=new Array(o),h=new Array(o);for(let e=0;e<o;e++){const t=C._ts_query_predicates_for_pattern(s,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");p[e]=[],h[e]=[];const n=new Array;let a=t;for(let t=0;t<r;t++){const t=C.getValue(a,"i32");a+=SIZE_OF_INT;const r=C.getValue(a,"i32");a+=SIZE_OF_INT,parsePattern(e,t,r,i,u,n,h,p,d,c,m)}Object.freeze(h[e]),Object.freeze(p[e]),Object.freeze(d[e]),Object.freeze(c[e]),Object.freeze(m[e])}C._free(n),this[0]=s,this.captureNames=i,this.captureQuantifiers=l,this.textPredicates=h,this.predicates=p,this.setProperties=d,this.assertedProperties=c,this.refutedProperties=m,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(e,t={}){const r=t.startPosition??ZERO_POINT,n=t.endPosition??ZERO_POINT,s=t.startIndex??0,a=t.endIndex??0,_=t.startContainingPosition??ZERO_POINT,o=t.endContainingPosition??ZERO_POINT,i=t.startContainingIndex??0,l=t.endContainingIndex??0,u=t.matchLimit??4294967295,d=t.maxStartDepth??4294967295,c=t.progressCallback;if("number"!=typeof u)throw new Error("Arguments must be numbers");if(this.matchLimit=u,0!==a&&s>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==ZERO_POINT&&(r.row>n.row||r.row===n.row&&r.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(0!==l&&i>l)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(o!==ZERO_POINT&&(_.row>o.row||_.row===o.row&&_.column>o.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");c&&(C.currentQueryProgressCallback=c),marshalNode(e),C._ts_query_matches_wasm(this[0],e.tree[0],r.row,r.column,n.row,n.column,s,a,_.row,_.column,o.row,o.column,i,l,u,d);const m=C.getValue(TRANSFER_BUFFER,"i32"),p=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),h=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),f=new Array(m);this.exceededMatchLimit=Boolean(h);let g=0,y=p;for(let t=0;t<m;t++){const t=C.getValue(y,"i32");y+=SIZE_OF_INT;const r=C.getValue(y,"i32");y+=SIZE_OF_INT;const n=new Array(r);if(y=unmarshalCaptures(this,e.tree,y,t,n),this.textPredicates[t].every(e=>e(n))){f[g]={patternIndex:t,captures:n};const e=this.setProperties[t];f[g].setProperties=e;const r=this.assertedProperties[t];f[g].assertedProperties=r;const s=this.refutedProperties[t];f[g].refutedProperties=s,g++}}return f.length=g,C._free(p),C.currentQueryProgressCallback=null,f}captures(e,t={}){const r=t.startPosition??ZERO_POINT,n=t.endPosition??ZERO_POINT,s=t.startIndex??0,a=t.endIndex??0,_=t.startContainingPosition??ZERO_POINT,o=t.endContainingPosition??ZERO_POINT,i=t.startContainingIndex??0,l=t.endContainingIndex??0,u=t.matchLimit??4294967295,d=t.maxStartDepth??4294967295,c=t.progressCallback;if("number"!=typeof u)throw new Error("Arguments must be numbers");if(this.matchLimit=u,0!==a&&s>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(n!==ZERO_POINT&&(r.row>n.row||r.row===n.row&&r.column>n.column))throw new Error("`startPosition` cannot be greater than `endPosition`");if(0!==l&&i>l)throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");if(o!==ZERO_POINT&&(_.row>o.row||_.row===o.row&&_.column>o.column))throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");c&&(C.currentQueryProgressCallback=c),marshalNode(e),C._ts_query_captures_wasm(this[0],e.tree[0],r.row,r.column,n.row,n.column,s,a,_.row,_.column,o.row,o.column,i,l,u,d);const m=C.getValue(TRANSFER_BUFFER,"i32"),p=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),h=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),f=new Array;this.exceededMatchLimit=Boolean(h);const g=new Array;let y=p;for(let t=0;t<m;t++){const t=C.getValue(y,"i32");y+=SIZE_OF_INT;const r=C.getValue(y,"i32");y+=SIZE_OF_INT;const n=C.getValue(y,"i32");if(y+=SIZE_OF_INT,g.length=r,y=unmarshalCaptures(this,e.tree,y,t,g),this.textPredicates[t].every(e=>e(g))){const e=g[n],r=this.setProperties[t];e.setProperties=r;const s=this.assertedProperties[t];e.assertedProperties=s;const a=this.refutedProperties[t];e.refutedProperties=a,f.push(e)}}return C._free(p),C.currentQueryProgressCallback=null,f}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){const t=C.lengthBytesUTF8(e),r=C._malloc(t+1);C.stringToUTF8(e,r,t+1),C._ts_query_disable_capture(this[0],r,t),C._free(r)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);C._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return C._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return 1===C._ts_query_is_pattern_rooted(this[0],e)}isPatternNonLocal(e){return 1===C._ts_query_is_pattern_non_local(this[0],e)}isPatternGuaranteedAtStep(e){return 1===C._ts_query_is_pattern_guaranteed_at_step(this[0],e)}};module.exports.default=module.exports}};const __webpack_module_cache__={};function __webpack_require__(e){const t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;const r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;__webpack_require__.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}const s=Object.create(null);__webpack_require__.r(s);const a={};t=t||[null,e({}),e([]),e(e)];for(var _=2&n&&r;("object"==typeof _||"function"==typeof _)&&!~t.indexOf(_);_=e(_))Object.getOwnPropertyNames(_).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,__webpack_require__.d(s,a),s}})(),__webpack_require__.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var n=t[r++],s=t[r++];__webpack_require__.o(e,n)?0===s&&r++:0===s?Object.defineProperty(e,n,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,n,{enumerable:!0,get:s})}else for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let __webpack_exports__=__webpack_require__(186);module.exports=__webpack_exports__})();